I have a perl script - wow.pl. I want to write a wrapper that will run the script and if it exits successfully, echo a message to the IRC chat windows that listens on port 4514 on foo400host. The echo works, but the script does not necessarily run.
#!/bin/bash
if [ ~/scripts/wow.pl ]
then
echo "wow.pl is done" | /home/bin/nc foo400host 4514
fi
You need to check the return status of your script, you can do this using $?
/usr/bin/perl ~/scripts/wow.pl
rc=$?
if [[ $rc == 0 ]] ; then
echo "wow.pl is done" | /home/bin/nc foo400host 4514
fi
exit $rc