Automation, Orchestration, and Scripting
A technician is writing a script that must run under Bash and abort when any command returns a nonzero status. Which first line of the file achieves this when the script is executed directly?
Show the answer
Correct answerA. #!/bin/bash -e
A shebang is #! followed by the interpreter's absolute path and at most one optional argument, here -e. The forms with the characters reversed or missing are read as ordinary comments or invalid text, so the kernel will not use them to pick an interpreter.