9
0
Fork 0

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 faeb86d795
commit 653ee19c65
1 changed files with 9 additions and 0 deletions

View File

@ -51,6 +51,15 @@ fi
# report that it does not exist.
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}"
else