Change PATH environment variable

In csh, if you want to change $PATH environment variable, you should modify .cshrc file:

  1. # cat .cshrc
  2. ......
  3. set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin $HOME/bin $HOME/gocode/bin)
  4. ......

For example, you add “/usr/local/go/bin“ into $PATH:

  1. # cat .cshrc
  2. ......
  3. set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin $HOME/bin $HOME/gocode/bin /usr/local/go/bin)
  4. ......

Then executing “source .cshrc“ command, you will find the new $PATH takes effect:

  1. # source .cshrc
  2. # echo $PATH
  3. /sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/root/bin:/root/gocode/bin:/usr/local/go/bin

Reference:
Misc Tips & Tricks.