If you run it via bash or make it executable and run it, it'll presumably either display nothing (which is what I expect to happen because -23 is non-zero and set -e means bomb out whenever anything returns non-zero) or possibly display -23 (if it doesn't count in a function, but I don't think that's the case).
If you source/dot the file to run it in the current context, you'll end up closing your shell.
I am a professional DevOps Engineer with a demonstrated history of working in the internet industry. I am an avid Linux lover and supporter of the open-source movement philosophy.
Top comments (2)
If you run it via bash or make it executable and run it, it'll presumably either display nothing (which is what I expect to happen because -23 is non-zero and
set -emeans bomb out whenever anything returns non-zero) or possibly display -23 (if it doesn't count in a function, but I don't think that's the case).If you source/dot the file to run it in the current context, you'll end up closing your shell.
I use the
shellchecktool as described here:devdojo.com/guide/bash/debugging-a...
You can use their website directly or you could install the CLI tool as well.
It is very handy, it gives you some suggestions on some best practices too.