
01-06-2009
|
|
Shell programmer, author
|
|
|
Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,361
|
|
Quote:
Originally Posted by Hangman2
How do I define a particular dir in front of PATH variable and then run some job and then at the end of job SET the PATH variable to original?
in a script, WILL something like this work:
ORIG_PATH=$PATH
export PATH=/dir1/dir2:$PATH
RUN SOME JOBS .....
unset PATH
EXPORT PATH=$ORIG_PATH
|
There is no command called EXPORT; it is lowercase: export
Quote:
Also is there a way to not UNSET the path and look for particular dir and take it out from PATH variable??
|
There is (see http://cfaj.freeshell.org/shell/scripts/path-funcs-sh), but it is not necessary, since the change only affects the current script and its children.
|