sane-which: handle relative symlinks
This commit is contained in:
@@ -6,12 +6,15 @@
|
||||
cur="$1"
|
||||
next="$(which "$cur")"
|
||||
|
||||
getExists() {
|
||||
[ -e "$1" ] && echo "$1"
|
||||
}
|
||||
|
||||
getSymlinked() {
|
||||
# test if $cur is a symlink
|
||||
# TODO: handle relative symlinks too!
|
||||
local next_
|
||||
next_="$(readlink "$cur")"
|
||||
[ "$?" -eq 0 ] && echo "$next_"
|
||||
[ "$?" -eq 0 ] && (getExists "$next_" || getExists "$(dirname "$cur")/$next_" || echo "$next_")
|
||||
}
|
||||
|
||||
getWrapped() {
|
||||
|
Reference in New Issue
Block a user