I have 2 VMs. One is debian lenny and one is Ubuntu. There is a script by name "two" in different folders of debian (name "two" is same but the contents are little bit different in different folders) and when I go to that folder, I just have to type two and enter to make it run. When I copied the same script to Ubuntu, even after giving it execute permissions, it still does not run by simply entering two. I have to type ./two to make it work. Is there any way I can type two in their respective folders and the scrips will run without ./ ?
You could add current dir to your path:
With this current dir will always be in the shell search path.
You can persist this putting the code above in your
You have to add the program/directory into your path.
A path set in .bash_profile will only be set in a bash login shell (
bash -l). If you put your path in
.profile it will be available to your complete desktop session. That means even metacity will use it.
if [ -d "$HOME/bin" ] ; then PATH="$PATH:$HOME/bin" fi
Btw, you can check the PATH variable of a process by looking at its environment in
/proc/[pid]/environ. (replace [pid] with the number from
Instead of adding . to the PATH you might be better off adding the directory where "two" resides. For instance if two is really /usr/local/bin/two then you'd say
And if you may have lots of different programs like two then you amy want to place them all in a common directory instead of having to add a new directory to the path for each one.