1BASH(1)                     General Commands Manual                    BASH(1)
2
3
4

NAME

6       bash - GNU Bourne-Again SHell
7

SYNOPSIS

9       bash [options] [file]
10
12       Bash is Copyright (C) 1989-2011 by the Free Software Foundation, Inc.
13

DESCRIPTION

15       Bash  is  an  sh-compatible  command language interpreter that executes
16       commands read from the standard input or from a file.  Bash also incor‐
17       porates useful features from the Korn and C shells (ksh and csh).
18
19       Bash  is  intended  to  be a conformant implementation of the Shell and
20       Utilities portion  of  the  IEEE  POSIX  specification  (IEEE  Standard
21       1003.1).  Bash can be configured to be POSIX-conformant by default.
22

OPTIONS

24       All  of  the  single-character shell options documented in the descrip‐
25       tion of the set builtin command can be used as options when  the  shell
26       is invoked.  In addition, bash interprets the following options when it
27       is invoked:
28
29       -c string If the -c option is present,  then  commands  are  read  from
30                 string.   If  there  are arguments after the string, they are
31                 assigned to the positional parameters, starting with $0.
32       -i        If the -i option is present, the shell is interactive.
33       -l        Make bash act as if it had been invoked as a login shell (see
34                 INVOCATION below).
35       -r        If  the  -r  option  is present, the shell becomes restricted
36                 (see RESTRICTED SHELL below).
37       -s        If the -s option is present, or if no arguments remain  after
38                 option  processing,  then commands are read from the standard
39                 input.  This option allows the positional  parameters  to  be
40                 set when invoking an interactive shell.
41       -D        A  list of all double-quoted strings preceded by $ is printed
42                 on the standard output.  These are the strings that are  sub‐
43                 ject to language translation when the current locale is not C
44                 or POSIX.  This implies the -n option; no  commands  will  be
45                 executed.
46       [-+]O [shopt_option]
47                 shopt_option  is  one  of  the  shell options accepted by the
48                 shopt  builtin  (see  SHELL  BUILTIN  COMMANDS  below).    If
49                 shopt_option is present, -O sets the value of that option; +O
50                 unsets it.  If shopt_option is not supplied,  the  names  and
51                 values  of the shell options accepted by shopt are printed on
52                 the standard output.  If the invocation  option  is  +O,  the
53                 output is displayed in a format that may be reused as input.
54       --        A  --  signals the end of options and disables further option
55                 processing.  Any arguments after the -- are treated as  file‐
56                 names and arguments.  An argument of - is equivalent to --.
57
58       Bash  also  interprets  a  number  of  multi-character  options.  These
59       options must appear on the command  line  before  the  single-character
60       options to be recognized.
61
62       --debugger
63              Arrange for the debugger profile to be executed before the shell
64              starts.  Turns on extended debugging mode (see  the  description
65              of the extdebug option to the shopt builtin below).
66       --dump-po-strings
67              Equivalent  to -D, but the output is in the GNU gettext po (por‐
68              table object) file format.
69       --dump-strings
70              Equivalent to -D.
71       --help Display a usage message on standard  output  and  exit  success‐
72              fully.
73       --init-file file
74       --rcfile file
75              Execute commands from file instead of the standard personal ini‐
76              tialization file ~/.bashrc if  the  shell  is  interactive  (see
77              INVOCATION below).
78
79       --login
80              Equivalent to -l.
81
82       --noediting
83              Do  not  use the GNU readline library to read command lines when
84              the shell is interactive.
85
86       --noprofile
87              Do not read either the system-wide startup file /etc/profile  or
88              any   of  the  personal  initialization  files  ~/.bash_profile,
89              ~/.bash_login, or ~/.profile.   By  default,  bash  reads  these
90              files  when  it  is  invoked  as  a  login shell (see INVOCATION
91              below).
92
93       --norc Do  not  read  and  execute  the  personal  initialization  file
94              ~/.bashrc  if  the  shell  is interactive.  This option is on by
95              default if the shell is invoked as sh.
96
97       --posix
98              Change the behavior of bash where the default operation  differs
99              from the POSIX standard to match the standard (posix mode).
100
101       --restricted
102              The shell becomes restricted (see RESTRICTED SHELL below).
103
104       --rpm-requires
105              Produce the list of files that are required for the shell script
106              to run.  This implies '-n' and is subject to  the  same  limita‐
107              tions as compile time error checking checking; Command substitu‐
108              tions, Conditional expressions and eval builtin are  not  parsed
109              so some dependencies may be missed.
110
111       --verbose
112              Equivalent to  -v.
113
114       --version
115              Show  version information for this instance of bash on the stan‐
116              dard output and exit successfully.
117

ARGUMENTS

119       If arguments remain after option processing, and neither the -c nor the
120       -s  option  has  been supplied, the first argument is assumed to be the
121       name of a file containing shell commands.  If bash is invoked  in  this
122       fashion,  $0 is set to the name of the file, and the positional parame‐
123       ters are set to the remaining arguments.  Bash reads and executes  com‐
124       mands  from this file, then exits.  Bash's exit status is the exit sta‐
125       tus of the last command executed in the script.   If  no  commands  are
126       executed,  the  exit status is 0.  An attempt is first made to open the
127       file in the current directory, and, if no file is found, then the shell
128       searches the directories in PATH for the script.
129

INVOCATION

131       A  login shell is one whose first character of argument zero is a -, or
132       one started with the --login option.
133
134       An interactive shell is one started without  non-option  arguments  and
135       without the -c option whose standard input and error are both connected
136       to terminals (as determined by isatty(3)), or one started with  the  -i
137       option.   PS1 is set and $- includes i if bash is interactive, allowing
138       a shell script or a startup file to test this state.
139
140       The following paragraphs describe how bash executes its startup  files.
141       If  any  of  the files exist but cannot be read, bash reports an error.
142       Tildes are expanded in file names as described below under Tilde Expan‐
143       sion in the EXPANSION section.
144
145       When  bash is invoked as an interactive login shell, or as a non-inter‐
146       active shell with the --login option, it first reads and executes  com‐
147       mands  from  the file /etc/profile, if that file exists.  After reading
148       that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile,
149       in  that order, and reads and executes commands from the first one that
150       exists and is readable.  The --noprofile option may be  used  when  the
151       shell is started to inhibit this behavior.
152
153       When  a  login  shell  exits, bash reads and executes commands from the
154       files ~/.bash_logout and /etc/bash.bash_logout, if the files exists.
155
156       When an interactive shell that is not a login shell  is  started,  bash
157       reads  and executes commands from ~/.bashrc, if that file exists.  This
158       may be inhibited by using the --norc option.  The --rcfile file  option
159       will  force  bash  to  read  and  execute commands from file instead of
160       ~/.bashrc.
161
162       When bash is started non-interactively, to  run  a  shell  script,  for
163       example, it looks for the variable BASH_ENV in the environment, expands
164       its value if it appears there, and uses the expanded value as the  name
165       of  a  file to read and execute.  Bash behaves as if the following com‐
166       mand were executed:
167              if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi
168       but the value of the PATH variable is not used to search for  the  file
169       name.
170
171       If  bash  is  invoked  with  the name sh, it tries to mimic the startup
172       behavior of historical versions of sh as  closely  as  possible,  while
173       conforming  to the POSIX standard as well.  When invoked as an interac‐
174       tive login shell, or a non-interactive shell with the  --login  option,
175       it  first  attempts  to read and execute commands from /etc/profile and
176       ~/.profile, in that order.  The  --noprofile  option  may  be  used  to
177       inhibit  this  behavior.  When invoked as an interactive shell with the
178       name sh, bash looks for the variable ENV, expands its value  if  it  is
179       defined,  and uses the expanded value as the name of a file to read and
180       execute.  Since a shell invoked as sh does not attempt to read and exe‐
181       cute  commands from any other startup files, the --rcfile option has no
182       effect.  A non-interactive shell invoked with  the  name  sh  does  not
183       attempt  to  read  any  other  startup files.  When invoked as sh, bash
184       enters posix mode after the startup files are read.
185
186       When bash is started in posix mode, as with the  --posix  command  line
187       option, it follows the POSIX standard for startup files.  In this mode,
188       interactive shells expand the ENV variable and commands  are  read  and
189       executed  from  the  file  whose  name is the expanded value.  No other
190       startup files are read.
191
192       Bash attempts to determine when it is being run with its standard input
193       connected to a network connection, as when executed by the remote shell
194       daemon, usually rshd, or the secure shell daemon sshd.  If bash  deter‐
195       mines  it  is being run in this fashion, it reads and executes commands
196       from ~/.bashrc, if that file exists and is readable.  It  will  not  do
197       this  if  invoked as sh.  The --norc option may be used to inhibit this
198       behavior, and the --rcfile option may be used to force another file  to
199       be  read,  but  rshd  does  not  generally  invoke the shell with those
200       options or allow them to be specified.
201
202       If the shell is started with the effective user (group) id not equal to
203       the real user (group) id, and the -p option is not supplied, no startup
204       files are read, shell functions are not inherited from the environment,
205       the  SHELLOPTS,  BASHOPTS,  CDPATH,  and  GLOBIGNORE variables, if they
206       appear in the environment, are ignored, and the effective  user  id  is
207       set  to  the real user id.  If the -p option is supplied at invocation,
208       the startup behavior is the same, but the  effective  user  id  is  not
209       reset.
210

DEFINITIONS

212       The  following  definitions  are used throughout the rest of this docu‐
213       ment.
214       blank  A space or tab.
215       word   A sequence of characters considered as  a  single  unit  by  the
216              shell.  Also known as a token.
217       name   A  word  consisting  only  of alphanumeric characters and under‐
218              scores, and beginning with an alphabetic character or an  under‐
219              score.  Also referred to as an identifier.
220       metacharacter
221              A  character  that,  when unquoted, separates words.  One of the
222              following:
223              |  & ; ( ) < > space tab
224       control operator
225              A token that performs a control function.  It is one of the fol‐
226              lowing symbols:
227              || & && ; ;; ( ) | |& <newline>
228

RESERVED WORDS

230       Reserved words are words that have a special meaning to the shell.  The
231       following words are recognized as reserved when unquoted and either the
232       first  word  of a simple command (see SHELL GRAMMAR below) or the third
233       word of a case or for command:
234
235       ! case  do done elif else esac fi for function if in select then  until
236       while { } time [[ ]]
237

SHELL GRAMMAR

239   Simple Commands
240       A  simple  command  is a sequence of optional variable assignments fol‐
241       lowed by blank-separated words and redirections, and  terminated  by  a
242       control operator.  The first word specifies the command to be executed,
243       and is passed as argument zero.  The  remaining  words  are  passed  as
244       arguments to the invoked command.
245
246       The  return  value  of a simple command is its exit status, or 128+n if
247       the command is terminated by signal n.
248
249   Pipelines
250       A pipeline is a sequence of one or more commands separated  by  one  of
251       the control operators | or |&.  The format for a pipeline is:
252
253              [time [-p]] [ ! ] command [ [||&] command2 ... ]
254
255       The  standard output of command is connected via a pipe to the standard
256       input of command2.  This connection is performed  before  any  redirec‐
257       tions specified by the command (see REDIRECTION below).  If |& is used,
258       the standard error of command is connected to command2's standard input
259       through  the pipe; it is shorthand for 2>&1 |.  This implicit redirect‐
260       ion of the standard error is performed after any redirections specified
261       by the command.
262
263       The return status of a pipeline is the exit status of the last command,
264       unless the pipefail option is enabled.  If  pipefail  is  enabled,  the
265       pipeline's  return  status is the value of the last (rightmost) command
266       to exit with a non-zero status, or zero if all commands  exit  success‐
267       fully.  If the reserved word !  precedes a pipeline, the exit status of
268       that pipeline is the logical negation of the exit status  as  described
269       above.   The  shell waits for all commands in the pipeline to terminate
270       before returning a value.
271
272       If the time reserved word precedes a pipeline, the elapsed as  well  as
273       user  and  system  time consumed by its execution are reported when the
274       pipeline terminates.  The -p option changes the output format  to  that
275       specified  by POSIX.  When the shell is in posix mode, it does not rec‐
276       ognize time as a reserved word if the next token  begins  with  a  `-'.
277       The  TIMEFORMAT  variable  may be set to a format string that specifies
278       how the timing information should be displayed; see the description  of
279       TIMEFORMAT under Shell Variables below.
280
281       When the shell is in posix mode, time may be followed by a newline.  In
282       this case, the shell displays the total user and system  time  consumed
283       by  the shell and its children.  The TIMEFORMAT variable may be used to
284       specify the format of the time information.
285
286       Each command in a pipeline is executed as a separate process (i.e.,  in
287       a subshell).
288
289   Lists
290       A  list  is a sequence of one or more pipelines separated by one of the
291       operators ;, &, &&, or ||, and optionally terminated by one of ;, &, or
292       <newline>.
293
294       Of these list operators, && and || have equal precedence, followed by ;
295       and &, which have equal precedence.
296
297       A sequence of one or more newlines may appear in a list  instead  of  a
298       semicolon to delimit commands.
299
300       If  a  command  is terminated by the control operator &, the shell exe‐
301       cutes the command in the background in a subshell.  The shell does  not
302       wait  for  the command to finish, and the return status is 0.  Commands
303       separated by a ; are executed sequentially; the shell  waits  for  each
304       command  to terminate in turn.  The return status is the exit status of
305       the last command executed.
306
307       AND and OR lists are sequences of one of more  pipelines  separated  by
308       the  &&  and  || control operators, respectively.  AND and OR lists are
309       executed with left associativity.  An AND list has the form
310
311              command1 && command2
312
313       command2 is executed if, and only if, command1 returns an  exit  status
314       of zero.
315
316       An OR list has the form
317
318              command1 || command2
319
320       command2  is  executed  if and only if command1 returns a non-zero exit
321       status.  The return status of AND and OR lists is the  exit  status  of
322       the last command executed in the list.
323
324   Compound Commands
325       A compound command is one of the following:
326
327       (list) list  is  executed in a subshell environment (see COMMAND EXECU‐
328              TION ENVIRONMENT below).  Variable assignments and builtin  com‐
329              mands  that  affect  the  shell's  environment  do not remain in
330              effect after the command completes.  The return  status  is  the
331              exit status of list.
332
333       { list; }
334              list  is simply executed in the current shell environment.  list
335              must be terminated with a newline or semicolon.  This  is  known
336              as  a  group  command.   The return status is the exit status of
337              list.  Note that unlike the metacharacters ( and ), { and }  are
338              reserved words and must occur where a reserved word is permitted
339              to be recognized.  Since they do not cause a  word  break,  they
340              must  be  separated  from  list  by  whitespace or another shell
341              metacharacter.
342
343       ((expression))
344              The expression is evaluated according  to  the  rules  described
345              below  under ARITHMETIC EVALUATION.  If the value of the expres‐
346              sion is non-zero, the return status is 0; otherwise  the  return
347              status is 1.  This is exactly equivalent to let "expression".
348
349       [[ expression ]]
350              Return  a  status  of  0 or 1 depending on the evaluation of the
351              conditional expression expression.  Expressions are composed  of
352              the  primaries  described  below  under CONDITIONAL EXPRESSIONS.
353              Word splitting and pathname expansion are not performed  on  the
354              words  between  the  [[  and  ]]; tilde expansion, parameter and
355              variable expansion, arithmetic expansion, command  substitution,
356              process  substitution,  and quote removal are performed.  Condi‐
357              tional operators such as -f must be unquoted to be recognized as
358              primaries.
359
360              When  used with [[, the < and > operators sort lexicographically
361              using the current locale.
362
363              When the == and != operators are used, the string to  the  right
364              of the operator is considered a pattern and matched according to
365              the rules described below under Pattern Matching.  If the  shell
366              option  nocasematch  is  enabled, the match is performed without
367              regard to the case of alphabetic characters.  The  return  value
368              is  0 if the string matches (==) or does not match (!=) the pat‐
369              tern, and 1 otherwise.  Any part of the pattern may be quoted to
370              force it to be matched as a string.
371
372              An  additional  binary operator, =~, is available, with the same
373              precedence as == and !=.  When it is used,  the  string  to  the
374              right  of the operator is considered an extended regular expres‐
375              sion and matched accordingly (as in regex(3)).  The return value
376              is 0 if the string matches the pattern, and 1 otherwise.  If the
377              regular expression is syntactically incorrect,  the  conditional
378              expression's return value is 2.  If the shell option nocasematch
379              is enabled, the match is performed without regard to the case of
380              alphabetic characters.  Any part of the pattern may be quoted to
381              force it to be matched  as  a  string.   Substrings  matched  by
382              parenthesized  subexpressions  within the regular expression are
383              saved in  the  array  variable  BASH_REMATCH.   The  element  of
384              BASH_REMATCH  with index 0 is the portion of the string matching
385              the entire regular expression.  The element of BASH_REMATCH with
386              index  n is the portion of the string matching the nth parenthe‐
387              sized subexpression.
388
389              Expressions may  be  combined  using  the  following  operators,
390              listed in decreasing order of precedence:
391
392              ( expression )
393                     Returns  the  value  of  expression.  This may be used to
394                     override the normal precedence of operators.
395              ! expression
396                     True if expression is false.
397              expression1 && expression2
398                     True if both expression1 and expression2 are true.
399              expression1 || expression2
400                     True if either expression1 or expression2 is true.
401
402              The && and || operators do not evaluate expression2 if the value
403              of  expression1  is  sufficient to determine the return value of
404              the entire conditional expression.
405
406       for name [ [ in [ word ... ] ] ; ] do list ; done
407              The list of words following in is expanded, generating a list of
408              items.  The variable name is set to each element of this list in
409              turn, and list is executed each time.  If the in word  is  omit‐
410              ted,  the  for  command  executes  list once for each positional
411              parameter that is set (see PARAMETERS below).  The return status
412              is  the  exit  status of the last command that executes.  If the
413              expansion of the items following in results in an empty list, no
414              commands are executed, and the return status is 0.
415
416       for (( expr1 ; expr2 ; expr3 )) ; do list ; done
417              First, the arithmetic expression expr1 is evaluated according to
418              the rules described  below  under  ARITHMETIC  EVALUATION.   The
419              arithmetic  expression  expr2 is then evaluated repeatedly until
420              it evaluates to zero.  Each time expr2 evaluates to  a  non-zero
421              value,  list  is executed and the arithmetic expression expr3 is
422              evaluated.  If any expression is omitted, it behaves  as  if  it
423              evaluates to 1.  The return value is the exit status of the last
424              command in list that is executed, or false if any of the expres‐
425              sions is invalid.
426
427       select name [ in word ] ; do list ; done
428              The list of words following in is expanded, generating a list of
429              items.  The set of expanded words is  printed  on  the  standard
430              error,  each  preceded  by a number.  If the in word is omitted,
431              the positional parameters are printed  (see  PARAMETERS  below).
432              The  PS3 prompt is then displayed and a line read from the stan‐
433              dard input.  If the line consists of a number  corresponding  to
434              one  of  the  displayed  words, then the value of name is set to
435              that word.  If the line is empty, the words and prompt are  dis‐
436              played again.  If EOF is read, the command completes.  Any other
437              value read causes name to be set to  null.   The  line  read  is
438              saved  in  the  variable REPLY.  The list is executed after each
439              selection until a break command is executed.  The exit status of
440              select  is the exit status of the last command executed in list,
441              or zero if no commands were executed.
442
443       case word in [ [(] pattern [ | pattern ] ... ) list ;; ] ... esac
444              A case command first expands word, and tries to match it against
445              each pattern in turn, using the same matching rules as for path‐
446              name expansion (see Pathname  Expansion  below).   The  word  is
447              expanded  using  tilde  expansion, parameter and variable expan‐
448              sion, arithmetic  substitution,  command  substitution,  process
449              substitution  and  quote  removal.   Each  pattern  examined  is
450              expanded using tilde expansion, parameter  and  variable  expan‐
451              sion, arithmetic substitution, command substitution, and process
452              substitution.  If the shell option nocasematch is  enabled,  the
453              match  is  performed  without  regard  to the case of alphabetic
454              characters.  When a match is found, the  corresponding  list  is
455              executed.  If the ;; operator is used, no subsequent matches are
456              attempted after the first pattern match.  Using ;& in  place  of
457              ;;  causes  execution  to continue with the list associated with
458              the next set of patterns.  Using ;;& in place of ;;  causes  the
459              shell  to  test  the next pattern list in the statement, if any,
460              and execute any associated list on a successful match.  The exit
461              status is zero if no pattern matches.  Otherwise, it is the exit
462              status of the last command executed in list.
463
464       if list; then list; [ elif list; then list; ] ... [ else list; ] fi
465              The if list is executed.  If its exit status is zero,  the  then
466              list  is  executed.   Otherwise,  each  elif list is executed in
467              turn, and if its exit status is  zero,  the  corresponding  then
468              list is executed and the command completes.  Otherwise, the else
469              list is executed, if present.  The exit status is the exit  sta‐
470              tus of the last command executed, or zero if no condition tested
471              true.
472
473       while list-1; do list-2; done
474       until list-1; do list-2; done
475              The while command continuously executes the list list-2 as  long
476              as the last command in the list list-1 returns an exit status of
477              zero.  The until command is  identical  to  the  while  command,
478              except  that  the test is negated; list-2 is executed as long as
479              the last command in list-1 returns a non-zero exit status.   The
480              exit  status  of the while and until commands is the exit status
481              of the last command executed in list-2, or zero if none was exe‐
482              cuted.
483
484   Coprocesses
485       A coprocess is a shell command preceded by the coproc reserved word.  A
486       coprocess is executed asynchronously in a subshell, as if  the  command
487       had  been  terminated  with the & control operator, with a two-way pipe
488       established between the executing shell and the coprocess.
489
490       The format for a coprocess is:
491
492              coproc [NAME] command [redirections]
493
494       This creates a coprocess named NAME.  If  NAME  is  not  supplied,  the
495       default name is COPROC.  NAME must not be supplied if command is a sim‐
496       ple command (see above); otherwise, it is interpreted as the first word
497       of  the simple command.  When the coproc is executed, the shell creates
498       an array variable (see Arrays below) named NAME in the context  of  the
499       executing  shell.   The  standard  output of command is connected via a
500       pipe to a file  descriptor  in  the  executing  shell,  and  that  file
501       descriptor  is  assigned  to NAME[0].  The standard input of command is
502       connected via a pipe to a file descriptor in the executing  shell,  and
503       that  file descriptor is assigned to NAME[1].  This pipe is established
504       before any redirections  specified  by  the  command  (see  REDIRECTION
505       below).   The  file  descriptors  can be utilized as arguments to shell
506       commands and redirections using standard word expansions.  The  process
507       ID  of  the  shell spawned to execute the coprocess is available as the
508       value of the variable NAME_PID.  The wait builtin command may  be  used
509       to wait for the coprocess to terminate.
510
511       The return status of a coprocess is the exit status of command.
512
513   Shell Function Definitions
514       A  shell function is an object that is called like a simple command and
515       executes a compound command with a new set  of  positional  parameters.
516       Shell functions are declared as follows:
517
518       name () compound-command [redirection]
519       function name [()] compound-command [redirection]
520              This  defines a function named name.  The reserved word function
521              is optional.  If the function reserved  word  is  supplied,  the
522              parentheses  are optional.  The body of the function is the com‐
523              pound command compound-command (see  Compound  Commands  above).
524              That  command is usually a list of commands between { and }, but
525              may be any command listed under Compound Commands  above.   com‐
526              pound-command is executed whenever name is specified as the name
527              of a simple command.  Any redirections (see  REDIRECTION  below)
528              specified  when  a  function  is  defined are performed when the
529              function is executed.  The exit status of a function  definition
530              is zero unless a syntax error occurs or a readonly function with
531              the same name already exists.  When executed, the exit status of
532              a  function  is  the exit status of the last command executed in
533              the body.  (See FUNCTIONS below.)
534

COMMENTS

536       In a non-interactive shell, or an interactive shell in which the inter‐
537       active_comments  option  to  the  shopt  builtin  is enabled (see SHELL
538       BUILTIN COMMANDS below), a word beginning with # causes that  word  and
539       all  remaining  characters  on that line to be ignored.  An interactive
540       shell without the interactive_comments option enabled  does  not  allow
541       comments.  The interactive_comments option is on by default in interac‐
542       tive shells.
543

QUOTING

545       Quoting is used to remove the special meaning of certain characters  or
546       words  to  the shell.  Quoting can be used to disable special treatment
547       for special characters, to prevent reserved words from being recognized
548       as such, and to prevent parameter expansion.
549
550       Each  of  the metacharacters listed above under DEFINITIONS has special
551       meaning to the shell and must be quoted if it is to represent itself.
552
553       When the command history expansion facilities are being used (see  HIS‐
554       TORY EXPANSION below), the history expansion character, usually !, must
555       be quoted to prevent history expansion.
556
557       There are  three  quoting  mechanisms:  the  escape  character,  single
558       quotes, and double quotes.
559
560       A  non-quoted  backslash (\) is the escape character.  It preserves the
561       literal value of the next character that follows, with the exception of
562       <newline>.   If  a  \<newline>  pair  appears, and the backslash is not
563       itself quoted, the \<newline> is treated as a line  continuation  (that
564       is, it is removed from the input stream and effectively ignored).
565
566       Enclosing  characters  in  single quotes preserves the literal value of
567       each character within the quotes.  A single quote may not occur between
568       single quotes, even when preceded by a backslash.
569
570       Enclosing  characters  in  double quotes preserves the literal value of
571       all characters within the quotes, with the exception of $, `,  \,  and,
572       when  history  expansion  is enabled, !.  The characters $ and ` retain
573       their special meaning within double quotes.  The backslash retains  its
574       special  meaning only when followed by one of the following characters:
575       $, `, ", \, or <newline>.  A double quote may be quoted  within  double
576       quotes by preceding it with a backslash.  If enabled, history expansion
577       will be performed unless an !  appearing in double  quotes  is  escaped
578       using a backslash.  The backslash preceding the !  is not removed.
579
580       The  special  parameters  *  and  @ have special meaning when in double
581       quotes (see PARAMETERS below).
582
583       Words of the form $'string' are treated specially.  The word expands to
584       string,  with backslash-escaped characters replaced as specified by the
585       ANSI C standard.  Backslash escape sequences, if present,  are  decoded
586       as follows:
587              \a     alert (bell)
588              \b     backspace
589              \e
590              \E     an escape character
591              \f     form feed
592              \n     new line
593              \r     carriage return
594              \t     horizontal tab
595              \v     vertical tab
596              \\     backslash
597              \'     single quote
598              \"     double quote
599              \nnn   the  eight-bit  character  whose value is the octal value
600                     nnn (one to three digits)
601              \xHH   the eight-bit character whose value  is  the  hexadecimal
602                     value HH (one or two hex digits)
603              \uHHHH the  Unicode (ISO/IEC 10646) character whose value is the
604                     hexadecimal value HHHH (one to four hex digits)
605              \UHHHHHHHH
606                     the Unicode (ISO/IEC 10646) character whose value is  the
607                     hexadecimal value HHHHHHHH (one to eight hex digits)
608              \cx    a control-x character
609
610       The  expanded  result  is  single-quoted, as if the dollar sign had not
611       been present.
612
613       A double-quoted string preceded by a dollar sign ($"string") will cause
614       the  string  to  be translated according to the current locale.  If the
615       current locale is C or POSIX, the  dollar  sign  is  ignored.   If  the
616       string is translated and replaced, the replacement is double-quoted.
617

PARAMETERS

