builtin

set

Change shell options or positional parameters. A minus enables an option and a plus disables it; set -- replaces positional arguments. Without arguments set can disclose shell variables, so avoid dumping real environments.

Formal Syntax & Structure

bash syntaxbash
set [-eEuT] [-o option]; set +o option; set -- [arg ...]

Parameters & Attributes

NameTypeDescription
optionshell optionAn option name or short flag.
argstringPositional argument after --.

Return Value

exit status

Change shell options or positional parameters. A minus enables an option and a plus disables it; set -- replaces positional arguments. Without arguments set can disclose shell variables, so avoid dumping real environments.

Working Example

Example Snippetbash
set -- red 'light blue'printf '%s\n' "$#"
Bash Reference