I'm trying to check if a symlink exists in bash. Here's what I've tried.
mda=/usr/mda
if [ ! -L $mda ]; then
echo "=> File doesn't exist"
fi
mda='/usr/mda'
if [ ! -L $mda ]; then
echo "=> File doesn't exist"
fi
However, that doesn't work.
If '!' is left out, it never triggers. And if '!' is there, it triggers every time.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…