Date: Thu, 9 Nov 2000 14:49:11 -0600 (CST) From: Mike Meyer <mwm@mired.org> To: Peter <peterk@americanisp.net> Cc: questions@freebsd.org Subject: Re: your mail Message-ID: <14859.3527.407826.940938@guru.mired.org> In-Reply-To: <64974940@toto.iv>
next in thread | previous in thread | raw e-mail | index | archive | help
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?14859.3527.407826.940938>