check the exit code inside a if statement before existing script
I want to check the exit code of the second condition before existing the
script
if [ -f "/var/lock/myproc/agentlock" ] && \
[ $(ps ax | grep "myproc" | grep -v "grep" | awk '{print $1}' | xargs
kill -9) ]; then
echo "Exiting without running the rest of the script" | sendmail $myemail
exit
fi
I want to exit the script if the exit status of the second command is
non-zero.
No comments:
Post a Comment