From owner-freebsd-questions Thu Nov 9 13:21:10 2000 Delivered-To: freebsd-questions@freebsd.org Received: from copper.americanisp.net (copper.americanisp.net [208.244.174.41]) by hub.freebsd.org (Postfix) with SMTP id B28DA37B479 for ; Thu, 9 Nov 2000 13:21:07 -0800 (PST) Received: (qmail 22227 invoked from network); 9 Nov 2000 21:20:47 -0000 Received: from unknown (HELO oxygen.americanisp.net) (208.244.174.10) by copper.americanisp.net with SMTP; 9 Nov 2000 21:20:47 -0000 Date: Thu, 9 Nov 2000 14:20:18 -0700 (MST) From: Peter To: Mike Meyer Cc: questions@freebsd.org Subject: Re: your mail In-Reply-To: <14859.3527.407826.940938@guru.mired.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG "$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 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 > | > /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: Command not found. > /tmp/a2$ bar |/tmp/a2$ bar > bar: Command not found. | > > 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. > > > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message