[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bash unexpected directory prompting

From: Eric Blake
Subject: Re: Bash unexpected directory prompting
Date: Sat, 12 Apr 2008 11:05:34 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20080213 Thunderbird/ Mnenhy/

Hash: SHA1

According to Bob Friesenhahn on 4/12/2008 10:39 AM:
| I have since learned that if CDPATH is set, then the shell prints the
| new path every time the directory path is changed

Actually, it only prints the path if CDPATH was used to find the
directory, and the directory was not anchored.  You can defeat it by using
an absolute path, or by prefixing a relative path with `./'.

| (something I have been
| looking at every day for years).  What does not make sense to me is that
| this happens in non-interactive scripts as well.

Yes.  POSIX requires this non-intuitive behavior.  Which is why it is a
good idea to unset CDPATH at the start of any robust script, in case
CDPATH was accidentally exported (generally, you should set it as a shell
variable rather than an environment variable).

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


reply via email to

[Prev in Thread] Current Thread [Next in Thread]