The Bourne shell (sh) is a shell, or command-line interpreter, for computer operating systems.

The Bourne shell was the default shell for Unix Version 7. Most Unix-like systems continue to have /bin/sh—which will be the Bourne shell, or a symbolic link or hard link to a compatible shell even when other shells are used by most users.

🔗set options

In sh, the set built-in command has the following options:

--An option of a double-dash ("--") signifies the end of an option list. This is primarily useful when values listed after the options will start with a dash themselves.
-aMark variables which are modified or created for "export"; environment variables set in this way will be passed on to the environments of any subsequent commands.
-eExit immediately if a command exits with a non-zero exit status.
-fDisable file name generation (globbing).
-hLocate and remember function commands as functions are defined (function commands are normally located when the function is executed).
-nRead commands but do not execute them.
-tExit after reading and executing one command.
-uTreat unset variables as an error when substituting.
-vPrint shell input lines as they are read.
-xPrint commands and their arguments as they are executed.

Using + rather than - causes these flags to be turned off.


set -e
set -x

test 1 -eq 0
echo "never printed"