# ... stuff run every time this script is invoked if [ "$checkvar" != "foo" ]; then exec perl /usr/script/myscript.pl else # ... stuff to do after the script has run fi