Hi,
My login shell is c shell
I have a line in .cshrc like
setenv a 1000
I have a line in .profile like
ENV=$HOME/.kshrc
export ENV
and in my .kshrc
a=10
export a
I wrote one korn script
#!/bin/ksh
echo $a
it must have shown o/p 10 rathe it is showing 1000
Please tell me how is the flow happening
I heard/know that if I use korn shell script, it is going to read .profile and .kshrc!
Using the shebang "#!/bin/ksh" in your script doesn't force the script to read the .profile file.
To use the environment variables declared in .profile 'source' the .profile as follow:
. /path/to/.profile
within your script.
Regards
Thanks Franklin.
When I say like
#!/bin/ksh
. ~/.profile
...
...
.profile getting executed but it is not considering .kshrc as environment file even though I have the following lines in my .profile file
export ENV=$HOME/.kshrc
export ENV=$HOME/.kshrc
doesn't set the environment variables of .kshrc, 'source' .kshrc:
. /path/to/.kshrc
Regards