[shell] Override CDPATH in brew script.

The CDPATH environment variable can affect the behavior of
`cd`, and `cd` takes the `-P`, `-L` and `-e` flags.
(I didn't know about `-e` until looking at the source)
Make quietcd more robust by setting the CDPATH to ''.

I tested this change by running the following commands from a nonstandard
directory, which caused some of tcsh's and perl's dependencies to be recompiled.

$ [path to brew] install tcsh
$ [path to brew] install perl

Here's a link to the source code of `cd` in a mirror of the bash repo.

ec8113b986/builtins/cd.def (L267)
This commit is contained in:
Greg NISBET 2023-11-04 16:10:21 -07:00
parent 735bc219eb
commit 077eee8f86

View File

@ -27,7 +27,7 @@ then
fi
quiet_cd() {
cd "$@" &>/dev/null || return
CDPATH='' cd -- "$@" &>/dev/null || return
}
symlink_target_directory() {