I want to write a program which will check if soft links exist or not
#!/bin/bash
file="/var/link1"
if [[ -L "$file" ]]; then
echo "$file symlink is present";
exit 0
else
echo "$file symlink is not present";
exit 1
fi
There will be link2
, link3
, link4
, link5
.
Do I have to write the same script n
number of times for n
number of links or can this be achieved in one script?
Also I want to have the exit 0 and exit 1 so that I can use for monitoring purpose.