0

Possible Duplicate:
How can I make a program executable from everywhere

So, I'm new to Linux/Unix and am working in a corporate version of Red Hat at my company. Obviously I don't have full control over my computer (not sure if that matters).

I have a bunch of executables located in some folder.

I want to be able to run these programs from any other directory.

How can I make this happen? Some sort of bash profile file maybe? If so, where would that be located?

1 Answers1

1

For this to work you add the /path/to/executables to the $PATH variable, to make this a default setting you add it to one of bash'es startup files, .bash_profile is probably the most appropriate one. Add the following line to $HOME/.bash_profile:

export PATH="${PATH}:/path/to/executables" 

Or if a PATH line already exists in .bash_profile, append or prepend /path/to/executables to it. Each of the path elements are searched in order, so if you want to override some commands, put your path first.

Thor
  • 17,182
  • Forgive me, but I don't understand how to do this. When I type in the export PATH command: 'export PATH="$PATH:"/ep/home/eniven/gslib1/"', then I get an error "Bad : modifier in $ (/)". When I type the command:'export PATH="$PATH:"ep/home/eniven/gslib1"', I get the error: export: command not found. When I look in the directory /home/, there is nothing in there (no hidden files either) and I do not have write access to that directory. – Flux Capacitor Aug 22 '12 at 21:37
  • PATH needs to be protected from parameter expansion, you can do this with curly braces, see update to answer. – Thor Aug 22 '12 at 22:12