I'm wondering where a new path has to be added to PATH
environment variable. I know this is accomplished editing .bash_rc
(for example), but it's not clear how to do this.
This way:
export PATH=~/opt/bin:$PATH
export PATH=~/opt/bin:$PATH
or this?
export PATH=$PATH:~/opt/bin
Question 2 (related). What's a workable way to append more paths on different lines? Initially I thought this could do the trick:
export PATH=$PATH:~/opt/bin
export PATH=$PATH:~/opt/node/bin
but it doesn't because the second assignment doesn't only append ~/opt/node/bin
, but also the whole PATH
previously assigned.
This is a possible workaround:
export PATH=$PATH:~/opt/bin:~/opt/node/bin
but for readability I'd prefer to have one assignment for one path.