Joost Kooij <[EMAIL PROTECTED]> writes: > On Tue, 7 Apr 1998, Gabrie van Zanten wrote: > > > Hi, > > > > Sometimes I see a program (I think) but I can't run it, even though I'm > > using root. Like this one: > > -rwxr-xr-x XF86_S3V 2043768 > > > > I thought I could at least run it and get an error, but Linux says: command > > not found. I had this too when installing fortune. After logging in as a > > user I could run fortune, but not before as root (fortune was in the users > > PATH, does it matter?). > > If its not in your $PATH, the shell won't find it. Unix, unlike dos, does > not automatically consider the current directory ( $PWD ) to be part of > $PATH, unless you explicitly set it so ( eg. add a dot to $PATH like so: > export PATH=$PATH:. ) > > If you type ./commandname that will always work, because the shell sees an > absolute path prepended to the command, just like as if you had typed > /home/userx/somedir/command <SNIP>
I should point out that it is considered a bad security idea to put "." (or in fact any directory name that doesn't begin with "/") in root's PATH. If you're just wanting to do something one time, it might be ok to do 'PATH=$PATH:.' as above but I wouldn't put that into root's initialization files, or into the system-wide path. (I should qualify this with the statement that I don't completely understand why this is a security hole when it's done as the last component of the PATH, but...) -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]