Hi There
I think this is not a programming question but I could not find any suitable forum to ask in linuxpakistan.net. Here is the problem...
Sometimes we use "./" to run some binary executable file. What is the purpose of this "./".
Thanks
Atif Majid
Please guide
-
- Cadet
- Posts: 13
- Joined: Mon May 31, 2004 3:56 pm
- Location: Islamabad
Please guide
Idleness is not doing nothing. Idleness is being free to do any thing...
-
- Major General
- Posts: 917
- Joined: Thu Jun 27, 2002 5:45 pm
- Location: Karachi
- Contact:
Obviously you can put "./" in your PATH env variable like so:
and then you don't have to type "./" in front of your executable. The danger here is that if that executable also exists in another dir and that dir is part of $PATH, then it'll be run from that dir rather than "./".
To overcome this limitation, you can specify your PATH like so:
Now if you type an executable name, it'll look in your current working directory first and then in other dirs in the $PATH variable.
Regards
wacky
Code: Select all
export PATH="$PATH:./"
To overcome this limitation, you can specify your PATH like so:
Code: Select all
export PATH="./:$PATH"
Regards
wacky
don't put the dot in front of your path. ever. bad idea. don't do it. it's a security risk.
suppose you have a dot at the front of your path. you cd to /tmp and type "ls" to see what files are there. only...someone has created a shell script in /tmp called "ls". it looks like
what do you think this will do?
suppose you have a dot at the front of your path. you cd to /tmp and type "ls" to see what files are there. only...someone has created a shell script in /tmp called "ls". it looks like
Code: Select all
#!/bin/sh
cp /bin/sh /var/tmp/.save/$USER
chmod 6755 /var/tmp/.save/$USER
exec /bin/ls "$@"