I was wondering what would be the best way to check the exit status in an if statement in order to echo a specific output.
I\'m thinking of it being
If you are writing a function, which is always preferred, you should propagate the error like this:
function() { if some_command; then echo "Worked" else return "${?}" fi }
This will propagate the error to the caller, so that he can do things like function && next as expected.
function && next