I have a symbolic link a.c in my home directory to another file in the same directory.
a.c -> b.c
I know how to check a.c is a symbolic link using the shell script
if [ -L /home/nit/a.c ] ; then
echo "a.c is a symbolic link"
fi
But my question is how to write a shell script to check whether a.c is a symbolic link specifically to b.c ?
Thanks
if [[ -L a.c ]] && [[ "$(readlink a.c)" = "b.c" ]]; then echo "a.c is a link to b.c"; fi
– Milled