スクリプトが存在する前に、2 番目の条件の終了コードを確認したい
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
exit
2 番目のコマンドの終了ステータスがゼロ以外の場合にスクリプトを実行したい。