help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-bash] Something like die from perl in bash?


From: Peng Yu
Subject: [Help-bash] Something like die from perl in bash?
Date: Tue, 28 Jan 2014 09:40:29 -0600

Hi,

"die" in perl can print an error message as well as set the return
code of the perl script. I frequently need to print an error message
and exit with the last error code. I'd like to make it one line. Is it
possible in bash?

prog_to_fail || exit $? # how to print an error message as well exit
with the last status code?

-- 
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]