Reputation: 11
I want to write an sh file that will set classpath in Linux.
I tried using:
export ClASSPATH=$CLASSPATH:$ABC_HOME
However, when I run the .sh file it doesn't set the classpath.
Upvotes: 1
Views: 2069
Reputation: 383
Executing the bash script only sets the environment for the child process. The "source" command may do what you want...
https://askubuntu.com/questions/53177/bash-script-to-set-environment-variables-not-working
Upvotes: 1
Reputation: 1
You should make it a shell function, or source
it. Because the environment variables are local to the shell (the one started by invoking your shell script).
Please read the advanced bash scripting guide. See also this answer to a similar question.
Upvotes: 0