Possible Duplicate:
Why do we use “./” to execute a file?
It seems redundant and gets annoying after a while -- is there a way to change this? If not, can somebody explain the reasoning behind this?
Thanks!
Possible Duplicate:
Why do we use “./” to execute a file?
It seems redundant and gets annoying after a while -- is there a way to change this? If not, can somebody explain the reasoning behind this?
Thanks!
You don't, if the current directory is in your path and there isn't another executable with the same name in a directory named earlier in the path. If either of these conditions isn't true, ./ effectively says "look here".
Although you can add "." to your path, it isn't advisable, since that opens the door for unexpected (or malicious) results if you execute a command from a directory that has executables that match the name of system commands.
su
privileges, since it fails to sanitize the environment beforehand.
– Shadur-don't-feed-the-AI
Jul 04 '11 at 04:09
You do if your current directory is not in your path. If you ever log in as root or are a sudoer, I do not recommend you add your current directory to your path. Just put up with the ./
If you wish, make a directory in your home directory called bin
. Then add this directory to your search path. It's a good place to put your general purpose housekeeping scripts.
isnt it much easier than running your program using sh yourprogram.sh
or python yourprogram.py
?