i have to run set of commands
command1
command2
command3
command4
Now Whenever any of these command fails i should quit while capturing error message.
Is there a better way then checking for $? after each command.
i have to run set of commands
command1
command2
command3
command4
Now Whenever any of these command fails i should quit while capturing error message.
Is there a better way then checking for $? after each command.
function em {
echo "error [${1}]"
exit ${1}
}
command1 || em ${?}
command2 || em ${?}
command3 || em ${?}
command4 || em ${?}