Check link target - do nothing if link is already created and the target matches the request. From Freddie Chopin.

This commit is contained in:
Gregory Nutt 2014-11-11 07:00:18 -06:00
parent 0ef0793bf9
commit 6fd018089c
1 changed files with 9 additions and 0 deletions

View File

@ -51,6 +51,15 @@ fi
# report that it does not exist. # report that it does not exist.
if [ -h "${dest}" ]; then if [ -h "${dest}" ]; then
# If the link is already created (and matches the request) do nothing
if [ "$(readlink ${dest})" = "${src}" ]; then
exit 0
fi
# Otherwise, remove the link
rm -f "${dest}" rm -f "${dest}"
else else