Bash - Set (of Bash Options)

Bash Liste Des Attaques Ovh

About

The set builtin command can be specify shell option.

When options are specified, they set or unset shell attributes.

Syntax

set [--abefhkmnptuvxBCHP] [-o option] [arg ...]

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.

Read-only variables cannot be reset.

In posix mode, only shell variables are listed.

The output is sorted according to the current locale.

When options are specified, they set or unset shell attributes.

Any arguments remaining after the options are processed are treated as values for the positional parameters and are assigned, in order, to 1, 2, … n.

Options, if specified, have the following meanings:

  • -a Automatically mark variables and functions which are modified or created for export to the environment of subsequent commands.
  • -b Report the status of terminated background jobs immediately, rather than before the next primary prompt. This is effective only when job control is enabled.
  • -e Exit immediately if a simple command exits with a non-zero status. The shell does not exit if the command that fails is part of the command list immediately following a while or until keyword, part of the test in an if statement, part of a && or ││ list, or if the command’s return value is being inverted via !. A trap on ERR, if set, is executed before the shell exits.
  • -f Disable pathname expansion.
  • -h Remember the location of commands as they are looked up for execution. This is enabled by default.
  • -k All arguments in the form of assignment statements are placed in the environment for a command, not just those that precede the command name.
  • -m Monitor mode. Job control is enabled. This option is on by default for interactive shells on systems that support it. Background processes run in a separate process group and a line containing their exit status is printed upon their completion.
  • -n Read commands but do not execute them. This may be used to check a shell script for syntax errors. This is ignored by interactive shells.
  • -o option-name. See option-name below for a list. If -o is supplied with no option-name, the values of the current options are printed. If +o is supplied with no option-name, a series of set commands to recreate the current option settings is displayed on the standard output.
  • -p Turn on privileged mode. In this mode, the ENV and BASH_ENV files are not processed, shell functions are not inherited from the environment, and the SHELLOPTS variable, if it appears in the environment, is ignored. If the shell is started with the effective user (group) id not equal to the real user (group) id, and the -p option is not supplied, these actions are taken and the effective user id is set to the real user id. If the -p option is supplied at startup, the effective user id is not reset. Turning this option off causes the effective user and group ids to be set to the real user and group ids.
  • -t Exit after reading and executing one command.
  • -u Treat unset variables as an error when performing parameter expansion. If expansion is attempted on an unset variable, the shell prints an error message, and, if not interactive, exits with a non-zero status.
  • -v Print shell input lines as they are read.
  • -x After expanding each simple command, for command, case command, select command, or arithmetic for command, display the expanded value of PS4, followed by the command and its expanded arguments or associated word list.
  • -B The shell performs brace expansion. This is on by default.
  • -C If set, bash does not overwrite an existing file with the >, >&, and <> redirection operators. This may be overridden when creating output files by using the redirection operator >| instead of >.
  • -E If set, any trap on ERR is inherited by shell functions, command substitutions, and commands executed in a subshell environment. The ERR trap is normally not inherited in such cases.
  • -H Enable ! style history substitution. This option is on by default when the shell is interactive.
  • -P If set, the shell does not follow symbolic links when executing commands such as cd that change the current working directory. It uses the physical directory structure instead. By default, bash follows the logical chain of directories when performing commands which change the current directory.
  • -T If set, any traps on DEBUG and RETURN are inherited by shell functions, command substitutions, and commands executed in a subshell environment. The DEBUG and RETURN traps are normally not inherited in such cases.
  • If no arguments follow this option, then the positional parameters are unset. Otherwise, the positional parameters are set to the args, even if some of them begin with a -.
  • - Signal the end of options, cause all remaining args to be assigned to the positional parameters. The -x and -v options are turned off. If there are no args, the positional parameters remain unchanged.

The options are off by default unless otherwise noted. Using + rather than - causes these options to be turned off. The options can also be specified as arguments to an invocation of the shell.

List

The current set of options may be found in $-.

Return Status

The return status is always true unless an invalid option is encountered.

Option-Name

The option-name can be one of the following:

  • allexport Same as -a.
  • braceexpand. Same as -B.
  • emacs Use an emacs-style command line editing interface. This is enabled by default when the shell is interactive, unless the shell is started with the –noediting option.
  • errtrace: Same as -E.
  • functrace Same as -T.
  • errexit Same as -e.
  • hashall Same as -h.
  • histexpand Same as -H.
  • history Enable command history. This option is on by default in interactive shells.
  • ignoreeof The effect is as if the shell command IGNOREEOF=10 had been executed.
  • keyword Same as -k.
  • monitor Same as -m.
  • noclobber Same as -C.
  • noexec Same as -n.
  • noglob Same as -f. nolog Currently ignored.
  • notify Same as -b.
  • nounset Same as -u.
  • onecmd Same as -t.
  • physical Same as -P.
  • pipefail If set, the return value of a pipeline is the value of the last (rightmost) command to exit with a non-zero status, or zero if all commands in the pipeline exit successfully. This option is disabled by default.
  • posix Change the behavior of bash where the default operation differs from the POSIX standard to match the standard (posix mode).
  • privileged Same as -p.
  • verbose Same as -v.
  • vi Use a vi-style command line editing interface.
  • xtrace Same as -x.





Discover More
Bash Liste Des Attaques Ovh
Bash - (Argument|Positional Parameter)

An argument is a parameter given: to a command to a function or to the bash shell They are referenced by position. A positional parameter is a parameter denoted: by one or more digits, ...
Bash Liste Des Attaques Ovh
Bash - Bash cli

Bash is an sh-compatible a shell that executes commands read: from the standard input or from a file (script). In addition to the single-character shell options documented in the description...
Bash Liste Des Attaques Ovh
Bash - Builtin Commands

builtin refers to: a builtin command. See or to the specific builtin command. See (useful when defining a function whose name is the same as a shell builtin) The builtin command execute the specified...
Bash Liste Des Attaques Ovh
Bash - Cd (Change Directory) builtin command

in bash. Cd is a builtin command that changes the current directory where: the options -L forces symbolic links to be followed. -P says to use the physical directory structure instead of...
Bash Liste Des Attaques Ovh
Bash - Complete (Builtin command) - Completion

The programmable completion feature in Bash permits typing a partial command, then pressing the [Tab] key to auto-complete the command sequence The process of applying these completion specifications...
Bash Liste Des Attaques Ovh
Bash - Pipeline

This article talks the syntax of a Shell Pipeline in Bash All command(s) in a pipeline are executed: in parallel. and started in a subshell (meaning that the environment is not passed along the...
Bash Liste Des Attaques Ovh
Bash - Print Working directory (pwd)

pwd displays the absolute pathname of the current directory in bash. where: -P will print the pathname with no symbolic links or the -o physical option to the set builtin command is enabled. ...
Bash Liste Des Attaques Ovh
Bash - Shell Option (Shopt)

Shell option are the option of the shell Shell option can be specified upon invocation, by: the set builtin command, or those set by the shell itself (such as the -i option). The special...
Bash Liste Des Attaques Ovh
Bash - Text Editing

By default, the line editing commands are similar to those of Emacs. A vi-style line editing interface is also available. Manipulating the text as you type it in. See: for word completion: for...
Bash Liste Des Attaques Ovh
Bash - process

This article is the bash Process. To see how to manage another general linux process, see The process running the command is created. The process inherits the stdin, stdout, and stderr from...



Share this page:
Follow us:
Task Runner