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
| Name | Type | Description |
|---|---|---|
| option | shell option | An option name or short flag. |
| arg | string | Positional 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' "$#"