Show errors codes on screen always

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the bash category.

Last Updated: 2024-03-28

When running external programs (e.g. unit tests or CLI commands) from vim, I noticed it always finished by saying "shell returned 0" or some other return code, should there happen to be an error at exit.

This made debugging easier, since I both a) knew when the script failed and b) could Google the exit code (whenever it was from a shared library)

Lesson:

Always do shell scripting in an environment where you see the exit codes of the last commands.

In my case, I even added it to my command line prompt.