

The return status is always zero unless an invalid option is supplied. The current set of options may be found in $-.Īny arguments remaining after the options are processed are treated as values for the positional parameters and are assigned, in order, to $1, $2. The options can also be specified as arguments to an invocation of the shell. When writing and debugging shell scripts it is good practice to set both -e and -u so that the script will exit on an Error or if an Unset variable is referenced When options are specified, they set or unset shell attributes.īy default, unset variables are evaluated as an empty string which can have unexpected and undesirable effects. Without options, the name and value of each shell variable are displayed in a format that can be reused as input for setting or resetting the currently-set variables. If there are no arguments, the positional parameters Signal the end of options, cause all remaining arguments to beĪssigned to the positional parameters. Otherwise, the positional parameters are set to the arguments, If no arguments follow this option, then the positional parameters are unset. x Print a trace of simple commands and their argumentsĪfter they are expanded and before they are executed. v Print shell input lines as they are read. To the standard error, and a non-interactive shell will exit. u Treat unset variables as an error when performing t Exit after reading and executing one command. P If set, do not follow symbolic links when performing commands. User and group ids to be set to the real user and group ids. Turning this option off causes the effective If the -p option is supplied at startup, the effective user Real user (group) id, and the -p option is not supplied, these actionsĪre taken and the effective user id is set to the real user id. If the shell is started with the effective user (group) id not equal to the Shell functions are not inherited from the environment,Īnd the SHELLOPTS variable, if it appears in the environment, is ignored. The $BASH_ENV and $ENV files are not processed, Vi Use a vi-style command line editing interface. Standard to match the standard (posix mode). Posix Change the behavior of bash where the default operation differs from the POSIX When used in combination with set -e, pipefail will make a script exit if any command Pipefail If set, the return value of a pipeline is the value of the last (rightmost) command toĮxit with a non-zero status, or zero if all commands in the pipeline exit successfully.īy default, pipelines only return a failure if the last command errors. Ignoreeof The effect is as if the shell command ` IGNOREEOF=10' had been executed History Enable command history, as described above under HISTORY. When the shell is interactive, unless the shell is started with -noediting The `option-names' are listed above and below (in bold):Įmacs Use an emacs-style command line editing interface. Set the option corresponding to ' option-name' Option settings is displayed on the standard output.
#MAC OS X SHELL SCRIPT COMMAND LINE PARAMETERS SERIES#
If +o is supplied with no option-name, a series of set commands to recreate the current o If -o is supplied with no option-name, the values of the current options are printed. This option is ignored by interactive shells. n Read commands but do not execute them this can be used Placed in the environment for a command, not just those that k All arguments in the form of assignment statements are This option is on by default for interactive shells. h Locate and remember (hash) commands as they are looked f Disable file name generation (globbing). If statement, part of a & or || list, or if the command's return status The command that fails is part of an until or while loop, part of an e Exit immediately if a simple command exits with a non-zero status, unless C Prevent output redirection using `>', `>&',Īnd `' from overwriting existing files. B The shell will perform brace expansion. Reported immediately, rather than before printing the b Cause the status of terminated background jobs to be a Mark variables which are modified or created for export. Using + rather than - will cause the option to be turned off. When options are supplied, they set or unset shell attributes.


Names and values of all shell variables and functions, sorted according to theĬurrent locale, in a format that can be reused as input. If no options or arguments are supplied, set displays the Change the value of a shell option and set the positional parameters, or display the names and values of shell variables.
