Many of us, customize our shells under Unix (for the difference between Unix and UNIX - see the Art of Unix Programming). We usually add to our PATH environment variable. Usually what we do is
PATH=$PATH:[paths to add]
Lets assume this file is called .profile and is read by the shell on start-up. This approach is good, but if the user were to change our .profile and run
. $HOME/.profile
Then on seeing the PATH variable, it would have repeated path names.
If the change to PATH was
PATH=$PATH:$HOME/bin:.
The on running . $HOME/.profile for the first time the user would see PATH as
[original]:[user's home directory]/bin:.:[user's home directory]/bin:.
One easy way to work around this problem is to use the following approach in your .profile
OLDPATH=${OLDPATH=$PATH}
export OLDPATH
export PATH=
export PATH=$OLDPATH:/sbin:/usr/sbin:$HOME/bin:.
and then customize PATH as the user did previously, repeated running of
. $HOME/.profile shall now not cause the PATH environment variable to grow uncontrollably
Subscribe to:
Post Comments (Atom)
Ranking and Unranking permutations
I've been a big fan of Skiena's Algorithm Design Manual , I recently found my first edition of the book (although I own the third ed...
-
(Photo from http://content-usa.cricinfo.com/indvaus2008/content/current/player/28114.html) Dravid's dismal form continues in test crick...
-
I've been reading up on Fast Fourier Transform (FFT) from several books on algorithms that I have, TCLR, Tamassia, Sahni, Numerical Rec...
-
The book is almost out there . There is code and selected solutions as well. The book is supposed to be in full colour from what I heard....
No comments:
Post a Comment