Is there a reasonable way to attach new path to PATH in bashrc?
Posted
by Ripley
on Stack Overflow
See other posts from Stack Overflow
or by Ripley
Published on 2010-05-14T04:54:15Z
Indexed on
2010/05/14
5:14 UTC
Read the original article
Hit count: 241
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?
© Stack Overflow or respective owner