bug-bash
[Top][All Lists]
Advanced

[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:1.8.1.12) Gecko/20080213 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
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             ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
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

iEYEARECAAYFAkgA694ACgkQ84KuGfSFAYCsvwCfQDfGznAc92tuDoZa+SKBOsmP
hAEAoL+quETWOblfB8/OkkjuMUMuRRu4
=zXnd
-----END PGP SIGNATURE-----




reply via email to

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