In /bin/sh
and /bin/bash
(and I guess a lot of other shells), starting scripts with #!/bin/sh -e
(or executing set -e
in someplace in the script) would cause the script to abort when any command line inside the script exits with a status code different than 0.
Is there any equivalent or workaround to get the same behavior in a perl script? (i.e. if any instruction generates an error or if any external command executed with system(...)
or backticks returns error code then exit immediately)