619       A  parameter is an entity that stores values.  It can be a name, a num‐
620       ber, or one of the special characters listed below under Special Param‐
621       eters.   A variable is a parameter denoted by a name.  A variable has a
622       value and zero or more attributes.  Attributes are assigned  using  the
623       declare builtin command (see declare below in SHELL BUILTIN COMMANDS).
624
625       A parameter is set if it has been assigned a value.  The null string is
626       a valid value.  Once a variable is set, it may be unset only  by  using
627       the unset builtin command (see SHELL BUILTIN COMMANDS below).
628
629       A variable may be assigned to by a statement of the form
630
631              name=[value]
632
633       If  value  is not given, the variable is assigned the null string.  All
634       values undergo tilde expansion, parameter and variable expansion,  com‐
635       mand  substitution, arithmetic expansion, and quote removal (see EXPAN‐
636       SION below).  If the variable has its integer attribute set, then value
637       is evaluated as an arithmetic expression even if the $((...)) expansion
638       is not used (see Arithmetic Expansion below).  Word  splitting  is  not
639       performed,  with the exception of "$@" as explained below under Special
640       Parameters.  Pathname expansion is not  performed.   Assignment  state‐
641       ments  may  also  appear  as  arguments to the alias, declare, typeset,
642       export, readonly, and local builtin commands.
643
644       In the context where an assignment statement is assigning a value to  a
645       shell variable or array index, the += operator can be used to append to
646       or add to the variable's previous value.  When += is applied to a vari‐
647       able  for  which the integer attribute has been set, value is evaluated
648       as an arithmetic expression and added to the variable's current  value,
649       which is also evaluated.  When += is applied to an array variable using
650       compound assignment (see Arrays below), the  variable's  value  is  not
651       unset (as it is when using =), and new values are appended to the array
652       beginning at one greater than the array's maximum  index  (for  indexed
653       arrays) or added as additional key-value pairs in an associative array.
654       When applied  to  a  string-valued  variable,  value  is  expanded  and
655       appended to the variable's value.
656
657   Positional Parameters
658       A  positional  parameter  is a parameter denoted by one or more digits,
659       other than the single digit 0.  Positional parameters are assigned from
660       the  shell's  arguments when it is invoked, and may be reassigned using
661       the set builtin command.  Positional parameters may not be assigned  to
662       with  assignment statements.  The positional parameters are temporarily
663       replaced when a shell function is executed (see FUNCTIONS below).
664
665       When a positional parameter consisting of more than a single  digit  is
666       expanded, it must be enclosed in braces (see EXPANSION below).
667
668   Special Parameters
669       The  shell  treats  several parameters specially.  These parameters may
670       only be referenced; assignment to them is not allowed.
671       *      Expands to the positional parameters, starting from  one.   When
672              the  expansion occurs within double quotes, it expands to a sin‐
673              gle word with the value of each parameter separated by the first
674              character of the IFS special variable.  That is, "$*" is equiva‐
675              lent to "$1c$2c...", where c is the first character of the value
676              of  the IFS variable.  If IFS is unset, the parameters are sepa‐
677              rated by spaces.  If IFS is  null,  the  parameters  are  joined
678              without intervening separators.
679       @      Expands  to  the positional parameters, starting from one.  When
680              the  expansion  occurs  within  double  quotes,  each  parameter
681              expands to a separate word.  That is, "$@" is equivalent to "$1"
682              "$2" ...  If the double-quoted expansion occurs within  a  word,
683              the  expansion  of the first parameter is joined with the begin‐
684              ning part of the original word, and the expansion  of  the  last
685              parameter  is  joined  with  the last part of the original word.
686              When there are no positional parameters, "$@" and $@  expand  to
687              nothing (i.e., they are removed).
688       #      Expands to the number of positional parameters in decimal.
689       ?      Expands  to  the exit status of the most recently executed fore‐
690              ground pipeline.
691       -      Expands to the current option flags as  specified  upon  invoca‐
692              tion,  by  the  set  builtin  command, or those set by the shell
693              itself (such as the -i option).
694       $      Expands to the process ID of the shell.  In a  ()  subshell,  it
695              expands  to  the  process  ID of the current shell, not the sub‐
696              shell.
697       !      Expands to the process ID of the most  recently  executed  back‐
698              ground (asynchronous) command.
699       0      Expands  to  the name of the shell or shell script.  This is set
700              at shell initialization.  If bash is invoked with a file of com‐
701              mands,  $0  is set to the name of that file.  If bash is started
702              with the -c option, then $0 is set to the first  argument  after
703              the  string to be executed, if one is present.  Otherwise, it is
704              set to the file name used to invoke bash, as given  by  argument
705              zero.
706       _      At  shell  startup,  set to the absolute pathname used to invoke
707              the shell or shell script being executed as passed in the  envi‐
708              ronment  or  argument  list.   Subsequently, expands to the last
709              argument to the previous command, after expansion.  Also set  to
710              the  full  pathname  used  to  invoke  each command executed and
711              placed in the environment exported to that command.  When check‐
712              ing  mail,  this  parameter holds the name of the mail file cur‐
713              rently being checked.
714
715   Shell Variables
716       The following variables are set by the shell:
717
718       BASH   Expands to the full file name used to invoke  this  instance  of
719              bash.
720       BASHOPTS
721              A  colon-separated  list of enabled shell options.  Each word in
722              the list is a valid argument for the  -s  option  to  the  shopt
723              builtin command (see SHELL BUILTIN COMMANDS below).  The options
724              appearing in BASHOPTS are those reported as  on  by  shopt.   If
725              this  variable  is  in the environment when bash starts up, each
726              shell option in the list will  be  enabled  before  reading  any
727              startup files.  This variable is read-only.
728       BASHPID
729              Expands  to  the  process  ID of the current bash process.  This
730              differs from $$ under certain circumstances, such  as  subshells
731              that do not require bash to be re-initialized.
732       BASH_ALIASES
733              An  associative  array  variable whose members correspond to the
734              internal list of aliases as maintained  by  the  alias  builtin.
735              Elements added to this array appear in the alias list; unsetting
736              array elements cause aliases to be removed from the alias list.
737       BASH_ARGC
738              An array variable whose values are the number of  parameters  in
739              each frame of the current bash execution call stack.  The number
740              of parameters to  the  current  subroutine  (shell  function  or
741              script  executed  with  . or source) is at the top of the stack.
742              When a subroutine is executed, the number of  parameters  passed
743              is pushed onto BASH_ARGC.  The shell sets BASH_ARGC only when in
744              extended debugging mode (see the  description  of  the  extdebug
745              option to the shopt builtin below)
746       BASH_ARGV
747              An  array  variable containing all of the parameters in the cur‐
748              rent bash execution call stack.  The final parameter of the last
749              subroutine  call is at the top of the stack; the first parameter
750              of the initial call is at the bottom.  When a subroutine is exe‐
751              cuted,  the  parameters supplied are pushed onto BASH_ARGV.  The
752              shell sets BASH_ARGV only when in extended debugging  mode  (see
753              the  description  of  the  extdebug  option to the shopt builtin
754              below)
755       BASH_CMDS
756              An associative array variable whose members  correspond  to  the
757              internal  hash  table  of  commands  as  maintained  by the hash
758              builtin.  Elements added to this array appear in the hash table;
759              unsetting  array  elements cause commands to be removed from the
760              hash table.
761       BASH_COMMAND
762              The command currently being executed or about  to  be  executed,
763              unless the shell is executing a command as the result of a trap,
764              in which case it is the command executing at  the  time  of  the
765              trap.
766       BASH_EXECUTION_STRING
767              The command argument to the -c invocation option.
768       BASH_LINENO
769              An  array  variable whose members are the line numbers in source
770              files where each corresponding member of FUNCNAME  was  invoked.
771              ${BASH_LINENO[$i]}  is  the  line  number  in  the  source  file
772              (${BASH_SOURCE[$i+1]})  where  ${FUNCNAME[$i]}  was  called  (or
773              ${BASH_LINENO[$i-1]}  if  referenced  within another shell func‐
774              tion).  Use LINENO to obtain the current line number.
775       BASH_REMATCH
776              An array variable whose members are assigned by  the  =~  binary
777              operator  to the [[ conditional command.  The element with index
778              0 is the portion of  the  string  matching  the  entire  regular
779              expression.   The  element  with  index  n is the portion of the
780              string matching the nth parenthesized subexpression.  This vari‐
781              able is read-only.
782       BASH_SOURCE
783              An  array  variable whose members are the source filenames where
784              the corresponding shell function names  in  the  FUNCNAME  array
785              variable  are  defined.   The  shell function ${FUNCNAME[$i]} is
786              defined  in  the  file  ${BASH_SOURCE[$i]}   and   called   from
787              ${BASH_SOURCE[$i+1]}.
788       BASH_SUBSHELL
789              Incremented  by one each time a subshell or subshell environment
790              is spawned.  The initial value is 0.
791       BASH_VERSINFO
792              A readonly array variable whose members hold version information
793              for  this  instance  of  bash.  The values assigned to the array
794              members are as follows:
795              BASH_VERSINFO[0]        The major version number (the release).
796              BASH_VERSINFO[1]        The minor version number (the version).
797              BASH_VERSINFO[2]        The patch level.
798              BASH_VERSINFO[3]        The build version.
799              BASH_VERSINFO[4]        The release status (e.g., beta1).
800              BASH_VERSINFO[5]        The value of MACHTYPE.
801       BASH_VERSION
802              Expands to a string describing the version of this  instance  of
803              bash.
804       COMP_CWORD
805              An  index  into ${COMP_WORDS} of the word containing the current
806              cursor position.  This variable is available only in shell func‐
807              tions  invoked  by  the  programmable completion facilities (see
808              Programmable Completion below).
809       COMP_KEY
810              The key (or final key of a key sequence) used to invoke the cur‐
811              rent completion function.
812       COMP_LINE
813              The  current  command  line.  This variable is available only in
814              shell functions and external commands invoked  by  the  program‐
815              mable completion facilities (see Programmable Completion below).
816       COMP_POINT
817              The  index of the current cursor position relative to the begin‐
818              ning of the current command.  If the current cursor position  is
819              at the end of the current command, the value of this variable is
820              equal to ${#COMP_LINE}.  This  variable  is  available  only  in
821              shell  functions  and  external commands invoked by the program‐
822              mable completion facilities (see Programmable Completion below).
823       COMP_TYPE
824              Set to an integer value corresponding to the type of  completion
825              attempted  that  caused a completion function to be called: TAB,
826              for normal completion, ?, for listing completions after  succes‐
827              sive  tabs,  !, for listing alternatives on partial word comple‐
828              tion, @, to list completions if the word is not  unmodified,  or
829              %,  for  menu  completion.   This  variable is available only in
830              shell functions and external commands invoked  by  the  program‐
831              mable completion facilities (see Programmable Completion below).
832       COMP_WORDBREAKS
833              The  set  of characters that the readline library treats as word
834              separators when performing word completion.  If  COMP_WORDBREAKS
835              is  unset, it loses its special properties, even if it is subse‐
836              quently reset.
837       COMP_WORDS
838              An array variable (see Arrays below) consisting of the  individ‐
839              ual  words  in the current command line.  The line is split into
840              words as readline  would  split  it,  using  COMP_WORDBREAKS  as
841              described above.  This variable is available only in shell func‐
842              tions invoked by the  programmable  completion  facilities  (see
843              Programmable Completion below).
844       COPROC An  array  variable  (see Arrays below) created to hold the file
845              descriptors for output from and input to  an  unnamed  coprocess
846              (see Coprocesses above).
847       DIRSTACK
848              An array variable (see Arrays below) containing the current con‐
849              tents of the directory stack.  Directories appear in  the  stack
850              in  the order they are displayed by the dirs builtin.  Assigning
851              to members of this array variable may be used to modify directo‐
852              ries  already in the stack, but the pushd and popd builtins must
853              be used to add and remove directories.  Assignment to this vari‐
854              able  will  not  change  the  current directory.  If DIRSTACK is
855              unset, it loses its special properties, even  if  it  is  subse‐
856              quently reset.
857       EUID   Expands  to  the effective user ID of the current user, initial‐
858              ized at shell startup.  This variable is readonly.
859       FUNCNAME
860              An array variable containing the names of  all  shell  functions
861              currently in the execution call stack.  The element with index 0
862              is the name of any currently-executing shell function.  The bot‐
863              tom-most  element  (the  one  with the highest index) is "main".
864              This variable exists only when a shell  function  is  executing.
865              Assignments  to FUNCNAME have no effect and return an error sta‐
866              tus.  If FUNCNAME is unset, it  loses  its  special  properties,
867              even if it is subsequently reset.
868
869              This  variable  can  be  used  with BASH_LINENO and BASH_SOURCE.
870              Each  element  of  FUNCNAME  has   corresponding   elements   in
871              BASH_LINENO  and  BASH_SOURCE  to  describe the call stack.  For
872              instance,   ${FUNCNAME[$i]}   was   called   from    the    file
873              ${BASH_SOURCE[$i+1]}  at  line  number  ${BASH_LINENO[$i]}.  The
874              caller builtin displays the current call stack using this infor‐
875              mation.
876       GROUPS An  array  variable  containing  the list of groups of which the
877              current user is a member.  Assignments to GROUPS have no  effect
878              and  return  an  error status.  If GROUPS is unset, it loses its
879              special properties, even if it is subsequently reset.
880       HISTCMD
881              The history number, or index in the history list, of the current
882              command.   If HISTCMD is unset, it loses its special properties,
883              even if it is subsequently reset.
884       HOSTNAME
885              Automatically set to the name of the current host.
886       HOSTTYPE
887              Automatically set to a string that uniquely describes  the  type
888              of  machine  on which bash is executing.  The default is system-
889              dependent.
890       LINENO Each time this parameter is referenced, the shell substitutes  a
891              decimal  number  representing the current sequential line number
892              (starting with 1) within a script or function.  When  not  in  a
893              script  or  function, the value substituted is not guaranteed to
894              be meaningful.  If LINENO is unset, it loses its special proper‐
895              ties, even if it is subsequently reset.
896       MACHTYPE
897              Automatically  set  to  a string that fully describes the system
898              type on which bash is executing, in the  standard  GNU  cpu-com‐
899              pany-system format.  The default is system-dependent.
900       MAPFILE
901              An  array  variable  (see Arrays below) created to hold the text
902              read by the mapfile builtin when no variable name is supplied.
903       OLDPWD The previous working directory as set by the cd command.
904       OPTARG The value of the last option argument processed by  the  getopts
905              builtin command (see SHELL BUILTIN COMMANDS below).
906       OPTIND The  index  of  the next argument to be processed by the getopts
907              builtin command (see SHELL BUILTIN COMMANDS below).
908       OSTYPE Automatically set to a string that describes the operating  sys‐
909              tem  on  which  bash is executing.  The default is system-depen‐
910              dent.
911       PIPESTATUS
912              An array variable (see Arrays below) containing a list  of  exit
913              status  values  from the processes in the most-recently-executed
914              foreground pipeline (which may contain only a single command).
915       PPID   The process ID of the shell's parent.  This  variable  is  read‐
916              only.
917       PWD    The current working directory as set by the cd command.
918       RANDOM Each time this parameter is referenced, a random integer between
919              0 and 32767 is generated.  The sequence of random numbers may be
920              initialized by assigning a value to RANDOM.  If RANDOM is unset,
921              it loses its special properties,  even  if  it  is  subsequently
922              reset.
923       READLINE_LINE
924              The contents of the readline line buffer, for use with "bind -x"
925              (see SHELL BUILTIN COMMANDS below).
926       READLINE_POINT
927              The position of the insertion point in the readline line buffer,
928              for use with "bind -x" (see SHELL BUILTIN COMMANDS below).
929       REPLY  Set  to  the line of input read by the read builtin command when
930              no arguments are supplied.
931       SECONDS
932              Each time this parameter is referenced, the  number  of  seconds
933              since  shell  invocation is returned.  If a value is assigned to
934              SECONDS, the value returned upon subsequent  references  is  the
935              number  of seconds since the assignment plus the value assigned.
936              If SECONDS is unset, it loses its special properties, even if it
937              is subsequently reset.
938       SHELLOPTS
939              A  colon-separated  list of enabled shell options.  Each word in
940              the list is a valid argument  for  the  -o  option  to  the  set
941              builtin command (see SHELL BUILTIN COMMANDS below).  The options
942              appearing in SHELLOPTS are those reported as on by set  -o.   If
943              this  variable  is  in the environment when bash starts up, each
944              shell option in the list will  be  enabled  before  reading  any
945              startup files.  This variable is read-only.
946       SHLVL  Incremented by one each time an instance of bash is started.
947       UID    Expands to the user ID of the current user, initialized at shell
948              startup.  This variable is readonly.
949
950       The following variables are used by the shell.   In  some  cases,  bash
951       assigns a default value to a variable; these cases are noted below.
952
953       BASH_ENV
954              If  this parameter is set when bash is executing a shell script,
955              its value is interpreted as a filename  containing  commands  to
956              initialize the shell, as in ~/.bashrc.  The value of BASH_ENV is
957              subjected to  parameter  expansion,  command  substitution,  and
958              arithmetic  expansion  before  being interpreted as a file name.
959              PATH is not used to search for the resultant file name.
960       BASH_XTRACEFD
961              If set to an integer corresponding to a valid  file  descriptor,
962              bash  will  write  the  trace  output  generated  when set -x is
963              enabled to that file descriptor.  The file descriptor is  closed
964              when  BASH_XTRACEFD is unset or assigned a new value.  Unsetting
965              BASH_XTRACEFD or assigning it the empty string causes the  trace
966              output  to  be  sent  to  the standard error.  Note that setting
967              BASH_XTRACEFD to 2 (the standard error file descriptor) and then
968              unsetting it will result in the standard error being closed.
969       CDPATH The  search  path for the cd command.  This is a colon-separated
970              list of directories in which the  shell  looks  for  destination
971              directories  specified  by  the  cd  command.  A sample value is
972              ".:~:/usr".
973       COLUMNS
974              Used by the select compound command to  determine  the  terminal
975              width  when  printing  selection  lists.  Automatically set upon
976              receipt of a SIGWINCH.
977       COMPREPLY
978              An array variable from which bash reads the possible completions
979              generated  by  a shell function invoked by the programmable com‐
980              pletion facility (see Programmable Completion below).
981       EMACS  If bash finds this variable in the environment  when  the  shell
982              starts  with  value "t", it assumes that the shell is running in
983              an Emacs shell buffer and disables line editing.
984       ENV    Similar to BASH_ENV; used when the shell  is  invoked  in  POSIX
985              mode.
986       FCEDIT The default editor for the fc builtin command.
987       FIGNORE
988              A  colon-separated  list  of  suffixes to ignore when performing
989              filename completion (see READLINE below).  A filename whose suf‐
990              fix  matches  one of the entries in FIGNORE is excluded from the
991              list of matched filenames.  A sample value is ".o:~".
992       FUNCNEST
993              If set to a numeric value greater  than  0,  defines  a  maximum
994              function  nesting  level.  Function invocations that exceed this
995              nesting level will cause the current command to abort.
996       GLOBIGNORE
997              A colon-separated list of patterns defining the set of filenames
998              to be ignored by pathname expansion.  If a filename matched by a
999              pathname expansion pattern also matches one of the  patterns  in
1000              GLOBIGNORE, it is removed from the list of matches.
1001       HISTCONTROL
1002              A  colon-separated  list  of values controlling how commands are
1003              saved on the history list.   If  the  list  of  values  includes
1004              ignorespace,  lines  which  begin with a space character are not
1005              saved in the history list.  A value of ignoredups  causes  lines
1006              matching the previous history entry to not be saved.  A value of
1007              ignoreboth is shorthand for ignorespace and ignoredups.  A value
1008              of erasedups causes all previous lines matching the current line
1009              to be removed from the history list before that line  is  saved.
1010              Any  value  not in the above list is ignored.  If HISTCONTROL is
1011              unset, or does not include a valid value, all lines read by  the
1012              shell parser are saved on the history list, subject to the value
1013              of HISTIGNORE.  The second and subsequent lines of a  multi-line
1014              compound  command  are  not tested, and are added to the history
1015              regardless of the value of HISTCONTROL.
1016       HISTFILE
1017              The name of the file in which command history is saved (see HIS‐
1018              TORY  below).   The default value is ~/.bash_history.  If unset,
1019              the command history is  not  saved  when  an  interactive  shell
1020              exits.
1021       HISTFILESIZE
1022              The maximum number of lines contained in the history file.  When
1023              this variable is assigned a value, the  history  file  is  trun‐
1024              cated,  if necessary, by removing the oldest entries, to contain
1025              no more than that number of lines.  The default  value  is  500.
1026              The history file is also truncated to this size after writing it
1027              when an interactive shell exits.
1028       HISTIGNORE
1029              A colon-separated list of patterns used to decide which  command
1030              lines  should  be  saved  on  the history list.  Each pattern is
1031              anchored at the beginning of the line and must  match  the  com‐
1032              plete  line  (no  implicit  `*'  is  appended).  Each pattern is
1033              tested against the line after the checks specified  by  HISTCON‐
1034              TROL  are  applied.   In  addition  to  the normal shell pattern
1035              matching characters, `&' matches the previous history line.  `&'
1036              may  be  escaped  using  a  backslash;  the backslash is removed
1037              before attempting a match.  The second and subsequent lines of a
1038              multi-line compound command are not tested, and are added to the
1039              history regardless of the value of HISTIGNORE.
1040       HISTSIZE
1041              The number of commands to remember in the command  history  (see
1042              HISTORY below).  The default value is 500.
1043       HISTTIMEFORMAT
1044              If  this  variable  is  set and not null, its value is used as a
1045              format string for strftime(3) to print the time stamp associated
1046              with  each  history  entry displayed by the history builtin.  If
1047              this variable is set, time stamps are  written  to  the  history
1048              file  so they may be preserved across shell sessions.  This uses
1049              the history comment character  to  distinguish  timestamps  from
1050              other history lines.
1051       HOME   The home directory of the current user; the default argument for
1052              the cd builtin command.  The value of this variable is also used
1053              when performing tilde expansion.
1054       HOSTFILE
1055              Contains  the  name  of  a file in the same format as /etc/hosts
1056              that should be read when the shell needs to complete a hostname.
1057              The  list  of possible hostname completions may be changed while
1058              the shell is running;  the  next  time  hostname  completion  is
1059              attempted  after the value is changed, bash adds the contents of
1060              the new file to the existing list.  If HOSTFILE is set, but  has
1061              no  value,  or  does  not name a readable file, bash attempts to
1062              read /etc/hosts to obtain the list of possible hostname  comple‐
1063              tions.  When HOSTFILE is unset, the hostname list is cleared.
1064       IFS    The  Internal  Field  Separator  that is used for word splitting
1065              after expansion and to split lines  into  words  with  the  read
1066              builtin  command.   The  default  value  is  ``<space><tab><new‐
1067              line>''.
1068       IGNOREEOF
1069              Controls the action of an interactive shell on receipt of an EOF
1070              character as the sole input.  If set, the value is the number of
1071              consecutive EOF characters which must  be  typed  as  the  first
1072              characters  on an input line before bash exits.  If the variable
1073              exists but does not have a numeric value, or has no  value,  the
1074              default  value  is  10.  If it does not exist, EOF signifies the
1075              end of input to the shell.
1076       INPUTRC
1077              The filename for  the  readline  startup  file,  overriding  the
1078              default of ~/.inputrc (see READLINE below).
1079       LANG   Used  to  determine  the  locale  category  for any category not
1080              specifically selected with a variable starting with LC_.
1081       LC_ALL This variable overrides the value of  LANG  and  any  other  LC_
1082              variable specifying a locale category.
1083       LC_COLLATE
1084              This  variable  determines the collation order used when sorting
1085              the results of pathname expansion, and determines  the  behavior
1086              of   range   expressions,  equivalence  classes,  and  collating
1087              sequences within pathname expansion and pattern matching.
1088       LC_CTYPE
1089              This variable determines the interpretation  of  characters  and
1090              the  behavior of character classes within pathname expansion and
1091              pattern matching.
1092       LC_MESSAGES
1093              This variable determines the locale used  to  translate  double-
1094              quoted strings preceded by a $.
1095       LC_NUMERIC
1096              This  variable  determines  the  locale category used for number
1097              formatting.
1098       LINES  Used by the select compound  command  to  determine  the  column
1099              length  for  printing  selection  lists.  Automatically set upon
1100              receipt of a SIGWINCH.
1101       MAIL   If this parameter is set to a file or  directory  name  and  the
1102              MAILPATH  variable  is  not  set,  bash  informs the user of the
1103              arrival of mail in the specified file or  Maildir-format  direc‐
1104              tory.
1105       MAILCHECK
1106              Specifies  how  often  (in  seconds)  bash checks for mail.  The
1107              default is 60 seconds.  When it is time to check for  mail,  the
1108              shell  does  so  before  displaying the primary prompt.  If this
1109              variable is unset, or set to  a  value  that  is  not  a  number
1110              greater than or equal to zero, the shell disables mail checking.
1111       MAILPATH
1112              A  colon-separated  list  of  file names to be checked for mail.
1113              The message to be printed when mail arrives in a particular file
1114              may  be  specified  by separating the file name from the message
1115              with a `?'.  When used in the text of the message, $_ expands to
1116              the name of the current mailfile.  Example:
1117              MAILPATH='/var/mail/bfox?"You  have  mail":~/shell-mail?"$_  has
1118              mail!"'
1119              Bash supplies a default value for this variable, but  the  loca‐
1120              tion  of  the  user  mail files that it uses is system dependent
1121              (e.g., /var/mail/$USER).
1122       OPTERR If set to the value 1, bash displays error messages generated by
1123              the  getopts builtin command (see SHELL BUILTIN COMMANDS below).
1124              OPTERR is initialized to 1 each time the shell is invoked  or  a
1125              shell script is executed.
1126       PATH   The  search  path for commands.  It is a colon-separated list of
1127              directories in which the shell looks for commands  (see  COMMAND
1128              EXECUTION  below).   A  zero-length (null) directory name in the
1129              value of PATH indicates the current directory.  A null directory
1130              name  may  appear  as  two  adjacent colons, or as an initial or
1131              trailing colon.  The default path is  system-dependent,  and  is
1132              set  by  the administrator who installs bash.  A common value is
1133              ``/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin''.
1134       POSIXLY_CORRECT
1135              If this variable is in the environment  when  bash  starts,  the
1136              shell  enters posix mode before reading the startup files, as if
1137              the --posix invocation option had been supplied.  If it  is  set
1138              while  the  shell is running, bash enables posix mode, as if the
1139              command set -o posix had been executed.
1140       PROMPT_COMMAND
1141              If set, the value is executed as a command prior to issuing each
1142              primary prompt.
1143       PROMPT_DIRTRIM
1144              If  set  to a number greater than zero, the value is used as the
1145              number of trailing directory components to retain when expanding
1146              the  \w  and  \W  prompt  string  escapes (see PROMPTING below).
1147              Characters removed are replaced with an ellipsis.
1148       PS1    The value of this parameter is expanded  (see  PROMPTING  below)
1149              and  used  as  the  primary prompt string.  The default value is
1150              ``\s-\v\$ ''.
1151       PS2    The value of this parameter is expanded as with PS1 and used  as
1152              the secondary prompt string.  The default is ``> ''.
1153       PS3    The value of this parameter is used as the prompt for the select
1154              command (see SHELL GRAMMAR above).
1155       PS4    The value of this parameter is expanded  as  with  PS1  and  the
1156              value  is  printed  before  each command bash displays during an
1157              execution trace.  The first character of PS4 is replicated  mul‐
1158              tiple  times, as necessary, to indicate multiple levels of indi‐
1159              rection.  The default is ``+ ''.
1160       SHELL  The full pathname to the shell is kept in this environment vari‐
1161              able.   If  it is not set when the shell starts, bash assigns to
1162              it the full pathname of the current user's login shell.
1163       TIMEFORMAT
1164              The value of this parameter is used as a format string  specify‐
1165              ing  how  the timing information for pipelines prefixed with the
1166              time reserved word should be displayed.  The % character  intro‐
1167              duces  an  escape  sequence  that is expanded to a time value or
1168              other information.  The escape sequences and their meanings  are
1169              as follows; the braces denote optional portions.
1170              %%        A literal %.
1171              %[p][l]R  The elapsed time in seconds.
1172              %[p][l]U  The number of CPU seconds spent in user mode.
1173              %[p][l]S  The number of CPU seconds spent in system mode.
1174              %P        The CPU percentage, computed as (%U + %S) / %R.
1175
1176              The  optional  p is a digit specifying the precision, the number
1177              of fractional digits after a decimal point.  A value of 0 causes
1178              no decimal point or fraction to be output.  At most three places
1179              after the decimal point may be specified; values  of  p  greater
1180              than  3 are changed to 3.  If p is not specified, the value 3 is
1181              used.
1182
1183              The optional l specifies a longer format, including minutes,  of
1184              the  form  MMmSS.FFs.   The value of p determines whether or not
1185              the fraction is included.
1186
1187              If this variable is not set, bash acts as if it  had  the  value
1188              $'\nreal\t%3lR\nuser\t%3lU\nsys%3lS'.   If the value is null, no
1189              timing information is displayed.  A trailing  newline  is  added
1190              when the format string is displayed.
1191       TMOUT  If  set  to  a  value greater than zero, TMOUT is treated as the
1192              default timeout for the read builtin.  The select command termi‐
1193              nates if input does not arrive after TMOUT seconds when input is
1194              coming from a terminal.  In an interactive shell, the  value  is
1195              interpreted  as  the  number  of seconds to wait for input after
1196              issuing the primary prompt.  Bash terminates after  waiting  for
1197              that number of seconds if input does not arrive.
1198       TMPDIR If  set, bash uses its value as the name of a directory in which
1199              bash creates temporary files for the shell's use.
1200       auto_resume
1201              This variable controls how the shell interacts with the user and
1202              job  control.   If this variable is set, single word simple com‐
1203              mands without redirections are treated as candidates for resump‐
1204              tion of an existing stopped job.  There is no ambiguity allowed;
1205              if there is more than one job beginning with the  string  typed,
1206              the  job  most  recently  accessed  is  selected.  The name of a
1207              stopped job, in this context, is the command line used to  start
1208              it.   If  set to the value exact, the string supplied must match
1209              the name of a stopped job exactly;  if  set  to  substring,  the
1210              string  supplied  needs  to  match  a substring of the name of a
1211              stopped job.  The substring value provides functionality  analo‐
1212              gous  to the %?  job identifier (see JOB CONTROL below).  If set
1213              to any other value, the supplied string must be a  prefix  of  a
1214              stopped job's name; this provides functionality analogous to the
1215              %string job identifier.
1216       histchars
1217              The two or three characters which control history expansion  and
1218              tokenization (see HISTORY EXPANSION below).  The first character
1219              is the history expansion character, the character which  signals
1220              the  start  of  a  history  expansion, normally `!'.  The second
1221              character is the quick substitution character, which is used  as
1222              shorthand  for  re-running the previous command entered, substi‐
1223              tuting one string for another in the command.   The  default  is
1224              `^'.   The optional third character is the character which indi‐
1225              cates that the remainder of the line is a comment when found  as
1226              the  first  character of a word, normally `#'.  The history com‐
1227              ment character causes history substitution to be skipped for the
1228              remaining  words on the line.  It does not necessarily cause the
1229              shell parser to treat the rest of the line as a comment.
1230
1231   Arrays
1232       Bash provides one-dimensional indexed and associative array  variables.
1233       Any  variable may be used as an indexed array; the declare builtin will
1234       explicitly declare an array.  There is no maximum limit on the size  of
1235       an  array, nor any requirement that members be indexed or assigned con‐
1236       tiguously.  Indexed arrays are  referenced  using  integers  (including
1237       arithmetic  expressions)   and  are  zero-based; associative arrays are
1238       referenced using arbitrary strings.
1239
1240       An indexed array is created automatically if any variable  is  assigned
1241       to using the syntax name[subscript]=value.  The subscript is treated as
1242       an arithmetic expression that must evaluate to a number.  If  subscript
1243       evaluates  to a number less than zero, it is used as an offset from one
1244       greater than the array's maximum index (so a subcript of -1  refers  to
1245       the  last  element  of  the  array).   To explicitly declare an indexed
1246       array, use declare -a name (see SHELL BUILTIN COMMANDS below).  declare
1247       -a name[subscript] is also accepted; the subscript is ignored.
1248
1249       Associative arrays are created using declare -A name.
1250
1251       Attributes may be specified for an array variable using the declare and
1252       readonly builtins.  Each attribute applies to all members of an array.
1253
1254       Arrays  are  assigned  to  using  compound  assignments  of  the   form
1255       name=(value1  ...  valuen),  where  each  value  is  of  the form [sub‐
1256       script]=string.  Indexed array assignments do not require  the  bracket
1257       and  subscript.   When  assigning  to  indexed  arrays, if the optional
1258       brackets and subscript are supplied, that index is assigned to;  other‐
1259       wise the index of the element assigned is the last index assigned to by
1260       the statement plus one.  Indexing starts at zero.
1261
1262       When assigning to an associative array, the subscript is required.
1263
1264       This syntax is also accepted by the declare builtin.  Individual  array
1265       elements  may  be  assigned  to  using the name[subscript]=value syntax
1266       introduced above.
1267
1268       Any element of an array may  be  referenced  using  ${name[subscript]}.
1269       The braces are required to avoid conflicts with pathname expansion.  If
1270       subscript is @ or *, the word expands to all members  of  name.   These
1271       subscripts  differ only when the word appears within double quotes.  If
1272       the word is double-quoted, ${name[*]} expands to a single word with the
1273       value  of each array member separated by the first character of the IFS
1274       special variable, and ${name[@]} expands each element of name to a sep‐
1275       arate  word.   When  there  are no array members, ${name[@]} expands to
1276       nothing.  If the double-quoted expansion  occurs  within  a  word,  the
1277       expansion  of  the first parameter is joined with the beginning part of
1278       the original word, and the expansion of the last  parameter  is  joined
1279       with  the  last  part  of  the original word.  This is analogous to the
1280       expansion of the special parameters * and  @  (see  Special  Parameters
1281       above).   ${#name[subscript]}  expands  to  the  length  of ${name[sub‐
1282       script]}.  If subscript is * or @, the expansion is the number of  ele‐
1283       ments  in the array.  Referencing an array variable without a subscript
1284       is equivalent to referencing the array with a subscript of 0.
1285
1286       An array variable is considered set if a subscript has been assigned  a
1287       value.  The null string is a valid value.
1288
1289       The  unset  builtin  is  used to destroy arrays.  unset name[subscript]
1290       destroys the array element at index subscript.  Care must be  taken  to
1291       avoid  unwanted side effects caused by pathname expansion.  unset name,
1292       where name is an array, or unset name[subscript], where subscript is  *
1293       or @, removes the entire array.
1294
1295       The  declare,  local,  and readonly builtins each accept a -a option to
1296       specify an indexed array and a -A  option  to  specify  an  associative
1297       array.   If  both  options are supplied, -A takes precedence.  The read
1298       builtin accepts a -a option to assign a list of  words  read  from  the
1299       standard input to an array.  The set and declare builtins display array
1300       values in a way that allows them to be reused as assignments.
1301

EXPANSION

1303       Expansion is performed on the command line after it has been split into
1304       words.   There are seven kinds of expansion performed: brace expansion,
1305       tilde expansion, parameter and variable  expansion,  command  substitu‐
1306       tion, arithmetic expansion, word splitting, and pathname expansion.
1307
1308       The  order  of expansions is: brace expansion, tilde expansion, parame‐
1309       ter, variable and arithmetic expansion and command  substitution  (done
1310       in a left-to-right fashion), word splitting, and pathname expansion.
1311
1312       On systems that can support it, there is an additional expansion avail‐
1313       able: process substitution.
1314
1315       Only brace expansion, word splitting, and pathname expansion can change
1316       the  number of words of the expansion; other expansions expand a single
1317       word to a single word.  The only exceptions to this are the  expansions
1318       of "$@" and "${name[@]}" as explained above (see PARAMETERS).
1319
1320   Brace Expansion
1321       Brace expansion is a mechanism by which arbitrary strings may be gener‐
1322       ated.  This mechanism is similar to pathname expansion, but  the  file‐
1323       names generated need not exist.  Patterns to be brace expanded take the
1324       form of an optional preamble, followed by either a series of comma-sep‐
1325       arated  strings or a sequence expression between a pair of braces, fol‐
1326       lowed by an optional postscript.  The  preamble  is  prefixed  to  each
1327       string contained within the braces, and the postscript is then appended
1328       to each resulting string, expanding left to right.
1329
1330       Brace expansions may be nested.  The results of  each  expanded  string
1331       are  not  sorted;  left  to  right  order  is  preserved.  For example,
1332       a{d,c,b}e expands into `ade ace abe'.
1333
1334       A sequence expression takes the form {x..y[..incr]}, where x and y  are
1335       either  integers or single characters, and incr, an optional increment,
1336       is an integer.  When integers are supplied, the expression  expands  to
1337       each  number between x and y, inclusive.  Supplied integers may be pre‐
1338       fixed with 0 to force each term to have the same width.  When either  x
1339       or  y  begins  with  a  zero, the shell attempts to force all generated
1340       terms to contain the same number of digits, zero-padding  where  neces‐
1341       sary.   When  characters  are  supplied, the expression expands to each
1342       character lexicographically between x and y, inclusive.  Note that both
1343       x  and  y must be of the same type.  When the increment is supplied, it
1344       is used as the difference between each term.  The default increment  is
1345       1 or -1 as appropriate.
1346
1347       Brace expansion is performed before any other expansions, and any char‐
1348       acters special to other expansions are preserved in the result.  It  is
1349       strictly  textual.  Bash does not apply any syntactic interpretation to
1350       the context of the expansion or the text between the braces.
1351
1352       A correctly-formed brace expansion must contain  unquoted  opening  and
1353       closing  braces,  and  at  least one unquoted comma or a valid sequence
1354       expression.  Any incorrectly formed brace expansion is left  unchanged.
1355       A { or , may be quoted with a backslash to prevent its being considered
1356       part of a brace expression.  To avoid conflicts with  parameter  expan‐
1357       sion, the string ${ is not considered eligible for brace expansion.
1358
1359       This construct is typically used as shorthand when the common prefix of
1360       the strings to be generated is longer than in the above example:
1361
1362              mkdir /usr/local/src/bash/{old,new,dist,bugs}
1363       or
1364              chown root /usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}}
1365
1366       Brace expansion introduces a  slight  incompatibility  with  historical
1367       versions  of sh.  sh does not treat opening or closing braces specially
1368       when they appear as part of a word, and preserves them in  the  output.
1369       Bash  removes  braces  from  words as a consequence of brace expansion.
1370       For example, a word entered to sh as file{1,2} appears  identically  in
1371       the  output.  The same word is output as file1 file2 after expansion by
1372       bash.  If strict compatibility with sh is desired, start bash with  the
1373       +B option or disable brace expansion with the +B option to the set com‐
1374       mand (see SHELL BUILTIN COMMANDS below).
1375
1376   Tilde Expansion
1377       If a word begins with an unquoted tilde character  (`~'),  all  of  the
1378       characters  preceding  the  first unquoted slash (or all characters, if
1379       there is no unquoted slash) are considered a tilde-prefix.  If none  of
1380       the  characters  in  the tilde-prefix are quoted, the characters in the
1381       tilde-prefix following the tilde are treated as a possible login  name.
1382       If  this  login name is the null string, the tilde is replaced with the
1383       value of the shell parameter HOME.  If HOME is unset, the  home  direc‐
1384       tory  of  the  user executing the shell is substituted instead.  Other‐
1385       wise, the tilde-prefix is replaced with the home  directory  associated
1386       with the specified login name.
1387
1388       If  the  tilde-prefix  is  a  `~+', the value of the shell variable PWD
1389       replaces the tilde-prefix.  If the tilde-prefix is a `~-', the value of
1390       the  shell variable OLDPWD, if it is set, is substituted.  If the char‐
1391       acters following the tilde in the tilde-prefix consist of a  number  N,
1392       optionally  prefixed  by  a  `+' or a `-', the tilde-prefix is replaced
1393       with the corresponding element from the directory stack, as it would be
1394       displayed by the dirs builtin invoked with the tilde-prefix as an argu‐
1395       ment.  If the characters following the tilde in the  tilde-prefix  con‐
1396       sist of a number without a leading `+' or `-', `+' is assumed.
1397
1398       If the login name is invalid, or the tilde expansion fails, the word is
1399       unchanged.
1400
1401       Each variable assignment is checked for unquoted tilde-prefixes immedi‐
1402       ately following a : or the first =.  In these cases, tilde expansion is
1403       also performed.  Consequently, one may use file names  with  tildes  in
1404       assignments  to  PATH,  MAILPATH, and CDPATH, and the shell assigns the
1405       expanded value.
1406
1407   Parameter Expansion
1408       The `$' character introduces parameter expansion, command substitution,
1409       or  arithmetic  expansion.  The parameter name or symbol to be expanded
1410       may be enclosed in braces, which are optional but serve to protect  the
1411       variable  to be expanded from characters immediately following it which
1412       could be interpreted as part of the name.
1413
1414       When braces are used, the matching ending brace is the  first  `}'  not
1415       escaped  by  a  backslash  or within a quoted string, and not within an
1416       embedded  arithmetic  expansion,  command  substitution,  or  parameter
1417       expansion.
1418
1419       ${parameter}
1420              The  value of parameter is substituted.  The braces are required
1421              when parameter is a positional  parameter  with  more  than  one
1422              digit, or when parameter is followed by a character which is not
1423              to be interpreted as part of its name.
1424
1425       If the first character of parameter is  an  exclamation  point  (!),  a
1426       level  of  variable  indirection is introduced.  Bash uses the value of
1427       the variable formed from the rest of parameter as the name of the vari‐
1428       able; this variable is then expanded and that value is used in the rest
1429       of the substitution, rather than the value of parameter  itself.   This
1430       is  known as indirect expansion.  The exceptions to this are the expan‐
1431       sions of ${!prefix*} and ${!name[@]} described below.  The  exclamation
1432       point  must  immediately  follow  the  left brace in order to introduce
1433       indirection.
1434
1435       In each of the cases below, word is subject to tilde expansion, parame‐
1436       ter expansion, command substitution, and arithmetic expansion.
1437
1438       When  not  performing  substring  expansion, using the forms documented
1439       below, bash tests for a parameter that is unset or null.  Omitting  the
1440       colon results in a test only for a parameter that is unset.
1441
1442       ${parameter:-word}
1443              Use  Default  Values.  If parameter is unset or null, the expan‐
1444              sion of word is substituted.  Otherwise, the value of  parameter
1445              is substituted.
1446       ${parameter:=word}
1447              Assign  Default  Values.   If  parameter  is  unset or null, the
1448              expansion of word is assigned to parameter.  The value of param‐
1449              eter  is  then  substituted.   Positional parameters and special
1450              parameters may not be assigned to in this way.
1451       ${parameter:?word}
1452              Display Error if Null or Unset.  If parameter is null or  unset,
1453              the  expansion  of  word (or a message to that effect if word is
1454              not present) is written to the standard error and the shell,  if
1455              it is not interactive, exits.  Otherwise, the value of parameter
1456              is substituted.
1457       ${parameter:+word}
1458              Use Alternate Value.  If parameter is null or unset, nothing  is
1459              substituted, otherwise the expansion of word is substituted.
1460       ${parameter:offset}
1461       ${parameter:offset:length}
1462              Substring  Expansion.   Expands  to  up  to length characters of
1463              parameter starting at the character  specified  by  offset.   If
1464              length  is omitted, expands to the substring of parameter start‐
1465              ing at the character specified by offset.  length and offset are
1466              arithmetic  expressions  (see  ARITHMETIC EVALUATION below).  If
1467              offset evaluates to a number less than zero, the value  is  used
1468              as  an offset from the end of the value of parameter.  If length
1469              evaluates to a number less than zero, and parameter is not @ and
1470              not  an  indexed  or  associative array, it is interpreted as an
1471              offset from the end of the value of parameter rather than a num‐
1472              ber  of  characters, and the expansion is the characters between
1473              the two offsets.  If parameter is @, the result is length  posi‐
1474              tional  parameters  beginning  at  offset.   If  parameter is an
1475              indexed array name subscripted by @ or  *,  the  result  is  the
1476              length members of the array beginning with ${parameter[offset]}.
1477              A negative offset is taken relative to one greater than the max‐
1478              imum  index of the specified array.  Substring expansion applied
1479              to an associative array produces undefined results.  Note that a
1480              negative offset must be separated from the colon by at least one
1481              space to avoid being confused with the :- expansion.   Substring
1482              indexing  is  zero-based  unless  the  positional parameters are
1483              used, in which case the indexing starts at  1  by  default.   If
1484              offset  is 0, and the positional parameters are used, $0 is pre‐
1485              fixed to the list.
1486
1487       ${!prefix*}
1488       ${!prefix@}
1489              Names matching prefix.  Expands to the names of variables  whose
1490              names begin with prefix, separated by the first character of the
1491              IFS special variable.  When @ is used and the expansion  appears
1492              within  double  quotes, each variable name expands to a separate
1493              word.
1494
1495       ${!name[@]}
1496       ${!name[*]}
1497              List of array keys.  If name is an array  variable,  expands  to
1498              the  list  of array indices (keys) assigned in name.  If name is
1499              not an array, expands to 0 if name is set  and  null  otherwise.
1500              When  @  is used and the expansion appears within double quotes,
1501              each key expands to a separate word.
1502
1503       ${#parameter}
1504              Parameter length.  The length in  characters  of  the  value  of
1505              parameter  is  substituted.   If  parameter is * or @, the value
1506              substituted is the number of positional parameters.  If  parame‐
1507              ter  is  an  array name subscripted by * or @, the value substi‐
1508              tuted is the number of elements in the array.
1509
1510       ${parameter#word}
1511       ${parameter##word}
1512              Remove matching prefix pattern.  The word is expanded to produce
1513              a pattern just as in pathname expansion.  If the pattern matches
1514              the beginning of the value of parameter, then the result of  the
1515              expansion  is  the expanded value of parameter with the shortest
1516              matching pattern (the ``#'' case) or the longest  matching  pat‐
1517              tern  (the  ``##''  case)  deleted.  If parameter is @ or *, the
1518              pattern removal operation is applied to each positional  parame‐
1519              ter in turn, and the expansion is the resultant list.  If param‐
1520              eter is an array variable subscripted with @ or *,  the  pattern
1521              removal  operation  is  applied  to  each member of the array in
1522              turn, and the expansion is the resultant list.
1523
1524       ${parameter%word}
1525       ${parameter%%word}
1526              Remove matching suffix pattern.  The word is expanded to produce
1527              a pattern just as in pathname expansion.  If the pattern matches
1528              a trailing portion of the expanded value of parameter, then  the
1529              result  of the expansion is the expanded value of parameter with
1530              the shortest matching pattern (the ``%'' case)  or  the  longest
1531              matching  pattern  (the ``%%'' case) deleted.  If parameter is @
1532              or *, the pattern removal operation is  applied  to  each  posi‐
1533              tional  parameter  in  turn,  and the expansion is the resultant
1534              list.  If parameter is an array variable subscripted with  @  or
1535              *,  the  pattern  removal operation is applied to each member of
1536              the array in turn, and the expansion is the resultant list.
1537
1538       ${parameter/pattern/string}
1539              Pattern substitution.  The pattern is expanded to produce a pat‐
1540              tern  just  as in pathname expansion.  Parameter is expanded and
1541              the longest match of pattern against its value is replaced  with
1542              string.   If  pattern  begins with /, all matches of pattern are
1543              replaced  with  string.   Normally  only  the  first  match   is
1544              replaced.  If pattern begins with #, it must match at the begin‐
1545              ning of the expanded value of parameter.  If pattern begins with
1546              %,  it must match at the end of the expanded value of parameter.
1547              If string is null, matches of pattern are deleted and the / fol‐
1548              lowing pattern may be omitted.  If parameter is @ or *, the sub‐
1549              stitution operation is applied to each positional  parameter  in
1550              turn,  and the expansion is the resultant list.  If parameter is
1551              an array variable subscripted with  @  or  *,  the  substitution
1552              operation  is  applied  to each member of the array in turn, and
1553              the expansion is the resultant list.
1554
1555       ${parameter^pattern}
1556       ${parameter^^pattern}
1557       ${parameter,pattern}
1558       ${parameter,,pattern}
1559              Case modification.  This expansion modifies the case  of  alpha‐
1560              betic  characters in parameter.  The pattern is expanded to pro‐
1561              duce a pattern just as in pathname expansion.   The  ^  operator
1562              converts  lowercase letters matching pattern to uppercase; the ,
1563              operator converts matching uppercase letters to lowercase.   The
1564              ^^  and  ,,  expansions  convert  each  matched character in the
1565              expanded value; the ^ and , expansions match  and  convert  only
1566              the  first character in the expanded value.  If pattern is omit‐
1567              ted, it is treated like a ?, which matches every character.   If
1568              parameter  is @ or *, the case modification operation is applied
1569              to each positional parameter in turn, and the expansion  is  the
1570              resultant  list.   If parameter is an array variable subscripted
1571              with @ or *, the case modification operation is applied to  each
1572              member  of the array in turn, and the expansion is the resultant
1573              list.
1574
1575   Command Substitution
1576       Command substitution allows the output of a command to replace the com‐
1577       mand name.  There are two forms:
1578
1579              $(command)
1580       or
1581              `command`
1582
1583       Bash performs the expansion by executing command and replacing the com‐
1584       mand substitution with the standard output of  the  command,  with  any
1585       trailing newlines deleted.  Embedded newlines are not deleted, but they
1586       may be removed during word splitting.  The command  substitution  $(cat
1587       file) can be replaced by the equivalent but faster $(< file).
1588
1589       When  the  old-style  backquote form of substitution is used, backslash
1590       retains its literal meaning except when followed by $, `,  or  \.   The
1591       first backquote not preceded by a backslash terminates the command sub‐
1592       stitution.  When using the $(command) form, all characters between  the
1593       parentheses make up the command; none are treated specially.
1594
1595       Command substitutions may be nested.  To nest when using the backquoted
1596       form, escape the inner backquotes with backslashes.
1597
1598       If the substitution appears within double quotes,  word  splitting  and
1599       pathname expansion are not performed on the results.
1600
1601   Arithmetic Expansion
1602       Arithmetic  expansion allows the evaluation of an arithmetic expression
1603       and the substitution of the result.  The format for  arithmetic  expan‐
1604       sion is:
1605
1606              $((expression))
1607
1608       The  expression  is  treated  as if it were within double quotes, but a
1609       double quote inside the parentheses  is  not  treated  specially.   All
1610       tokens in the expression undergo parameter expansion, string expansion,
1611       command substitution, and quote removal.  Arithmetic expansions may  be
1612       nested.
1613
1614       The  evaluation  is performed according to the rules listed below under
1615       ARITHMETIC EVALUATION.  If expression is invalid, bash prints a message
1616       indicating failure and no substitution occurs.
1617
1618   Process Substitution
1619       Process  substitution  is supported on systems that support named pipes
1620       (FIFOs) or the /dev/fd method of naming open files.  It takes the  form
1621       of  <(list) or >(list).  The process list is run with its input or out‐
1622       put connected to a FIFO or some file in /dev/fd.  The name of this file
1623       is  passed  as  an argument to the current command as the result of the
1624       expansion.  If the >(list) form is used, writing to the file will  pro‐
1625       vide  input  for list.  If the <(list) form is used, the file passed as
1626       an argument should be read to obtain the output of list.
1627
1628       When available, process substitution is performed  simultaneously  with
1629       parameter  and variable expansion, command substitution, and arithmetic
1630       expansion.
1631
1632   Word Splitting
1633       The shell scans the results of parameter expansion,  command  substitu‐
1634       tion,  and arithmetic expansion that did not occur within double quotes
1635       for word splitting.
1636
1637       The shell treats each character of IFS as a delimiter, and  splits  the
1638       results of the other expansions into words on these characters.  If IFS
1639       is unset, or its value is exactly <space><tab><newline>,  the  default,
1640       then  sequences  of  <space>, <tab>, and <newline> at the beginning and
1641       end of the results of the previous  expansions  are  ignored,  and  any
1642       sequence  of  IFS  characters  not  at  the  beginning or end serves to
1643       delimit words.  If IFS  has  a  value  other  than  the  default,  then
1644       sequences of the whitespace characters space and tab are ignored at the
1645       beginning and end of the word, as long as the whitespace  character  is
1646       in  the  value  of IFS (an IFS whitespace character).  Any character in
1647       IFS that is not IFS whitespace, along with any adjacent IFS  whitespace
1648       characters,  delimits a field.  A sequence of IFS whitespace characters
1649       is also treated as a delimiter.  If the value of IFS is null,  no  word
1650       splitting occurs.
1651
1652       Explicit  null  arguments  (""  or '') are retained.  Unquoted implicit
1653       null arguments, resulting from the expansion of parameters that have no
1654       values,  are  removed.  If a parameter with no value is expanded within
1655       double quotes, a null argument results and is retained.
1656
1657       Note that if no expansion occurs, no splitting is performed.
1658
1659   Pathname Expansion
1660       After word splitting, unless the -f option has  been  set,  bash  scans
1661       each  word  for the characters *, ?, and [.  If one of these characters
1662       appears, then the word is regarded as a pattern, and replaced  with  an
1663       alphabetically  sorted  list of file names matching the pattern.  If no
1664       matching file names are found, and the shell  option  nullglob  is  not
1665       enabled,  the  word  is left unchanged.  If the nullglob option is set,
1666       and no matches are found, the word is removed.  If the  failglob  shell
1667       option  is  set,  and no matches are found, an error message is printed
1668       and the command is not executed.  If the  shell  option  nocaseglob  is
1669       enabled,  the  match  is performed without regard to the case of alpha‐
1670       betic characters.  When a pattern is used for pathname  expansion,  the
1671       character  ``.''   at  the  start  of a name or immediately following a
1672       slash must be matched explicitly, unless the shell  option  dotglob  is
1673       set.   When  matching  a  pathname,  the slash character must always be
1674       matched explicitly.  In  other  cases,  the  ``.''   character  is  not
1675       treated  specially.   See  the  description  of shopt below under SHELL
1676       BUILTIN COMMANDS for a description of the nocaseglob,  nullglob,  fail‐
1677       glob, and dotglob shell options.
1678
1679       The  GLOBIGNORE  shell variable may be used to restrict the set of file
1680       names matching a pattern.  If GLOBIGNORE is  set,  each  matching  file
1681       name  that  also  matches  one of the patterns in GLOBIGNORE is removed
1682       from the list of matches.  The file names ``.''  and ``..''  are always
1683       ignored  when GLOBIGNORE is set and not null.  However, setting GLOBIG‐
1684       NORE to a non-null value has the effect of enabling the  dotglob  shell
1685       option, so all other file names beginning with a ``.''  will match.  To
1686       get the old behavior of ignoring file names  beginning  with  a  ``.'',
1687       make  ``.*''  one of the patterns in GLOBIGNORE.  The dotglob option is
1688       disabled when GLOBIGNORE is unset.
1689
1690       Pattern Matching
1691
1692       Any character that appears in a pattern, other than the special pattern
1693       characters  described below, matches itself.  The NUL character may not
1694       occur in a pattern.  A backslash escapes the following  character;  the
1695       escaping  backslash  is  discarded  when matching.  The special pattern
1696       characters must be quoted if they are to be matched literally.
1697
1698       The special pattern characters have the following meanings:
1699
1700              *      Matches any string, including the null string.  When  the
1701                     globstar  shell  option  is  enabled,  and * is used in a
1702                     pathname expansion context, two adjacent  *s  used  as  a
1703                     single  pattern  will  match  all  files and zero or more
1704                     directories and subdirectories.  If followed by a /,  two
1705                     adjacent  *s  will match only directories and subdirecto‐
1706                     ries.
1707              ?      Matches any single character.
1708              [...]  Matches any one of the enclosed characters.   A  pair  of
1709                     characters  separated by a hyphen denotes a range expres‐
1710                     sion; any character that sorts between those two  charac‐
1711                     ters,  inclusive,  using  the  current locale's collating
1712                     sequence and character set, is  matched.   If  the  first
1713                     character following the [ is a !  or a ^ then any charac‐
1714                     ter not enclosed is matched.  The sorting order of  char‐
1715                     acters  in range expressions is determined by the current
1716                     locale and the value of the LC_COLLATE shell variable, if
1717                     set.   A - may be matched by including it as the first or
1718                     last character in the set.  A ] may be matched by includ‐
1719                     ing it as the first character in the set.
1720
1721                     Within  [ and ], character classes can be specified using
1722                     the syntax [:class:], where class is one of the following
1723                     classes defined in the POSIX standard:
1724                     alnum  alpha  ascii  blank  cntrl digit graph lower print
1725                     punct space upper word xdigit
1726                     A character class matches any character belonging to that
1727                     class.  The word character class matches letters, digits,
1728                     and the character _.
1729
1730                     Within [ and ], an equivalence  class  can  be  specified
1731                     using the syntax [=c=], which matches all characters with
1732                     the same collation weight  (as  defined  by  the  current
1733                     locale) as the character c.
1734
1735                     Within [ and ], the syntax [.symbol.] matches the collat‐
1736                     ing symbol symbol.
1737
1738       Several extended pattern matching operators  are  recognized.   In  the
1739       following description, a pattern-list is a list of one or more patterns
1740       separated by a |.  Composite patterns may be formed using one  or  more
1741       of the following sub-patterns:
1742
1743              ?(pattern-list)
1744                     Matches zero or one occurrence of the given patterns
1745              *(pattern-list)
1746                     Matches zero or more occurrences of the given patterns
1747              +(pattern-list)
1748                     Matches one or more occurrences of the given patterns
1749              @(pattern-list)
1750                     Matches one of the given patterns
1751
1752       If the extglob shell option is enabled using the shopt builtin, follow‐
1753       ing pattern matching operator is recognized as well:
1754
1755              !(pattern-list)
1756                     Matches anything except one of the given patterns
1757
1758   Quote Removal
1759       After the preceding expansions, all unquoted occurrences of the charac‐
1760       ters  \,  ', and " that did not result from one of the above expansions
1761       are removed.
1762

REDIRECTION

1764       Before a command is executed, its input and output  may  be  redirected
1765       using  a  special  notation  interpreted by the shell.  Redirection may
1766       also be used to open and close files for the  current  shell  execution
1767       environment.  The following redirection operators may precede or appear
1768       anywhere within a simple command or may follow a command.  Redirections
1769       are processed in the order they appear, from left to right.
1770
1771       Each  redirection  that may be preceded by a file descriptor number may
1772       instead be preceded by a word of the form {varname}.  In this case, for
1773       each redirection operator except >&- and <&-, the shell will allocate a
1774       file descriptor greater than 10 and assign it to varname.   If  >&-  or
1775       <&-  is  preceded  by  {varname}, the value of varname defines the file
1776       descriptor to close.
1777
1778       In the following descriptions, if the file descriptor number  is  omit‐
1779       ted,  and the first character of the redirection operator is <, the re‐
1780       direction refers to the standard input (file  descriptor  0).   If  the
1781       first  character  of  the  redirection  operator  is >, the redirection
1782       refers to the standard output (file descriptor 1).
1783
1784       The word following the redirection operator in the  following  descrip‐
1785       tions,  unless  otherwise noted, is subjected to brace expansion, tilde
1786       expansion, parameter expansion, command substitution, arithmetic expan‐
1787       sion,  quote  removal,  pathname  expansion, and word splitting.  If it
1788       expands to more than one word, bash reports an error.
1789
1790       Note that the order of redirections is significant.  For  example,  the
1791       command
1792
1793              ls > dirlist 2>&1
1794
1795       directs  both  standard  output and standard error to the file dirlist,
1796       while the command
1797
1798              ls 2>&1 > dirlist
1799
1800       directs only the standard output to file dirlist, because the  standard
1801       error  was duplicated from the standard output before the standard out‐
1802       put was redirected to dirlist.
1803
1804       Bash handles several filenames specially when they are used in redirec‐
1805       tions, as described in the following table:
1806
1807              /dev/fd/fd
1808                     If  fd  is  a valid integer, file descriptor fd is dupli‐
1809                     cated.
1810              /dev/stdin
1811                     File descriptor 0 is duplicated.
1812              /dev/stdout
1813                     File descriptor 1 is duplicated.
1814              /dev/stderr
1815                     File descriptor 2 is duplicated.
1816              /dev/tcp/host/port
1817                     If host is a valid hostname or Internet address, and port
1818                     is  an integer port number or service name, bash attempts
1819                     to open a TCP connection to the corresponding socket.
1820              /dev/udp/host/port
1821                     If host is a valid hostname or Internet address, and port
1822                     is  an integer port number or service name, bash attempts
1823                     to open a UDP connection to the corresponding socket.
1824
1825       A failure to open or create a file causes the redirection to fail.
1826
1827       Redirections using file descriptors greater than 9 should be used  with
1828       care,  as they may conflict with file descriptors the shell uses inter‐
1829       nally.
1830
1831   Redirecting Input
1832       Redirection of input causes the file whose name results from the expan‐
1833       sion  of  word  to  be  opened for reading on file descriptor n, or the
1834       standard input (file descriptor 0) if n is not specified.
1835
1836       The general format for redirecting input is:
1837
1838              [n]<word
1839
1840   Redirecting Output
1841       Redirection of output causes the  file  whose  name  results  from  the
1842       expansion of word to be opened for writing on file descriptor n, or the
1843       standard output (file descriptor 1) if n is not specified.  If the file
1844       does  not exist it is created; if it does exist it is truncated to zero
1845       size.
1846
1847       The general format for redirecting output is:
1848
1849              [n]>word
1850
1851       If the redirection operator is >, and the noclobber option to  the  set
1852       builtin  has  been enabled, the redirection will fail if the file whose
1853       name results from the expansion of word exists and is a  regular  file.
1854       If the redirection operator is >|, or the redirection operator is > and
1855       the noclobber option to the set builtin command is not enabled, the re‐
1856       direction is attempted even if the file named by word exists.
1857
1858   Appending Redirected Output
1859       Redirection  of  output  in  this  fashion  causes  the file whose name
1860       results from the expansion of word to be opened for appending  on  file
1861       descriptor  n,  or  the standard output (file descriptor 1) if n is not
1862       specified.  If the file does not exist it is created.
1863
1864       The general format for appending output is:
1865
1866              [n]>>word
1867
1868   Redirecting Standard Output and Standard Error
1869       This construct allows both the standard output (file descriptor 1)  and
1870       the  standard  error output (file descriptor 2) to be redirected to the
1871       file whose name is the expansion of word.
1872
1873       There are two formats for  redirecting  standard  output  and  standard
1874       error:
1875
1876              &>word
1877       and
1878              >&word
1879
1880       Of the two forms, the first is preferred.  This is semantically equiva‐
1881       lent to
1882
1883              >word 2>&1
1884
1885   Appending Standard Output and Standard Error
1886       This construct allows both the standard output (file descriptor 1)  and
1887       the  standard  error  output  (file descriptor 2) to be appended to the
1888       file whose name is the expansion of word.
1889
1890       The format for appending standard output and standard error is:
1891
1892              &>>word
1893
1894       This is semantically equivalent to
1895
1896              >>word 2>&1
1897
1898   Here Documents
1899       This type of redirection instructs the shell to  read  input  from  the
1900       current source until a line containing only delimiter (with no trailing
1901       blanks) is seen.  All of the lines read up to that point are then  used
1902       as the standard input for a command.
1903
1904       The format of here-documents is:
1905
1906              <<[-]word
1907                      here-document
1908              delimiter
1909
1910       No  parameter expansion, command substitution, arithmetic expansion, or
1911       pathname expansion is performed on word.  If any characters in word are
1912       quoted,  the  delimiter is the result of quote removal on word, and the
1913       lines in the here-document are not expanded.  If word is unquoted,  all
1914       lines  of  the here-document are subjected to parameter expansion, com‐
1915       mand substitution, and arithmetic expansion.  In the latter  case,  the
1916       character  sequence  \<newline> is ignored, and \ must be used to quote
1917       the characters \, $, and `.
1918
1919       If the redirection operator is <<-, then all leading tab characters are
1920       stripped  from  input  lines  and  the line containing delimiter.  This
1921       allows here-documents within shell scripts to be indented in a  natural
1922       fashion.
1923
1924   Here Strings
1925       A variant of here documents, the format is:
1926
1927              <<<word
1928
1929       The word is expanded and supplied to the command on its standard input.
1930
1931   Duplicating File Descriptors
1932       The redirection operator
1933
1934              [n]<&word
1935
1936       is used to duplicate input file descriptors.  If word expands to one or
1937       more digits, the file descriptor denoted by n is made to be a  copy  of
1938       that  file  descriptor.   If  the  digits in word do not specify a file
1939       descriptor open for input, a redirection error occurs.  If word  evalu‐
1940       ates  to  -,  file  descriptor n is closed.  If n is not specified, the
1941       standard input (file descriptor 0) is used.
1942
1943       The operator
1944
1945              [n]>&word
1946
1947       is used similarly to duplicate output file descriptors.  If  n  is  not
1948       specified,  the  standard  output  (file descriptor 1) is used.  If the
1949       digits in word do not specify a file descriptor open for output, a  re‐
1950       direction  error  occurs.  As a special case, if n is omitted, and word
1951       does not expand to one or more digits, the standard output and standard
1952       error are redirected as described previously.
1953
1954   Moving File Descriptors
1955       The redirection operator
1956
1957              [n]<&digit-
1958
1959       moves  the  file descriptor digit to file descriptor n, or the standard
1960       input (file descriptor 0) if n is not specified.  digit is closed after
1961       being duplicated to n.
1962
1963       Similarly, the redirection operator
1964
1965              [n]>&digit-
1966
1967       moves  the  file descriptor digit to file descriptor n, or the standard
1968       output (file descriptor 1) if n is not specified.
1969
1970   Opening File Descriptors for Reading and Writing
1971       The redirection operator
1972
1973              [n]<>word
1974
1975       causes the file whose name is the expansion of word to  be  opened  for
1976       both  reading and writing on file descriptor n, or on file descriptor 0
1977       if n is not specified.  If the file does not exist, it is created.
1978

ALIASES

1980       Aliases allow a string to be substituted for a word when it is used  as
1981       the  first  word  of  a  simple command.  The shell maintains a list of
1982       aliases that may be set and unset with the alias  and  unalias  builtin
1983       commands  (see  SHELL  BUILTIN COMMANDS below).  The first word of each
1984       simple command, if unquoted, is checked to see if it has an alias.   If
1985       so,  that word is replaced by the text of the alias.  The characters /,
1986       $, `, and = and any of the shell metacharacters or  quoting  characters
1987       listed above may not appear in an alias name.  The replacement text may
1988       contain any valid shell input,  including  shell  metacharacters.   The
1989       first  word  of  the replacement text is tested for aliases, but a word
1990       that is identical to an alias being expanded is not expanded  a  second
1991       time.   This  means  that  one may alias ls to ls -F, for instance, and
1992       bash does not try to recursively expand the replacement text.   If  the
1993       last  character  of  the  alias value is a blank, then the next command
1994       word following the alias is also checked for alias expansion.
1995
1996       Aliases are created and listed with the alias command, and removed with
1997       the unalias command.
1998
1999       There  is no mechanism for using arguments in the replacement text.  If
2000       arguments are needed, a shell function should be  used  (see  FUNCTIONS
2001       below).
2002
2003       Aliases  are not expanded when the shell is not interactive, unless the
2004       expand_aliases shell option is set using shopt (see the description  of
2005       shopt under SHELL BUILTIN COMMANDS below).
2006
2007       The  rules  concerning  the  definition and use of aliases are somewhat
2008       confusing.  Bash always reads at  least  one  complete  line  of  input
2009       before  executing  any  of  the  commands  on  that  line.  Aliases are
2010       expanded when a command is read, not when it is  executed.   Therefore,
2011       an  alias definition appearing on the same line as another command does
2012       not take effect until the next line of input  is  read.   The  commands
2013       following the alias definition on that line are not affected by the new
2014       alias.  This behavior is also an issue  when  functions  are  executed.
2015       Aliases  are  expanded when a function definition is read, not when the
2016       function is executed, because a function definition is  itself  a  com‐
2017       pound command.  As a consequence, aliases defined in a function are not
2018       available until after that function is executed.  To  be  safe,  always
2019       put  alias definitions on a separate line, and do not use alias in com‐
2020       pound commands.
2021
2022       For almost every purpose, aliases are superseded by shell functions.
2023

FUNCTIONS

2025       A shell function, defined  as  described  above  under  SHELL  GRAMMAR,
2026       stores  a  series  of commands for later execution.  When the name of a
2027       shell function is used as a simple command name, the list  of  commands
2028       associated with that function name is executed.  Functions are executed
2029       in the context of the current shell;  no  new  process  is  created  to
2030       interpret  them  (contrast  this with the execution of a shell script).
2031       When a function is executed, the arguments to the function  become  the
2032       positional parameters during its execution.  The special parameter # is
2033       updated to reflect the change.  Special parameter 0 is unchanged.   The
2034       first  element of the FUNCNAME variable is set to the name of the func‐
2035       tion while the function is executing.
2036
2037       All other aspects of the  shell  execution  environment  are  identical
2038       between a function and its caller with these exceptions:  the DEBUG and
2039       RETURN traps (see the description  of  the  trap  builtin  under  SHELL
2040       BUILTIN  COMMANDS below) are not inherited unless the function has been
2041       given the trace attribute (see the description of the  declare  builtin
2042       below)  or  the -o functrace shell option has been enabled with the set
2043       builtin (in which case all  functions  inherit  the  DEBUG  and  RETURN
2044       traps),  and the ERR trap is not inherited unless the -o errtrace shell
2045       option has been enabled.
2046
2047       Variables local to the function may be declared with the local  builtin
2048       command.  Ordinarily, variables and their values are shared between the
2049       function and its caller.
2050
2051       The FUNCNEST variable, if set  to  a  numeric  value  greater  than  0,
2052       defines  a  maximum  function nesting level.  Function invocations that
2053       exceed the limit cause the entire command to abort.
2054
2055       If the builtin command return is executed in a function,  the  function
2056       completes  and  execution resumes with the next command after the func‐
2057       tion call.  Any command associated with the  RETURN  trap  is  executed
2058       before execution resumes.  When a function completes, the values of the
2059       positional parameters and the special parameter # are restored  to  the
2060       values they had prior to the function's execution.
2061
2062       Function  names and definitions may be listed with the -f option to the
2063       declare or typeset builtin commands.  The -F option to declare or type‐
2064       set  will  list the function names only (and optionally the source file
2065       and line number, if the extdebug shell option is  enabled).   Functions
2066       may  be exported so that subshells automatically have them defined with
2067       the -f option to the export builtin.   A  function  definition  may  be
2068       deleted  using  the  -f  option  to the unset builtin.  Note that shell
2069       functions and variables with the same name may result in multiple iden‐
2070       tically-named  entries  in  the environment passed to the shell's chil‐
2071       dren.  Care should be taken in cases where this may cause a problem.
2072
2073       Functions may be recursive.  The FUNCNEST variable may be used to limit
2074       the  depth  of the function call stack and restrict the number of func‐
2075       tion invocations.  By default, no limit is imposed  on  the  number  of
2076       recursive calls.
2077

ARITHMETIC EVALUATION

2079       The  shell allows arithmetic expressions to be evaluated, under certain
2080       circumstances (see the let and declare builtin commands and  Arithmetic
2081       Expansion).   Evaluation  is done in fixed-width integers with no check
2082       for overflow, though division by 0 is trapped and flagged as an  error.
2083       The  operators  and their precedence, associativity, and values are the
2084       same as in the C language.  The following list of operators is  grouped
2085       into  levels  of  equal-precedence operators.  The levels are listed in
2086       order of decreasing precedence.
2087
2088       id++ id--
2089              variable post-increment and post-decrement
2090       ++id --id
2091              variable pre-increment and pre-decrement
2092       - +    unary minus and plus
2093       ! ~    logical and bitwise negation
2094       **     exponentiation
2095       * / %  multiplication, division, remainder
2096       + -    addition, subtraction
2097       << >>  left and right bitwise shifts
2098       <= >= < >
2099              comparison
2100       == !=  equality and inequality
2101       &      bitwise AND
2102       ^      bitwise exclusive OR
2103       |      bitwise OR
2104       &&     logical AND
2105       ||     logical OR
2106       expr?expr:expr
2107              conditional operator
2108       = *= /= %= += -= <<= >>= &= ^= |=
2109              assignment
2110       expr1 , expr2
2111              comma
2112
2113       Shell variables are allowed as operands; parameter  expansion  is  per‐
2114       formed before the expression is evaluated.  Within an expression, shell
2115       variables may also be referenced by name without  using  the  parameter
2116       expansion  syntax.  A shell variable that is null or unset evaluates to
2117       0 when referenced by name without using the parameter expansion syntax.
2118       The  value  of a variable is evaluated as an arithmetic expression when
2119       it is referenced, or when a variable which has been given  the  integer
2120       attribute using declare -i is assigned a value.  A null value evaluates
2121       to 0.  A shell variable need not have its integer attribute  turned  on
2122       to be used in an expression.
2123
2124       Constants with a leading 0 are interpreted as octal numbers.  A leading
2125       0x or  0X  denotes  hexadecimal.   Otherwise,  numbers  take  the  form
2126       [base#]n,  where the optional base is a decimal number between 2 and 64
2127       representing the arithmetic base, and n is a number in that  base.   If
2128       base#  is omitted, then base 10 is used.  The digits greater than 9 are
2129       represented by the lowercase letters, the uppercase letters, @, and  _,
2130       in  that  order.   If  base  is less than or equal to 36, lowercase and
2131       uppercase letters may be  used  interchangeably  to  represent  numbers
2132       between 10 and 35.
2133
2134       Operators  are  evaluated  in  order of precedence.  Sub-expressions in
2135       parentheses are evaluated first and may override the  precedence  rules
2136       above.
2137

CONDITIONAL EXPRESSIONS

2139       Conditional  expressions  are  used  by the [[ compound command and the
2140       test and [ builtin commands to test file attributes and perform  string
2141       and  arithmetic comparisons.  Expressions are formed from the following
2142       unary or binary primaries.  If any file argument to  one  of  the  pri‐
2143       maries is of the form /dev/fd/n, then file descriptor n is checked.  If
2144       the file argument to  one  of  the  primaries  is  one  of  /dev/stdin,
2145       /dev/stdout,  or /dev/stderr, file descriptor 0, 1, or 2, respectively,
2146       is checked.
2147
2148       Unless otherwise specified, primaries that operate on files follow sym‐
2149       bolic links and operate on the target of the link, rather than the link
2150       itself.
2151
2152       When used with [[, the < and > operators sort  lexicographically  using
2153       the current locale.  The test command sorts using ASCII ordering.
2154
2155       -a file
2156              True if file exists.
2157       -b file
2158              True if file exists and is a block special file.
2159       -c file
2160              True if file exists and is a character special file.
2161       -d file
2162              True if file exists and is a directory.
2163       -e file
2164              True if file exists.
2165       -f file
2166              True if file exists and is a regular file.
2167       -g file
2168              True if file exists and is set-group-id.
2169       -h file
2170              True if file exists and is a symbolic link.
2171       -k file
2172              True if file exists and its ``sticky'' bit is set.
2173       -p file
2174              True if file exists and is a named pipe (FIFO).
2175       -r file
2176              True if file exists and is readable.
2177       -s file
2178              True if file exists and has a size greater than zero.
2179       -t fd  True if file descriptor fd is open and refers to a terminal.
2180       -u file
2181              True if file exists and its set-user-id bit is set.
2182       -w file
2183              True if file exists and is writable.
2184       -x file
2185              True if file exists and is executable.
2186       -G file
2187              True if file exists and is owned by the effective group id.
2188       -L file
2189              True if file exists and is a symbolic link.
2190       -N file
2191              True  if  file  exists  and  has been modified since it was last
2192              read.
2193       -O file
2194              True if file exists and is owned by the effective user id.
2195       -S file
2196              True if file exists and is a socket.
2197       file1 -ef file2
2198              True if file1 and file2 refer to the same device and inode  num‐
2199              bers.
2200       file1 -nt file2
2201              True  if  file1  is  newer (according to modification date) than
2202              file2, or if file1 exists and file2 does not.
2203       file1 -ot file2
2204              True if file1 is older than file2, or if file2 exists and  file1
2205              does not.
2206       -o optname
2207              True  if  the  shell option optname is enabled.  See the list of
2208              options under the description  of  the  -o  option  to  the  set
2209              builtin below.
2210       -v varname
2211              True  if  the shell variable varname is set (has been assigned a
2212              value).
2213       -z string
2214              True if the length of string is zero.
2215       string
2216       -n string
2217              True if the length of string is non-zero.
2218
2219       string1 == string2
2220       string1 = string2
2221              True if the strings are equal.  = should be used with  the  test
2222              command for POSIX conformance.
2223
2224       string1 != string2
2225              True if the strings are not equal.
2226
2227       string1 < string2
2228              True if string1 sorts before string2 lexicographically.
2229
2230       string1 > string2
2231              True if string1 sorts after string2 lexicographically.
2232
2233       arg1 OP arg2
2234              OP  is one of -eq, -ne, -lt, -le, -gt, or -ge.  These arithmetic
2235              binary operators return true if arg1 is equal to, not equal  to,
2236              less  than, less than or equal to, greater than, or greater than
2237              or equal to arg2, respectively.  Arg1 and arg2 may  be  positive
2238              or negative integers.
2239

SIMPLE COMMAND EXPANSION

2241       When  a  simple  command  is executed, the shell performs the following
2242       expansions, assignments, and redirections, from left to right.
2243
2244       1.     The words that the parser has  marked  as  variable  assignments
2245              (those  preceding  the  command name) and redirections are saved
2246              for later processing.
2247
2248       2.     The words that are not variable assignments or redirections  are
2249              expanded.   If  any words remain after expansion, the first word
2250              is taken to be the name of the command and the  remaining  words
2251              are the arguments.
2252
2253       3.     Redirections are performed as described above under REDIRECTION.
2254
2255       4.     The text after the = in each variable assignment undergoes tilde
2256              expansion, parameter expansion, command substitution, arithmetic
2257              expansion,  and quote removal before being assigned to the vari‐
2258              able.
2259
2260       If no command name results, the variable assignments affect the current
2261       shell  environment.  Otherwise, the variables are added to the environ‐
2262       ment of the executed command and do not affect the current shell  envi‐
2263       ronment.   If  any  of  the assignments attempts to assign a value to a
2264       readonly variable, an error occurs, and the command exits with  a  non-
2265       zero status.
2266
2267       If  no  command  name  results,  redirections are performed, but do not
2268       affect the current shell environment.  A redirection error  causes  the
2269       command to exit with a non-zero status.
2270
2271       If  there is a command name left after expansion, execution proceeds as
2272       described below.  Otherwise, the command exits.  If one of  the  expan‐
2273       sions  contained a command substitution, the exit status of the command
2274       is the exit status of the  last  command  substitution  performed.   If
2275       there were no command substitutions, the command exits with a status of
2276       zero.
2277

COMMAND EXECUTION

2279       After a command has been split into words, if it results  in  a  simple
2280       command  and  an  optional list of arguments, the following actions are
2281       taken.
2282
2283       If the command name contains no slashes, the shell attempts  to  locate
2284       it.   If  there  exists a shell function by that name, that function is
2285       invoked as described above in FUNCTIONS.  If the name does not match  a
2286       function,  the shell searches for it in the list of shell builtins.  If
2287       a match is found, that builtin is invoked.
2288
2289       If the name is neither a shell function nor a builtin, and contains  no
2290       slashes,  bash  searches  each element of the PATH for a directory con‐
2291       taining an executable file by that name.  Bash uses  a  hash  table  to
2292       remember  the  full pathnames of executable files (see hash under SHELL
2293       BUILTIN COMMANDS below).  A full search of the directories in  PATH  is
2294       performed  only  if the command is not found in the hash table.  If the
2295       search is unsuccessful, the shell searches for a defined shell function
2296       named command_not_found_handle.  If that function exists, it is invoked
2297       with the original command and the original command's arguments  as  its
2298       arguments,  and  the  function's exit status becomes the exit status of
2299       the shell.  If that function is not defined, the shell prints an  error
2300       message and returns an exit status of 127.
2301
2302       If  the  search  is  successful, or if the command name contains one or
2303       more slashes, the shell executes the named program in a separate execu‐
2304       tion environment.  Argument 0 is set to the name given, and the remain‐
2305       ing arguments to the command are set to the arguments given, if any.
2306
2307       If this execution fails because the file is not in  executable  format,
2308       and  the file is not a directory, it is assumed to be a shell script, a
2309       file containing shell commands.  A subshell is spawned to  execute  it.
2310       This  subshell  reinitializes itself, so that the effect is as if a new
2311       shell had been invoked to handle the script, with  the  exception  that
2312       the  locations  of  commands  remembered  by the parent (see hash below
2313       under SHELL BUILTIN COMMANDS) are retained by the child.
2314
2315       If the program is a file beginning with #!, the remainder of the  first
2316       line  specifies an interpreter for the program.  The shell executes the
2317       specified interpreter on operating systems that do not handle this exe‐
2318       cutable format themselves.  The arguments to the interpreter consist of
2319       a single optional argument following the interpreter name on the  first
2320       line  of  the program, followed by the name of the program, followed by
2321       the command arguments, if any.
2322

COMMAND EXECUTION ENVIRONMENT

2324       The shell has an execution environment, which consists of  the  follow‐
2325       ing:
2326
2327       ·      open  files inherited by the shell at invocation, as modified by
2328              redirections supplied to the exec builtin
2329
2330       ·      the current working directory as set by cd, pushd, or  popd,  or
2331              inherited by the shell at invocation
2332
2333       ·      the  file  creation  mode mask as set by umask or inherited from
2334              the shell's parent
2335
2336       ·      current traps set by trap
2337
2338       ·      shell parameters that are set by variable assignment or with set
2339              or inherited from the shell's parent in the environment
2340
2341       ·      shell  functions  defined during execution or inherited from the
2342              shell's parent in the environment
2343
2344       ·      options enabled at invocation (either by default  or  with  com‐
2345              mand-line arguments) or by set
2346
2347       ·      options enabled by shopt
2348
2349       ·      shell aliases defined with alias
2350
2351       ·      various  process  IDs,  including  those of background jobs, the
2352              value of $$, and the value of PPID
2353
2354       When a simple command other than a builtin or shell function is  to  be
2355       executed,  it  is invoked in a separate execution environment that con‐
2356       sists of the following.  Unless otherwise noted, the values are  inher‐
2357       ited from the shell.
2358
2359
2360       ·      the  shell's  open  files,  plus any modifications and additions
2361              specified by redirections to the command
2362
2363       ·      the current working directory
2364
2365       ·      the file creation mode mask
2366
2367       ·      shell variables and functions  marked  for  export,  along  with
2368              variables exported for the command, passed in the environment
2369
2370       ·      traps caught by the shell are reset to the values inherited from
2371              the shell's parent, and traps ignored by the shell are ignored
2372
2373       A command invoked  in  this  separate  environment  cannot  affect  the
2374       shell's execution environment.
2375
2376       Command  substitution, commands grouped with parentheses, and asynchro‐
2377       nous commands are invoked in a subshell environment that is a duplicate
2378       of  the  shell  environment,  except that traps caught by the shell are
2379       reset to the values that the shell inherited from its parent at invoca‐
2380       tion.  Builtin commands that are invoked as part of a pipeline are also
2381       executed in a subshell environment.  Changes made to the subshell envi‐
2382       ronment cannot affect the shell's execution environment.
2383
2384       Subshells spawned to execute command substitutions inherit the value of
2385       the -e option from the parent shell.  When  not  in  posix  mode,  bash
2386       clears the -e option in such subshells.
2387
2388       If  a  command  is  followed  by a & and job control is not active, the
2389       default standard input for the command is  the  empty  file  /dev/null.
2390       Otherwise,  the  invoked  command  inherits the file descriptors of the
2391       calling shell as modified by redirections.
2392

ENVIRONMENT

2394       When a program is invoked it is given an array of  strings  called  the
2395       environment.   This  is  a  list  of  name-value  pairs,  of  the  form
2396       name=value.
2397
2398       The shell provides several ways  to  manipulate  the  environment.   On
2399       invocation, the shell scans its own environment and creates a parameter
2400       for each name found, automatically marking it for export to child  pro‐
2401       cesses.   Executed  commands  inherit  the environment.  The export and
2402       declare -x commands allow parameters and functions to be added  to  and
2403       deleted from the environment.  If the value of a parameter in the envi‐
2404       ronment is modified, the new value becomes  part  of  the  environment,
2405       replacing  the  old.  The environment inherited by any executed command
2406       consists of the shell's initial environment, whose values may be  modi‐
2407       fied  in  the  shell, less any pairs removed by the unset command, plus
2408       any additions via the export and declare -x commands.
2409
2410       The environment for any simple command or  function  may  be  augmented
2411       temporarily  by  prefixing  it with parameter assignments, as described
2412       above in PARAMETERS.  These assignment statements affect only the envi‐
2413       ronment seen by that command.
2414
2415       If  the  -k option is set (see the set builtin command below), then all
2416       parameter assignments are placed in the environment for a command,  not
2417       just those that precede the command name.
2418
2419       When  bash  invokes  an  external command, the variable _ is set to the
2420       full file name of the command and passed to that command in  its  envi‐
2421       ronment.
2422

EXIT STATUS

2424       The  exit  status  of  an executed command is the value returned by the
2425       waitpid system call or equivalent function.  Exit statuses fall between
2426       0  and  255, though, as explained below, the shell may use values above
2427       125 specially.  Exit statuses from shell builtins and compound commands
2428       are  also limited to this range. Under certain circumstances, the shell
2429       will use special values to indicate specific failure modes.
2430
2431       For the shell's purposes, a command which exits with a zero exit status
2432       has  succeeded.   An exit status of zero indicates success.  A non-zero
2433       exit status indicates failure.  When a command terminates  on  a  fatal
2434       signal N, bash uses the value of 128+N as the exit status.
2435
2436       If  a  command  is  not  found, the child process created to execute it
2437       returns a status of 127.  If a command is found but is not  executable,
2438       the return status is 126.
2439
2440       If a command fails because of an error during expansion or redirection,
2441       the exit status is greater than zero.
2442
2443       Shell builtin commands return a status of 0 (true) if  successful,  and
2444       non-zero  (false)  if an error occurs while they execute.  All builtins
2445       return an exit status of 2 to indicate incorrect usage.
2446
2447       Bash itself returns the exit  status  of  the  last  command  executed,
2448       unless  a  syntax  error occurs, in which case it exits with a non-zero
2449       value.  See also the exit builtin command below.
2450

SIGNALS

2452       When bash is interactive, in the  absence  of  any  traps,  it  ignores
2453       SIGTERM (so that kill 0 does not kill an interactive shell), and SIGINT
2454       is caught and handled (so that the wait builtin is interruptible).   In
2455       all  cases,  bash  ignores  SIGQUIT.  If job control is in effect, bash
2456       ignores SIGTTIN, SIGTTOU, and SIGTSTP.
2457
2458       Non-builtin commands run by bash have signal handlers set to the values
2459       inherited  by  the  shell  from its parent.  When job control is not in
2460       effect, asynchronous commands ignore SIGINT and SIGQUIT in addition  to
2461       these  inherited handlers.  Commands run as a result of command substi‐
2462       tution ignore the keyboard-generated job control signals SIGTTIN, SIGT‐
2463       TOU, and SIGTSTP.
2464
2465       The  shell  exits by default upon receipt of a SIGHUP.  Before exiting,
2466       an interactive shell  resends  the  SIGHUP  to  all  jobs,  running  or
2467       stopped.  Stopped jobs are sent SIGCONT to ensure that they receive the
2468       SIGHUP.  To prevent the shell from sending the signal to  a  particular
2469       job,  it  should be removed from the jobs table with the disown builtin
2470       (see SHELL BUILTIN COMMANDS below) or  marked  to  not  receive  SIGHUP
2471       using disown -h.
2472
2473       If  the  huponexit  shell  option has been set with shopt, bash sends a
2474       SIGHUP to all jobs when an interactive login shell exits.
2475
2476       If bash is waiting for a command to complete and receives a signal  for
2477       which a trap has been set, the trap will not be executed until the com‐
2478       mand completes.  When bash is waiting for an asynchronous  command  via
2479       the  wait  builtin, the reception of a signal for which a trap has been
2480       set will cause the wait builtin to return immediately with an exit sta‐
2481       tus greater than 128, immediately after which the trap is executed.
2482

JOB CONTROL

2484       Job  control  refers  to  the ability to selectively stop (suspend) the
2485       execution of processes and continue (resume) their execution at a later
2486       point.   A  user  typically  employs  this  facility via an interactive
2487       interface supplied jointly by the operating  system  kernel's  terminal
2488       driver and bash.
2489
2490       The  shell  associates  a  job with each pipeline.  It keeps a table of
2491       currently executing jobs, which may be listed with  the  jobs  command.
2492       When  bash starts a job asynchronously (in the background), it prints a
2493       line that looks like:
2494
2495              [1] 25647
2496
2497       indicating that this job is job number 1 and that the process ID of the
2498       last process in the pipeline associated with this job is 25647.  All of
2499       the processes in a single pipeline are members of the same  job.   Bash
2500       uses the job abstraction as the basis for job control.
2501
2502       To  facilitate the implementation of the user interface to job control,
2503       the operating system maintains the notion of a current terminal process
2504       group ID.  Members of this process group (processes whose process group
2505       ID is equal to the current terminal process group ID) receive keyboard-
2506       generated  signals  such  as SIGINT.  These processes are said to be in
2507       the foreground.  Background processes are those whose process group  ID
2508       differs from the terminal's; such processes are immune to keyboard-gen‐
2509       erated signals.  Only foreground processes are allowed to read from or,
2510       if  the  user  so  specifies  with  stty tostop, write to the terminal.
2511       Background processes which attempt to read from  (write  to  when  stty
2512       tostop  is  in effect) the terminal are sent a SIGTTIN (SIGTTOU) signal
2513       by the kernel's terminal driver, which,  unless  caught,  suspends  the
2514       process.
2515
2516       If  the operating system on which bash is running supports job control,
2517       bash contains facilities to use it.  Typing the suspend character (typ‐
2518       ically ^Z, Control-Z) while a process is running causes that process to
2519       be stopped and returns control to bash.   Typing  the  delayed  suspend
2520       character  (typically  ^Y,  Control-Y) causes the process to be stopped
2521       when it attempts to read input from the terminal,  and  control  to  be
2522       returned  to bash.  The user may then manipulate the state of this job,
2523       using the bg command to continue it in the background, the  fg  command
2524       to continue it in the foreground, or the kill command to kill it.  A ^Z
2525       takes effect immediately, and has the additional side effect of causing
2526       pending output and typeahead to be discarded.
2527
2528       There are a number of ways to refer to a job in the shell.  The charac‐
2529       ter % introduces a job specification (jobspec).  Job number  n  may  be
2530       referred to as %n.  A job may also be referred to using a prefix of the
2531       name used to start it, or using a substring that appears in its command
2532       line.   For  example,  %ce  refers  to  a  stopped ce job.  If a prefix
2533       matches more than one job, bash reports an error.  Using %?ce,  on  the
2534       other  hand,  refers to any job containing the string ce in its command
2535       line.  If the substring matches more than  one  job,  bash  reports  an
2536       error.   The  symbols %% and %+ refer to the shell's notion of the cur‐
2537       rent job, which is the last job stopped while it was in the  foreground
2538       or started in the background.  The previous job may be referenced using
2539       %-.  If there is only a single job, %+ and %- can both be used to refer
2540       to  that  job.   In  output pertaining to jobs (e.g., the output of the
2541       jobs command), the current job is always flagged with a +, and the pre‐
2542       vious  job  with  a -.  A single % (with no accompanying job specifica‐
2543       tion) also refers to the current job.
2544
2545       Simply naming a job can be used to bring it into the foreground: %1  is
2546       a  synonym  for  ``fg %1'', bringing job 1 from the background into the
2547       foreground.  Similarly, ``%1 &''  resumes  job  1  in  the  background,
2548       equivalent to ``bg %1''.
2549
2550       The  shell  learns immediately whenever a job changes state.  Normally,
2551       bash waits until it is about to print a prompt before reporting changes
2552       in  a  job's status so as to not interrupt any other output.  If the -b
2553       option to the set builtin command is enabled, bash reports such changes
2554       immediately.   Any  trap  on  SIGCHLD  is  executed for each child that
2555       exits.
2556
2557       If an attempt to exit bash is made while jobs are stopped (or,  if  the
2558       checkjobs  shell  option has been enabled using the shopt builtin, run‐
2559       ning), the shell prints a warning message, and, if the checkjobs option
2560       is  enabled,  lists  the jobs and their statuses.  The jobs command may
2561       then be used to inspect their status.  If a second attempt to  exit  is
2562       made  without  an intervening command, the shell does not print another
2563       warning, and any stopped jobs are terminated.
2564

PROMPTING

2566       When executing interactively, bash displays the primary prompt PS1 when
2567       it  is  ready  to  read a command, and the secondary prompt PS2 when it
2568       needs more input to complete  a  command.   Bash  allows  these  prompt
2569       strings  to  be  customized  by inserting a number of backslash-escaped
2570       special characters that are decoded as follows:
2571              \a     an ASCII bell character (07)
2572              \d     the date in "Weekday Month Date" format (e.g.,  "Tue  May
2573                     26")
2574              \D{format}
2575                     the  format  is  passed  to strftime(3) and the result is
2576                     inserted into the prompt string; an empty format  results
2577                     in a locale-specific time representation.  The braces are
2578                     required
2579              \e     an ASCII escape character (033)
2580              \h     the hostname up to the first `.'
2581              \H     the hostname
2582              \j     the number of jobs currently managed by the shell
2583              \l     the basename of the shell's terminal device name
2584              \n     newline
2585              \r     carriage return
2586              \s     the name of the shell, the basename of  $0  (the  portion
2587                     following the final slash)
2588              \t     the current time in 24-hour HH:MM:SS format
2589              \T     the current time in 12-hour HH:MM:SS format
2590              \@     the current time in 12-hour am/pm format
2591              \A     the current time in 24-hour HH:MM format
2592              \u     the username of the current user
2593              \v     the version of bash (e.g., 2.00)
2594              \V     the release of bash, version + patch level (e.g., 2.00.0)
2595              \w     the  current  working  directory,  with $HOME abbreviated
2596                     with a tilde (uses the value of the PROMPT_DIRTRIM  vari‐
2597                     able)
2598              \W     the basename of the current working directory, with $HOME
2599                     abbreviated with a tilde
2600              \!     the history number of this command
2601              \#     the command number of this command
2602              \$     if the effective UID is 0, a #, otherwise a $
2603              \nnn   the character corresponding to the octal number nnn
2604              \\     a backslash
2605              \[     begin a sequence of non-printing characters, which  could
2606                     be  used  to  embed  a terminal control sequence into the
2607                     prompt
2608              \]     end a sequence of non-printing characters
2609
2610       The command number and the history number are  usually  different:  the
2611       history  number of a command is its position in the history list, which
2612       may include commands  restored  from  the  history  file  (see  HISTORY
2613       below),  while  the  command  number is the position in the sequence of
2614       commands executed during the current shell session.  After  the  string
2615       is  decoded,  it is expanded via parameter expansion, command substitu‐
2616       tion, arithmetic expansion, and quote removal, subject to the value  of
2617       the  promptvars  shell option (see the description of the shopt command
2618       under SHELL BUILTIN COMMANDS below).
2619

READLINE

2621       This is the library that handles reading input when using  an  interac‐
2622       tive shell, unless the --noediting option is given at shell invocation.
2623       Line editing is also used when using the -e option to the read builtin.
2624       By default, the line editing commands are similar to those of Emacs.  A
2625       vi-style line editing interface is also available.  Line editing can be
2626       enabled  at  any  time  using  the -o emacs or -o vi options to the set
2627       builtin (see SHELL BUILTIN COMMANDS below).  To turn off  line  editing
2628       after  the  shell  is running, use the +o emacs or +o vi options to the
2629       set builtin.
2630
2631   Readline Notation
2632       In this section, the Emacs-style notation is used to denote keystrokes.
2633       Control  keys  are  denoted by C-key, e.g., C-n means Control-N.  Simi‐
2634       larly, meta keys are denoted by M-key, so M-x means Meta-X.   (On  key‐
2635       boards  without a meta key, M-x means ESC x, i.e., press the Escape key
2636       then the x key.  This makes ESC the meta prefix.  The combination M-C-x
2637       means  ESC-Control-x, or press the Escape key then hold the Control key
2638       while pressing the x key.)
2639
2640       Readline commands may be given numeric arguments, which normally act as
2641       a  repeat  count.   Sometimes,  however, it is the sign of the argument
2642       that is significant.  Passing a negative argument  to  a  command  that
2643       acts  in the forward direction (e.g., kill-line) causes that command to
2644       act in a backward direction.  Commands whose  behavior  with  arguments
2645       deviates from this are noted below.
2646
2647       When  a command is described as killing text, the text deleted is saved
2648       for possible future retrieval (yanking).  The killed text is saved in a
2649       kill ring.  Consecutive kills cause the text to be accumulated into one
2650       unit, which can be yanked all at once.  Commands which do not kill text
2651       separate the chunks of text on the kill ring.
2652
2653   Readline Initialization
2654       Readline  is  customized  by putting commands in an initialization file
2655       (the inputrc file).  The name of this file is taken from the  value  of
2656       the  INPUTRC  variable.   If  that  variable  is  unset, the default is
2657       ~/.inputrc.  When a program which uses the readline library starts  up,
2658       the initialization file is read, and the key bindings and variables are
2659       set.  There are only a few basic constructs  allowed  in  the  readline
2660       initialization  file.  Blank lines are ignored.  Lines beginning with a
2661       # are comments.  Lines beginning with a  $  indicate  conditional  con‐
2662       structs.  Other lines denote key bindings and variable settings.
2663
2664       The  default  key-bindings  may be changed with an inputrc file.  Other
2665       programs that use this library may add their own commands and bindings.
2666
2667       For example, placing
2668
2669              M-Control-u: universal-argument
2670       or
2671              C-Meta-u: universal-argument
2672       into the inputrc would make M-C-u execute the readline command  univer‐
2673       sal-argument.
2674
2675       The  following  symbolic  character  names are recognized: RUBOUT, DEL,
2676       ESC, LFD, NEWLINE, RET, RETURN, SPC, SPACE, and TAB.
2677
2678       In addition to command names, readline allows keys to  be  bound  to  a
2679       string that is inserted when the key is pressed (a macro).
2680
2681   Readline Key Bindings
2682       The  syntax for controlling key bindings in the inputrc file is simple.
2683       All that is required is the name of the command or the text of a  macro
2684       and  a key sequence to which it should be bound. The name may be speci‐
2685       fied in one of two ways: as a symbolic key name, possibly with Meta- or
2686       Control- prefixes, or as a key sequence.
2687
2688       When using the form keyname:function-name or macro, keyname is the name
2689       of a key spelled out in English.  For example:
2690
2691              Control-u: universal-argument
2692              Meta-Rubout: backward-kill-word
2693              Control-o: "> output"
2694
2695       In the above example, C-u is bound to the function  universal-argument,
2696       M-DEL  is bound to the function backward-kill-word, and C-o is bound to
2697       run the macro expressed on the right hand side (that is, to insert  the
2698       text ``> output'' into the line).
2699
2700       In  the  second  form,  "keyseq":function-name or macro, keyseq differs
2701       from keyname above in that strings denoting an entire key sequence  may
2702       be  specified  by  placing the sequence within double quotes.  Some GNU
2703       Emacs style key escapes can be used, as in the following  example,  but
2704       the symbolic character names are not recognized.
2705
2706              "\C-u": universal-argument
2707              "\C-x\C-r": re-read-init-file
2708              "\e[11~": "Function Key 1"
2709
2710       In this example, C-u is again bound to the function universal-argument.
2711       C-x C-r is bound to the function re-read-init-file, and ESC [ 1 1 ~  is
2712       bound to insert the text ``Function Key 1''.
2713
2714       The full set of GNU Emacs style escape sequences is
2715              \C-    control prefix
2716              \M-    meta prefix
2717              \e     an escape character
2718              \\     backslash
2719              \"     literal "
2720              \'     literal '
2721
2722       In  addition  to  the GNU Emacs style escape sequences, a second set of
2723       backslash escapes is available:
2724              \a     alert (bell)
2725              \b     backspace
2726              \d     delete
2727              \f     form feed
2728              \n     newline
2729              \r     carriage return
2730              \t     horizontal tab
2731              \v     vertical tab
2732              \nnn   the eight-bit character whose value is  the  octal  value
2733                     nnn (one to three digits)
2734              \xHH   the  eight-bit  character  whose value is the hexadecimal
2735                     value HH (one or two hex digits)
2736
2737       When entering the text of a macro, single or double quotes must be used
2738       to indicate a macro definition.  Unquoted text is assumed to be a func‐
2739       tion name.  In the macro body, the backslash  escapes  described  above
2740       are  expanded.   Backslash  will quote any other character in the macro
2741       text, including " and '.
2742
2743       Bash allows the current readline key bindings to be displayed or  modi‐
2744       fied  with  the bind builtin command.  The editing mode may be switched
2745       during interactive use by using the -o option to the set  builtin  com‐
2746       mand (see SHELL BUILTIN COMMANDS below).
2747
2748   Readline Variables
2749       Readline has variables that can be used to further customize its behav‐
2750       ior.  A variable may be set in the inputrc file with a statement of the
2751       form
2752
2753              set variable-name value
2754
2755       Except  where  noted,  readline variables can take the values On or Off
2756       (without regard to case).  Unrecognized  variable  names  are  ignored.
2757       When  a variable value is read, empty or null values, "on" (case-insen‐
2758       sitive), and "1" are equivalent to On.  All other values are equivalent
2759       to Off.  The variables and their default values are:
2760
2761       bell-style (audible)
2762              Controls  what  happens when readline wants to ring the terminal
2763              bell.  If set to none, readline never rings the bell.  If set to
2764              visible,  readline  uses a visible bell if one is available.  If
2765              set to audible, readline attempts to ring the terminal's bell.
2766       bind-tty-special-chars (On)
2767              If set to On, readline attempts to bind the  control  characters
2768              treated specially by the kernel's terminal driver to their read‐
2769              line equivalents.
2770       comment-begin (``#'')
2771              The string that is inserted  when  the  readline  insert-comment
2772              command is executed.  This command is bound to M-# in emacs mode
2773              and to # in vi command mode.
2774       completion-ignore-case (Off)
2775              If set to On, readline performs filename matching and completion
2776              in a case-insensitive fashion.
2777       completion-prefix-display-length (0)
2778              The  length in characters of the common prefix of a list of pos‐
2779              sible completions that is displayed without modification.   When
2780              set  to  a  value greater than zero, common prefixes longer than
2781              this value are replaced with an ellipsis when displaying  possi‐
2782              ble completions.
2783       completion-query-items (100)
2784              This  determines when the user is queried about viewing the num‐
2785              ber of possible completions generated  by  the  possible-comple‐
2786              tions  command.  It may be set to any integer value greater than
2787              or equal to zero.  If the  number  of  possible  completions  is
2788              greater than or equal to the value of this variable, the user is
2789              asked whether or not he wishes to view them; otherwise they  are
2790              simply listed on the terminal.
2791       convert-meta (On)
2792              If  set  to On, readline will convert characters with the eighth
2793              bit set to an ASCII key sequence by stripping the eighth bit and
2794              prefixing  an  escape  character (in effect, using escape as the
2795              meta prefix).
2796       disable-completion (Off)
2797              If set to On, readline will inhibit word completion.  Completion
2798              characters  will  be  inserted into the line as if they had been
2799              mapped to self-insert.
2800       editing-mode (emacs)
2801              Controls whether readline begins with a set of key bindings sim‐
2802              ilar to Emacs or vi.  editing-mode can be set to either emacs or
2803              vi.
2804       echo-control-characters (On)
2805              When set to On, on operating systems that indicate they  support
2806              it, readline echoes a character corresponding to a signal gener‐
2807              ated from the keyboard.
2808       enable-keypad (Off)
2809              When set to On, readline will try to enable the application key‐
2810              pad  when  it  is  called.  Some systems need this to enable the
2811              arrow keys.
2812       enable-meta-key (On)
2813              When set to On, readline will try to enable  any  meta  modifier
2814              key  the  terminal claims to support when it is called.  On many
2815              terminals, the meta key is used to send eight-bit characters.
2816       expand-tilde (Off)
2817              If set  to  On,  tilde  expansion  is  performed  when  readline
2818              attempts word completion.
2819       history-preserve-point (Off)
2820              If  set  to  On, the history code attempts to place point at the
2821              same location on each history line retrieved with  previous-his‐
2822              tory or next-history.
2823       history-size (0)
2824              Set  the  maximum number of history entries saved in the history
2825              list.  If set to zero, the number of entries in the history list
2826              is not limited.
2827       horizontal-scroll-mode (Off)
2828              When  set  to  On, makes readline use a single line for display,
2829              scrolling the input horizontally on a single screen line when it
2830              becomes  longer  than the screen width rather than wrapping to a
2831              new line.
2832       input-meta (Off)
2833              If set to On, readline will enable eight-bit input (that is,  it
2834              will  not  strip  the  high  bit  from the characters it reads),
2835              regardless of what the terminal claims it can support.  The name
2836              meta-flag is a synonym for this variable.
2837       isearch-terminators (``C-[C-J'')
2838              The  string  of  characters that should terminate an incremental
2839              search without subsequently executing the character  as  a  com‐
2840              mand.   If this variable has not been given a value, the charac‐
2841              ters ESC and C-J will terminate an incremental search.
2842       keymap (emacs)
2843              Set the current readline keymap.  The set of valid keymap  names
2844              is  emacs,  emacs-standard,  emacs-meta, emacs-ctlx, vi, vi-com‐
2845              mand, and vi-insert.  vi is equivalent to vi-command;  emacs  is
2846              equivalent  to  emacs-standard.  The default value is emacs; the
2847              value of editing-mode also affects the default keymap.
2848       mark-directories (On)
2849              If set to On, completed directory names have a slash appended.
2850       mark-modified-lines (Off)
2851              If set to On, history lines that have  been  modified  are  dis‐
2852              played with a preceding asterisk (*).
2853       mark-symlinked-directories (Off)
2854              If set to On, completed names which are symbolic links to direc‐
2855              tories  have  a  slash  appended  (subject  to  the   value   of
2856              mark-directories).
2857       match-hidden-files (On)
2858              This  variable,  when  set to On, causes readline to match files
2859              whose names begin with a  `.'  (hidden  files)  when  performing
2860              filename  completion.   If  set  to Off, the leading `.' must be
2861              supplied by the user in the filename to be completed.
2862       menu-complete-display-prefix (Off)
2863              If set to On, menu completion displays the common prefix of  the
2864              list of possible completions (which may be empty) before cycling
2865              through the list.
2866       output-meta (Off)
2867              If set to On, readline will display characters with  the  eighth
2868              bit set directly rather than as a meta-prefixed escape sequence.
2869       page-completions (On)
2870              If  set to On, readline uses an internal more-like pager to dis‐
2871              play a screenful of possible completions at a time.
2872       print-completions-horizontally (Off)
2873              If set to On, readline will  display  completions  with  matches
2874              sorted  horizontally in alphabetical order, rather than down the
2875              screen.
2876       revert-all-at-newline (Off)
2877              If set to On, readline will undo all changes  to  history  lines
2878              before returning when accept-line is executed.  By default, his‐
2879              tory lines may be modified  and  retain  individual  undo  lists
2880              across calls to readline.
2881       show-all-if-ambiguous (Off)
2882              This  alters  the  default behavior of the completion functions.
2883              If set to On, words which have more than one possible completion
2884              cause  the  matches  to be listed immediately instead of ringing
2885              the bell.
2886       show-all-if-unmodified (Off)
2887              This alters the default behavior of the completion functions  in
2888              a fashion similar to show-all-if-ambiguous.  If set to On, words
2889              which have more than one possible completion without any  possi‐
2890              ble  partial  completion (the possible completions don't share a
2891              common prefix)  cause  the  matches  to  be  listed  immediately
2892              instead of ringing the bell.
2893       skip-completed-text (Off)
2894              If  set  to On, this alters the default completion behavior when
2895              inserting a single match into the line.  It's only  active  when
2896              performing  completion  in  the  middle  of a word.  If enabled,
2897              readline does not insert characters  from  the  completion  that
2898              match  characters  after  point  in the word being completed, so
2899              portions of the word following the cursor are not duplicated.
2900       visible-stats (Off)
2901              If set to On, a character denoting a file's type as reported  by
2902              stat(2)  is  appended to the filename when listing possible com‐
2903              pletions.
2904
2905   Readline Conditional Constructs
2906       Readline implements a facility similar in  spirit  to  the  conditional
2907       compilation  features  of  the C preprocessor which allows key bindings
2908       and variable settings to be performed as the result  of  tests.   There
2909       are four parser directives used.
2910
2911       $if    The  $if construct allows bindings to be made based on the edit‐
2912              ing mode, the terminal being  used,  or  the  application  using
2913              readline.   The text of the test extends to the end of the line;
2914              no characters are required to isolate it.
2915
2916              mode   The mode= form of the  $if  directive  is  used  to  test
2917                     whether  readline  is  in  emacs or vi mode.  This may be
2918                     used in conjunction with  the  set  keymap  command,  for
2919                     instance,  to  set  bindings  in  the  emacs-standard and
2920                     emacs-ctlx keymaps only if readline is  starting  out  in
2921                     emacs mode.
2922
2923              term   The  term=  form may be used to include terminal-specific
2924                     key bindings, perhaps to bind the key sequences output by
2925                     the terminal's function keys.  The word on the right side
2926                     of the = is tested against the both full name of the ter‐
2927                     minal  and  the  portion  of the terminal name before the
2928                     first -.  This allows sun to match both sun and  sun-cmd,
2929                     for instance.
2930
2931              application
2932                     The application construct is used to include application-
2933                     specific  settings.   Each  program  using  the  readline
2934                     library  sets the application name, and an initialization
2935                     file can test for a particular value.  This could be used
2936                     to  bind key sequences to functions useful for a specific
2937                     program.  For instance, the following command adds a  key
2938                     sequence  that  quotes  the  current  or previous word in
2939                     bash:
2940
2941                     $if Bash
2942                     # Quote the current or previous word
2943                     "\C-xq": "\eb\"\ef\""
2944                     $endif
2945
2946       $endif This command, as seen in the previous example, terminates an $if
2947              command.
2948
2949       $else  Commands in this branch of the $if directive are executed if the
2950              test fails.
2951
2952       $include
2953              This directive takes a single filename as an argument and  reads
2954              commands  and bindings from that file.  For example, the follow‐
2955              ing directive would read /etc/inputrc:
2956
2957              $include  /etc/inputrc
2958
2959   Searching
2960       Readline provides commands for searching through  the  command  history
2961       (see HISTORY below) for lines containing a specified string.  There are
2962       two search modes: incremental and non-incremental.
2963
2964       Incremental searches begin before the  user  has  finished  typing  the
2965       search  string.  As each character of the search string is typed, read‐
2966       line displays the next entry from the history matching the string typed
2967       so  far.   An  incremental  search  requires only as many characters as
2968       needed to find the desired history entry.  The  characters  present  in
2969       the  value of the isearch-terminators variable are used to terminate an
2970       incremental search.  If that variable has not been assigned a value the
2971       Escape  and  Control-J characters will terminate an incremental search.
2972       Control-G will abort an incremental search  and  restore  the  original
2973       line.   When the search is terminated, the history entry containing the
2974       search string becomes the current line.
2975
2976       To find other matching entries in the history list, type  Control-S  or
2977       Control-R  as appropriate.  This will search backward or forward in the
2978       history for the next entry matching the search  string  typed  so  far.
2979       Any  other  key sequence bound to a readline command will terminate the
2980       search and execute that command.  For instance, a newline  will  termi‐
2981       nate the search and accept the line, thereby executing the command from
2982       the history list.
2983
2984       Readline remembers the last incremental search string.  If two Control-
2985       Rs  are  typed without any intervening characters defining a new search
2986       string, any remembered search string is used.
2987
2988       Non-incremental searches read the entire search string before  starting
2989       to  search  for matching history lines.  The search string may be typed
2990       by the user or be part of the contents of the current line.
2991
2992   Readline Command Names
2993       The following is a list of the names of the commands  and  the  default
2994       key sequences to which they are bound.  Command names without an accom‐
2995       panying key sequence are unbound by default.  In the following descrip‐
2996       tions,  point refers to the current cursor position, and mark refers to
2997       a cursor position saved by the set-mark command.  The text between  the
2998       point and mark is referred to as the region.
2999
3000   Commands for Moving
3001       beginning-of-line (C-a)
3002              Move to the start of the current line.
3003       end-of-line (C-e)
3004              Move to the end of the line.
3005       forward-char (C-f)
3006              Move forward a character.
3007       backward-char (C-b)
3008              Move back a character.
3009       forward-word (M-f)
3010              Move forward to the end of the next word.  Words are composed of
3011              alphanumeric characters (letters and digits).
3012       backward-word (M-b)
3013              Move back to the start of the current or previous  word.   Words
3014              are composed of alphanumeric characters (letters and digits).
3015       shell-forward-word
3016              Move  forward  to the end of the next word.  Words are delimited
3017              by non-quoted shell metacharacters.
3018       shell-backward-word
3019              Move back to the start of the current or previous  word.   Words
3020              are delimited by non-quoted shell metacharacters.
3021       clear-screen (C-l)
3022              Clear  the  screen  leaving  the  current line at the top of the
3023              screen.  With an argument,  refresh  the  current  line  without
3024              clearing the screen.
3025       redraw-current-line
3026              Refresh the current line.
3027
3028   Commands for Manipulating the History
3029       accept-line (Newline, Return)
3030              Accept the line regardless of where the cursor is.  If this line
3031              is non-empty, add it to the history list according to the  state
3032              of  the HISTCONTROL variable.  If the line is a modified history
3033              line, then restore the history line to its original state.
3034       previous-history (C-p)
3035              Fetch the previous command from the history list, moving back in
3036              the list.
3037       next-history (C-n)
3038              Fetch  the next command from the history list, moving forward in
3039              the list.
3040       beginning-of-history (M-<)
3041              Move to the first line in the history.
3042       end-of-history (M->)
3043              Move to the end of the input history, i.e., the  line  currently
3044              being entered.
3045       reverse-search-history (C-r)
3046              Search  backward  starting  at  the current line and moving `up'
3047              through the  history  as  necessary.   This  is  an  incremental
3048              search.
3049       forward-search-history (C-s)
3050              Search  forward  starting  at the current line and moving `down'
3051              through the  history  as  necessary.   This  is  an  incremental
3052              search.
3053       non-incremental-reverse-search-history (M-p)
3054              Search backward through the history starting at the current line
3055              using a non-incremental search for  a  string  supplied  by  the
3056              user.
3057       non-incremental-forward-search-history (M-n)
3058              Search  forward  through  the  history  using  a non-incremental
3059              search for a string supplied by the user.
3060       history-search-forward
3061              Search forward through the history for the string of  characters
3062              between  the start of the current line and the point.  This is a
3063              non-incremental search.
3064       history-search-backward
3065              Search backward through the history for the string of characters
3066              between  the start of the current line and the point.  This is a
3067              non-incremental search.
3068       yank-nth-arg (M-C-y)
3069              Insert the first argument to the previous command  (usually  the
3070              second word on the previous line) at point.  With an argument n,
3071              insert the nth word from the previous command (the words in  the
3072              previous  command  begin  with  word  0).   A  negative argument
3073              inserts the nth word from the end of the previous command.  Once
3074              the  argument n is computed, the argument is extracted as if the
3075              "!n" history expansion had been specified.
3076       yank-last-arg (M-., M-_)
3077              Insert the last argument to the previous command (the last  word
3078              of the previous history entry).  With a numeric argument, behave
3079              exactly like yank-nth-arg.  Successive  calls  to  yank-last-arg
3080              move  back through the history list, inserting the last word (or
3081              the word specified by the argument to the first  call)  of  each
3082              line in turn.  Any numeric argument supplied to these successive
3083              calls determines the direction to move through the  history.   A
3084              negative  argument  switches  the  direction through the history
3085              (back or forward).  The history expansion facilities are used to
3086              extract  the last argument, as if the "!$" history expansion had
3087              been specified.
3088       shell-expand-line (M-C-e)
3089              Expand the line as the shell does.  This performs alias and his‐
3090              tory expansion as well as all of the shell word expansions.  See
3091              HISTORY EXPANSION below for a description of history expansion.
3092       history-expand-line (M-^)
3093              Perform history expansion on  the  current  line.   See  HISTORY
3094              EXPANSION below for a description of history expansion.
3095       magic-space
3096              Perform  history  expansion  on  the  current  line and insert a
3097              space.  See HISTORY EXPANSION below for a description of history
3098              expansion.
3099       alias-expand-line
3100              Perform  alias expansion on the current line.  See ALIASES above
3101              for a description of alias expansion.
3102       history-and-alias-expand-line
3103              Perform history and alias expansion on the current line.
3104       insert-last-argument (M-., M-_)
3105              A synonym for yank-last-arg.
3106       operate-and-get-next (C-o)
3107              Accept the current line for execution and fetch  the  next  line
3108              relative  to the current line from the history for editing.  Any
3109              argument is ignored.
3110       edit-and-execute-command (C-xC-e)
3111              Invoke an editor on the current command line,  and  execute  the
3112              result  as  shell  commands.   Bash  attempts to invoke $VISUAL,
3113              $EDITOR, and emacs as the editor, in that order.
3114
3115   Commands for Changing Text
3116       delete-char (C-d)
3117              Delete the character at point.  If point is at the beginning  of
3118              the  line,  there  are  no  characters in the line, and the last
3119              character typed was not bound to delete-char, then return EOF.
3120       backward-delete-char (Rubout)
3121              Delete the character behind the cursor.  When  given  a  numeric
3122              argument, save the deleted text on the kill ring.
3123       forward-backward-delete-char
3124              Delete  the  character under the cursor, unless the cursor is at
3125              the end of the line, in which case the character behind the cur‐
3126              sor is deleted.
3127       quoted-insert (C-q, C-v)
3128              Add  the next character typed to the line verbatim.  This is how
3129              to insert characters like C-q, for example.
3130       tab-insert (C-v TAB)
3131              Insert a tab character.
3132       self-insert (a, b, A, 1, !, ...)
3133              Insert the character typed.
3134       transpose-chars (C-t)
3135              Drag the character before point forward over  the  character  at
3136              point,  moving point forward as well.  If point is at the end of
3137              the line, then this transposes the two characters before  point.
3138              Negative arguments have no effect.
3139       transpose-words (M-t)
3140              Drag  the  word  before  point past the word after point, moving
3141              point over that word as well.  If point is at  the  end  of  the
3142              line, this transposes the last two words on the line.
3143       upcase-word (M-u)
3144              Uppercase  the  current  (or  following)  word.  With a negative
3145              argument, uppercase the previous word, but do not move point.
3146       downcase-word (M-l)
3147              Lowercase the current (or  following)  word.   With  a  negative
3148              argument, lowercase the previous word, but do not move point.
3149       capitalize-word (M-c)
3150              Capitalize  the  current  (or  following) word.  With a negative
3151              argument, capitalize the previous word, but do not move point.
3152       overwrite-mode
3153              Toggle overwrite mode.  With an explicit positive numeric  argu‐
3154              ment, switches to overwrite mode.  With an explicit non-positive
3155              numeric argument, switches to insert mode.  This command affects
3156              only  emacs mode; vi mode does overwrite differently.  Each call
3157              to readline() starts in insert mode.  In overwrite mode, charac‐
3158              ters  bound to self-insert replace the text at point rather than
3159              pushing the text  to  the  right.   Characters  bound  to  back‐
3160              ward-delete-char  replace  the  character  before  point  with a
3161              space.  By default, this command is unbound.
3162
3163   Killing and Yanking
3164       kill-line (C-k)
3165              Kill the text from point to the end of the line.
3166       backward-kill-line (C-x Rubout)
3167              Kill backward to the beginning of the line.
3168       unix-line-discard (C-u)
3169              Kill backward from point to the  beginning  of  the  line.   The
3170              killed text is saved on the kill-ring.
3171       kill-whole-line
3172              Kill  all  characters on the current line, no matter where point
3173              is.
3174       kill-word (M-d)
3175              Kill from point to the end of the current word,  or  if  between
3176              words,  to  the  end  of the next word.  Word boundaries are the
3177              same as those used by forward-word.
3178       backward-kill-word (M-Rubout)
3179              Kill the word behind point.  Word boundaries  are  the  same  as
3180              those used by backward-word.
3181       shell-kill-word (M-d)
3182              Kill  from  point  to the end of the current word, or if between
3183              words, to the end of the next word.   Word  boundaries  are  the
3184              same as those used by shell-forward-word.
3185       shell-backward-kill-word (M-Rubout)
3186              Kill  the  word  behind  point.  Word boundaries are the same as
3187              those used by shell-backward-word.
3188       unix-word-rubout (C-w)
3189              Kill the word behind point, using white space as a  word  bound‐
3190              ary.  The killed text is saved on the kill-ring.
3191       unix-filename-rubout
3192              Kill  the  word  behind  point,  using white space and the slash
3193              character as the word boundaries.  The killed text is  saved  on
3194              the kill-ring.
3195       delete-horizontal-space (M-\)
3196              Delete all spaces and tabs around point.
3197       kill-region
3198              Kill the text in the current region.
3199       copy-region-as-kill
3200              Copy the text in the region to the kill buffer.
3201       copy-backward-word
3202              Copy  the word before point to the kill buffer.  The word bound‐
3203              aries are the same as backward-word.
3204       copy-forward-word
3205              Copy the word following point to  the  kill  buffer.   The  word
3206              boundaries are the same as forward-word.
3207       yank (C-y)
3208              Yank the top of the kill ring into the buffer at point.
3209       yank-pop (M-y)
3210              Rotate  the kill ring, and yank the new top.  Only works follow‐
3211              ing yank or yank-pop.
3212
3213   Numeric Arguments
3214       digit-argument (M-0, M-1, ..., M--)
3215              Add this digit to the argument already accumulating, or start  a
3216              new argument.  M-- starts a negative argument.
3217       universal-argument
3218              This  is another way to specify an argument.  If this command is
3219              followed by one or more digits, optionally with a leading  minus
3220              sign,  those digits define the argument.  If the command is fol‐
3221              lowed by digits, executing  universal-argument  again  ends  the
3222              numeric  argument, but is otherwise ignored.  As a special case,
3223              if this command is immediately followed by a character  that  is
3224              neither  a  digit or minus sign, the argument count for the next
3225              command is multiplied by four.  The argument count is  initially
3226              one,  so  executing this function the first time makes the argu‐
3227              ment count four, a second time makes the argument count sixteen,
3228              and so on.
3229
3230   Completing
3231       complete (TAB)
3232              Attempt  to  perform  completion on the text before point.  Bash
3233              attempts completion treating the text as a variable (if the text
3234              begins  with  $), username (if the text begins with ~), hostname
3235              (if the text begins with @), or command (including  aliases  and
3236              functions) in turn.  If none of these produces a match, filename
3237              completion is attempted.
3238       possible-completions (M-?)
3239              List the possible completions of the text before point.
3240       insert-completions (M-*)
3241              Insert all completions of the text before point that would  have
3242              been generated by possible-completions.
3243       menu-complete
3244              Similar  to complete, but replaces the word to be completed with
3245              a single match from the list of possible completions.   Repeated
3246              execution  of  menu-complete  steps through the list of possible
3247              completions, inserting each match in turn.  At the  end  of  the
3248              list of completions, the bell is rung (subject to the setting of
3249              bell-style) and the original text is restored.  An argument of n
3250              moves  n  positions  forward  in the list of matches; a negative
3251              argument may be used to move backward through  the  list.   This
3252              command  is  intended  to  be  bound  to  TAB, but is unbound by
3253              default.
3254       menu-complete-backward
3255              Identical to menu-complete, but moves backward through the  list
3256              of  possible  completions,  as if menu-complete had been given a
3257              negative argument.  This command is unbound by default.
3258       delete-char-or-list
3259              Deletes the character under the cursor if not at  the  beginning
3260              or  end  of  the  line (like delete-char).  If at the end of the
3261              line, behaves identically to possible-completions.  This command
3262              is unbound by default.
3263       complete-filename (M-/)
3264              Attempt filename completion on the text before point.
3265       possible-filename-completions (C-x /)
3266              List the possible completions of the text before point, treating
3267              it as a filename.
3268       complete-username (M-~)
3269              Attempt completion on the text before point, treating  it  as  a
3270              username.
3271       possible-username-completions (C-x ~)
3272              List the possible completions of the text before point, treating
3273              it as a username.
3274       complete-variable (M-$)
3275              Attempt completion on the text before point, treating  it  as  a
3276              shell variable.
3277       possible-variable-completions (C-x $)
3278              List the possible completions of the text before point, treating
3279              it as a shell variable.
3280       complete-hostname (M-@)
3281              Attempt completion on the text before point, treating  it  as  a
3282              hostname.
3283       possible-hostname-completions (C-x @)
3284              List the possible completions of the text before point, treating
3285              it as a hostname.
3286       complete-command (M-!)
3287              Attempt completion on the text before point, treating  it  as  a
3288              command  name.   Command  completion  attempts to match the text
3289              against  aliases,  reserved  words,   shell   functions,   shell
3290              builtins, and finally executable filenames, in that order.
3291       possible-command-completions (C-x !)
3292              List the possible completions of the text before point, treating
3293              it as a command name.
3294       dynamic-complete-history (M-TAB)
3295              Attempt completion on the text before point, comparing the  text
3296              against  lines  from  the  history  list for possible completion
3297              matches.
3298       dabbrev-expand
3299              Attempt menu completion on the text before point, comparing  the
3300              text against lines from the history list for possible completion
3301              matches.
3302       complete-into-braces (M-{)
3303              Perform filename completion and insert the list of possible com‐
3304              pletions  enclosed within braces so the list is available to the
3305              shell (see Brace Expansion above).
3306
3307   Keyboard Macros
3308       start-kbd-macro (C-x ()
3309              Begin saving the characters  typed  into  the  current  keyboard
3310              macro.
3311       end-kbd-macro (C-x ))
3312              Stop saving the characters typed into the current keyboard macro
3313              and store the definition.
3314       call-last-kbd-macro (C-x e)
3315              Re-execute the last keyboard macro defined, by making the  char‐
3316              acters in the macro appear as if typed at the keyboard.
3317
3318   Miscellaneous
3319       re-read-init-file (C-x C-r)
3320              Read  in  the  contents of the inputrc file, and incorporate any
3321              bindings or variable assignments found there.
3322       abort (C-g)
3323              Abort the current editing command and ring the  terminal's  bell
3324              (subject to the setting of bell-style).
3325       do-uppercase-version (M-a, M-b, M-x, ...)
3326              If  the  metafied character x is lowercase, run the command that
3327              is bound to the corresponding uppercase character.
3328       prefix-meta (ESC)
3329              Metafy the next character typed.  ESC f is equivalent to Meta-f.
3330       undo (C-_, C-x C-u)
3331              Incremental undo, separately remembered for each line.
3332       revert-line (M-r)
3333              Undo all changes made to this line.  This is like executing  the
3334              undo  command  enough  times  to  return the line to its initial
3335              state.
3336       tilde-expand (M-&)
3337              Perform tilde expansion on the current word.
3338       set-mark (C-@, M-<space>)
3339              Set the mark to the point.  If a numeric argument  is  supplied,
3340              the mark is set to that position.
3341       exchange-point-and-mark (C-x C-x)
3342              Swap  the  point  with the mark.  The current cursor position is
3343              set to the saved position, and the old cursor position is  saved
3344              as the mark.
3345       character-search (C-])
3346              A character is read and point is moved to the next occurrence of
3347              that character.  A negative count searches for  previous  occur‐
3348              rences.
3349       character-search-backward (M-C-])
3350              A  character  is  read and point is moved to the previous occur‐
3351              rence of that character.  A negative count searches  for  subse‐
3352              quent occurrences.
3353       skip-csi-sequence
3354              Read  enough  characters to consume a multi-key sequence such as
3355              those defined for keys like Home and End.  Such sequences  begin
3356              with a Control Sequence Indicator (CSI), usually ESC-[.  If this
3357              sequence is bound to "\[", keys producing  such  sequences  will
3358              have  no  effect  unless explicitly bound to a readline command,
3359              instead of inserting stray characters into the  editing  buffer.
3360              This is unbound by default, but usually bound to ESC-[.
3361       insert-comment (M-#)
3362              Without  a  numeric  argument,  the  value  of the readline com‐
3363              ment-begin variable is inserted at the beginning of the  current
3364              line.  If a numeric argument is supplied, this command acts as a
3365              toggle:  if the characters at the beginning of the line  do  not
3366              match  the value of comment-begin, the value is inserted, other‐
3367              wise the characters in comment-begin are deleted from the begin‐
3368              ning  of the line.  In either case, the line is accepted as if a
3369              newline had been typed.   The  default  value  of  comment-begin
3370              causes  this  command  to make the current line a shell comment.
3371              If a  numeric  argument  causes  the  comment  character  to  be
3372              removed, the line will be executed by the shell.
3373       glob-complete-word (M-g)
3374              The  word  before  point  is  treated  as a pattern for pathname
3375              expansion, with an asterisk implicitly appended.   This  pattern
3376              is  used  to generate a list of matching file names for possible
3377              completions.
3378       glob-expand-word (C-x *)
3379              The word before point is  treated  as  a  pattern  for  pathname
3380              expansion,  and  the  list  of  matching file names is inserted,
3381              replacing the word.  If  a  numeric  argument  is  supplied,  an
3382              asterisk is appended before pathname expansion.
3383       glob-list-expansions (C-x g)
3384              The  list  of  expansions  that  would  have  been  generated by
3385              glob-expand-word is displayed, and the line is  redrawn.   If  a
3386              numeric  argument  is  supplied,  an asterisk is appended before
3387              pathname expansion.
3388       dump-functions
3389              Print all of the functions and their key bindings to  the  read‐
3390              line output stream.  If a numeric argument is supplied, the out‐
3391              put is formatted in such a way that it can be made  part  of  an
3392              inputrc file.
3393       dump-variables
3394              Print all of the settable readline variables and their values to
3395              the readline output stream.  If a numeric argument is  supplied,
3396              the  output  is formatted in such a way that it can be made part
3397              of an inputrc file.
3398       dump-macros
3399              Print all of the readline key sequences bound to macros and  the
3400              strings  they  output.   If  a numeric argument is supplied, the
3401              output is formatted in such a way that it can be made part of an
3402              inputrc file.
3403       display-shell-version (C-x C-v)
3404              Display version information about the current instance of bash.
3405
3406   Programmable Completion
3407       When  word  completion  is  attempted  for an argument to a command for
3408       which a completion specification (a compspec) has  been  defined  using
3409       the  complete  builtin (see SHELL BUILTIN COMMANDS below), the program‐
3410       mable completion facilities are invoked.
3411
3412       First, the command name is identified.  If  the  command  word  is  the
3413       empty  string (completion attempted at the beginning of an empty line),
3414       any compspec defined with the -E option to  complete  is  used.   If  a
3415       compspec  has  been  defined  for that command, the compspec is used to
3416       generate the list of possible completions for the word.  If the command
3417       word  is  a full pathname, a compspec for the full pathname is searched
3418       for first.  If no compspec is found for the full pathname,  an  attempt
3419       is  made  to find a compspec for the portion following the final slash.
3420       If those searches do not result in a  compspec,  any  compspec  defined
3421       with the -D option to complete is used as the default.
3422
3423       Once  a  compspec  has  been  found, it is used to generate the list of
3424       matching words.  If a compspec is not found, the default  bash  comple‐
3425       tion as described above under Completing is performed.
3426
3427       First,  the  actions  specified by the compspec are used.  Only matches
3428       which are prefixed by the word being completed are returned.  When  the
3429       -f  or -d option is used for filename or directory name completion, the
3430       shell variable FIGNORE is used to filter the matches.
3431
3432       Any completions specified by a pathname expansion  pattern  to  the  -G
3433       option are generated next.  The words generated by the pattern need not
3434       match the word being completed.  The GLOBIGNORE shell variable  is  not
3435       used to filter the matches, but the FIGNORE variable is used.
3436
3437       Next,  the string specified as the argument to the -W option is consid‐
3438       ered.  The string is first split using the characters in the  IFS  spe‐
3439       cial  variable  as delimiters.  Shell quoting is honored.  Each word is
3440       then expanded using brace expansion,  tilde  expansion,  parameter  and
3441       variable  expansion, command substitution, and arithmetic expansion, as
3442       described above under EXPANSION.  The results are split using the rules
3443       described above under Word Splitting.  The results of the expansion are
3444       prefix-matched against the word being completed, and the matching words
3445       become the possible completions.
3446
3447       After  these matches have been generated, any shell function or command
3448       specified with the -F and -C options is invoked.  When the  command  or
3449       function is invoked, the COMP_LINE, COMP_POINT, COMP_KEY, and COMP_TYPE
3450       variables are assigned values as described above under Shell Variables.
3451       If  a  shell  function  is being invoked, the COMP_WORDS and COMP_CWORD
3452       variables are also set.  When the function or command is  invoked,  the
3453       first  argument  is  the  name of the command whose arguments are being
3454       completed, the second argument is the word  being  completed,  and  the
3455       third  argument  is  the word preceding the word being completed on the
3456       current command  line.   No  filtering  of  the  generated  completions
3457       against  the word being completed is performed; the function or command
3458       has complete freedom in generating the matches.
3459
3460       Any function specified with -F is invoked first.  The function may  use
3461       any  of  the  shell facilities, including the compgen builtin described
3462       below, to generate the matches.  It must put the  possible  completions
3463       in the COMPREPLY array variable.
3464
3465       Next,  any  command specified with the -C option is invoked in an envi‐
3466       ronment equivalent to command substitution.  It should print a list  of
3467       completions,  one  per  line, to the standard output.  Backslash may be
3468       used to escape a newline, if necessary.
3469
3470       After all of the possible completions are generated, any filter  speci‐
3471       fied  with  the -X option is applied to the list.  The filter is a pat‐
3472       tern as used for pathname expansion; a & in  the  pattern  is  replaced
3473       with  the text of the word being completed.  A literal & may be escaped
3474       with a backslash; the backslash is removed before attempting  a  match.
3475       Any  completion that matches the pattern will be removed from the list.
3476       A leading ! negates the pattern; in this case any completion not match‐
3477       ing the pattern will be removed.
3478
3479       Finally, any prefix and suffix specified with the -P and -S options are
3480       added to each member of the completion list, and the result is returned
3481       to the readline completion code as the list of possible completions.
3482
3483       If  the previously-applied actions do not generate any matches, and the
3484       -o dirnames option was supplied  to  complete  when  the  compspec  was
3485       defined, directory name completion is attempted.
3486
3487       If  the  -o  plusdirs option was supplied to complete when the compspec
3488       was defined, directory name completion is attempted and any matches are
3489       added to the results of the other actions.
3490
3491       By  default,  if a compspec is found, whatever it generates is returned
3492       to the completion code as the full set of  possible  completions.   The
3493       default bash completions are not attempted, and the readline default of
3494       filename completion is disabled.  If the -o bashdefault option was sup‐
3495       plied  to complete when the compspec was defined, the bash default com‐
3496       pletions are attempted if the compspec generates no matches.  If the -o
3497       default  option was supplied to complete when the compspec was defined,
3498       readline's default completion will be performed if the  compspec  (and,
3499       if attempted, the default bash completions) generate no matches.
3500
3501       When  a  compspec  indicates that directory name completion is desired,
3502       the programmable completion functions force readline to append a  slash
3503       to  completed names which are symbolic links to directories, subject to
3504       the value of the mark-directories readline variable, regardless of  the
3505       setting of the mark-symlinked-directories readline variable.
3506
3507       There  is  some support for dynamically modifying completions.  This is
3508       most useful when used in combination with a default  completion  speci‐
3509       fied  with  complete -D.  It's possible for shell functions executed as
3510       completion handlers to indicate that completion should  be  retried  by
3511       returning  an exit status of 124.  If a shell function returns 124, and
3512       changes the compspec associated with the command on which completion is
3513       being  attempted  (supplied  as the first argument when the function is
3514       executed), programmable completion restarts from the beginning, with an
3515       attempt  to find a new compspec for that command.  This allows a set of
3516       completions to be built dynamically as completion is attempted,  rather
3517       than being loaded all at once.
3518
3519       For  instance, assuming that there is a library of compspecs, each kept
3520       in a file corresponding to the  name  of  the  command,  the  following
3521       default completion function would load completions dynamically:
3522
3523       _completion_loader()
3524       {
3525            . "/etc/bash_completion.d/$1.sh" >/dev/null 2>&1 && return 124
3526       }
3527       complete -D -F _completion_loader
3528
3529

HISTORY

3531       When  the  -o  history  option to the set builtin is enabled, the shell
3532       provides access to the command history, the list of commands previously
3533       typed.   The  value  of  the HISTSIZE variable is used as the number of
3534       commands to save in a history list.  The text of the last HISTSIZE com‐
3535       mands  (default  500)  is  saved.  The shell stores each command in the
3536       history list prior to parameter and variable expansion  (see  EXPANSION
3537       above)  but after history expansion is performed, subject to the values
3538       of the shell variables HISTIGNORE and HISTCONTROL.
3539
3540       On startup, the history is initialized from the file named by the vari‐
3541       able  HISTFILE  (default ~/.bash_history).  The file named by the value
3542       of HISTFILE is truncated, if necessary, to contain  no  more  than  the
3543       number  of lines specified by the value of HISTFILESIZE.  When the his‐
3544       tory file is read, lines beginning with the history  comment  character
3545       followed  immediately  by a digit are interpreted as timestamps for the
3546       preceding history line.   These  timestamps  are  optionally  displayed
3547       depending  on the value of the HISTTIMEFORMAT variable.  When an inter‐
3548       active shell exits, the last $HISTSIZE lines are copied from  the  his‐
3549       tory list to $HISTFILE.  If the histappend shell option is enabled (see
3550       the description of shopt under SHELL BUILTIN COMMANDS below), the lines
3551       are  appended  to the history file, otherwise the history file is over‐
3552       written.  If HISTFILE is unset, or if the history file  is  unwritable,
3553       the  history is not saved.  If the HISTTIMEFORMAT variable is set, time
3554       stamps are written to the history file, marked with the history comment
3555       character,  so  they may be preserved across shell sessions.  This uses
3556       the history comment character to distinguish timestamps from other his‐
3557       tory lines.  After saving the history, the history file is truncated to
3558       contain no more than HISTFILESIZE lines.  If HISTFILESIZE is  not  set,
3559       no truncation is performed.
3560
3561       The  builtin  command fc (see SHELL BUILTIN COMMANDS below) may be used
3562       to list or edit and re-execute a portion of the history list.  The his‐
3563       tory  builtin  may  be  used  to display or modify the history list and
3564       manipulate the history file.  When using command-line  editing,  search
3565       commands  are available in each editing mode that provide access to the
3566       history list.
3567
3568       The shell allows control over which commands are saved on  the  history
3569       list.  The HISTCONTROL and HISTIGNORE variables may be set to cause the
3570       shell to save only a subset of the commands entered.  The cmdhist shell
3571       option,  if enabled, causes the shell to attempt to save each line of a
3572       multi-line command in the same history entry, adding  semicolons  where
3573       necessary  to preserve syntactic correctness.  The lithist shell option
3574       causes the shell to save the command with embedded newlines instead  of
3575       semicolons.  See the description of the shopt builtin below under SHELL
3576       BUILTIN  COMMANDS  for  information  on  setting  and  unsetting  shell
3577       options.
3578

HISTORY EXPANSION

3580       The  shell  supports a history expansion feature that is similar to the
3581       history expansion in csh.  This section describes what syntax  features
3582       are  available.   This  feature  is  enabled by default for interactive
3583       shells, and can be disabled using the +H option to the set builtin com‐
3584       mand (see SHELL BUILTIN COMMANDS below).  Non-interactive shells do not
3585       perform history expansion by default.
3586
3587       History expansions introduce words from the history list into the input
3588       stream,  making  it  easy to repeat commands, insert the arguments to a
3589       previous command into the current input line, or fix errors in previous
3590       commands quickly.
3591
3592       History  expansion  is  performed  immediately after a complete line is
3593       read, before the shell breaks it into words.  It  takes  place  in  two
3594       parts.   The  first is to determine which line from the history list to
3595       use during substitution.  The second is to select portions of that line
3596       for inclusion into the current one.  The line selected from the history
3597       is the event, and the portions of that line that  are  acted  upon  are
3598       words.   Various  modifiers  are  available  to manipulate the selected
3599       words.  The line is broken into words in the same fashion as when read‐
3600       ing  input, so that several metacharacter-separated words surrounded by
3601       quotes are considered one word.  History expansions are  introduced  by
3602       the  appearance  of  the  history  expansion  character,  which is ! by
3603       default.  Only backslash (\) and single quotes can  quote  the  history
3604       expansion character.
3605
3606       Several  characters inhibit history expansion if found immediately fol‐
3607       lowing the history expansion character, even if it is unquoted:  space,
3608       tab,  newline,  carriage return, and =.  If the extglob shell option is
3609       enabled, ( will also inhibit expansion.
3610
3611       Several shell options settable with the shopt builtin may  be  used  to
3612       tailor  the  behavior  of  history  expansion.  If the histverify shell
3613       option is enabled (see the description of the shopt builtin below), and
3614       readline  is  being  used,  history  substitutions  are not immediately
3615       passed to the shell parser.  Instead, the  expanded  line  is  reloaded
3616       into the readline editing buffer for further modification.  If readline
3617       is being used, and the histreedit shell option  is  enabled,  a  failed
3618       history  substitution will be reloaded into the readline editing buffer
3619       for correction.  The -p option to the history builtin  command  may  be
3620       used  to  see what a history expansion will do before using it.  The -s
3621       option to the history builtin may be used to add commands to the end of
3622       the  history  list  without  actually  executing them, so that they are
3623       available for subsequent recall.
3624
3625       The shell allows control of the various characters used by the  history
3626       expansion mechanism (see the description of histchars above under Shell
3627       Variables).  The shell uses the history comment character to mark  his‐
3628       tory timestamps when writing the history file.
3629
3630   Event Designators
3631       An  event designator is a reference to a command line entry in the his‐
3632       tory list.  Unless the reference is absolute, events  are  relative  to
3633       the current position in the history list.
3634
3635       !      Start  a  history substitution, except when followed by a blank,
3636              newline, carriage return, = or ( (when the extglob shell  option
3637              is enabled using the shopt builtin).
3638       !n     Refer to command line n.
3639       !-n    Refer to the current command minus n.
3640       !!     Refer to the previous command.  This is a synonym for `!-1'.
3641       !string
3642              Refer  to the most recent command preceding the current position
3643              in the history list starting with string.
3644       !?string[?]
3645              Refer to the most recent command preceding the current postition
3646              in  the  history  list containing string.  The trailing ? may be
3647              omitted if string is followed immediately by a newline.
3648       ^string1^string2^
3649              Quick substitution.   Repeat  the  previous  command,  replacing
3650              string1  with  string2.  Equivalent to ``!!:s/string1/string2/''
3651              (see Modifiers below).
3652       !#     The entire command line typed so far.
3653
3654   Word Designators
3655       Word designators are used to select desired words from the event.  A  :
3656       separates  the event specification from the word designator.  It may be
3657       omitted if the word designator begins with a ^, $, *, -, or  %.   Words
3658       are  numbered from the beginning of the line, with the first word being
3659       denoted by 0 (zero).  Words are inserted into the  current  line  sepa‐
3660       rated by single spaces.
3661
3662       0 (zero)
3663              The zeroth word.  For the shell, this is the command word.
3664       n      The nth word.
3665       ^      The first argument.  That is, word 1.
3666       $      The last argument.
3667       %      The word matched by the most recent `?string?' search.
3668       x-y    A range of words; `-y' abbreviates `0-y'.
3669       *      All  of  the words but the zeroth.  This is a synonym for `1-$'.
3670              It is not an error to use * if there is just  one  word  in  the
3671              event; the empty string is returned in that case.
3672       x*     Abbreviates x-$.
3673       x-     Abbreviates x-$ like x*, but omits the last word.
3674
3675       If  a  word  designator is supplied without an event specification, the
3676       previous command is used as the event.
3677
3678   Modifiers
3679       After the optional word designator, there may appear a sequence of  one
3680       or more of the following modifiers, each preceded by a `:'.
3681
3682       h      Remove a trailing file name component, leaving only the head.
3683       t      Remove all leading file name components, leaving the tail.
3684       r      Remove a trailing suffix of the form .xxx, leaving the basename.
3685       e      Remove all but the trailing suffix.
3686       p      Print the new command but do not execute it.
3687       q      Quote the substituted words, escaping further substitutions.
3688       x      Quote  the  substituted words as with q, but break into words at
3689              blanks and newlines.
3690       s/old/new/
3691              Substitute new for the first occurrence  of  old  in  the  event
3692              line.   Any  delimiter  can  be  used  in place of /.  The final
3693              delimiter is optional if it is the last character of  the  event
3694              line.   The delimiter may be quoted in old and new with a single
3695              backslash.  If & appears in new, it is replaced by old.  A  sin‐
3696              gle  backslash  will  quote the &.  If old is null, it is set to
3697              the last old substituted, or, if no previous  history  substitu‐
3698              tions took place, the last string in a !?string[?]  search.
3699       &      Repeat the previous substitution.
3700       g      Cause changes to be applied over the entire event line.  This is
3701              used in conjunction with `:s' (e.g.,  `:gs/old/new/')  or  `:&'.
3702              If  used with `:s', any delimiter can be used in place of /, and
3703              the final delimiter is optional if it is the last  character  of
3704              the event line.  An a may be used as a synonym for g.
3705       G      Apply  the following `s' modifier once to each word in the event
3706              line.
3707

SHELL BUILTIN COMMANDS

3709       Unless otherwise noted, each builtin command documented in this section
3710       as accepting options preceded by - accepts -- to signify the end of the
3711       options.  The :, true, false, and test builtins do not  accept  options
3712       and do not treat -- specially.  The exit, logout, break, continue, let,
3713       and shift builtins accept and process arguments beginning with -  with‐
3714       out  requiring  --.   Other  builtins that accept arguments but are not
3715       specified as accepting options interpret arguments beginning with -  as
3716       invalid options and require -- to prevent this interpretation.
3717       : [arguments]
3718              No  effect;  the command does nothing beyond expanding arguments
3719              and performing any specified redirections.  A zero exit code  is
3720              returned.
3721
3722        .  filename [arguments]
3723       source filename [arguments]
3724              Read  and  execute  commands  from filename in the current shell
3725              environment and return the exit status of the last command  exe‐
3726              cuted from filename.  If filename does not contain a slash, file
3727              names in PATH are used to find the  directory  containing  file‐
3728              name.   The  file  searched  for in PATH need not be executable.
3729              When bash is  not  in  posix  mode,  the  current  directory  is
3730              searched  if no file is found in PATH.  If the sourcepath option
3731              to the shopt builtin command is turned  off,  the  PATH  is  not
3732              searched.   If any arguments are supplied, they become the posi‐
3733              tional parameters when  filename  is  executed.   Otherwise  the
3734              positional  parameters  are unchanged.  The return status is the
3735              status of the last command exited within the  script  (0  if  no
3736              commands  are  executed),  and false if filename is not found or
3737              cannot be read.
3738
3739       alias [-p] [name[=value] ...]
3740              Alias with no arguments or with the -p option prints the list of
3741              aliases  in  the form alias name=value on standard output.  When
3742              arguments are supplied, an alias is defined for each name  whose
3743              value is given.  A trailing space in  value causes the next word
3744              to be checked for alias substitution when the alias is expanded.
3745              For  each  name  in the argument list for which no value is sup‐
3746              plied, the name and  value  of  the  alias  is  printed.   Alias
3747              returns  true unless a name is given for which no alias has been
3748              defined.
3749
3750       bg [jobspec ...]
3751              Resume each suspended job jobspec in the background,  as  if  it
3752              had been started with &.  If jobspec is not present, the shell's
3753              notion of the current job is used.  bg jobspec returns 0  unless
3754              run  when  job control is disabled or, when run with job control
3755              enabled, any specified jobspec was  not  found  or  was  started
3756              without job control.
3757
3758       bind [-m keymap] [-lpsvPSV]
3759       bind [-m keymap] [-q function] [-u function] [-r keyseq]
3760       bind [-m keymap] -f filename
3761       bind [-m keymap] -x keyseq:shell-command
3762       bind [-m keymap] keyseq:function-name
3763       bind readline-command
3764              Display  current  readline key and function bindings, bind a key
3765              sequence to a readline function or  macro,  or  set  a  readline
3766              variable.   Each  non-option  argument  is a command as it would
3767              appear in .inputrc, but each binding or command must  be  passed
3768              as  a  separate argument; e.g., '"\C-x\C-r": re-read-init-file'.
3769              Options, if supplied, have the following meanings:
3770              -m keymap
3771                     Use keymap as the keymap to be affected by the subsequent
3772                     bindings.  Acceptable keymap names are emacs, emacs-stan‐
3773                     dard, emacs-meta, emacs-ctlx,  vi,  vi-move,  vi-command,
3774                     and  vi-insert.  vi is equivalent to vi-command; emacs is
3775                     equivalent to emacs-standard.
3776              -l     List the names of all readline functions.
3777              -p     Display readline function names and bindings  in  such  a
3778                     way that they can be re-read.
3779              -P     List current readline function names and bindings.
3780              -s     Display  readline  key  sequences bound to macros and the
3781                     strings they output in such a way that they  can  be  re-
3782                     read.
3783              -S     Display  readline  key  sequences bound to macros and the
3784                     strings they output.
3785              -v     Display readline variable names and values in such a  way
3786                     that they can be re-read.
3787              -V     List current readline variable names and values.
3788              -f filename
3789                     Read key bindings from filename.
3790              -q function
3791                     Query about which keys invoke the named function.
3792              -u function
3793                     Unbind all keys bound to the named function.
3794              -r keyseq
3795                     Remove any current binding for keyseq.
3796              -x keyseq:shell-command
3797                     Cause  shell-command  to  be  executed whenever keyseq is
3798                     entered.  When shell-command is executed, the shell  sets
3799                     the  READLINE_LINE  variable to the contents of the read‐
3800                     line line buffer and the READLINE_POINT variable  to  the
3801                     current location of the insertion point.  If the executed
3802                     command changes  the  value  of  READLINE_LINE  or  READ‐
3803                     LINE_POINT,  those  new  values  will be reflected in the
3804                     editing state.
3805
3806              The return value is 0 unless an unrecognized option is given  or
3807              an error occurred.
3808
3809       break [n]
3810              Exit  from  within a for, while, until, or select loop.  If n is
3811              specified, break n levels.  n must be ≥ 1.  If n is greater than
3812              the  number  of enclosing loops, all enclosing loops are exited.
3813              The return value is non-zero when n is  ≤  0;  Otherwise,  break
3814              returns 0 value.
3815
3816       builtin shell-builtin [arguments]
3817              Execute  the  specified shell builtin, passing it arguments, and
3818              return its exit status.  This is useful when defining a function
3819              whose  name  is the same as a shell builtin, retaining the func‐
3820              tionality of the builtin within the function.  The cd builtin is
3821              commonly  redefined  this  way.   The  return status is false if
3822              shell-builtin is not a shell builtin command.
3823
3824       caller [expr]
3825              Returns the context of any active subroutine call (a shell func‐
3826              tion or a script executed with the . or source builtins).  With‐
3827              out expr, caller displays the line number and source filename of
3828              the  current subroutine call.  If a non-negative integer is sup‐
3829              plied as expr, caller displays the line number, subroutine name,
3830              and  source  file  corresponding to that position in the current
3831              execution call stack.  This extra information may be  used,  for
3832              example,  to print a stack trace.  The current frame is frame 0.
3833              The return value is 0 unless the shell is not executing  a  sub‐
3834              routine  call or expr does not correspond to a valid position in
3835              the call stack.
3836
3837       cd [-L|[-P [-e]]] [dir]
3838              Change the current directory to dir.  The variable HOME  is  the
3839              default  dir.   The  variable CDPATH defines the search path for
3840              the directory containing dir.  Alternative  directory  names  in
3841              CDPATH  are  separated by a colon (:).  A null directory name in
3842              CDPATH is the same as the current directory,  i.e.,  ``.''.   If
3843              dir  begins  with  a  slash (/), then CDPATH is not used. The -P
3844              option says to use the physical directory structure  instead  of
3845              following  symbolic  links  (see  also  the -P option to the set
3846              builtin command); the -L option forces symbolic links to be fol‐
3847              lowed.   If  the  -e option is supplied with -P, and the current
3848              working directory cannot be successfully determined after a suc‐
3849              cessful directory change, cd will return an unsuccessful status.
3850              An argument of - is  equivalent  to  $OLDPWD.   If  a  non-empty
3851              directory  name  from CDPATH is used, or if - is the first argu‐
3852              ment, and the directory change is successful, the absolute path‐
3853              name  of  the  new  working directory is written to the standard
3854              output.  The return value is true if the directory was  success‐
3855              fully changed; false otherwise.
3856
3857       command [-pVv] command [arg ...]
3858              Run  command  with  args  suppressing  the normal shell function
3859              lookup. Only builtin commands or commands found in the PATH  are
3860              executed.   If the -p option is given, the search for command is
3861              performed using a default value for PATH that is  guaranteed  to
3862              find  all  of  the  standard  utilities.  If either the -V or -v
3863              option is supplied, a description of command is printed.  The -v
3864              option  causes a single word indicating the command or file name
3865              used to invoke command to be displayed; the -V option produces a
3866              more  verbose  description.  If the -V or -v option is supplied,
3867              the exit status is 0 if command was found, and  1  if  not.   If
3868              neither option is supplied and an error occurred or command can‐
3869              not be found, the exit status is 127.  Otherwise, the exit  sta‐
3870              tus of the command builtin is the exit status of command.
3871
3872       compgen [option] [word]
3873              Generate  possible  completion matches for word according to the
3874              options, which may  be  any  option  accepted  by  the  complete
3875              builtin  with  the exception of -p and -r, and write the matches
3876              to the standard output.  When using the -F or  -C  options,  the
3877              various  shell  variables  set  by  the  programmable completion
3878              facilities, while available, will not have useful values.
3879
3880              The matches will be generated in the same way as if the program‐
3881              mable completion code had generated them directly from a comple‐
3882              tion specification with the same flags.  If word  is  specified,
3883              only those completions matching word will be displayed.
3884
3885              The  return  value is true unless an invalid option is supplied,
3886              or no matches were generated.
3887
3888       complete [-abcdefgjksuv] [-o comp-option] [-DE] [-A action]  [-G  glob‐
3889       pat] [-W wordlist] [-F function] [-C command]
3890              [-X filterpat] [-P prefix] [-S suffix] name [name ...]
3891       complete -pr [-DE] [name ...]
3892              Specify  how arguments to each name should be completed.  If the
3893              -p option is supplied, or if no options are  supplied,  existing
3894              completion  specifications are printed in a way that allows them
3895              to be reused as input.  The -r option removes a completion spec‐
3896              ification  for each name, or, if no names are supplied, all com‐
3897              pletion  specifications.   The  -D  option  indicates  that  the
3898              remaining  options  and  actions should apply to the ``default''
3899              command completion; that is, completion attempted on  a  command
3900              for  which  no  completion  has previously been defined.  The -E
3901              option indicates that the remaining options and  actions  should
3902              apply  to  ``empty''  command  completion;  that  is, completion
3903              attempted on a blank line.
3904
3905              The process of applying  these  completion  specifications  when
3906              word  completion  is attempted is described above under Program‐
3907              mable Completion.
3908
3909              Other options, if specified, have the following  meanings.   The
3910              arguments  to the -G, -W, and -X options (and, if necessary, the
3911              -P and -S options) should be quoted to protect them from  expan‐
3912              sion before the complete builtin is invoked.
3913              -o comp-option
3914                      The  comp-option  controls  several aspects of the comp‐
3915                      spec's behavior beyond the simple generation of  comple‐
3916                      tions.  comp-option may be one of:
3917                      bashdefault
3918                              Perform the rest of the default bash completions
3919                              if the compspec generates no matches.
3920                      default Use readline's default  filename  completion  if
3921                              the compspec generates no matches.
3922                      dirnames
3923                              Perform  directory  name completion if the comp‐
3924                              spec generates no matches.
3925                      filenames
3926                              Tell readline that the compspec generates  file‐
3927                              names,  so  it can perform any filename-specific
3928                              processing (like adding  a  slash  to  directory
3929                              names,  quoting special characters, or suppress‐
3930                              ing trailing spaces).  Intended to be used  with
3931                              shell functions.
3932                      nospace Tell   readline  not  to  append  a  space  (the
3933                              default) to words completed at the  end  of  the
3934                              line.
3935                      plusdirs
3936                              After  any  matches  defined by the compspec are
3937                              generated,   directory   name   completion    is
3938                              attempted  and  any  matches  are  added  to the
3939                              results of the other actions.
3940              -A action
3941                      The action may be one of the  following  to  generate  a
3942                      list of possible completions:
3943                      alias   Alias names.  May also be specified as -a.
3944                      arrayvar
3945                              Array variable names.
3946                      binding Readline key binding names.
3947                      builtin Names  of  shell  builtin commands.  May also be
3948                              specified as -b.
3949                      command Command names.  May also be specified as -c.
3950                      directory
3951                              Directory names.  May also be specified as -d.
3952                      disabled
3953                              Names of disabled shell builtins.
3954                      enabled Names of enabled shell builtins.
3955                      export  Names of exported shell variables.  May also  be
3956                              specified as -e.
3957                      file    File names.  May also be specified as -f.
3958                      function
3959                              Names of shell functions.
3960                      group   Group names.  May also be specified as -g.
3961                      helptopic
3962                              Help topics as accepted by the help builtin.
3963                      hostname
3964                              Hostnames,  as  taken from the file specified by
3965                              the HOSTFILE shell variable.
3966                      job     Job names, if job control is active.   May  also
3967                              be specified as -j.
3968                      keyword Shell  reserved words.  May also be specified as
3969                              -k.
3970                      running Names of running jobs, if job control is active.
3971                      service Service names.  May also be specified as -s.
3972                      setopt  Valid arguments for the -o  option  to  the  set
3973                              builtin.
3974                      shopt   Shell  option  names  as  accepted  by the shopt
3975                              builtin.
3976                      signal  Signal names.
3977                      stopped Names of stopped jobs, if job control is active.
3978                      user    User names.  May also be specified as -u.
3979                      variable
3980                              Names of all shell variables.  May also be spec‐
3981                              ified as -v.
3982              -C command
3983                      command  is  executed in a subshell environment, and its
3984                      output is used as the possible completions.
3985              -F function
3986                      The shell function function is executed in  the  current
3987                      shell  environment.  When it finishes, the possible com‐
3988                      pletions are retrieved from the value of  the  COMPREPLY
3989                      array variable.
3990              -G globpat
3991                      The  pathname  expansion  pattern globpat is expanded to
3992                      generate the possible completions.
3993              -P prefix
3994                      prefix is added at the beginning of each  possible  com‐
3995                      pletion after all other options have been applied.
3996              -S suffix
3997                      suffix is appended to each possible completion after all
3998                      other options have been applied.
3999              -W wordlist
4000                      The wordlist is split using the characters  in  the  IFS
4001                      special  variable as delimiters, and each resultant word
4002                      is expanded.  The possible completions are  the  members
4003                      of  the  resultant  list which match the word being com‐
4004                      pleted.
4005              -X filterpat
4006                      filterpat is a pattern as used for  pathname  expansion.
4007                      It is applied to the list of possible completions gener‐
4008                      ated by the preceding options and  arguments,  and  each
4009                      completion  matching filterpat is removed from the list.
4010                      A leading ! in filterpat negates the  pattern;  in  this
4011                      case, any completion not matching filterpat is removed.
4012
4013              The  return  value is true unless an invalid option is supplied,
4014              an option other than -p or -r is supplied without a  name  argu‐
4015              ment,  an  attempt  is made to remove a completion specification
4016              for a name for which no specification exists, or an error occurs
4017              adding a completion specification.
4018
4019       compopt [-o option] [-DE] [+o option] [name]
4020              Modify  completion  options  for  each  name  according  to  the
4021              options, or for the currently-executing completion if  no  names
4022              are  supplied.   If no options are given, display the completion
4023              options for each name or the current completion.   The  possible
4024              values  of  option  are  those  valid  for  the complete builtin
4025              described above.  The -D option  indicates  that  the  remaining
4026              options should apply to the ``default'' command completion; that
4027              is, completion attempted on a command for  which  no  completion
4028              has  previously  been defined.  The -E option indicates that the
4029              remaining options should apply to ``empty'' command  completion;
4030              that is, completion attempted on a blank line.
4031
4032              The  return  value is true unless an invalid option is supplied,
4033              an attempt is made to modify the options for a name for which no
4034              completion specification exists, or an output error occurs.
4035
4036       continue [n]
4037              Resume the next iteration of the enclosing for, while, until, or
4038              select loop.  If n is specified, resume  at  the  nth  enclosing
4039              loop.   n  must  be  ≥  1.   If  n is greater than the number of
4040              enclosing loops, the  last  enclosing  loop  (the  ``top-level''
4041              loop) is resumed.  When continue is executed inside of loop, the
4042              return value is non-zero when n  is  ≤  0;  Otherwise,  continue
4043              returns  0 value. When continue is executed outside of loop, the
4044              return value is 0.
4045
4046       declare [-aAfFgilrtux] [-p] [name[=value] ...]
4047       typeset [-aAfFgilrtux] [-p] [name[=value] ...]
4048              Declare variables and/or give them attributes.  If no names  are
4049              given  then display the values of variables.  The -p option will
4050              display the attributes and values of each name.  When -p is used
4051              with name arguments, additional options are ignored.  When -p is
4052              supplied without name arguments, it will display the  attributes
4053              and  values  of all variables having the attributes specified by
4054              the additional options.  If no other options are  supplied  with
4055              -p,  declare will display the attributes and values of all shell
4056              variables.  The -f option will restrict  the  display  to  shell
4057              functions.  The -F option inhibits the display of function defi‐
4058              nitions; only the function name and attributes are printed.   If
4059              the  extdebug  shell  option  is enabled using shopt, the source
4060              file name and line number where the function is defined are dis‐
4061              played as well.  The -F option implies -f.  The -g option forces
4062              variables to be created or modified at the  global  scope,  even
4063              when  declare is executed in a shell function.  It is ignored in
4064              all other cases.  The following options can be used to  restrict
4065              output  to  variables  with  the  specified attribute or to give
4066              variables attributes:
4067              -a     Each name  is  an  indexed  array  variable  (see  Arrays
4068                     above).
4069              -A     Each  name  is  an associative array variable (see Arrays
4070                     above).
4071              -f     Use function names only.
4072              -i     The variable is treated as an integer; arithmetic evalua‐
4073                     tion  (see ARITHMETIC EVALUATION above) is performed when
4074                     the variable is assigned a value.
4075              -l     When the variable is assigned  a  value,  all  upper-case
4076                     characters  are  converted to lower-case.  The upper-case
4077                     attribute is disabled.
4078              -r     Make names readonly.  These names cannot then be assigned
4079                     values by subsequent assignment statements or unset.
4080              -t     Give  each  name  the  trace attribute.  Traced functions
4081                     inherit the DEBUG  and  RETURN  traps  from  the  calling
4082                     shell.   The  trace  attribute has no special meaning for
4083                     variables.
4084              -u     When the variable is assigned  a  value,  all  lower-case
4085                     characters  are  converted to upper-case.  The lower-case
4086                     attribute is disabled.
4087              -x     Mark names for export  to  subsequent  commands  via  the
4088                     environment.
4089
4090              Using  `+'  instead of `-' turns off the attribute instead, with
4091              the exceptions that +a may not be used to destroy an array vari‐
4092              able  and  +r will not remove the readonly attribute.  When used
4093              in a function, makes each name local, as with the local command,
4094              unless the -g option is supplied, If a variable name is followed
4095              by =value, the value of the  variable  is  set  to  value.   The
4096              return  value  is  0 unless an invalid option is encountered, an
4097              attempt is made to define a function using  ``-f  foo=bar'',  an
4098              attempt  is  made  to  assign a value to a readonly variable, an
4099              attempt is made to assign a value to an array  variable  without
4100              using  the compound assignment syntax (see Arrays above), one of
4101              the names is not a valid shell variable name, an attempt is made
4102              to  turn off readonly status for a readonly variable, an attempt
4103              is made to turn off array status for an array  variable,  or  an
4104              attempt is made to display a non-existent function with -f.
4105
4106       dirs [+n] [-n] [-clpv]
4107              Without  options,  displays  the  list  of  currently remembered
4108              directories.  The default display  is  on  a  single  line  with
4109              directory  names  separated by spaces.  Directories are added to
4110              the list with  the  pushd  command;  the  popd  command  removes
4111              entries from the list.
4112              +n     Displays the nth entry counting from the left of the list
4113                     shown by dirs when invoked without options, starting with
4114                     zero.
4115              -n     Displays  the  nth  entry  counting from the right of the
4116                     list shown by dirs when invoked without options, starting
4117                     with zero.
4118              -c     Clears  the  directory  stack  by  deleting  all  of  the
4119                     entries.
4120              -l     Produces a longer listing;  the  default  listing  format
4121                     uses a tilde to denote the home directory.
4122              -p     Print the directory stack with one entry per line.
4123              -v     Print  the  directory stack with one entry per line, pre‐
4124                     fixing each entry with its index in the stack.
4125
4126              The return value is 0 unless an invalid option is supplied or  n
4127              indexes beyond the end of the directory stack.
4128
4129       disown [-ar] [-h] [jobspec ...]
4130              Without  options,  each  jobspec  is  removed  from the table of
4131              active jobs.  If jobspec is not present, and neither -a  nor  -r
4132              is  supplied, the shell's notion of the current job is used.  If
4133              the -h option is given, each jobspec is not removed from the ta‐
4134              ble,  but is marked so that SIGHUP is not sent to the job if the
4135              shell receives a SIGHUP.  If no jobspec is present, and  neither
4136              the  -a  nor the -r option is supplied, the current job is used.
4137              If no jobspec is supplied, the -a option means to remove or mark
4138              all  jobs;  the  -r  option without a jobspec argument restricts
4139              operation to running jobs.  The return value is 0 unless a  job‐
4140              spec does not specify a valid job.
4141
4142       echo [-neE] [arg ...]
4143              Output  the  args,  separated  by spaces, followed by a newline.
4144              The return status is always 0.  If -n is specified, the trailing
4145              newline  is  suppressed.  If the -e option is given, interpreta‐
4146              tion of the following backslash-escaped characters  is  enabled.
4147              The  -E option disables the interpretation of these escape char‐
4148              acters, even on systems where they are interpreted  by  default.
4149              The  xpg_echo  shell option may be used to dynamically determine
4150              whether or not echo expands these escape characters by  default.
4151              echo  does  not  interpret  -- to mean the end of options.  echo
4152              interprets the following escape sequences:
4153              \a     alert (bell)
4154              \b     backspace
4155              \c     suppress further output
4156              \e
4157              \E     an escape character
4158              \f     form feed
4159              \n     new line
4160              \r     carriage return
4161              \t     horizontal tab
4162              \v     vertical tab
4163              \\     backslash
4164              \0nnn  the eight-bit character whose value is  the  octal  value
4165                     nnn (zero to three octal digits)
4166              \xHH   the  eight-bit  character  whose value is the hexadecimal
4167                     value HH (one or two hex digits)
4168              \uHHHH the Unicode (ISO/IEC 10646) character whose value is  the
4169                     hexadecimal value HHHH (one to four hex digits)
4170              \UHHHHHHHH
4171                     the  Unicode (ISO/IEC 10646) character whose value is the
4172                     hexadecimal value HHHHHHHH (one to eight hex digits)
4173
4174       enable [-a] [-dnps] [-f filename] [name ...]
4175              Enable and disable builtin shell commands.  Disabling a  builtin
4176              allows a disk command which has the same name as a shell builtin
4177              to be executed without specifying a full pathname,  even  though
4178              the  shell  normally searches for builtins before disk commands.
4179              If -n is used, each  name  is  disabled;  otherwise,  names  are
4180              enabled.  For example, to use the test binary found via the PATH
4181              instead of the shell builtin version, run  ``enable  -n  test''.
4182              The  -f  option  means to load the new builtin command name from
4183              shared object filename, on systems that support dynamic loading.
4184              The  -d  option will delete a builtin previously loaded with -f.
4185              If no name arguments are given, or if the -p option is supplied,
4186              a list of shell builtins is printed.  With no other option argu‐
4187              ments, the list consists of all enabled shell builtins.   If  -n
4188              is  supplied, only disabled builtins are printed.  If -a is sup‐
4189              plied, the list printed includes all builtins, with  an  indica‐
4190              tion  of whether or not each is enabled.  If -s is supplied, the
4191              output is restricted to the POSIX special builtins.  The  return
4192              value  is  0 unless a name is not a shell builtin or there is an
4193              error loading a new builtin from a shared object.
4194
4195       eval [arg ...]
4196              The args are read and concatenated together into a  single  com‐
4197              mand.   This command is then read and executed by the shell, and
4198              its exit status is returned as the value of eval.  If there  are
4199              no args, or only null arguments, eval returns 0.
4200
4201       exec [-cl] [-a name] [command [arguments]]
4202              If  command is specified, it replaces the shell.  No new process
4203              is created.  The arguments become the arguments to command.   If
4204              the -l option is supplied, the shell places a dash at the begin‐
4205              ning of the zeroth argument passed to  command.   This  is  what
4206              login(1) does.  The -c option causes command to be executed with
4207              an empty environment.  If -a is supplied, the shell passes  name
4208              as the zeroth argument to the executed command.  If command can‐
4209              not be executed for some reason, a non-interactive shell  exits,
4210              unless  the  shell  option execfail is enabled, in which case it
4211              returns failure.  An interactive shell returns  failure  if  the
4212              file cannot be executed.  If command is not specified, any redi‐
4213              rections take effect in the current shell, and the return status
4214              is 0.  If there is a redirection error, the return status is 1.
4215
4216       exit [n]
4217              Cause  the  shell  to exit with a status of n.  If n is omitted,
4218              the exit status is that of the last command executed.  A trap on
4219              EXIT is executed before the shell terminates.
4220
4221       export [-fn] [name[=word]] ...
4222       export -p
4223              The  supplied names are marked for automatic export to the envi‐
4224              ronment of subsequently executed commands.  If the -f option  is
4225              given,  the names refer to functions.  If no names are given, or
4226              if the -p option is supplied, a  list  of  all  names  that  are
4227              exported  in  this  shell  is printed.  The -n option causes the
4228              export property to be removed from each  name.   If  a  variable
4229              name  is  followed by =word, the value of the variable is set to
4230              word.  export returns an exit status  of  0  unless  an  invalid
4231              option  is  encountered,  one  of the names is not a valid shell
4232              variable name, or -f is supplied with a name that is not a func‐
4233              tion.
4234
4235       fc [-e ename] [-lnr] [first] [last]
4236       fc -s [pat=rep] [cmd]
4237              Fix  Command.  In the first form, a range of commands from first
4238              to last is selected from the history list.  First and  last  may
4239              be  specified  as a string (to locate the last command beginning
4240              with that string) or as a number  (an  index  into  the  history
4241              list, where a negative number is used as an offset from the cur‐
4242              rent command number).  If last is not specified it is set to the
4243              current  command  for  listing (so that ``fc -l -10'' prints the
4244              last 10 commands) and to first otherwise.  If first is not spec‐
4245              ified  it is set to the previous command for editing and -16 for
4246              listing.
4247
4248              The -n option suppresses the command numbers when listing.   The
4249              -r  option reverses the order of the commands.  If the -l option
4250              is given, the commands are listed on  standard  output.   Other‐
4251              wise,  the editor given by ename is invoked on a file containing
4252              those commands.  If ename is not given, the value of the  FCEDIT
4253              variable  is used, and the value of EDITOR if FCEDIT is not set.
4254              If neither variable is set, vi is used.  When  editing  is  com‐
4255              plete, the edited commands are echoed and executed.
4256
4257              In  the  second form, command is re-executed after each instance
4258              of pat is replaced by rep.  A useful alias to use with  this  is
4259              ``r="fc  -s"'',  so  that  typing ``r cc'' runs the last command
4260              beginning with ``cc'' and typing ``r'' re-executes the last com‐
4261              mand.
4262
4263              If  the  first  form  is  used,  the return value is 0 unless an
4264              invalid option is encountered or first or last  specify  history
4265              lines  out  of  range.  If the -e option is supplied, the return
4266              value is the value of the last command executed or failure if an
4267              error occurs with the temporary file of commands.  If the second
4268              form is used, the return status is that of the  command  re-exe‐
4269              cuted,  unless  cmd  does  not  specify a valid history line, in
4270              which case fc returns failure.
4271
4272       fg [jobspec]
4273              Resume jobspec in the foreground, and make it the  current  job.
4274              If jobspec is not present, the shell's notion of the current job
4275              is used.  The return value is that of the  command  placed  into
4276              the  foreground,  or failure if run when job control is disabled
4277              or, when run with job control enabled, if jobspec does not spec‐
4278              ify  a  valid  job  or  jobspec specifies a job that was started
4279              without job control.
4280
4281       getopts optstring name [args]
4282              getopts is used by shell procedures to parse positional  parame‐
4283              ters.   optstring  contains  the  option characters to be recog‐
4284              nized; if a character is followed by  a  colon,  the  option  is
4285              expected  to have an argument, which should be separated from it
4286              by white space.  The colon and question mark characters may  not
4287              be  used as option characters.  Each time it is invoked, getopts
4288              places the next option in the shell variable name,  initializing
4289              name if it does not exist, and the index of the next argument to
4290              be processed into the variable OPTIND.  OPTIND is initialized to
4291              1  each  time  the  shell or a shell script is invoked.  When an
4292              option requires an argument, getopts places that  argument  into
4293              the  variable OPTARG.  The shell does not reset OPTIND automati‐
4294              cally; it must be  manually  reset  between  multiple  calls  to
4295              getopts within the same shell invocation if a new set of parame‐
4296              ters is to be used.
4297
4298              When the end of options is encountered,  getopts  exits  with  a
4299              return  value  greater than zero.  OPTIND is set to the index of
4300              the first non-option argument, and name is set to ?.
4301
4302              getopts normally parses the positional parameters, but  if  more
4303              arguments are given in args, getopts parses those instead.
4304
4305              getopts  can  report errors in two ways.  If the first character
4306              of optstring is a colon, silent error  reporting  is  used.   In
4307              normal  operation  diagnostic  messages are printed when invalid
4308              options or missing option arguments  are  encountered.   If  the
4309              variable  OPTERR  is  set  to  0, no error messages will be dis‐
4310              played, even if the first character of optstring is not a colon.
4311
4312              If an invalid option is seen, getopts places ? into name and, if
4313              not  silent,  prints  an  error  message  and unsets OPTARG.  If
4314              getopts is silent, the  option  character  found  is  placed  in
4315              OPTARG and no diagnostic message is printed.
4316
4317              If  a required argument is not found, and getopts is not silent,
4318              a question mark (?) is placed in name, OPTARG is  unset,  and  a
4319              diagnostic  message  is  printed.   If getopts is silent, then a
4320              colon (:) is placed in name and OPTARG  is  set  to  the  option
4321              character found.
4322
4323              getopts  returns true if an option, specified or unspecified, is
4324              found.  It returns false if the end of options is encountered or
4325              an error occurs.
4326
4327       hash [-lr] [-p filename] [-dt] [name]
4328              Each time hash is invoked, the full pathname of the command name
4329              is determined by searching the directories in $PATH  and  remem‐
4330              bered.  Any previously-remembered pathname is discarded.  If the
4331              -p option is supplied, no path search is performed, and filename
4332              is  used  as  the  full file name of the command.  The -r option
4333              causes the shell to forget all  remembered  locations.   The  -d
4334              option  causes  the  shell  to forget the remembered location of
4335              each name.  If the -t option is supplied, the full  pathname  to
4336              which  each name corresponds is printed.  If multiple name argu‐
4337              ments are supplied with -t,  the  name  is  printed  before  the
4338              hashed  full  pathname.   The -l option causes output to be dis‐
4339              played in a format that may be reused as input.  If no arguments
4340              are  given,  or if only -l is supplied, information about remem‐
4341              bered commands is printed.  The return status is true  unless  a
4342              name is not found or an invalid option is supplied.
4343
4344       help [-dms] [pattern]
4345              Display  helpful information about builtin commands.  If pattern
4346              is specified, help gives detailed help on all commands  matching
4347              pattern;  otherwise  help for all the builtins and shell control
4348              structures is printed.
4349              -d     Display a short description of each pattern
4350              -m     Display the description of each pattern in a manpage-like
4351                     format
4352              -s     Display only a short usage synopsis for each pattern
4353
4354              The return status is 0 unless no command matches pattern.
4355
4356       history [n]
4357       history -c
4358       history -d offset
4359       history -anrw [filename]
4360       history -p arg [arg ...]
4361       history -s arg [arg ...]
4362              With no options, display the command history list with line num‐
4363              bers.  Lines listed with a * have been modified.  An argument of
4364              n  lists only the last n lines.  If the shell variable HISTTIME‐
4365              FORMAT is set and not null, it is used as a  format  string  for
4366              strftime(3)  to display the time stamp associated with each dis‐
4367              played history entry.  No intervening blank is  printed  between
4368              the  formatted  time stamp and the history line.  If filename is
4369              supplied, it is used as the name of the history  file;  if  not,
4370              the  value  of HISTFILE is used.  Options, if supplied, have the
4371              following meanings:
4372              -c     Clear the history list by deleting all the entries.
4373              -d offset
4374                     Delete the history entry at position offset.
4375              -a     Append the ``new'' history lines (history  lines  entered
4376                     since  the  beginning of the current bash session) to the
4377                     history file.
4378              -n     Read the history lines not already read from the  history
4379                     file  into  the  current  history  list.  These are lines
4380                     appended to the history file since the beginning  of  the
4381                     current bash session.
4382              -r     Read the contents of the history file and use them as the
4383                     current history.
4384              -w     Write the current history to the history file,  overwrit‐
4385                     ing the history file's contents.
4386              -p     Perform  history  substitution  on the following args and
4387                     display the result on  the  standard  output.   Does  not
4388                     store  the results in the history list.  Each arg must be
4389                     quoted to disable normal history expansion.
4390              -s     Store the args in the history list  as  a  single  entry.
4391                     The  last  command  in the history list is removed before
4392                     the args are added.
4393
4394              If the HISTTIMEFORMAT variable is set, the time  stamp  informa‐
4395              tion  associated  with each history entry is written to the his‐
4396              tory file, marked with the history comment character.  When  the
4397              history  file  is read, lines beginning with the history comment
4398              character followed immediately by a  digit  are  interpreted  as
4399              timestamps for the previous history line.  The return value is 0
4400              unless an invalid option is encountered, an error  occurs  while
4401              reading  or  writing the history file, an invalid offset is sup‐
4402              plied as an argument to -d, or the history expansion supplied as
4403              an argument to -p fails.
4404
4405       jobs [-lnprs] [ jobspec ... ]
4406       jobs -x command [ args ... ]
4407              The first form lists the active jobs.  The options have the fol‐
4408              lowing meanings:
4409              -l     List process IDs in addition to the normal information.
4410              -n     Display information only about  jobs  that  have  changed
4411                     status since the user was last notified of their status.
4412              -p     List  only  the  process  ID  of  the job's process group
4413                     leader.
4414              -r     Restrict output to running jobs.
4415              -s     Restrict output to stopped jobs.
4416
4417              If jobspec is given, output is restricted to  information  about
4418              that  job.   The  return status is 0 unless an invalid option is
4419              encountered or an invalid jobspec is supplied.
4420
4421              If the -x option is supplied, jobs replaces any jobspec found in
4422              command  or  args  with  the corresponding process group ID, and
4423              executes command passing it args, returning its exit status.
4424
4425       kill [-s sigspec | -n signum | -sigspec] [pid | jobspec] ...
4426       kill -l [sigspec | exit_status]
4427              Send the signal named by sigspec  or  signum  to  the  processes
4428              named  by  pid or jobspec.  sigspec is either a case-insensitive
4429              signal name such as SIGKILL (with or without the SIG prefix)  or
4430              a  signal  number; signum is a signal number.  If sigspec is not
4431              present, then SIGTERM is assumed.  An argument of -l  lists  the
4432              signal  names.   If any arguments are supplied when -l is given,
4433              the names of the signals  corresponding  to  the  arguments  are
4434              listed, and the return status is 0.  The exit_status argument to
4435              -l is a number specifying either a signal  number  or  the  exit
4436              status  of  a process terminated by a signal.  kill returns true
4437              if at least one signal was successfully sent,  or  false  if  an
4438              error occurs or an invalid option is encountered.
4439
4440       let arg [arg ...]
4441              Each arg is an arithmetic expression to be evaluated (see ARITH‐
4442              METIC EVALUATION above).  If the last arg evaluates  to  0,  let
4443              returns 1; 0 is returned otherwise.
4444
4445       local [option] [name[=value] ...]
4446              For  each  argument, a local variable named name is created, and
4447              assigned value.  The option can be any of the  options  accepted
4448              by declare.  When local is used within a function, it causes the
4449              variable name to have a visible scope restricted to  that  func‐
4450              tion and its children.  With no operands, local writes a list of
4451              local variables to the standard output.  It is an error  to  use
4452              local when not within a function.  The return status is 0 unless
4453              local is used outside a function, an invalid name  is  supplied,
4454              or name is a readonly variable.
4455
4456       logout Exit a login shell.
4457
4458       mapfile  [-n  count]  [-O origin] [-s count] [-t] [-u fd] [-C callback]
4459       [-c quantum] [array]
4460       readarray [-n count] [-O origin] [-s count] [-t] [-u fd] [-C  callback]
4461       [-c quantum] [array]
4462              Read  lines from the standard input into the indexed array vari‐
4463              able array, or from file descriptor fd if the -u option is  sup‐
4464              plied.   The variable MAPFILE is the default array.  Options, if
4465              supplied, have the following meanings:
4466              -n     Copy at most count lines.  If count is 0, all  lines  are
4467                     copied.
4468              -O     Begin  assigning  to  array at index origin.  The default
4469                     index is 0.
4470              -s     Discard the first count lines read.
4471              -t     Remove a trailing newline from each line read.
4472              -u     Read lines from file descriptor fd instead of  the  stan‐
4473                     dard input.
4474              -C     Evaluate  callback each time quantum lines are read.  The
4475                     -c option specifies quantum.
4476              -c     Specify the number of lines read  between  each  call  to
4477                     callback.
4478
4479              If  -C  is  specified  without  -c, the default quantum is 5000.
4480              When callback is evaluated, it is supplied the index of the next
4481              array element to be assigned and the line to be assigned to that
4482              element as additional arguments.  callback  is  evaluated  after
4483              the line is read but before the array element is assigned.
4484
4485              If  not  supplied  with  an  explicit origin, mapfile will clear
4486              array before assigning to it.
4487
4488              mapfile returns successfully unless an invalid option or  option
4489              argument  is  supplied,  array is invalid or unassignable, or if
4490              array is not an indexed array.
4491
4492       popd [-n] [+n] [-n]
4493              Removes entries from the directory stack.   With  no  arguments,
4494              removes  the  top directory from the stack, and performs a cd to
4495              the new top directory.  Arguments, if supplied, have the follow‐
4496              ing meanings:
4497              -n     Suppresses  the  normal change of directory when removing
4498                     directories from the stack, so that  only  the  stack  is
4499                     manipulated.
4500              +n     Removes  the nth entry counting from the left of the list
4501                     shown by dirs, starting with zero.  For  example:  ``popd
4502                     +0'' removes the first directory, ``popd +1'' the second.
4503              -n     Removes the nth entry counting from the right of the list
4504                     shown by dirs, starting with zero.  For  example:  ``popd
4505                     -0''  removes the last directory, ``popd -1'' the next to
4506                     last.
4507
4508              If the popd command is successful, a dirs is performed as  well,
4509              and  the  return  status is 0.  popd returns false if an invalid
4510              option is encountered, the directory stack is empty, a non-exis‐
4511              tent directory stack entry is specified, or the directory change
4512              fails.
4513
4514       printf [-v var] format [arguments]
4515              Write the formatted arguments to the standard output  under  the
4516              control  of  the  format.  The -v option causes the output to be
4517              assigned to the variable var rather than being  printed  to  the
4518              standard output.
4519
4520              The  format  is a character string which contains three types of
4521              objects: plain characters, which are simply copied  to  standard
4522              output,  character  escape  sequences,  which  are converted and
4523              copied to the standard output, and format  specifications,  each
4524              of  which  causes  printing of the next successive argument.  In
4525              addition to the standard printf(1) format specifications, printf
4526              interprets the following extensions:
4527              %b     causes printf to expand backslash escape sequences in the
4528                     corresponding argument (except that \c terminates output,
4529                     backslashes  in \', \", and \? are not removed, and octal
4530                     escapes beginning with \0 may contain up to four digits).
4531              %q     causes printf to output the corresponding argument  in  a
4532                     format that can be reused as shell input.
4533              %(datefmt)T
4534                     causes  printf  to  output the date-time string resulting
4535                     from using datefmt as a format  string  for  strftime(3).
4536                     The corresponding argument is an integer representing the
4537                     number of seconds since the epoch.  Two special  argument
4538                     values  may  be used: -1 represents the current time, and
4539                     -2 represents the time the shell was invoked.
4540
4541              Arguments to non-string format specifiers are treated as C  con‐
4542              stants, except that a leading plus or minus sign is allowed, and
4543              if the leading character is a single or double quote, the  value
4544              is the ASCII value of the following character.
4545
4546              The  format  is  reused as necessary to consume all of the argu‐
4547              ments.  If the format requires more arguments than are supplied,
4548              the  extra  format  specifications  behave as if a zero value or
4549              null string, as appropriate,  had  been  supplied.   The  return
4550              value is zero on success, non-zero on failure.
4551
4552       pushd [-n] [+n] [-n]
4553       pushd [-n] [dir]
4554              Adds  a  directory to the top of the directory stack, or rotates
4555              the stack, making the new top of the stack the  current  working
4556              directory.  With no arguments, exchanges the top two directories
4557              and returns 0, unless the directory stack is empty.   Arguments,
4558              if supplied, have the following meanings:
4559              -n     Suppresses  the  normal  change  of directory when adding
4560                     directories to the stack,  so  that  only  the  stack  is
4561                     manipulated.
4562              +n     Rotates  the  stack  so  that the nth directory (counting
4563                     from the left of the list shown by  dirs,  starting  with
4564                     zero) is at the top.
4565              -n     Rotates  the  stack  so  that the nth directory (counting
4566                     from the right of the list shown by dirs,  starting  with
4567                     zero) is at the top.
4568              dir    Adds dir to the directory stack at the top, making it the
4569                     new current working directory.
4570
4571              If the pushd command is successful, a dirs is performed as well.
4572              If  the first form is used, pushd returns 0 unless the cd to dir
4573              fails.  With the second form, pushd returns 0 unless the  direc‐
4574              tory  stack  is empty, a non-existent directory stack element is
4575              specified, or the directory change to the specified new  current
4576              directory fails.
4577
4578       pwd [-LP]
4579              Print  the  absolute  pathname of the current working directory.
4580              The pathname printed contains no symbolic links if the -P option
4581              is supplied or the -o physical option to the set builtin command
4582              is enabled.  If the -L option is used, the pathname printed  may
4583              contain  symbolic links.  The return status is 0 unless an error
4584              occurs while reading the name of the  current  directory  or  an
4585              invalid option is supplied.
4586
4587       read [-ers] [-a aname] [-d delim] [-i text] [-n nchars] [-N nchars] [-p
4588       prompt] [-t timeout] [-u fd] [name ...]
4589              One line is read from the  standard  input,  or  from  the  file
4590              descriptor  fd supplied as an argument to the -u option, and the
4591              first word is assigned to the first name, the second word to the
4592              second  name, and so on, with leftover words and their interven‐
4593              ing separators assigned to the last name.  If  there  are  fewer
4594              words read from the input stream than names, the remaining names
4595              are assigned empty values.  The characters in IFS  are  used  to
4596              split  the  line into words.  The backslash character (\) may be
4597              used to remove any special meaning for the next  character  read
4598              and  for line continuation.  Options, if supplied, have the fol‐
4599              lowing meanings:
4600              -a aname
4601                     The words are assigned to sequential indices of the array
4602                     variable aname, starting at 0.  aname is unset before any
4603                     new  values  are  assigned.   Other  name  arguments  are
4604                     ignored.
4605              -d delim
4606                     The  first  character  of  delim is used to terminate the
4607                     input line, rather than newline.
4608              -e     If the standard input is coming from a terminal, readline
4609                     (see  READLINE  above) is used to obtain the line.  Read‐
4610                     line uses the current (or default, if  line  editing  was
4611                     not previously active) editing settings.
4612              -i text
4613                     If  readline  is  being  used  to  read the line, text is
4614                     placed into the editing buffer before editing begins.
4615              -n nchars
4616                     read returns after reading nchars characters rather  than
4617                     waiting  for a complete line of input, but honor a delim‐
4618                     iter if fewer than nchars characters are read before  the
4619                     delimiter.
4620              -N nchars
4621                     read  returns  after  reading  exactly  nchars characters
4622                     rather than waiting for a complete line of input,  unless
4623                     EOF  is encountered or read times out.  Delimiter charac‐
4624                     ters encountered in the input are not  treated  specially
4625                     and  do  not cause read to return until nchars characters
4626                     are read.
4627              -p prompt
4628                     Display prompt on standard error, without a trailing new‐
4629                     line, before attempting to read any input.  The prompt is
4630                     displayed only if input is coming from a terminal.
4631              -r     Backslash does not act as an escape character.  The back‐
4632                     slash  is considered to be part of the line.  In particu‐
4633                     lar, a backslash-newline pair may not be used as  a  line
4634                     continuation.
4635              -s     Silent mode.  If input is coming from a terminal, charac‐
4636                     ters are not echoed.
4637              -t timeout
4638                     Cause read to time out and return failure if  a  complete
4639                     line  of input is not read within timeout seconds.  time‐
4640                     out may be a decimal number  with  a  fractional  portion
4641                     following  the decimal point.  This option is only effec‐
4642                     tive if read is reading input from a terminal,  pipe,  or
4643                     other  special  file;  it has no effect when reading from
4644                     regular files.  If timeout is 0, read returns success  if
4645                     input  is  available  on  the  specified file descriptor,
4646                     failure otherwise.  The exit status is greater  than  128
4647                     if the timeout is exceeded.
4648              -u fd  Read input from file descriptor fd.
4649
4650              If no names are supplied, the line read is assigned to the vari‐
4651              able REPLY.  The return code  is  zero,  unless  end-of-file  is
4652              encountered,  read  times  out (in which case the return code is
4653              greater than 128), or an invalid file descriptor is supplied  as
4654              the argument to -u.
4655
4656       readonly [-aAf] [-p] [name[=word] ...]
4657              The  given  names are marked readonly; the values of these names
4658              may not be changed by subsequent assignment.  If the  -f  option
4659              is  supplied,  the  functions  corresponding to the names are so
4660              marked.  The  -a  option  restricts  the  variables  to  indexed
4661              arrays;  the  -A  option  restricts the variables to associative
4662              arrays.  If both options are supplied, -A takes precedence.   If
4663              no  name arguments are given, or if the -p option is supplied, a
4664              list of all readonly names is printed.  The other options may be
4665              used  to  restrict the output to a subset of the set of readonly
4666              names.  The -p option causes output to be displayed in a  format
4667              that  may be reused as input.  If a variable name is followed by
4668              =word, the value of the variable is set  to  word.   The  return
4669              status  is 0 unless an invalid option is encountered, one of the
4670              names is not a valid shell variable name, or -f is supplied with
4671              a name that is not a function.
4672
4673       return [n]
4674              Causes  a function to exit with the return value specified by n.
4675              If n is omitted, the return status is that of the  last  command
4676              executed  in the function body.  If used outside a function, but
4677              during execution of a script by  the  .   (source)  command,  it
4678              causes the shell to stop executing that script and return either
4679              n or the exit status of the last  command  executed  within  the
4680              script  as  the  exit  status  of the script.  If used outside a
4681              function and not during execution of a script by .,  the  return
4682              status is false.  Any command associated with the RETURN trap is
4683              executed before execution resumes after the function or script.
4684
4685       set [--abefhkmnptuvxBCEHPT] [-o option-name] [arg ...]
4686       set [+abefhkmnptuvxBCEHPT] [+o option-name] [arg ...]
4687              Without options, the name and value of each shell  variable  are
4688              displayed in a format that can be reused as input for setting or
4689              resetting the currently-set variables.  Read-only variables can‐
4690              not  be  reset.  In posix mode, only shell variables are listed.
4691              The output is sorted according  to  the  current  locale.   When
4692              options  are specified, they set or unset shell attributes.  Any
4693              arguments remaining after option processing are treated as  val‐
4694              ues for the positional parameters and are assigned, in order, to
4695              $1, $2, ...  $n.  Options,  if  specified,  have  the  following
4696              meanings:
4697              -a      Automatically  mark  variables  and  functions which are
4698                      modified or created for export  to  the  environment  of
4699                      subsequent commands.
4700              -b      Report  the status of terminated background jobs immedi‐
4701                      ately, rather than before the next primary prompt.  This
4702                      is effective only when job control is enabled.
4703              -e      Exit  immediately  if a pipeline (which may consist of a
4704                      single simple command),  a subshell command enclosed  in
4705                      parentheses,  or one of the commands executed as part of
4706                      a command list enclosed by  braces  (see  SHELL  GRAMMAR
4707                      above) exits with a non-zero status.  The shell does not
4708                      exit if the command that fails is part  of  the  command
4709                      list  immediately  following  a  while or until keyword,
4710                      part of the test  following  the  if  or  elif  reserved
4711                      words,  part  of any command executed in a && or || list
4712                      except the command following the final  &&  or  ||,  any
4713                      command  in a pipeline but the last, or if the command's
4714                      return value is being inverted with !.  A trap  on  ERR,
4715                      if set, is executed before the shell exits.  This option
4716                      applies to the shell environment and each subshell envi‐
4717                      ronment  separately  (see  COMMAND EXECUTION ENVIRONMENT
4718                      above), and may cause subshells to exit before executing
4719                      all the commands in the subshell.
4720              -f      Disable pathname expansion.
4721              -h      Remember  the location of commands as they are looked up
4722                      for execution.  This is enabled by default.
4723              -k      All arguments in the form of assignment  statements  are
4724                      placed  in the environment for a command, not just those
4725                      that precede the command name.
4726              -m      Monitor mode.  Job control is enabled.  This  option  is
4727                      on  by  default  for  interactive shells on systems that
4728                      support it (see JOB  CONTROL  above).   Background  pro‐
4729                      cesses  run  in a separate process group and a line con‐
4730                      taining their exit status is printed upon their  comple‐
4731                      tion.
4732              -n      Read commands but do not execute them.  This may be used
4733                      to check a shell script  for  syntax  errors.   This  is
4734                      ignored by interactive shells.
4735              -o option-name
4736                      The option-name can be one of the following:
4737                      allexport
4738                              Same as -a.
4739                      braceexpand
4740                              Same as -B.
4741                      emacs   Use  an  emacs-style command line editing inter‐
4742                              face.  This is enabled by default when the shell
4743                              is interactive, unless the shell is started with
4744                              the --noediting option.  This also  affects  the
4745                              editing interface used for read -e.
4746                      errexit Same as -e.
4747                      errtrace
4748                              Same as -E.
4749                      functrace
4750                              Same as -T.
4751                      hashall Same as -h.
4752                      histexpand
4753                              Same as -H.
4754                      history Enable command history, as described above under
4755                              HISTORY.  This option is on by default in inter‐
4756                              active shells.
4757                      ignoreeof
4758                              The   effect   is   as   if  the  shell  command
4759                              ``IGNOREEOF=10'' had been  executed  (see  Shell
4760                              Variables above).
4761                      keyword Same as -k.
4762                      monitor Same as -m.
4763                      noclobber
4764                              Same as -C.
4765                      noexec  Same as -n.
4766                      noglob  Same as -f.
4767                      nolog   Currently ignored.
4768                      notify  Same as -b.
4769                      nounset Same as -u.
4770                      onecmd  Same as -t.
4771                      physical
4772                              Same as -P.
4773                      pipefail
4774                              If  set,  the  return value of a pipeline is the
4775                              value of the last (rightmost)  command  to  exit
4776                              with  a non-zero status, or zero if all commands
4777                              in the pipeline exit successfully.  This  option
4778                              is disabled by default.
4779                      posix   Change  the  behavior  of bash where the default
4780                              operation differs from  the  POSIX  standard  to
4781                              match the standard (posix mode).
4782                      privileged
4783                              Same as -p.
4784                      verbose Same as -v.
4785                      vi      Use  a  vi-style command line editing interface.
4786                              This also affects the editing interface used for
4787                              read -e.
4788                      xtrace  Same as -x.
4789                      If -o is supplied with no option-name, the values of the
4790                      current options are printed.  If +o is supplied with  no
4791                      option-name,  a  series  of set commands to recreate the
4792                      current option settings is  displayed  on  the  standard
4793                      output.
4794              -p      Turn  on  privileged  mode.   In this mode, the $ENV and
4795                      $BASH_ENV files are not processed, shell  functions  are
4796                      not  inherited  from the environment, and the SHELLOPTS,
4797                      BASHOPTS, CDPATH,  and  GLOBIGNORE  variables,  if  they
4798                      appear in the environment, are ignored.  If the shell is
4799                      started with the effective user (group) id not equal  to
4800                      the  real user (group) id, and the -p option is not sup‐
4801                      plied, these actions are taken and the effective user id
4802                      is  set  to  the real user id.  If the -p option is sup‐
4803                      plied at startup, the effective user id  is  not  reset.
4804                      Turning  this  option  off causes the effective user and
4805                      group ids to be set to the real user and group ids.
4806              -t      Exit after reading and executing one command.
4807              -u      Treat unset variables and parameters other than the spe‐
4808                      cial  parameters "@" and "*" as an error when performing
4809                      parameter expansion.  If expansion is  attempted  on  an
4810                      unset  variable  or parameter, the shell prints an error
4811                      message, and, if not interactive, exits with a  non-zero
4812                      status.
4813              -v      Print shell input lines as they are read.
4814              -x      After  expanding  each simple command, for command, case
4815                      command, select command, or arithmetic for command, dis‐
4816                      play  the expanded value of PS4, followed by the command
4817                      and its expanded arguments or associated word list.
4818              -B      The shell performs brace expansion (see Brace  Expansion
4819                      above).  This is on by default.
4820              -C      If  set,  bash  does not overwrite an existing file with
4821                      the >, >&, and <> redirection operators.   This  may  be
4822                      overridden when creating output files by using the redi‐
4823                      rection operator >| instead of >.
4824              -E      If set, any trap on ERR is inherited by shell functions,
4825                      command  substitutions,  and commands executed in a sub‐
4826                      shell environment.  The ERR trap is normally not  inher‐
4827                      ited in such cases.
4828              -H      Enable !  style history substitution.  This option is on
4829                      by default when the shell is interactive.
4830              -P      If set, the shell does not follow  symbolic  links  when
4831                      executing  commands  such  as cd that change the current
4832                      working  directory.   It  uses  the  physical  directory
4833                      structure instead.  By default, bash follows the logical
4834                      chain of  directories  when  performing  commands  which
4835                      change the current directory.
4836              -T      If  set,  any traps on DEBUG and RETURN are inherited by
4837                      shell functions,  command  substitutions,  and  commands
4838                      executed  in  a  subshell  environment.   The  DEBUG and
4839                      RETURN traps are normally not inherited in such cases.
4840              --      If no arguments follow this option, then the  positional
4841                      parameters are unset.  Otherwise, the positional parame‐
4842                      ters are set to the args, even if  some  of  them  begin
4843                      with a -.
4844              -       Signal  the  end of options, cause all remaining args to
4845                      be assigned to the positional parameters.  The -x and -v
4846                      options are turned off.  If there are no args, the posi‐
4847                      tional parameters remain unchanged.
4848
4849              The options are off by default unless otherwise noted.  Using  +
4850              rather  than  -  causes  these  options  to  be turned off.  The
4851              options can also be specified as arguments to an  invocation  of
4852              the  shell.  The current set of options may be found in $-.  The
4853              return status is always true unless an invalid option is encoun‐
4854              tered.
4855
4856       shift [n]
4857              The  positional  parameters  from n+1 ... are renamed to $1 ....
4858              Parameters represented by the numbers  $#  down  to  $#-n+1  are
4859              unset.   n  must  be a non-negative number less than or equal to
4860              $#.  If n is 0, no parameters are changed.  If n is  not  given,
4861              it  is assumed to be 1.  If n is greater than $#, the positional
4862              parameters are not changed.  The return status is  greater  than
4863              zero if n is greater than $# or less than zero; otherwise 0.
4864
4865       shopt [-pqsu] [-o] [optname ...]
4866              Toggle the values of variables controlling optional shell behav‐
4867              ior.  With no options, or with the -p option, a list of all set‐
4868              table options is displayed, with an indication of whether or not
4869              each is set.  The -p option causes output to be displayed  in  a
4870              form  that  may be reused as input.  Other options have the fol‐
4871              lowing meanings:
4872              -s     Enable (set) each optname.
4873              -u     Disable (unset) each optname.
4874              -q     Suppresses normal output (quiet mode); the return  status
4875                     indicates whether the optname is set or unset.  If multi‐
4876                     ple optname arguments are given with -q, the return  sta‐
4877                     tus  is zero if all optnames are enabled; non-zero other‐
4878                     wise.
4879              -o     Restricts the values of optname to be those  defined  for
4880                     the -o option to the set builtin.
4881
4882              If  either  -s or -u is used with no optname arguments, the dis‐
4883              play is limited to those options which are set or unset, respec‐
4884              tively.   Unless otherwise noted, the shopt options are disabled
4885              (unset) by default.
4886
4887              The return status when listing options is zero if  all  optnames
4888              are  enabled,  non-zero  otherwise.   When  setting or unsetting
4889              options, the return status is zero unless an optname  is  not  a
4890              valid shell option.
4891
4892              The list of shopt options is:
4893
4894              autocd  If  set,  a command name that is the name of a directory
4895                      is executed as if it were the argument to  the  cd  com‐
4896                      mand.  This option is only used by interactive shells.
4897              cdable_vars
4898                      If  set,  an  argument to the cd builtin command that is
4899                      not a directory is assumed to be the name of a  variable
4900                      whose value is the directory to change to.
4901              cdspell If set, minor errors in the spelling of a directory com‐
4902                      ponent in a cd command will be  corrected.   The  errors
4903                      checked for are transposed characters, a missing charac‐
4904                      ter, and one character too many.   If  a  correction  is
4905                      found,  the corrected file name is printed, and the com‐
4906                      mand proceeds.  This option is only used by  interactive
4907                      shells.
4908              checkhash
4909                      If set, bash checks that a command found in the hash ta‐
4910                      ble exists before trying to execute  it.   If  a  hashed
4911                      command  no  longer exists, a normal path search is per‐
4912                      formed.
4913              checkjobs
4914                      If set, bash lists the status of any stopped and running
4915                      jobs  before  exiting an interactive shell.  If any jobs
4916                      are running, this causes the exit to be deferred until a
4917                      second  exit is attempted without an intervening command
4918                      (see JOB CONTROL above).   The  shell  always  postpones
4919                      exiting if any jobs are stopped.
4920              checkwinsize
4921                      If  set,  bash checks the window size after each command
4922                      and, if necessary, updates the values of LINES and  COL‐
4923                      UMNS.
4924              cmdhist If  set,  bash attempts to save all lines of a multiple-
4925                      line command in the same  history  entry.   This  allows
4926                      easy re-editing of multi-line commands.
4927              compat31
4928                      If set, bash changes its behavior to that of version 3.1
4929                      with respect to quoted arguments to the  [[  conditional
4930                      command's =~ operator.
4931              compat32
4932                      If set, bash changes its behavior to that of version 3.2
4933                      with respect to locale-specific string  comparison  when
4934                      using  the  [[  conditional command's < and > operators.
4935                      Bash versions prior to bash-4.1 use ASCII collation  and
4936                      strcmp(3);  bash-4.1  and later use the current locale's
4937                      collation sequence and strcoll(3).
4938              compat40
4939                      If set, bash changes its behavior to that of version 4.0
4940                      with  respect  to locale-specific string comparison when
4941                      using the [[ conditional command's  <  and  >  operators
4942                      (see  previous  item)  and  the effect of interrupting a
4943                      command list.
4944              compat41
4945                      If set, bash, when in posix mode, treats a single  quote
4946                      in  a  double-quoted  parameter  expansion  as a special
4947                      character.  The single quotes must match (an  even  num‐
4948                      ber)  and  the  characters between the single quotes are
4949                      considered quoted.  This is the behavior of  posix  mode
4950                      through  version 4.1.  The default bash behavior remains
4951                      as in previous versions.
4952              direxpand
4953                      If set, bash replaces directory names with  the  results
4954                      of  word  expansion when performing filename completion.
4955                      This changes the contents of the readline  editing  buf‐
4956                      fer.   If  not  set,  bash attempts to preserve what the
4957                      user typed.
4958              dirspell
4959                      If set, bash attempts spelling correction  on  directory
4960                      names  during word completion if the directory name ini‐
4961                      tially supplied does not exist.
4962              dotglob If set, bash includes filenames beginning with a `.'  in
4963                      the results of pathname expansion.
4964              execfail
4965                      If set, a non-interactive shell will not exit if it can‐
4966                      not execute the file specified as  an  argument  to  the
4967                      exec  builtin  command.   An  interactive shell does not
4968                      exit if exec fails.
4969              expand_aliases
4970                      If set, aliases are expanded as  described  above  under
4971                      ALIASES.  This option is enabled by default for interac‐
4972                      tive shells.
4973              extdebug
4974                      If set,  behavior  intended  for  use  by  debuggers  is
4975                      enabled:
4976                      1.     The -F option to the declare builtin displays the
4977                             source file name and line number corresponding to
4978                             each function name supplied as an argument.
4979                      2.     If  the  command  run by the DEBUG trap returns a
4980                             non-zero value, the next command is  skipped  and
4981                             not executed.
4982                      3.     If  the  command  run by the DEBUG trap returns a
4983                             value of 2, and the shell is executing in a  sub‐
4984                             routine  (a shell function or a shell script exe‐
4985                             cuted by the . or source  builtins),  a  call  to
4986                             return is simulated.
4987                      4.     BASH_ARGC  and BASH_ARGV are updated as described
4988                             in their descriptions above.
4989                      5.     Function tracing is enabled:   command  substitu‐
4990                             tion, shell functions, and subshells invoked with
4991                             ( command ) inherit the DEBUG and RETURN traps.
4992                      6.     Error tracing is enabled:  command  substitution,
4993                             shell  functions,  and  subshells  invoked with (
4994                             command ) inherit the ERR trap.
4995              extglob If set, the extended pattern matching features described
4996                      above under Pathname Expansion are enabled.
4997              extquote
4998                      If  set,  $'string'  and  $"string" quoting is performed
4999                      within  ${parameter}  expansions  enclosed   in   double
5000                      quotes.  This option is enabled by default.
5001              failglob
5002                      If  set,  patterns  which fail to match filenames during
5003                      pathname expansion result in an expansion error.
5004              force_fignore
5005                      If set, the suffixes  specified  by  the  FIGNORE  shell
5006                      variable  cause words to be ignored when performing word
5007                      completion even if the ignored words are the only possi‐
5008                      ble  completions.   See  SHELL  VARIABLES  above  for  a
5009                      description of  FIGNORE.   This  option  is  enabled  by
5010                      default.
5011              globstar
5012                      If set, the pattern ** used in a pathname expansion con‐
5013                      text will match all files and zero or  more  directories
5014                      and  subdirectories.  If the pattern is followed by a /,
5015                      only directories and subdirectories match.
5016              gnu_errfmt
5017                      If set, shell error messages are written in the standard
5018                      GNU error message format.
5019              histappend
5020                      If  set,  the history list is appended to the file named
5021                      by the value of the HISTFILE  variable  when  the  shell
5022                      exits, rather than overwriting the file.
5023              histreedit
5024                      If  set, and readline is being used, a user is given the
5025                      opportunity to re-edit a failed history substitution.
5026              histverify
5027                      If set, and readline is being used, the results of  his‐
5028                      tory  substitution  are  not  immediately  passed to the
5029                      shell parser.  Instead, the  resulting  line  is  loaded
5030                      into the readline editing buffer, allowing further modi‐
5031                      fication.
5032              hostcomplete
5033                      If set, and readline is being used, bash will attempt to
5034                      perform  hostname  completion when a word containing a @
5035                      is  being  completed  (see  Completing  under   READLINE
5036                      above).  This is enabled by default.
5037              huponexit
5038                      If set, bash will send SIGHUP to all jobs when an inter‐
5039                      active login shell exits.
5040              interactive_comments
5041                      If set, allow a word beginning with # to cause that word
5042                      and  all remaining characters on that line to be ignored
5043                      in an interactive  shell  (see  COMMENTS  above).   This
5044                      option is enabled by default.
5045              lastpipe
5046                      If  set,  and  job control is not active, the shell runs
5047                      the last command of a pipeline not executed in the back‐
5048                      ground in the current shell environment.
5049              lithist If  set,  and  the cmdhist option is enabled, multi-line
5050                      commands are saved to the history with embedded newlines
5051                      rather than using semicolon separators where possible.
5052              login_shell
5053                      The  shell  sets this option if it is started as a login
5054                      shell (see INVOCATION above).   The  value  may  not  be
5055                      changed.
5056              mailwarn
5057                      If  set,  and  a file that bash is checking for mail has
5058                      been accessed since the last time it  was  checked,  the
5059                      message  ``The  mail in mailfile has been read'' is dis‐
5060                      played.
5061              no_empty_cmd_completion
5062                      If set, and  readline  is  being  used,  bash  will  not
5063                      attempt to search the PATH for possible completions when
5064                      completion is attempted on an empty line.
5065              nocaseglob
5066                      If set, bash matches  filenames  in  a  case-insensitive
5067                      fashion when performing pathname expansion (see Pathname
5068                      Expansion above).
5069              nocasematch
5070                      If set, bash  matches  patterns  in  a  case-insensitive
5071                      fashion when performing matching while executing case or
5072                      [[ conditional commands.
5073              nullglob
5074                      If set, bash allows patterns which match no  files  (see
5075                      Pathname  Expansion  above)  to expand to a null string,
5076                      rather than themselves.
5077              progcomp
5078                      If set, the programmable completion facilities (see Pro‐
5079                      grammable Completion above) are enabled.  This option is
5080                      enabled by default.
5081              promptvars
5082                      If set, prompt strings undergo parameter expansion, com‐
5083                      mand   substitution,  arithmetic  expansion,  and  quote
5084                      removal after being expanded as described  in  PROMPTING
5085                      above.  This option is enabled by default.
5086              restricted_shell
5087                      The   shell  sets  this  option  if  it  is  started  in
5088                      restricted mode (see RESTRICTED SHELL below).  The value
5089                      may  not be changed.  This is not reset when the startup
5090                      files are executed, allowing the startup files  to  dis‐
5091                      cover whether or not a shell is restricted.
5092              shift_verbose
5093                      If  set,  the shift builtin prints an error message when
5094                      the shift count exceeds the number of positional parame‐
5095                      ters.
5096              sourcepath
5097                      If set, the source (.) builtin uses the value of PATH to
5098                      find the directory containing the file  supplied  as  an
5099                      argument.  This option is enabled by default.
5100              xpg_echo
5101                      If   set,  the  echo  builtin  expands  backslash-escape
5102                      sequences by default.
5103
5104       suspend [-f]
5105              Suspend the execution of this shell until it receives a  SIGCONT
5106              signal. When the suspended shell is a background process, it can
5107              be restarted by the fg command. For more information,  read  the
5108              JOB  CONTROL  section.  The  suspend command can not suspend the
5109              login shell. However, when -f option is specified, suspend  com‐
5110              mand  can  suspend  even  login  shell.   The return status is 0
5111              unless the shell is a login shell and -f is not supplied, or  if
5112              job control is not enabled.
5113
5114       test expr
5115       [ expr ]
5116              Return  a  status  of  0 or 1 depending on the evaluation of the
5117              conditional expression expr.  Each operator and operand must  be
5118              a  separate argument.  Expressions are composed of the primaries
5119              described above under CONDITIONAL EXPRESSIONS.   test  does  not
5120              accept any options, nor does it accept and ignore an argument of
5121              -- as signifying the end of options.
5122
5123              Expressions may  be  combined  using  the  following  operators,
5124              listed  in  decreasing  order  of  precedence.   The  evaluation
5125              depends on the number of arguments; see below.  Operator  prece‐
5126              dence is used when there are five or more arguments.
5127              ! expr True if expr is false.
5128              ( expr )
5129                     Returns  the value of expr.  This may be used to override
5130                     the normal precedence of operators.
5131              expr1 -a expr2
5132                     True if both expr1 and expr2 are true.
5133              expr1 -o expr2
5134                     True if either expr1 or expr2 is true.
5135
5136              test and [ evaluate conditional expressions using a set of rules
5137              based on the number of arguments.
5138
5139              0 arguments
5140                     The expression is false.
5141              1 argument
5142                     The expression is true if and only if the argument is not
5143                     null.
5144              2 arguments
5145                     If the first argument is !, the expression is true if and
5146                     only  if the second argument is null.  If the first argu‐
5147                     ment is one of the  unary  conditional  operators  listed
5148                     above  under  CONDITIONAL  EXPRESSIONS, the expression is
5149                     true if the unary test is true.  If the first argument is
5150                     not a valid unary conditional operator, the expression is
5151                     false.
5152              3 arguments
5153                     The following conditions are applied in the order listed.
5154                     If  the  second argument is one of the binary conditional
5155                     operators listed above under CONDITIONAL EXPRESSIONS, the
5156                     result of the expression is the result of the binary test
5157                     using the first and third arguments as operands.  The  -a
5158                     and  -o  operators  are  considered binary operators when
5159                     there are three arguments.  If the first argument  is  !,
5160                     the  value is the negation of the two-argument test using
5161                     the second and third arguments.  If the first argument is
5162                     exactly ( and the third argument is exactly ), the result
5163                     is the one-argument test of the second argument.   Other‐
5164                     wise, the expression is false.
5165              4 arguments
5166                     If the first argument is !, the result is the negation of
5167                     the three-argument expression composed of  the  remaining
5168                     arguments.  Otherwise, the expression is parsed and eval‐
5169                     uated according to  precedence  using  the  rules  listed
5170                     above.
5171              5 or more arguments
5172                     The  expression  is  parsed  and  evaluated  according to
5173                     precedence using the rules listed above.
5174
5175              When used with test or [, the < and  >  operators  sort  lexico‐
5176              graphically using ASCII ordering.
5177
5178       times  Print  the  accumulated  user and system times for the shell and
5179              for processes run from the shell.  The return status is 0.
5180
5181       trap [-lp] [[arg] sigspec ...]
5182              The command arg is to  be  read  and  executed  when  the  shell
5183              receives  signal(s)  sigspec.   If arg is absent (and there is a
5184              single sigspec) or -, each specified  signal  is  reset  to  its
5185              original  disposition  (the  value  it  had upon entrance to the
5186              shell).  If arg is the null string the signal specified by  each
5187              sigspec  is ignored by the shell and by the commands it invokes.
5188              If arg is not present and -p has been supplied,  then  the  trap
5189              commands  associated  with  each  sigspec  are displayed.  If no
5190              arguments are supplied or if only -p is given, trap  prints  the
5191              list  of  commands  associated  with each signal.  The -l option
5192              causes the shell to print a list of signal names and their  cor‐
5193              responding  numbers.   Each  sigspec  is  either  a  signal name
5194              defined in <signal.h>, or a signal  number.   Signal  names  are
5195              case insensitive and the SIG prefix is optional.
5196
5197              If  a  sigspec  is  EXIT (0) the command arg is executed on exit
5198              from the shell.  If a sigspec is DEBUG, the command arg is  exe‐
5199              cuted  before  every  simple command, for command, case command,
5200              select command, every arithmetic for  command,  and  before  the
5201              first  command  executes  in a shell function (see SHELL GRAMMAR
5202              above).  Refer to the description of the extdebug option to  the
5203              shopt builtin for details of its effect on the DEBUG trap.  If a
5204              sigspec is RETURN, the command arg is executed each time a shell
5205              function or a script executed with the . or source builtins fin‐
5206              ishes executing.
5207
5208              If a sigspec is ERR, the command arg is executed whenever a sim‐
5209              ple command has a non-zero exit status, subject to the following
5210              conditions.  The ERR trap is not executed if the failed  command
5211              is  part  of  the  command list immediately following a while or
5212              until keyword, part of the test in an if statement,  part  of  a
5213              command  executed in a && or || list, or if the command's return
5214              value is being inverted via !.  These are  the  same  conditions
5215              obeyed by the errexit option.
5216
5217              Signals ignored upon entry to the shell cannot be trapped, reset
5218              or listed.  Trapped signals that are not being ignored are reset
5219              to  their  original values in a subshell or subshell environment
5220              when one is created.  The return status is false if any  sigspec
5221              is invalid; otherwise trap returns true.
5222
5223       type [-aftpP] name [name ...]
5224              With  no options, indicate how each name would be interpreted if
5225              used as a command name.  If the -t option is used, type prints a
5226              string  which  is  one  of alias, keyword, function, builtin, or
5227              file if  name  is  an  alias,  shell  reserved  word,  function,
5228              builtin,  or disk file, respectively.  If the name is not found,
5229              then nothing  is  printed,  and  an  exit  status  of  false  is
5230              returned.   If  the  -p  option is used, type either returns the
5231              name of the disk file that would be executed if name were speci‐
5232              fied as a command name, or nothing if ``type -t name'' would not
5233              return file.  The -P option forces a PATH search for each  name,
5234              even if ``type -t name'' would not return file.  If a command is
5235              hashed, -p and -P print the hashed value,  not  necessarily  the
5236              file that appears first in PATH.  If the -a option is used, type
5237              prints all of the places that contain an executable named  name.
5238              This  includes  aliases  and  functions,  if  and only if the -p
5239              option is not also used.  The table of hashed  commands  is  not
5240              consulted  when  using -a.  The -f option suppresses shell func‐
5241              tion lookup, as with the command builtin.  type returns true  if
5242              all of the arguments are found, false if any are not found.
5243
5244       ulimit [-HSTabcdefilmnpqrstuvx [limit]]
5245              Provides  control  over the resources available to the shell and
5246              to processes started by it, on systems that allow such  control.
5247              The -H and -S options specify that the hard or soft limit is set
5248              for the given resource.  A hard limit cannot be increased  by  a
5249              non-root  user  once it is set; a soft limit may be increased up
5250              to the value of the hard limit.  If neither -H nor -S is  speci‐
5251              fied, both the soft and hard limits are set.  The value of limit
5252              can be a number in the unit specified for the resource or one of
5253              the special values hard, soft, or unlimited, which stand for the
5254              current hard limit,  the  current  soft  limit,  and  no  limit,
5255              respectively.   If  limit  is  omitted, the current value of the
5256              soft limit of the resource is printed, unless the -H  option  is
5257              given.  When more than one resource is specified, the limit name
5258              and unit are printed before the value.  Other options are inter‐
5259              preted as follows:
5260              -a     All current limits are reported
5261              -b     The maximum socket buffer size
5262              -c     The maximum size of core files created
5263              -d     The maximum size of a process's data segment
5264              -e     The maximum scheduling priority ("nice")
5265              -f     The  maximum  size  of files written by the shell and its
5266                     children
5267              -i     The maximum number of pending signals
5268              -l     The maximum size that may be locked into memory
5269              -m     The maximum resident set size (many systems do not  honor
5270                     this limit)
5271              -n     The maximum number of open file descriptors (most systems
5272                     do not allow this value to be set)
5273              -p     The pipe size in 512-byte blocks (this may not be set)
5274              -q     The maximum number of bytes in POSIX message queues
5275              -r     The maximum real-time scheduling priority
5276              -s     The maximum stack size
5277              -t     The maximum amount of cpu time in seconds
5278              -u     The maximum number of processes  available  to  a  single
5279                     user
5280              -v     The  maximum  amount  of  virtual memory available to the
5281                     shell and, on some systems, to its children
5282              -x     The maximum number of file locks
5283              -T     The maximum number of threads
5284
5285              If limit is given, it is the new value of the specified resource
5286              (the -a option is display only).  If no option is given, then -f
5287              is assumed.  Values are in 1024-byte increments, except for  -t,
5288              which  is  in seconds, -p, which is in units of 512-byte blocks,
5289              and -T, -b, -n, and -u, which are unscaled values.   The  return
5290              status is 0 unless an invalid option or argument is supplied, or
5291              an error occurs while  setting  a  new  limit.   In  POSIX  Mode
5292              512-byte blocks are used for the `-c' and `-f' options.
5293
5294       umask [-p] [-S] [mode]
5295              The user file-creation mask is set to mode.  If mode begins with
5296              a digit, it is interpreted as an octal number; otherwise  it  is
5297              interpreted  as a symbolic mode mask similar to that accepted by
5298              chmod(1).  If mode is omitted, the current value of the mask  is
5299              printed.   The  -S  option causes the mask to be printed in sym‐
5300              bolic form; the default output is an octal number.   If  the  -p
5301              option is supplied, and mode is omitted, the output is in a form
5302              that may be reused as input.  The return status is 0 if the mode
5303              was  successfully  changed  or if no mode argument was supplied,
5304              and false otherwise.
5305
5306       unalias [-a] [name ...]
5307              Remove each name from the list of defined  aliases.   If  -a  is
5308              supplied,  all  alias definitions are removed.  The return value
5309              is true unless a supplied name is not a defined alias.
5310
5311       unset [-fv] [name ...]
5312              For each name, remove the corresponding  variable  or  function.
5313              If no options are supplied, or the -v option is given, each name
5314              refers to a shell variable.   Read-only  variables  may  not  be
5315              unset.   If  -f  is specified, each name refers to a shell func‐
5316              tion, and the function definition is removed.  Each unset  vari‐
5317              able  or function is removed from the environment passed to sub‐
5318              sequent commands.  If any of COMP_WORDBREAKS,  RANDOM,  SECONDS,
5319              LINENO,  HISTCMD,  FUNCNAME, GROUPS, or DIRSTACK are unset, they
5320              lose their special properties, even  if  they  are  subsequently
5321              reset.  The exit status is true unless a name is readonly.
5322
5323       wait [n ...]
5324              Wait  for each specified process and return its termination sta‐
5325              tus.  Each n may be a process ID or a job  specification;  if  a
5326              job  spec  is  given,  all  processes in that job's pipeline are
5327              waited for.  If n is not given, all currently active child  pro‐
5328              cesses  are  waited  for,  and  the return status is zero.  If n
5329              specifies a non-existent process or job, the  return  status  is
5330              127.   Otherwise,  the  return  status is the exit status of the
5331              last process or job waited for.
5332

RESTRICTED SHELL

5334       If bash is started with the name rbash, or the -r option is supplied at
5335       invocation,  the  shell becomes restricted.  A restricted shell is used
5336       to set up an environment more controlled than the standard  shell.   It
5337       behaves  identically  to bash with the exception that the following are
5338       disallowed or not performed:
5339
5340       ·      changing directories with cd
5341
5342       ·      setting or unsetting the values of SHELL, PATH, ENV, or BASH_ENV
5343
5344       ·      specifying command names containing /
5345
5346       ·      specifying a file name containing a / as an argument  to  the  .
5347              builtin command
5348
5349       ·      specifying  a  filename containing a slash as an argument to the
5350              -p option to the hash builtin command
5351
5352       ·      importing function definitions from  the  shell  environment  at
5353              startup
5354
5355       ·      parsing  the  value  of  SHELLOPTS from the shell environment at
5356              startup
5357
5358       ·      redirecting output using the >, >|, <>, >&, &>, and >> redirect‐
5359              ion operators
5360
5361       ·      using the exec builtin command to replace the shell with another
5362              command
5363
5364       ·      adding or deleting builtin commands with the -f and  -d  options
5365              to the enable builtin command
5366
5367       ·      using  the  enable  builtin  command  to  enable  disabled shell
5368              builtins
5369
5370       ·      specifying the -p option to the command builtin command
5371
5372       ·      turning off restricted mode with set +r or set +o restricted.
5373
5374       These restrictions are enforced after any startup files are read.
5375
5376       When a command that is found to be a shell script is executed (see COM‐
5377       MAND  EXECUTION  above),  rbash turns off any restrictions in the shell
5378       spawned to execute the script.
5379

SEE ALSO

5381       Bash Reference Manual, Brian Fox and Chet Ramey
5382       The Gnu Readline Library, Brian Fox and Chet Ramey
5383       The Gnu History Library, Brian Fox and Chet Ramey
5384       Portable Operating System Interface (POSIX) Part 2:  Shell  and  Utili‐
5385       ties, IEEE
5386       sh(1), ksh(1), csh(1)
5387       emacs(1), vi(1)
5388       readline(3)
5389

FILES

5391       /bin/bash
5392              The bash executable
5393       /etc/profile
5394              The systemwide initialization file, executed for login shells
5395       /etc/bash.bash_logout
5396              The  systemwide  login shell cleanup file, executed when a login
5397              shell exits
5398       ~/.bash_profile
5399              The personal initialization file, executed for login shells
5400       ~/.bashrc
5401              The individual per-interactive-shell startup file
5402       ~/.bash_logout
5403              The individual login shell cleanup file, executed when  a  login
5404              shell exits
5405       ~/.inputrc
5406              Individual readline initialization file
5407

AUTHORS

5409       Brian Fox, Free Software Foundation
5410       bfox@gnu.org
5411
5412       Chet Ramey, Case Western Reserve University
5413       chet.ramey@case.edu
5414

BUG REPORTS

5416       If you find a bug in bash, you should report it.  But first, you should
5417       make sure that it really is a bug, and that it appears  in  the  latest
5418       version   of  bash.   The  latest  version  is  always  available  from
5419       ftp://ftp.gnu.org/pub/gnu/bash/.
5420
5421       Once you have determined that a bug actually exists,  use  the  bashbug
5422       command  (from the source package) to submit a bug report.  If you have
5423       a fix, you are encouraged  to  mail  that  as  well!   Suggestions  and
5424       `philosophical' bug reports may be mailed to bug-bash@gnu.org or posted
5425       to the Usenet newsgroup gnu.bash.bug.
5426
5427       ALL bug reports should include:
5428
5429       The version number of bash
5430       The hardware and operating system
5431       The compiler used to compile
5432       A description of the bug behaviour
5433       A short script or `recipe' which exercises the bug
5434
5435       Comments and bug reports concerning this manual page should be directed
5436       to chet.ramey@case.edu.
5437

BUGS

5439       It's too big and too slow.
5440
5441       There are some subtle differences between bash and traditional versions
5442       of sh, mostly because of the POSIX specification.
5443
5444       Aliases are confusing in some uses.
5445
5446       Shell builtin commands and functions are not stoppable/restartable.
5447
5448       Compound commands and command sequences of the form `a ; b ; c' are not
5449       handled  gracefully  when  process  suspension  is  attempted.   When a
5450       process is stopped, the shell immediately executes the next command  in
5451       the  sequence.   It  suffices to place the sequence of commands between
5452       parentheses to force it into a subshell, which  may  be  stopped  as  a
5453       unit.
5454
5455       Array variables may not (yet) be exported.
5456
5457       There may be only one active coprocess at a time.
5458
5459
5460
5461GNU Bash-4.2                   2010 December 28                        BASH(1)
Impressum