I am working with a terrible project. It uses a lot of messy shell script in background. Script might include some other scripts. And many error outputs were redirected to /dev/null. When a script is not executed successfully, I can use echo $?
to see the error code, but I am not able to know what command returned this error code.
These scripts are there. I do not want to review all code and add extra code to handle errors in a gentle way. Now I have two questions here:
- Is it possible to print the last bash command with arguments, that was not executed successfully?
- How to live with such messy shell script code?