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!!


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.

  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.