`setupvars.sh`: ignore `cd` output (#20657)

* `setupvars.sh`: ignore `cd` output

Having `function cd() { builtin cd "$@" && l; }` defined in bash breaks `setupvars.sh`

* Use `builtin cd` to enable `function cd() { builtin cd "$@" && l; }`, remove wrapping `echo $()` because `pwd` already prints
This commit is contained in:
Zlobin Vladimir 2023-11-13 16:15:30 +04:00 committed by GitHub
parent 0125c89738
commit f97e7f1c9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -6,7 +6,8 @@
abs_path () {
script_path=$(eval echo "$1")
directory=$(dirname "$script_path")
echo "$(cd "$directory" || exit; pwd -P)";
builtin cd "$directory" || exit
pwd -P
}
SCRIPT_DIR="$(abs_path "${BASH_SOURCE[0]}")" >/dev/null 2>&1