exit with a custom msg

  • python — sys.exit(‘my msg’)
  • perl — die();
  • bash —
errorExit () # takes 1 or 2 args
{
  echo "$1" 1>&2;
  exit "${2:-49}" # bash string operator
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s