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
|
case "$target" in
|
||||||
/*) p="$target";;
|
/*) p="$target";;
|
||||||
|
'') ;;
|
||||||
*) p="${p%/*}/$target";;
|
*) p="${p%/*}/$target";;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
5
test.sh
5
test.sh
@ -10,7 +10,11 @@ do_test() {
|
|||||||
*/*) mkdir -p "${name%/*}";;
|
*/*) mkdir -p "${name%/*}";;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
if [ -n "$target" ]; then
|
||||||
ln -s "$target" "$name"
|
ln -s "$target" "$name"
|
||||||
|
else
|
||||||
|
touch "$name"
|
||||||
|
fi
|
||||||
|
|
||||||
is=$($bin "$name")
|
is=$($bin "$name")
|
||||||
|
|
||||||
@ -31,5 +35,6 @@ do_test 1 a /bin
|
|||||||
do_test 2 a/b .
|
do_test 2 a/b .
|
||||||
do_test 3 a/b ..
|
do_test 3 a/b ..
|
||||||
do_test 4 a/b ../t
|
do_test 4 a/b ../t
|
||||||
|
do_test 5 a
|
||||||
|
|
||||||
rm -rf "$dir"
|
rm -rf "$dir"
|
||||||
|
Loading…
Reference in New Issue
Block a user