Wrapper for RC != 0
Closed this issue · 2 comments
Anachron commented
Sometimes it would be very handy to have a function like this:
check_rc()
{
if [[ $? -gt 0 ]]; then
if [[ ${1} != "" ]]; then
echo -e "${@}"
fi
exit 1
fi
}
I've used it a couple of times now in my own coding, allowing critical actions to abort scripts very handy.
startup_server 2> error.log
check_rc "Error: Could not start server, please check error.log!"
jmcantrell commented
That's a great idea!
jmcantrell commented
Closing for now. Way out of date and the pull request needs lots of work.