Dot in PATH?

Paul Falstad pfalstad at phoenix.Princeton.EDU
Mon Jan 28 12:53:26 AEST 1991


data at buhub (Mark Hall) wrote:
>In <5528 at auspex.auspex.com> guy at auspex.auspex.com (Guy Harris) writes:
>> You thought incorrectly; UNIX shells, and the "exec[lv]p()" routines,
>> check only if "." is in the current command search path.
>
>Well, let me show you something:
>
>in my .profile is this path command:
>
>> PATH=:/usr/lbin:/usr/local/bin:/bin:/usr/bin:$HOME:$HOME/BIN:$HOME/USR:/usr/tmp:/tmp:/tmp/talk:
>
>if I run a program in the current directory (and it's not in my path command)
>my shell looks in the current directory FIRST.  This is also the way MS-DOS
>works, but that's a different notes-group.  This is why I made the original
>comment.  I grant that other shells may not work this way (I'm not saying that
>they have to be alike), but my shell DOES treat my commands this way.
>BTW: I'm running UNIX SYSTEM V v3.2(i think)

Most if not all shells do work this way.  Look at your PATH again:

PATH=:/usr/lbin:/usr/local/bin:/bin:/usr/bin:$HOME:$HOME/BIN:$HOME/USR:/usr/tmp:/tmp:/tmp/talk:

In path strings, a null component is synonymous with ".".  You have .
twice in your path, actually: once at the beginning and once at the end.
More explicitly, your path is equivalent to:

PATH=.:/usr/lbin:/usr/local/bin:/bin:/usr/bin:$HOME:$HOME/BIN:$HOME/USR:/usr/tmp:/tmp:/tmp/talk:.

I would change your PATH to:

PATH=/usr/lbin:/usr/local/bin:/bin:/usr/bin:$HOME:$HOME/BIN:$HOME/USR

or at the very least:

PATH=/usr/lbin:/usr/local/bin:/bin:/usr/bin:$HOME:$HOME/BIN:$HOME/USR:.

Now that you've posted to the net the fact that you have /tmp in your
path, we don't want people creating trojan horses named /tmp/mroe, now
do we?  ;-)

--
Paul Falstad, pfalstad at phoenix.princeton.edu PLink:HYPNOS GEnie:P.FALSTAD
"And she's always on about men following her.  I don't know what she
thinks they're going to do to her.  Vomit on her, Basil, says."-Flowery Twats



More information about the Comp.unix.shell mailing list