Created
October 27, 2018 07:03
-
-
Save hasufell/8241e25388fa9da2381a441cf6450dc7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
cd "$(mktemp -d)" | |
# create normal file | |
touch normal-file | |
# create proper symlink | |
ln -s normal-file proper-symlink | |
# create broken symlink | |
ln -s lala broken-symlink | |
echo "test assumption: [ ! -e "\$F" ]" | |
for F in * not-a-file ; do | |
if [ ! -e "$F" ] ; then | |
echo "$F is a dangling symlink" | |
fi | |
done | |
echo | |
echo "test assumption: [ -h "\$F" -a ! -e "\$F" ]" | |
for F in * not-a-file ; do | |
if [ -h "$F" -a ! -e "$F" ] ; then | |
echo "$F is a dangling symlink" | |
fi | |
done | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment