Skip to main content
Tweeted twitter.com/StackUnix/status/987860301407191040
Question Protected by heemayl
Fixed typo that wasn't essential to the question; cleaned up wording.
Source Link

I'm wondering where a new path has to be added to the PATH environment variable. I know this iscan be accomplished by editing .bash_rcbashrc (for example), but it's not clear how to do this.

This way:

export PATH=~/opt/bin:$PATH

or this?

export PATH=$PATH:~/opt/bin

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

or this?

export PATH=$PATH:~/opt/bin

I'm wondering where a new path has to be added to the PATH environment variable. I know this can be accomplished by editing .bashrc (for example), but it's not clear how to do this.

This way:

export PATH=~/opt/bin:$PATH

or this?

export PATH=$PATH:~/opt/bin
Removed the second question since it was due to another, unrelated errror
Source Link
terdon
  • 252.2k
  • 69
  • 480
  • 718

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

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.

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

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.

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

or this?

export PATH=$PATH:~/opt/bin
deleted 4 characters in body
Source Link
terdon
  • 252.2k
  • 69
  • 480
  • 718

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.

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

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.

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

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.

trying to set highlight http://meta.unix.stackexchange.com/questions/3056/why-arent-some-codeblocks-highlighted
Source Link
Loading
Source Link
Paolo
  • 17.9k
  • 12
  • 33
  • 41
Loading