Ksh - Env. Variables ??

Hey all,

I have been using Ksh and in that I am setting Environment variables.
To set Env. Variables I have created my own file "BuildScript.sh" in which i have written :

export CLASSPATH=/somedir/some other dir/file:.
export PATH=/some dir/file:.

But when i am calling this BuildScript.sh, its not setting values of those variables into env

Do you have any clue to this problem ?
Please let me know.

Thanks.:b:

How are you calling this script?

$ . ./BuildScript.sh

or

$./BuildScript.sh

hey,

I am calling it as :
./BuildScript.sh

And this is why it's not working. Your login shell spawns a child shell to run this script, and the child environment is discarded when the script exits; the parent shell (your login shell) is unaffected.

You should do as fpmurphy suggests and execute the script by sourcing it in:

.  ./script.sh

The "dot" command means "run in the current process environment". So the script will be run as if you typed each command within the current shell. This probably means you don't want "exit 0" in your script. :stuck_out_tongue:

Hey!

i also had the same problem. got it clarified, thanks guys!