2

For the following please consider that I'm new to the Linux file system and have little understanding here.

When I log onto my cluster I do so on a default machine. The admin have setup several python distributions in the root and I've set the one that I want to use in my .bashrc. In my case and for illustration this distribution is:

export PATH="/csoft/epd-7.3.2/bin:$PATH";

I've been asked to execute scripts from another machine that I have to ssh to via the terminal. When I ssh to this machine that file system appears exactly the same (including the .bashrc). However, a different version of python is executed by default. How do I set the path for this ssh machine, those unique name can be determined via hostname?

1 Answers1

2

In your .bash_profile, include this (replacing unique-hostname-here with the output from uname -n on that host):

case $(uname -n) in
  (unique-hostname-here) PATH="/csoft/epd-7.3.2/bin:$PATH"
        ;;
esac

This presumes that the PATH variable has already been populated and exported previously (or subsequently); no need to re-export it every time it's set.

Further reading on shell initialization files:

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255