GNU bash, version 1.14.7(1)
I have a script is called \"abc.sh\"
I have to check this from abc.sh script only...
inside it I have written f
I find the answer from @Austin Phillips is spot on. One small improvement I'd do is to add -o (to ignore the pid of the script itself) and match for the script with basename (ie same code can be put into any script):
if pidof -x "`basename $0`" -o $$ >/dev/null; then
echo "Process already running"
fi