Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm relatively new to using Linux and just recently had a very interesting request to assists testing at the company I work for. Testers tests application through terminal commands and separate which product line they are testing by using separate terminals. Sometimes PATHing can cause issues here as several executable are not uniquely named and the applications fork to relative paths. In this regard I would like to create a script that users/testers can run that sets environment variables that are local to each terminal session and can define the specific executables that should run when called. Is there a universal way in Linux to do this? THANKS IN ADVANCE!!

share|improve this question
up vote 1 down vote accepted

You cannot do this with an ordinary script — users must use the source command to process the command file(s) you write.  If you can edit the users’ .bashrc files (or tell the users what to put there), consider using alias commands.

share|improve this answer
After reviewing my options is it possible to use a script file to run an export PATH=these/particular/files command? – Wylie Coyote SG. Nov 12 '12 at 21:15
Yes — but your users will need to source your script. In *nix and Unix-like systems, process characteristics/ properties get passed from parent to child, but never the other way around. For example, if you set your PATH to include /foo, and then you run a script that tries to run bar, it will find /foo/bar — but if you change PATH in an ordinary script (one that’s run just by typing its name), it doesn’t affect your interactive shell. – Scott Nov 12 '12 at 22:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .