set [options] [argumets]
-
[options] are settings or flags that are set or unset in the Bash shell env
-
Set an option by using a minus sign (-) followed by the appropriate option.
-
Unset an option by using a plus sign (+) followed by the appropriate option.
-
[arguments] is $1 $2..$n
examples
Ouput all the settings without options
ScriptDebuggging
set -x
ScriptExporting
set -a
Exit When a command Fails
set -e
Prevent Data Loss
set -C
Report Non-Existent Variable
set -u
Set Positional Parameters
set first second third
echo $2 # second
- unset positional parametes by running :
set --
Split Strings
myvar = "This is a test"
set --$myvar
echo $1 # this
echo $2 # is