Let's say there's this script
#!/bin/zsh
python -c 'a'
which will fail since a
isn't defined. Just before the shell script exits, I want to run a command, say echo bye
. How can that be achieved?
Flow is to be:
- Python command above fails.
bye
appears in terminal.- The zsh script exits.
I'd prefer it to affect the python command as little as possible such as indent, putting it in an if block, checking its exit code etc. In real life, the command is in fact multiple commands.