change environment variable via script

Victor Odhner vodhner at cox.net
Fri Dec 23 11:00:23 MST 2005


Another solution is to source your script into the current shell by 
"dotting" it.

. ./script.sh

That runs script.sh in the current shell, so everything it does remains 
part of your environment.
It's especially useful in ad hoc situations where you don't want to 
modify your .profile.
And of course you can also use this approach to add the function to your 
environment
only when you need it.

Be careful not to put an "exit" in the "dotted" script, since that will 
end your session.

Vic




More information about the PLUG-discuss mailing list