PDA

View Full Version : adding cwd to $PATH



wtruong
April 8th, 2007, 07:07 AM
How do i add ./ to $PATH permanently in bash??

heimo
April 8th, 2007, 07:28 AM
It's a security risk, you probably shouldn't add it. At least for me it hasn't been a big trouble to prefix commands with "./"
http://www.arsc.edu/support/policy/dotinpath.html
http://www.math.psu.edu/guide/node30.html

jordanmthomas
April 8th, 2007, 08:09 AM
If you do want to, here's what you need to do for a bash prompt. I only quickly glanced at heimo's links, but they seemed to be mostly talking about korn shell and csh.


echo "export PATH=$PATH:." >> ~/.bashrc
Then, next time you log in . will be in your path.

I only told you this because you asked, but I agree with heimo that you really shouldn't put . in your path.
Good luck to you whichever way you decide to go here.

wtruong
April 8th, 2007, 08:41 PM
hmm true enough that it is a security risk, i'll just stick with using ./a.out

thanks

rplantz
April 8th, 2007, 10:55 PM
Another way to do this is to create a personal bin directory in your home directory. Then place

/home/your_user_name/bin

in your PATH. Then place all your own executables in your personal bin directory.