Fix case when target is not a symlink
This commit is contained in:
parent
256ef33bdf
commit
79a20986eb
@ -4,6 +4,7 @@ target=$(readlink "$p")
|
||||
|
||||
case "$target" in
|
||||
/*) p="$target";;
|
||||
'') ;;
|
||||
*) p="${p%/*}/$target";;
|
||||
esac
|
||||
|
||||
|
7
test.sh
7
test.sh
@ -10,7 +10,11 @@ do_test() {
|
||||
*/*) mkdir -p "${name%/*}";;
|
||||
esac
|
||||
|
||||
ln -s "$target" "$name"
|
||||
if [ -n "$target" ]; then
|
||||
ln -s "$target" "$name"
|
||||
else
|
||||
touch "$name"
|
||||
fi
|
||||
|
||||
is=$($bin "$name")
|
||||
|
||||
@ -31,5 +35,6 @@ do_test 1 a /bin
|
||||
do_test 2 a/b .
|
||||
do_test 3 a/b ..
|
||||
do_test 4 a/b ../t
|
||||
do_test 5 a
|
||||
|
||||
rm -rf "$dir"
|
||||
|
Loading…
Reference in New Issue
Block a user