Is there a reasonable way to attach new path to PATH in bashrc?
- by Ripley
Guys
I constantly need to attach new paths to the PATH environment variable in .bashrc, like below:
export PATH=/usr/local/bin:$PATH
Then to make it take effect, I always do 'source ~/.bashrc' or '. ~/.bashrc', while I found one shortcoming of doing so which make me uncomfortable.
If I keep doing so, the PATH will getting longer and longer with many duplicated entries, for example in the previous command, if I source it twice, the value of PATH will be
PATH=/usr/local/bin:/usr/local/bin:/usr/local/bin:$PATH(<-the original path).
Is there a more decent way to attach new path to PATH in bashrc without making it ugly?