Suresh Payankannur

Tuesday, July 26, 2011

Bash Tips

Debugging a bash script
% bash -x
Setting variables like CLASSPATH etc. using a script

Typically when setting variables with in a script and executing the script (% makes these variables available only within the sub-process that executing the script. Once the script execution is done, these variables are not passed back to the parent shell. In order to achieve this, one has to 'source' it.

Suppose you have a shell script which contains the following line:
In order for this variable to be available to the parent shell:
% source
Then the variable will be available in the parent shell
% env | grep -i classpath
Will show the set values.


Post a Comment

Blog Archive

Scroll To Top