diff options
| author | Ralf Jung <post@ralfj.de> | 2025-09-19 16:48:05 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2025-09-19 16:48:05 +0200 |
| commit | 04f6b8f99242eb61756fe294dd9d46536c1c8571 (patch) | |
| tree | ab4e22a28edd4d7542e59d332fc709d7cb0cf4d0 | |
| parent | 2f4dfc753fd86c672aa4145940db075a8a149f17 (diff) | |
| download | rust-04f6b8f99242eb61756fe294dd9d46536c1c8571.tar.gz rust-04f6b8f99242eb61756fe294dd9d46536c1c8571.zip | |
fix ./x readdir logic when CDPATH is set
| -rwxr-xr-x | x | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/x b/x index 551cfe6efbf..4fce0be219e 100755 --- a/x +++ b/x @@ -15,7 +15,8 @@ realpath() { if [ -L "$path" ]; then readlink -f "$path" elif [ -d "$path" ]; then - (cd -P "$path" && pwd) + # "cd" is not always silent (e.g. when CDPATH is set), so discard its output. + (cd -P "$path" >/dev/null && pwd) else echo "$(realpath "$(dirname "$path")")/$(basename "$path")" fi |
