Content
Data
License: GNU GPLv3 +
Version number: GNU Bash 5
Developer / owner: Free Software Foundation Inc.
Short description:
The manual page and help for the set built-in Bash command. Use the set command to set and clear shell settings and attributes. Running without arguments, outputs shell variables and their values.
Man page output
man bash
[...]
set [--abefhkmnptuvxBCEHPT] [-o option-name] [arg ...]
set [+abefhkmnptuvxBCEHPT] [+o option-name] [arg ...]
Without options, the name and value of each shell variable are displayed in a for-
mat that can be reused as input for setting or resetting the currently-set vari-
ables. 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
option processing are treated as values for the positional parameters and are as-
signed, in order, to $1, $2, ... $n. Options, if specified, have the following
meanings:
-a Each variable or function that is created or modified is given the export
attribute and marked 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 pipeline (which may consist of a single simple com-
mand), a list, or a compound command (see SHELL GRAMMAR above), 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 following the if or elif reserved words, part of any com-
mand executed in a && or || list except the command following the final &&
or ||, any command in a pipeline but the last, or if the command's return
value is being inverted with !. If a compound command other than a sub-
shell returns a non-zero status because a command failed while -e was being
ignored, the shell does not exit. A trap on ERR, if set, is executed be-
fore the shell exits. This option applies to the shell environment and
each subshell environment separately (see COMMAND EXECUTION ENVIRONMENT
above), and may cause subshells to exit before executing all the commands
in the subshell.
If a compound command or shell function executes in a context where -e is
being ignored, none of the commands executed within the compound command or
function body will be affected by the -e setting, even if -e is set and a
command returns a failure status. If a compound command or shell function
sets -e while executing in a context where -e is ignored, that setting will
not have any effect until the compound command or the command containing
the function call completes.
-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 envi-
ronment 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 (see JOB CONTROL above). All
processes run in a separate process group. When a background job com-
pletes, the shell prints a line containing its exit status.
-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
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. This also affects the editing
interface used for read -e.
errexit Same as -e.
errtrace
Same as -E.
functrace
Same as -T.
hashall Same as -h.
histexpand
Same as -H.
history Enable command history, as described above under HISTORY. This op-
tion is on by default in interactive shells.
ignoreeof
The effect is as if the shell command ``IGNOREEOF=10'' had been ex-
ecuted (see Shell Variables above).
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 dis-
abled by default.
posix Change the behavior of bash where the default operation differs
from the POSIX standard to match the standard (posix mode). See
SEE ALSO below for a reference to a document that details how posix
mode affects bash's behavior.
privileged
Same as -p.
verbose Same as -v.
vi Use a vi-style command line editing interface. This also affects
the editing interface used for read -e.
xtrace Same as -x.
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 com-
mands 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, BASHOPTS, CDPATH, and GLOBIGNORE variables, if they appear
in the environment, are ignored. If the shell is started with the effec-
tive user (group) id not equal to the real user (group) id, and the -p op-
tion 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 ef-
fective 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 and parameters other than the special parameters "@"
and "*" as an error when performing parameter expansion. If expansion is
attempted on an unset variable or parameter, the shell prints an error mes-
sage, 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 com-
mand, or arithmetic for command, display the expanded value of PS4, fol-
lowed by the command and its expanded arguments or associated word list.
-B The shell performs brace expansion (see Brace Expansion above). This is on
by default.
-C If set, bash does not overwrite an existing file with the >, >&, and <> re-
direction 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 substitu-
tions, 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 resolve 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 un-
set. 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 argu-
ments to an invocation of the shell. The current set of options may be found in
$-. The return status is always true unless an invalid option is encountered.
[...]
Help output
set --help
set: set [--abefhkmnptuvxBCHP] [-o beállításnév] [--] [arg ...]
Parancsértelmező-beállítások és pozicionális paraméterek állítása, törlése.
Parancsértelmező-attribútumok és pozicionális paraméterek értékeinek
módosítása, parancsértelmező-változók neveinek és értékeinek kiírása.
Kapcsolók:
-a A módosított vagy létrehozott változó exportálásra jelölése
-b Munka befejezéséről azonnali értesítés
-e Azonnali kilépés, ha egy parancs nem nullával lép ki
-f Fájlnév-generálás (globbing) tiltása
-h Parancsok helyének megjegyzése használatkor
-k Minden értékadó argumentum a parancs környezetébe kerül, nem
csak a parancsot megelőzők
-m Munkakezelés engedélyezése
-n Parancsok beolvasása végrehajtás nélkül
-o kapcsolónév
Kapcsolónév szerinti változóállítás:
allexport mint -a
braceexpand mint -B
emacs emacs-szerű sorszerkesztés
errexit mint -e
errtrace mint -E
functrace mint -T
hashall mint -h
histexpand mint -H
history előzmények tárolásának engedélyezése
ignoreeof EOF esetén nem lép ki a parancsértelmező
interactive-comments
interaktív parancsokban is lehetnek megjegyzések
keyword mint -k
monitor mint -m
noclobber mint -C
noexec mint -n
noglob mint -f
nolog jelenleg elfogadott, de mellőzött
notify mint -b
nounset mint -u
onecmd mint -t
physical mint -P
pipefail egy csővezeték-parancs kilépési kódja az utolsó
nem nullával kilépett parancs kilépési kódja,
vagy 0, ha nem volt ilyen
posix a bash viselkedésének megváltoztatása, ha az
alapértelmezett nem felel meg a Posix
szabványnak
privileged mint -p
verbose mint -v
vi vi-szerű sorszerkesztés
xtrace mint -x
-p Mindig be van kapcsolva, ha a valós és effektív felhasználó nem
egyezik. Letiltja az $ENV fájl értelmezését és a parancsértelmező-
függvények betöltését. A kapcsoló kikapcsolása az effektív
uid és gid valósra állítását okozza
-t Egyetlen parancs beolvasása és végrehajtás után kilépés
-u Nem létező változók behelyettesítése legyen hiba
-v Beolvasott parancsok kiírása olvasáskor (értelmezés előtt).
-x Parancsok kiírása végrehajtáskor (értelmezés után).
-B Szögleteszárójel-kiegészítés végrehajtása
-C Létező normál fájlok felülírásának tiltása kimenetátirányításnál
-E Az ERR csapdát öröklik a függvények
-H Felkiáltójeles előzményhelyettesítés engedélyezése. Interaktív
parancsértelmezőnél alapértelmezés
-P Parancsok végrehajtásánál szimbolikus linkek követésének tiltása
(például cd esetében)
-T A DEBUG és RETURN csapdát öröklik a függvények
-- A további argumentumok hozzárendelése a pozicionális paraméterekhez.
Ha nincsenek további argumentumok, akkora a pozicionális paraméterek
törlésre kerülnek.
- A további argumentumok pozicionális paraméterekhez rendelése
A -x és -v kapcsolók ki vannak kapcsolva.
„-” helyett „+” használatával a kapcsolók tilthatóak. A kapcsolók a
parancsértelmező indításakor is állíthatóak. Az érvényben lévő kapcsolók
a $- változóban vannak. A záró nem értelmezhető argumentumok pozicionális
paraméterek lesznek (rendre $1, $2 ... $n). Ha nincs ARG, minden
parancsértelmező-változó kiírásra kerül.
Kilépési kód:
Sikerrel tér vissza, kivéve ha érvénytelen kapcsolót kap.
Related Content
- 51 views