Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Nov 2000 14:20:18 -0700 (MST)
From:      Peter <peterk@americanisp.net>
To:        Mike Meyer <mwm@mired.org>
Cc:        questions@freebsd.org
Subject:   Re: your mail
Message-ID:  <Pine.LNX.4.21.0011091415570.28332-100000@oxygen.americanisp.net>
In-Reply-To: <14859.3527.407826.940938@guru.mired.org>

next in thread | previous in thread | raw e-mail | index | archive | help
"$PWD" always looks in what the shells current
> directory was when you added it to PATH.

Are you sure about this? I have $PWD added to my path, and I never have to
type ./proggie no matter what dir I am in, (at least on linux, my shell
account [just tried it] - doing echo $PATH it always replaces $PWD with my
pwd) I'll have to test it further on FBSD, but at home I dont' remember
ever having to type ./proggie anything even if I go to
/home/bob/proggie/dl/execute.proggie (no matter where I am), I use ksh btw
not sure if that matters.



--- www.nul.cjb.net --- The Power to Crash!
--- www.FreeBSD.org --- The Power to Serve!

On Thu, 9 Nov 2000, Mike Meyer wrote:

> Peter <peterk@americanisp.net> types:
> > > > You can add "." to your path by changing your shell rc file to
> > > > include the line PATH=$PATH:.
> > just add $PWD to your path so you don't have to type ./command everytime,
> > I'm not sure how adding a . to your path works, is that the same as $PWD ?
> 
> "." is another name for the current directory. $PWD is a variable that
> expands to the path of the current directory when it is evaluated. So
> in your path, "." always looks in the shells current directory when
> you issue a command. "$PWD" always looks in what the shells current
> directory was when you added it to PATH.
> 
> That's still not very clear, so here's an example:
> 
> /tmp/a1$ PATH=$PATH:$PWD        |/tmp/a1$ PATH=$PATH:.
> /tmp/a1$ ls                     |/tmp/a1$ ls
> foo                             |foo
> /tmp/a1$ foo                    |/tmp/a1$ foo
> <foo runs>                      |<foo runs>
> /tmp/a1$ cd /tmp/a2             |/tmp/a1$ cd /tmp/a2
> /tmp/a2$ ls                     |/tmp/a2$ ls
> bar                             |bar
> /tmp/a2$ foo                    |/tmp/a2$ foo
> <foo runs>                      |foo: Command not found.
> /tmp/a2$ bar                    |/tmp/a2$ bar
> bar: Command not found.         |<bar runs>
> 
> The critical thing is the last bit: not which directory the found
> vs. not found commands are in.
> 
> Final note, "." is considered to be a security problem. If you're
> going to add it, make sure it's the *last* thing in your path. That
> minimizes those problems.
> 
> 	<mike
> 
> 



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.21.0011091415570.28332-100000>