I want to perform certain action (run another command) for every command that fail from user input.
Imagine you open a terminal and type:
git clone somewebsiteijustmadeup.org.edu.gov.de
and it fails (returns non-zero code). I would like to trigger another command after that.
Is there an easy way to do it without changing shell and recompiling it? I tried to find some information about it but internet gave me void.
Thanks :- )
----- EDIT
This is supposed to be done automatically by shell. No explicit command should be required to be typed by user. This should be sort of a default way to handle non-zero status of a any command.