error handling - wrapping a perl script in bash - echo to IRC bot -
i have perl script - wow.pl. want write wrapper run script , if exits successfully, echo message irc chat windows listens on port 4514 on foo400host. echo works, script not run.
#!/bin/bash if [ ~/scripts/wow.pl ] echo "wow.pl done" | /home/bin/nc foo400host 4514 fi
you need check return status of script, can using $?
/usr/bin/perl ~/scripts/wow.pl rc=$? if [[ $rc == 0 ]] ; echo "wow.pl done" | /home/bin/nc foo400host 4514 fi exit $rc
Comments
Post a Comment