This question already has an answer here:
We use && operator to run a command after previous one finishes.
update-system-configuration && restart-service
but how do I run a command only if previous command is unsuccessful ? For example If I have to update system configuration and if it fails I need to send a mail to system admin ?
Edit: Come on this is not a duplicate question of control operators. This will help users who are searching for specifically this, I understand that answer to control operators will answer this question too, but people searching specifically for how to handle unsuccessful commands won't reach there directly, otherwise I would have got there before asking this question.