fix ./x readdir logic when CDPATH is set
This commit is contained in:
parent
2f4dfc753f
commit
04f6b8f992
1 changed files with 2 additions and 1 deletions
3
x
3
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue