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

NAME

6       bash - GNU Bourne-Again SHell
7

SYNOPSIS

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

ARGUMENTS

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

INVOCATION

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

DEFINITIONS

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

RESERVED WORDS

238       Reserved words are words that have a special meaning to the shell.  The
239       following words are recognized as reserved when unquoted and either the
240       first  word of a command (see SHELL GRAMMAR below), the third word of a
241       case or select command (only in is valid), or the third word of  a  for
242       command (only in and do are valid):
243
244       !  case   coproc   do  done elif else esac fi for function if in select
245       then until while { } time [[ ]]
246

SHELL GRAMMAR

248       This section describes the syntax of the various forms  of  shell  com‐
249       mands.
250
251   Simple Commands
252       A  simple  command  is a sequence of optional variable assignments fol‐
253       lowed by blank-separated words and redirections, and  terminated  by  a
254       control operator.  The first word specifies the command to be executed,
255       and is passed as argument zero.  The remaining words are passed as  ar‐
256       guments to the invoked command.
257
258       The  return  value  of a simple command is its exit status, or 128+n if
259       the command is terminated by signal n.
260
261   Pipelines
262       A pipeline is a sequence of one or more commands separated  by  one  of
263       the control operators | or |&.  The format for a pipeline is:
264
265              [time [-p]] [ ! ] command1 [ [||&] command2 ... ]
266
267       The standard output of command1 is connected via a pipe to the standard
268       input of command2.  This connection is performed  before  any  redirec‐
269       tions specified by the command1(see REDIRECTION below).  If |& is used,
270       command1's standard error, in addition to its standard output, is  con‐
271       nected  to  command2's standard input through the pipe; it is shorthand
272       for 2>&1 |.  This implicit redirection of the  standard  error  to  the
273       standard  output  is performed after any redirections specified by com‐
274       mand1.
275
276       The return status of a pipeline is the exit status of the last command,
277       unless  the  pipefail  option  is enabled.  If pipefail is enabled, the
278       pipeline's return status is the value of the last  (rightmost)  command
279       to  exit  with a non-zero status, or zero if all commands exit success‐
280       fully.  If the reserved word !  precedes a pipeline, the exit status of
281       that  pipeline  is the logical negation of the exit status as described
282       above.  The shell waits for all commands in the pipeline  to  terminate
283       before returning a value.
284
285       If  the  time reserved word precedes a pipeline, the elapsed as well as
286       user and system time consumed by its execution are  reported  when  the
287       pipeline  terminates.   The -p option changes the output format to that
288       specified by POSIX.  When the shell is in posix mode, it does not  rec‐
289       ognize  time  as  a  reserved word if the next token begins with a `-'.
290       The TIMEFORMAT variable may be set to a format  string  that  specifies
291       how  the timing information should be displayed; see the description of
292       TIMEFORMAT under Shell Variables below.
293
294       When the shell is in posix mode, time may be followed by a newline.  In
295       this  case,  the shell displays the total user and system time consumed
296       by the shell and its children.  The TIMEFORMAT variable may be used  to
297       specify the format of the time information.
298
299       Each  command  in a multi-command pipeline, where pipes are created, is
300       executed in a subshell, which is a separate process.  See COMMAND  EXE‐
301       CUTION  ENVIRONMENT for a description of subshells and a subshell envi‐
302       ronment.  If the lastpipe option is enabled  using  the  shopt  builtin
303       (see  the  description  of shopt below), the last element of a pipeline
304       may be run by the shell process when job control is not active.
305
306   Lists
307       A list is a sequence of one or more pipelines separated by one  of  the
308       operators ;, &, &&, or ||, and optionally terminated by one of ;, &, or
309       <newline>.
310
311       Of these list operators, && and || have equal precedence, followed by ;
312       and &, which have equal precedence.
313
314       A  sequence  of  one or more newlines may appear in a list instead of a
315       semicolon to delimit commands.
316
317       If a command is terminated by the control operator &,  the  shell  exe‐
318       cutes  the command in the background in a subshell.  The shell does not
319       wait for the command to finish, and the return status is 0.  These  are
320       referred  to  as  asynchronous commands.  Commands separated by a ; are
321       executed sequentially; the shell waits for each command to terminate in
322       turn.   The  return  status is the exit status of the last command exe‐
323       cuted.
324
325       AND and OR lists are sequences of one or more  pipelines  separated  by
326       the  &&  and  || control operators, respectively.  AND and OR lists are
327       executed with left associativity.  An AND list has the form
328
329              command1 && command2
330
331       command2 is executed if, and only if, command1 returns an  exit  status
332       of zero (success).
333
334       An OR list has the form
335
336              command1 || command2
337
338       command2  is executed if, and only if, command1 returns a non-zero exit
339       status.  The return status of AND and OR lists is the  exit  status  of
340       the last command executed in the list.
341
342   Compound Commands
343       A  compound command is one of the following.  In most cases a list in a
344       command's description may be separated from the rest of the command  by
345       one  or  more  newlines, and may be followed by a newline in place of a
346       semicolon.
347
348       (list) list is executed in a subshell (see COMMAND  EXECUTION  ENVIRON‐
349              MENT  below for a description of a subshell environment).  Vari‐
350              able assignments and builtin commands that  affect  the  shell's
351              environment do not remain in effect after the command completes.
352              The return status is the exit status of list.
353
354       { list; }
355              list is simply executed in the current shell environment.   list
356              must  be  terminated with a newline or semicolon.  This is known
357              as a group command.  The return status is  the  exit  status  of
358              list.   Note that unlike the metacharacters ( and ), { and } are
359              reserved words and must occur where a reserved word is permitted
360              to  be  recognized.   Since they do not cause a word break, they
361              must be separated from  list  by  whitespace  or  another  shell
362              metacharacter.
363
364       ((expression))
365              The expression is evaluated according to the rules described be‐
366              low under ARITHMETIC EVALUATION.  If the value of the expression
367              is non-zero, the return status is 0; otherwise the return status
368              is 1.  The expression undergoes the same  expansions  as  if  it
369              were  within  double  quotes, but double quote characters in ex‐
370              pression are not treated specially and are removed.
371
372       [[ expression ]]
373              Return a status of 0 or 1 depending on  the  evaluation  of  the
374              conditional  expression expression.  Expressions are composed of
375              the primaries described  below  under  CONDITIONAL  EXPRESSIONS.
376              The  words  between  the [[ and ]] do not undergo word splitting
377              and pathname expansion.  The shell performs tilde expansion, pa‐
378              rameter  and  variable  expansion, arithmetic expansion, command
379              substitution, process substitution, and quote removal  on  those
380              words  (the  expansions  that  would occur if the words were en‐
381              closed in double quotes).  Conditional operators such as -f must
382              be unquoted to be recognized as primaries.
383
384              When  used with [[, the < and > operators sort lexicographically
385              using the current locale.
386
387              When the == and != operators are used, the string to  the  right
388              of the operator is considered a pattern and matched according to
389              the rules described below under Pattern Matching, as if the ext‐
390              glob shell option were enabled.  The = operator is equivalent to
391              ==.  If the nocasematch shell option is enabled,  the  match  is
392              performed  without  regard to the case of alphabetic characters.
393              The return value is 0 if the string matches  (==)  or  does  not
394              match  (!=)  the pattern, and 1 otherwise.  Any part of the pat‐
395              tern may be quoted to force the quoted portion to be matched  as
396              a string.
397
398              An  additional  binary operator, =~, is available, with the same
399              precedence as == and !=.  When it is used,  the  string  to  the
400              right of the operator is considered a POSIX extended regular ex‐
401              pression and matched accordingly (using the  POSIX  regcomp  and
402              regexec  interfaces  usually described in regex(3)).  The return
403              value is 0 if the string matches the pattern, and  1  otherwise.
404              If the regular expression is syntactically incorrect, the condi‐
405              tional expression's return value is 2.  If the nocasematch shell
406              option  is enabled, the match is performed without regard to the
407              case of alphabetic characters.  If any part of  the  pattern  is
408              quoted, the quoted portion is matched literally.  This means ev‐
409              ery character in the quoted portion matches itself,  instead  of
410              having  any special pattern matching meaning.  If the pattern is
411              stored in a  shell  variable,  quoting  the  variable  expansion
412              forces  the  entire  pattern  to  be  matched  literally.  Treat
413              bracket expressions in regular expressions carefully, since nor‐
414              mal  quoting  and pattern characters lose their meanings between
415              brackets.
416
417              The pattern will match if it matches any  part  of  the  string.
418              Anchor  the  pattern using the ^ and $ regular expression opera‐
419              tors to force it to match the entire string.  The array variable
420              BASH_REMATCH  records which parts of the string matched the pat‐
421              tern.  The element of BASH_REMATCH with  index  0  contains  the
422              portion  of  the  string matching the entire regular expression.
423              Substrings matched by parenthesized  subexpressions  within  the
424              regular  expression  are saved in the remaining BASH_REMATCH in‐
425              dices. The element of BASH_REMATCH with index n is  the  portion
426              of  the  string  matching  the  nth parenthesized subexpression.
427              Bash sets BASH_REMATCH in the global scope; declaring  it  as  a
428              local variable will lead to unexpected results.
429
430              Expressions  may  be  combined  using  the  following operators,
431              listed in decreasing order of precedence:
432
433              ( expression )
434                     Returns the value of expression.  This  may  be  used  to
435                     override the normal precedence of operators.
436              ! expression
437                     True if expression is false.
438              expression1 && expression2
439                     True if both expression1 and expression2 are true.
440              expression1 || expression2
441                     True if either expression1 or expression2 is true.
442
443              The && and || operators do not evaluate expression2 if the value
444              of expression1 is sufficient to determine the  return  value  of
445              the entire conditional expression.
446
447       for name [ [ in [ word ... ] ] ; ] do list ; done
448              The list of words following in is expanded, generating a list of
449              items.  The variable name is set to each element of this list in
450              turn,  and  list is executed each time.  If the in word is omit‐
451              ted, the for command executes list once for each positional  pa‐
452              rameter  that  is set (see PARAMETERS below).  The return status
453              is the exit status of the last command that  executes.   If  the
454              expansion of the items following in results in an empty list, no
455              commands are executed, and the return status is 0.
456
457       for (( expr1 ; expr2 ; expr3 )) ; do list ; done
458              First, the arithmetic expression expr1 is evaluated according to
459              the  rules  described  below  under  ARITHMETIC EVALUATION.  The
460              arithmetic expression expr2 is then evaluated  repeatedly  until
461              it  evaluates  to zero.  Each time expr2 evaluates to a non-zero
462              value, list is executed and the arithmetic expression  expr3  is
463              evaluated.   If  any  expression is omitted, it behaves as if it
464              evaluates to 1.  The return value is the exit status of the last
465              command in list that is executed, or false if any of the expres‐
466              sions is invalid.
467
468       select name [ in word ] ; do list ; done
469              The list of words following in is expanded, generating a list of
470              items,  and the set of expanded words is printed on the standard
471              error, each preceded by a number.  If the in  word  is  omitted,
472              the  positional  parameters  are printed (see PARAMETERS below).
473              select then displays the PS3 prompt and reads a  line  from  the
474              standard  input.  If the line consists of a number corresponding
475              to one of the displayed words, then the value of name is set  to
476              that  word.  If the line is empty, the words and prompt are dis‐
477              played again.  If EOF is read, the select command completes  and
478              returns  1.  Any other value read causes name to be set to null.
479              The line read is saved in the variable REPLY.  The list is  exe‐
480              cuted  after  each  selection until a break command is executed.
481              The exit status of select is the exit status of the last command
482              executed in list, or zero if no commands were executed.
483
484       case word in [ [(] pattern [ | pattern ] ... ) list ;; ] ... esac
485              A case command first expands word, and tries to match it against
486              each pattern in turn, using the matching rules  described  under
487              Pattern Matching below.  The word is expanded using tilde expan‐
488              sion, parameter and variable  expansion,  arithmetic  expansion,
489              command  substitution,  process  substitution and quote removal.
490              Each pattern examined is expanded using tilde expansion, parame‐
491              ter  and  variable expansion, arithmetic expansion, command sub‐
492              stitution, process substitution, and quote removal.  If the  no‐
493              casematch  shell option is enabled, the match is performed with‐
494              out regard to the case of alphabetic characters.  When  a  match
495              is  found, the corresponding list is executed.  If the ;; opera‐
496              tor is used, no subsequent matches are attempted after the first
497              pattern match.  Using ;& in place of ;; causes execution to con‐
498              tinue with the list associated with the next  set  of  patterns.
499              Using  ;;& in place of ;; causes the shell to test the next pat‐
500              tern list in the statement, if any, and execute  any  associated
501              list on a successful match, continuing the case statement execu‐
502              tion as if the pattern list had not matched.  The exit status is
503              zero if no pattern matches.  Otherwise, it is the exit status of
504              the last command executed in list.
505
506       if list; then list; [ elif list; then list; ] ... [ else list; ] fi
507              The if list is executed.  If its exit status is zero,  the  then
508              list  is  executed.   Otherwise,  each  elif list is executed in
509              turn, and if its exit status is  zero,  the  corresponding  then
510              list is executed and the command completes.  Otherwise, the else
511              list is executed, if present.  The exit status is the exit  sta‐
512              tus of the last command executed, or zero if no condition tested
513              true.
514
515       while list-1; do list-2; done
516       until list-1; do list-2; done
517              The while command continuously executes the list list-2 as  long
518              as the last command in the list list-1 returns an exit status of
519              zero.  The until command is identical to the while command,  ex‐
520              cept that the test is negated: list-2 is executed as long as the
521              last command in list-1 returns a non-zero exit status.  The exit
522              status of the while and until commands is the exit status of the
523              last command executed in list-2, or zero if none was executed.
524
525   Coprocesses
526       A coprocess is a shell command preceded by the coproc reserved word.  A
527       coprocess  is  executed asynchronously in a subshell, as if the command
528       had been terminated with the & control operator, with  a  two-way  pipe
529       established between the executing shell and the coprocess.
530
531       The syntax for a coprocess is:
532
533              coproc [NAME] command [redirections]
534
535       This  creates  a  coprocess named NAME.  command may be either a simple
536       command or a compound command (see above).  NAME is  a  shell  variable
537       name.  If NAME is not supplied, the default name is COPROC.
538
539       The recommended form to use for a coprocess is
540
541              coproc NAME { command [redirections]; }
542
543       This  form  is recommended because simple commands result in the copro‐
544       cess always being named COPROC, and it is simpler to use and more  com‐
545       plete than the other compound commands.
546
547       If  command is a compound command, NAME is optional. The word following
548       coproc determines whether that word is interpreted as a variable  name:
549       it  is interpreted as NAME if it is not a reserved word that introduces
550       a compound command.  If command is a simple command, NAME  is  not  al‐
551       lowed;  this  is  to avoid confusion between NAME and the first word of
552       the simple command.
553
554       When the coprocess is executed, the shell  creates  an  array  variable
555       (see  Arrays  below)  named NAME in the context of the executing shell.
556       The standard output of command is connected via a pipe to  a  file  de‐
557       scriptor  in  the executing shell, and that file descriptor is assigned
558       to NAME[0].  The standard input of command is connected via a pipe to a
559       file descriptor in the executing shell, and that file descriptor is as‐
560       signed to NAME[1].  This pipe is established  before  any  redirections
561       specified by the command (see REDIRECTION below).  The file descriptors
562       can be utilized as arguments to shell commands and  redirections  using
563       standard  word expansions.  Other than those created to execute command
564       and process substitutions, the file descriptors are  not  available  in
565       subshells.
566
567       The  process ID of the shell spawned to execute the coprocess is avail‐
568       able as the value of the variable NAME_PID.  The wait  builtin  command
569       may be used to wait for the coprocess to terminate.
570
571       Since  the  coprocess is created as an asynchronous command, the coproc
572       command always returns success.  The return status of  a  coprocess  is
573       the exit status of command.
574
575   Shell Function Definitions
576       A  shell function is an object that is called like a simple command and
577       executes a compound command with a new set  of  positional  parameters.
578       Shell functions are declared as follows:
579
580       fname () compound-command [redirection]
581       function fname [()] compound-command [redirection]
582              This defines a function named fname.  The reserved word function
583              is optional.  If the function reserved  word  is  supplied,  the
584              parentheses  are optional.  The body of the function is the com‐
585              pound command compound-command (see  Compound  Commands  above).
586              That  command is usually a list of commands between { and }, but
587              may be any command listed under Compound Commands above.  If the
588              function reserved word is used, but the parentheses are not sup‐
589              plied, the braces are recommended.  compound-command is executed
590              whenever  fname  is  specified  as the name of a simple command.
591              When in posix mode, fname must be a valid shell name and may not
592              be  the  name  of one of the POSIX special builtins.  In default
593              mode, a function name can be any unquoted shell word  that  does
594              not  contain $.  Any redirections (see REDIRECTION below) speci‐
595              fied when a function is defined are performed when the  function
596              is  executed.   The exit status of a function definition is zero
597              unless a syntax error occurs or a  readonly  function  with  the
598              same  name  already exists.  When executed, the exit status of a
599              function is the exit status of the last command executed in  the
600              body.  (See FUNCTIONS below.)
601

COMMENTS

603       In a non-interactive shell, or an interactive shell in which the inter‐
604       active_comments option to the  shopt  builtin  is  enabled  (see  SHELL
605       BUILTIN  COMMANDS  below), a word beginning with # causes that word and
606       all remaining characters on that line to be  ignored.   An  interactive
607       shell  without  the  interactive_comments option enabled does not allow
608       comments.  The interactive_comments option is on by default in interac‐
609       tive shells.
610

QUOTING

612       Quoting  is used to remove the special meaning of certain characters or
613       words to the shell.  Quoting can be used to disable  special  treatment
614       for special characters, to prevent reserved words from being recognized
615       as such, and to prevent parameter expansion.
616
617       Each of the metacharacters listed above under DEFINITIONS  has  special
618       meaning to the shell and must be quoted if it is to represent itself.
619
620       When  the command history expansion facilities are being used (see HIS‐
621       TORY EXPANSION below), the history expansion character, usually !, must
622       be quoted to prevent history expansion.
623
624       There  are  three  quoting  mechanisms:  the  escape  character, single
625       quotes, and double quotes.
626
627       A non-quoted backslash (\) is the escape character.  It  preserves  the
628       literal value of the next character that follows, with the exception of
629       <newline>.  If a \<newline> pair appears, and the backslash is not  it‐
630       self quoted, the \<newline> is treated as a line continuation (that is,
631       it is removed from the input stream and effectively ignored).
632
633       Enclosing characters in single quotes preserves the  literal  value  of
634       each character within the quotes.  A single quote may not occur between
635       single quotes, even when preceded by a backslash.
636
637       Enclosing characters in double quotes preserves the  literal  value  of
638       all  characters  within the quotes, with the exception of $, `, \, and,
639       when history expansion is enabled, !.  When the shell is in posix mode,
640       the  !  has  no special meaning within double quotes, even when history
641       expansion is enabled.  The characters $  and  `  retain  their  special
642       meaning  within double quotes.  The backslash retains its special mean‐
643       ing only when followed by one of the following characters: $, `, ",  \,
644       or  <newline>.   A  double  quote may be quoted within double quotes by
645       preceding it with a backslash.  If enabled, history expansion  will  be
646       performed  unless  an  !  appearing in double quotes is escaped using a
647       backslash.  The backslash preceding the !  is not removed.
648
649       The special parameters * and @ have  special  meaning  when  in  double
650       quotes (see PARAMETERS below).
651
652       Character  sequences  of  the  form  $'string' are treated as a special
653       variant of single quotes.  The sequence expands to string,  with  back‐
654       slash-escaped  characters in string replaced as specified by the ANSI C
655       standard.  Backslash escape sequences, if present, are decoded as  fol‐
656       lows:
657              \a     alert (bell)
658              \b     backspace
659              \e
660              \E     an escape character
661              \f     form feed
662              \n     new line
663              \r     carriage return
664              \t     horizontal tab
665              \v     vertical tab
666              \\     backslash
667              \'     single quote
668              \"     double quote
669              \?     question mark
670              \nnn   the  eight-bit  character  whose value is the octal value
671                     nnn (one to three octal digits)
672              \xHH   the eight-bit character whose value  is  the  hexadecimal
673                     value HH (one or two hex digits)
674              \uHHHH the  Unicode (ISO/IEC 10646) character whose value is the
675                     hexadecimal value HHHH (one to four hex digits)
676              \UHHHHHHHH
677                     the Unicode (ISO/IEC 10646) character whose value is  the
678                     hexadecimal value HHHHHHHH (one to eight hex digits)
679              \cx    a control-x character
680
681       The  expanded  result  is  single-quoted, as if the dollar sign had not
682       been present.
683
684       A double-quoted string preceded by a dollar sign ($"string") will cause
685       the  string to be translated according to the current locale.  The get‐
686       text infrastructure performs the  lookup  and  translation,  using  the
687       LC_MESSAGES,  TEXTDOMAINDIR,  and  TEXTDOMAIN  shell variables.  If the
688       current locale is C or POSIX, if there are no  translations  available,
689       or  if  the string is not translated, the dollar sign is ignored.  This
690       is a form of double quoting, so the string remains double-quoted by de‐
691       fault,  whether  or  not  it  is translated and replaced.  If the noex‐
692       pand_translation option is enabled using the shopt builtin,  translated
693       strings  are  single-quoted instead of double-quoted.  See the descrip‐
694       tion of shopt below under SHELLBUILTINCOMMANDS.
695

PARAMETERS

697       A parameter is an entity that stores values.  It can be a name, a  num‐
698       ber, or one of the special characters listed below under Special Param‐
699       eters.  A variable is a parameter denoted by a name.  A variable has  a
700       value  and  zero or more attributes.  Attributes are assigned using the
701       declare builtin command (see declare below in SHELL BUILTIN COMMANDS).
702
703       A parameter is set if it has been assigned a value.  The null string is
704       a  valid  value.  Once a variable is set, it may be unset only by using
705       the unset builtin command (see SHELL BUILTIN COMMANDS below).
706
707       A variable may be assigned to by a statement of the form
708
709              name=[value]
710
711       If value is not given, the variable is assigned the null  string.   All
712       values  undergo tilde expansion, parameter and variable expansion, com‐
713       mand substitution, arithmetic expansion, and quote removal (see  EXPAN‐
714       SION below).  If the variable has its integer attribute set, then value
715       is evaluated as an arithmetic expression even if the $((...)) expansion
716       is not used (see Arithmetic Expansion below).  Word splitting and path‐
717       name expansion are not performed.  Assignment statements may  also  ap‐
718       pear as arguments to the alias, declare, typeset, export, readonly, and
719       local builtin commands (declaration commands).   When  in  posix  mode,
720       these  builtins  may appear in a command after one or more instances of
721       the command builtin and retain these assignment statement properties.
722
723       In the context where an assignment statement is assigning a value to  a
724       shell variable or array index, the += operator can be used to append to
725       or add to the variable's previous value.  This  includes  arguments  to
726       builtin  commands  such  as  declare  that accept assignment statements
727       (declaration commands).  When += is applied to a variable for which the
728       integer attribute has been set, value is evaluated as an arithmetic ex‐
729       pression and added to the variable's current value, which is also eval‐
730       uated.   When += is applied to an array variable using compound assign‐
731       ment (see Arrays below), the variable's value is not unset  (as  it  is
732       when  using  =),  and new values are appended to the array beginning at
733       one greater than the array's maximum  index  (for  indexed  arrays)  or
734       added  as additional key-value pairs in an associative array.  When ap‐
735       plied to a string-valued variable, value is expanded  and  appended  to
736       the variable's value.
737
738       A variable can be assigned the nameref attribute using the -n option to
739       the declare or local builtin commands (see the descriptions of  declare
740       and  local  below) to create a nameref, or a reference to another vari‐
741       able.  This allows variables to be  manipulated  indirectly.   Whenever
742       the  nameref variable is referenced, assigned to, unset, or has its at‐
743       tributes modified (other than using or changing the  nameref  attribute
744       itself),  the operation is actually performed on the variable specified
745       by the nameref variable's value.  A nameref  is  commonly  used  within
746       shell functions to refer to a variable whose name is passed as an argu‐
747       ment to the function.  For instance, if a variable name is passed to  a
748       shell function as its first argument, running
749              declare -n ref=$1
750       inside  the  function creates a nameref variable ref whose value is the
751       variable name passed as the first argument.  References and assignments
752       to  ref,  and changes to its attributes, are treated as references, as‐
753       signments, and attribute modifications to the variable whose  name  was
754       passed  as  $1.   If the control variable in a for loop has the nameref
755       attribute, the list of words can be a list of shell  variables,  and  a
756       name  reference will be established for each word in the list, in turn,
757       when the loop is executed.  Array variables cannot be given the nameref
758       attribute.   However,  nameref  variables can reference array variables
759       and subscripted array variables.  Namerefs can be unset  using  the  -n
760       option  to the unset builtin.  Otherwise, if unset is executed with the
761       name of a nameref variable as an argument, the variable  referenced  by
762       the nameref variable will be unset.
763
764   Positional Parameters
765       A  positional  parameter  is a parameter denoted by one or more digits,
766       other than the single digit 0.  Positional parameters are assigned from
767       the  shell's  arguments when it is invoked, and may be reassigned using
768       the set builtin command.  Positional parameters may not be assigned  to
769       with  assignment statements.  The positional parameters are temporarily
770       replaced when a shell function is executed (see FUNCTIONS below).
771
772       When a positional parameter consisting of more than a single  digit  is
773       expanded, it must be enclosed in braces (see EXPANSION below).
774
775   Special Parameters
776       The  shell  treats  several parameters specially.  These parameters may
777       only be referenced; assignment to them is not allowed.
778       *      Expands to the positional parameters, starting from  one.   When
779              the  expansion  is not within double quotes, each positional pa‐
780              rameter expands to a separate word.  In  contexts  where  it  is
781              performed, those words are subject to further word splitting and
782              pathname expansion.  When the  expansion  occurs  within  double
783              quotes,  it  expands to a single word with the value of each pa‐
784              rameter separated by the first  character  of  the  IFS  special
785              variable.   That  is, "$*" is equivalent to "$1c$2c...", where c
786              is the first character of the value of the IFS variable.  If IFS
787              is  unset,  the  parameters  are separated by spaces.  If IFS is
788              null, the parameters are joined without intervening separators.
789       @      Expands to the positional parameters,  starting  from  one.   In
790              contexts  where  word  splitting is performed, this expands each
791              positional parameter to a separate word; if  not  within  double
792              quotes,  these words are subject to word splitting.  In contexts
793              where word splitting is not performed, this expands to a  single
794              word  with each positional parameter separated by a space.  When
795              the expansion occurs within double quotes,  each  parameter  ex‐
796              pands  to  a separate word.  That is, "$@" is equivalent to "$1"
797              "$2" ...  If the double-quoted expansion occurs within  a  word,
798              the  expansion  of the first parameter is joined with the begin‐
799              ning part of the original word, and the expansion  of  the  last
800              parameter  is  joined  with  the last part of the original word.
801              When there are no positional parameters, "$@" and $@  expand  to
802              nothing (i.e., they are removed).
803       #      Expands to the number of positional parameters in decimal.
804       ?      Expands  to  the exit status of the most recently executed fore‐
805              ground pipeline.
806       -      Expands to the current option flags as  specified  upon  invoca‐
807              tion,  by the set builtin command, or those set by the shell it‐
808              self (such as the -i option).
809       $      Expands to the process ID of the shell. In a  subshell,  it  ex‐
810              pands to the process ID of the current shell, not the subshell.
811       !      Expands  to  the process ID of the job most recently placed into
812              the background, whether executed as an asynchronous  command  or
813              using the bg builtin (see JOB CONTROL below).
814       0      Expands  to  the name of the shell or shell script.  This is set
815              at shell initialization.  If bash is invoked with a file of com‐
816              mands,  $0  is set to the name of that file.  If bash is started
817              with the -c option, then $0 is set to the first  argument  after
818              the  string to be executed, if one is present.  Otherwise, it is
819              set to the filename used to invoke bash, as  given  by  argument
820              zero.
821
822   Shell Variables
823       The following variables are set by the shell:
824
825       _      At  shell  startup, set to the pathname used to invoke the shell
826              or shell script being executed as passed in the  environment  or
827              argument  list.   Subsequently,  expands to the last argument to
828              the previous simple command executed in  the  foreground,  after
829              expansion.   Also  set  to the full pathname used to invoke each
830              command executed and placed in the environment exported to  that
831              command.   When  checking mail, this parameter holds the name of
832              the mail file currently being checked.
833       BASH   Expands to the full filename used to  invoke  this  instance  of
834              bash.
835       BASHOPTS
836              A  colon-separated  list of enabled shell options.  Each word in
837              the list is a valid argument for the  -s  option  to  the  shopt
838              builtin command (see SHELL BUILTIN COMMANDS below).  The options
839              appearing in BASHOPTS are those reported as  on  by  shopt.   If
840              this  variable  is  in the environment when bash starts up, each
841              shell option in the list will  be  enabled  before  reading  any
842              startup files.  This variable is read-only.
843       BASHPID
844              Expands  to  the  process  ID of the current bash process.  This
845              differs from $$ under certain circumstances, such  as  subshells
846              that  do  not require bash to be re-initialized.  Assignments to
847              BASHPID have no effect.  If BASHPID is unset, it loses its  spe‐
848              cial properties, even if it is subsequently reset.
849       BASH_ALIASES
850              An  associative  array  variable whose members correspond to the
851              internal list of aliases as maintained  by  the  alias  builtin.
852              Elements  added to this array appear in the alias list; however,
853              unsetting array elements currently does not cause aliases to  be
854              removed from the alias list.  If BASH_ALIASES is unset, it loses
855              its special properties, even if it is subsequently reset.
856       BASH_ARGC
857              An array variable whose values are the number of  parameters  in
858              each frame of the current bash execution call stack.  The number
859              of parameters to  the  current  subroutine  (shell  function  or
860              script  executed  with  . or source) is at the top of the stack.
861              When a subroutine is executed, the number of  parameters  passed
862              is pushed onto BASH_ARGC.  The shell sets BASH_ARGC only when in
863              extended debugging mode (see the description of the extdebug op‐
864              tion  to  the  shopt builtin below).  Setting extdebug after the
865              shell has started to execute a script, or referencing this vari‐
866              able  when  extdebug is not set, may result in inconsistent val‐
867              ues.
868       BASH_ARGV
869              An array variable containing all of the parameters in  the  cur‐
870              rent bash execution call stack.  The final parameter of the last
871              subroutine call is at the top of the stack; the first  parameter
872              of the initial call is at the bottom.  When a subroutine is exe‐
873              cuted, the parameters supplied are pushed onto  BASH_ARGV.   The
874              shell  sets  BASH_ARGV only when in extended debugging mode (see
875              the description of the extdebug option to the shopt builtin  be‐
876              low).  Setting extdebug after the shell has started to execute a
877              script, or referencing this variable when extdebug is  not  set,
878              may result in inconsistent values.
879       BASH_ARGV0
880              When  referenced, this variable expands to the name of the shell
881              or shell script (identical to $0; see the description of special
882              parameter  0  above).  Assignment to BASH_ARGV0 causes the value
883              assigned to also be assigned to $0.  If BASH_ARGV0 is unset,  it
884              loses its special properties, even if it is subsequently reset.
885       BASH_CMDS
886              An  associative  array  variable whose members correspond to the
887              internal hash table  of  commands  as  maintained  by  the  hash
888              builtin.  Elements added to this array appear in the hash table;
889              however, unsetting array elements currently does not cause  com‐
890              mand  names  to be removed from the hash table.  If BASH_CMDS is
891              unset, it loses its special properties, even  if  it  is  subse‐
892              quently reset.
893       BASH_COMMAND
894              The  command  currently  being executed or about to be executed,
895              unless the shell is executing a command as the result of a trap,
896              in  which  case  it  is the command executing at the time of the
897              trap.  If BASH_COMMAND is unset, it loses  its  special  proper‐
898              ties, even if it is subsequently reset.
899       BASH_EXECUTION_STRING
900              The command argument to the -c invocation option.
901       BASH_LINENO
902              An  array  variable whose members are the line numbers in source
903              files where each corresponding member of FUNCNAME  was  invoked.
904              ${BASH_LINENO[$i]}  is  the  line  number  in  the  source  file
905              (${BASH_SOURCE[$i+1]})  where  ${FUNCNAME[$i]}  was  called  (or
906              ${BASH_LINENO[$i-1]}  if  referenced  within another shell func‐
907              tion).  Use LINENO to obtain the current line number.
908       BASH_LOADABLES_PATH
909              A colon-separated list of directories in which the  shell  looks
910              for  dynamically  loadable builtins specified by the enable com‐
911              mand.
912       BASH_REMATCH
913              An array variable whose members are assigned by  the  =~  binary
914              operator  to the [[ conditional command.  The element with index
915              0 is the portion of the string matching the entire  regular  ex‐
916              pression.  The element with index n is the portion of the string
917              matching the nth parenthesized subexpression.
918       BASH_SOURCE
919              An array variable whose members are the source  filenames  where
920              the  corresponding  shell  function  names in the FUNCNAME array
921              variable are defined.  The shell function ${FUNCNAME[$i]} is de‐
922              fined   in   the   file   ${BASH_SOURCE[$i]}   and  called  from
923              ${BASH_SOURCE[$i+1]}.
924       BASH_SUBSHELL
925              Incremented by one within each subshell or subshell  environment
926              when  the  shell begins executing in that environment.  The ini‐
927              tial value is 0.  If BASH_SUBSHELL is unset, it loses  its  spe‐
928              cial properties, even if it is subsequently reset.
929       BASH_VERSINFO
930              A readonly array variable whose members hold version information
931              for this instance of bash.  The values  assigned  to  the  array
932              members are as follows:
933              BASH_VERSINFO[0]        The major version number (the release).
934              BASH_VERSINFO[1]        The minor version number (the version).
935              BASH_VERSINFO[2]        The patch level.
936              BASH_VERSINFO[3]        The build version.
937              BASH_VERSINFO[4]        The release status (e.g., beta1).
938              BASH_VERSINFO[5]        The value of MACHTYPE.
939       BASH_VERSION
940              Expands  to  a string describing the version of this instance of
941              bash.
942       COMP_CWORD
943              An index into ${COMP_WORDS} of the word containing  the  current
944              cursor position.  This variable is available only in shell func‐
945              tions invoked by the  programmable  completion  facilities  (see
946              Programmable Completion below).
947       COMP_KEY
948              The key (or final key of a key sequence) used to invoke the cur‐
949              rent completion function.
950       COMP_LINE
951              The current command line.  This variable is  available  only  in
952              shell  functions  and  external commands invoked by the program‐
953              mable completion facilities (see Programmable Completion below).
954       COMP_POINT
955              The index of the current cursor position relative to the  begin‐
956              ning  of the current command.  If the current cursor position is
957              at the end of the current command, the value of this variable is
958              equal  to  ${#COMP_LINE}.   This  variable  is available only in
959              shell functions and external commands invoked  by  the  program‐
960              mable completion facilities (see Programmable Completion below).
961       COMP_TYPE
962              Set  to an integer value corresponding to the type of completion
963              attempted that caused a completion function to be  called:  TAB,
964              for  normal completion, ?, for listing completions after succes‐
965              sive tabs, !, for listing alternatives on partial  word  comple‐
966              tion,  @,  to list completions if the word is not unmodified, or
967              %, for menu completion.  This  variable  is  available  only  in
968              shell  functions  and  external commands invoked by the program‐
969              mable completion facilities (see Programmable Completion below).
970       COMP_WORDBREAKS
971              The set of characters that the readline library treats  as  word
972              separators  when performing word completion.  If COMP_WORDBREAKS
973              is unset, it loses its special properties, even if it is  subse‐
974              quently reset.
975       COMP_WORDS
976              An  array variable (see Arrays below) consisting of the individ‐
977              ual words in the current command line.  The line is  split  into
978              words  as  readline would split it, using COMP_WORDBREAKS as de‐
979              scribed above.  This variable is available only in  shell  func‐
980              tions  invoked  by  the  programmable completion facilities (see
981              Programmable Completion below).
982       COPROC An array variable (see Arrays below) created to  hold  the  file
983              descriptors  for  output  from and input to an unnamed coprocess
984              (see Coprocesses above).
985       DIRSTACK
986              An array variable (see Arrays below) containing the current con‐
987              tents  of  the directory stack.  Directories appear in the stack
988              in the order they are displayed by the dirs builtin.   Assigning
989              to members of this array variable may be used to modify directo‐
990              ries already in the stack, but the pushd and popd builtins  must
991              be used to add and remove directories.  Assignment to this vari‐
992              able will not change the current directory.  If DIRSTACK is  un‐
993              set, it loses its special properties, even if it is subsequently
994              reset.
995       EPOCHREALTIME
996              Each time this parameter is referenced, it expands to the number
997              of  seconds  since  the  Unix  Epoch (see time(3)) as a floating
998              point  value  with  micro-second  granularity.   Assignments  to
999              EPOCHREALTIME  are ignored.  If EPOCHREALTIME is unset, it loses
1000              its special properties, even if it is subsequently reset.
1001       EPOCHSECONDS
1002              Each time this parameter is referenced, it expands to the number
1003              of  seconds  since the Unix Epoch (see time(3)).  Assignments to
1004              EPOCHSECONDS are ignored.  If EPOCHSECONDS is  unset,  it  loses
1005              its special properties, even if it is subsequently reset.
1006       EUID   Expands  to  the effective user ID of the current user, initial‐
1007              ized at shell startup.  This variable is readonly.
1008       FUNCNAME
1009              An array variable containing the names of  all  shell  functions
1010              currently in the execution call stack.  The element with index 0
1011              is the name of any currently-executing shell function.  The bot‐
1012              tom-most  element  (the  one  with the highest index) is "main".
1013              This variable exists only when a shell  function  is  executing.
1014              Assignments  to  FUNCNAME have no effect.  If FUNCNAME is unset,
1015              it loses its special properties, even if it is subsequently  re‐
1016              set.
1017
1018              This  variable  can  be  used  with BASH_LINENO and BASH_SOURCE.
1019              Each  element  of  FUNCNAME  has   corresponding   elements   in
1020              BASH_LINENO and BASH_SOURCE to describe the call stack.  For in‐
1021              stance,   ${FUNCNAME[$i]}   was    called    from    the    file
1022              ${BASH_SOURCE[$i+1]}  at  line  number  ${BASH_LINENO[$i]}.  The
1023              caller builtin displays the current call stack using this infor‐
1024              mation.
1025       GROUPS An  array  variable  containing  the list of groups of which the
1026              current user is a member.  Assignments to GROUPS have no effect.
1027              If  GROUPS is unset, it loses its special properties, even if it
1028              is subsequently reset.
1029       HISTCMD
1030              The history number, or index in the history list, of the current
1031              command.  Assignments to HISTCMD are ignored.  If HISTCMD is un‐
1032              set, it loses its special properties, even if it is subsequently
1033              reset.
1034       HOSTNAME
1035              Automatically set to the name of the current host.
1036       HOSTTYPE
1037              Automatically  set  to a string that uniquely describes the type
1038              of machine on which bash is executing.  The default  is  system-
1039              dependent.
1040       LINENO Each  time this parameter is referenced, the shell substitutes a
1041              decimal number representing the current sequential  line  number
1042              (starting  with  1)  within a script or function.  When not in a
1043              script or function, the value substituted is not  guaranteed  to
1044              be meaningful.  If LINENO is unset, it loses its special proper‐
1045              ties, even if it is subsequently reset.
1046       MACHTYPE
1047              Automatically set to a string that fully  describes  the  system
1048              type  on  which  bash is executing, in the standard GNU cpu-com‐
1049              pany-system format.  The default is system-dependent.
1050       MAPFILE
1051              An array variable (see Arrays below) created to  hold  the  text
1052              read by the mapfile builtin when no variable name is supplied.
1053       OLDPWD The previous working directory as set by the cd command.
1054       OPTARG The  value  of the last option argument processed by the getopts
1055              builtin command (see SHELL BUILTIN COMMANDS below).
1056       OPTIND The index of the next argument to be processed  by  the  getopts
1057              builtin command (see SHELL BUILTIN COMMANDS below).
1058       OSTYPE Automatically  set to a string that describes the operating sys‐
1059              tem on which bash is executing.  The  default  is  system-depen‐
1060              dent.
1061       PIPESTATUS
1062              An  array  variable (see Arrays below) containing a list of exit
1063              status values from the processes in  the  most-recently-executed
1064              foreground pipeline (which may contain only a single command).
1065       PPID   The  process  ID  of the shell's parent.  This variable is read‐
1066              only.
1067       PWD    The current working directory as set by the cd command.
1068       RANDOM Each time this parameter is referenced, it expands to  a  random
1069              integer  between  0 and 32767.  Assigning a value to RANDOM ini‐
1070              tializes (seeds) the sequence of random numbers.  If  RANDOM  is
1071              unset,  it  loses  its  special properties, even if it is subse‐
1072              quently reset.
1073       READLINE_ARGUMENT
1074              Any numeric argument given to a readline command  that  was  de‐
1075              fined using "bind -x" (see SHELL BUILTIN COMMANDS below) when it
1076              was invoked.
1077       READLINE_LINE
1078              The contents of the readline line buffer, for use with "bind -x"
1079              (see SHELL BUILTIN COMMANDS below).
1080       READLINE_MARK
1081              The position of the mark (saved insertion point) in the readline
1082              line buffer, for use with "bind -x" (see SHELL BUILTIN  COMMANDS
1083              below).  The characters between the insertion point and the mark
1084              are often called the region.
1085       READLINE_POINT
1086              The position of the insertion point in the readline line buffer,
1087              for use with "bind -x" (see SHELL BUILTIN COMMANDS below).
1088       REPLY  Set  to  the line of input read by the read builtin command when
1089              no arguments are supplied.
1090       SECONDS
1091              Each time this parameter is referenced, it expands to the number
1092              of  seconds  since  shell invocation.  If a value is assigned to
1093              SECONDS, the value returned upon subsequent  references  is  the
1094              number  of seconds since the assignment plus the value assigned.
1095              The number of seconds at shell invocation and the  current  time
1096              are  always determined by querying the system clock.  If SECONDS
1097              is unset, it loses its special properties, even if it is  subse‐
1098              quently reset.
1099       SHELLOPTS
1100              A  colon-separated  list of enabled shell options.  Each word in
1101              the list is a valid argument  for  the  -o  option  to  the  set
1102              builtin command (see SHELL BUILTIN COMMANDS below).  The options
1103              appearing in SHELLOPTS are those reported as on by set  -o.   If
1104              this  variable  is  in the environment when bash starts up, each
1105              shell option in the list will  be  enabled  before  reading  any
1106              startup files.  This variable is read-only.
1107       SHLVL  Incremented by one each time an instance of bash is started.
1108       SRANDOM
1109              This variable expands to a 32-bit pseudo-random number each time
1110              it is referenced. The random number generator is not  linear  on
1111              systems  that  support  /dev/urandom  or arc4random, so each re‐
1112              turned number has no relationship to the numbers  preceding  it.
1113              The  random number generator cannot be seeded, so assignments to
1114              this variable have no effect.  If SRANDOM is unset, it loses its
1115              special properties, even if it is subsequently reset.
1116       UID    Expands to the user ID of the current user, initialized at shell
1117              startup.  This variable is readonly.
1118
1119       The following variables are used by the shell.  In some cases, bash as‐
1120       signs a default value to a variable; these cases are noted below.
1121
1122       BASH_COMPAT
1123              The  value  is used to set the shell's compatibility level.  See
1124              SHELL COMPATIBILITY MODE below for a description of the  various
1125              compatibility levels and their effects.  The value may be a dec‐
1126              imal number (e.g., 4.2) or an integer (e.g.,  42)  corresponding
1127              to  the desired compatibility level.  If BASH_COMPAT is unset or
1128              set to the empty string, the compatibility level is set  to  the
1129              default  for  the  current  version.  If BASH_COMPAT is set to a
1130              value that is not one of the  valid  compatibility  levels,  the
1131              shell  prints  an error message and sets the compatibility level
1132              to the default for the current version.  The valid values corre‐
1133              spond  to  the  compatibility levels described below under SHELL
1134              COMPATIBILITY MODE.  For example, 4.2 and 42  are  valid  values
1135              that correspond to the compat42 shopt option and set the compat‐
1136              ibility level to 42.  The current version is also a valid value.
1137       BASH_ENV
1138              If this parameter is set when bash is executing a shell  script,
1139              its  value  is  interpreted as a filename containing commands to
1140              initialize the shell, as in ~/.bashrc.  The value of BASH_ENV is
1141              subjected  to  parameter  expansion,  command  substitution, and
1142              arithmetic expansion before being  interpreted  as  a  filename.
1143              PATH is not used to search for the resultant filename.
1144       BASH_XTRACEFD
1145              If  set  to an integer corresponding to a valid file descriptor,
1146              bash will write the trace output generated when set  -x  is  en‐
1147              abled  to  that  file descriptor.  The file descriptor is closed
1148              when BASH_XTRACEFD is unset or assigned a new value.   Unsetting
1149              BASH_XTRACEFD  or assigning it the empty string causes the trace
1150              output to be sent to the  standard  error.   Note  that  setting
1151              BASH_XTRACEFD to 2 (the standard error file descriptor) and then
1152              unsetting it will result in the standard error being closed.
1153       CDPATH The search path for the cd command.  This is  a  colon-separated
1154              list of directories in which the shell looks for destination di‐
1155              rectories specified by  the  cd  command.   A  sample  value  is
1156              ".:~:/usr".
1157       CHILD_MAX
1158              Set  the  number  of exited child status values for the shell to
1159              remember.  Bash will not allow this value to be decreased  below
1160              a  POSIX-mandated  minimum,  and  there is a maximum value (cur‐
1161              rently 8192) that this may not exceed.   The  minimum  value  is
1162              system-dependent.
1163       COLUMNS
1164              Used  by  the  select compound command to determine the terminal
1165              width when printing selection lists.  Automatically set  if  the
1166              checkwinsize  option  is enabled or in an interactive shell upon
1167              receipt of a SIGWINCH.
1168       COMPREPLY
1169              An array variable from which bash reads the possible completions
1170              generated  by  a shell function invoked by the programmable com‐
1171              pletion facility (see Programmable Completion below).  Each  ar‐
1172              ray element contains one possible completion.
1173       EMACS  If  bash  finds  this variable in the environment when the shell
1174              starts with value "t", it assumes that the shell is  running  in
1175              an Emacs shell buffer and disables line editing.
1176       ENV    Expanded  and  executed  similarly  to  BASH_ENV (see INVOCATION
1177              above) when an interactive shell is invoked in posix mode.
1178       EXECIGNORE
1179              A colon-separated list of shell patterns (see Pattern  Matching)
1180              defining  the  list of filenames to be ignored by command search
1181              using PATH.  Files whose full pathnames match one of these  pat‐
1182              terns  are  not  considered executable files for the purposes of
1183              completion and command execution via PATH lookup.  This does not
1184              affect the behavior of the [, test, and [[ commands.  Full path‐
1185              names in the command hash table are not subject  to  EXECIGNORE.
1186              Use  this  variable to ignore shared library files that have the
1187              executable bit set, but are not executable files.   The  pattern
1188              matching honors the setting of the extglob shell option.
1189       FCEDIT The default editor for the fc builtin command.
1190       FIGNORE
1191              A  colon-separated  list  of  suffixes to ignore when performing
1192              filename completion (see READLINE below).  A filename whose suf‐
1193              fix  matches  one of the entries in FIGNORE is excluded from the
1194              list of matched filenames.  A sample value is ".o:~".
1195       FUNCNEST
1196              If set to a numeric value greater  than  0,  defines  a  maximum
1197              function  nesting  level.  Function invocations that exceed this
1198              nesting level will cause the current command to abort.
1199       GLOBIGNORE
1200              A colon-separated list of patterns  defining  the  set  of  file
1201              names  to  be  ignored  by  pathname  expansion.  If a file name
1202              matched by a pathname expansion pattern also matches one of  the
1203              patterns in GLOBIGNORE, it is removed from the list of matches.
1204       HISTCONTROL
1205              A  colon-separated  list  of values controlling how commands are
1206              saved on the history list.  If the list of values  includes  ig‐
1207              norespace,  lines  which  begin  with  a space character are not
1208              saved in the history list.  A value of ignoredups  causes  lines
1209              matching the previous history entry to not be saved.  A value of
1210              ignoreboth is shorthand for ignorespace and ignoredups.  A value
1211              of erasedups causes all previous lines matching the current line
1212              to be removed from the history list before that line  is  saved.
1213              Any  value  not in the above list is ignored.  If HISTCONTROL is
1214              unset, or does not include a valid value, all lines read by  the
1215              shell parser are saved on the history list, subject to the value
1216              of HISTIGNORE.  The second and subsequent lines of a  multi-line
1217              compound  command  are  not tested, and are added to the history
1218              regardless of the value of HISTCONTROL.
1219       HISTFILE
1220              The name of the file in which command history is saved (see HIS‐
1221              TORY  below).   The default value is ~/.bash_history.  If unset,
1222              the command history is not saved when a shell exits.
1223       HISTFILESIZE
1224              The maximum number of lines contained in the history file.  When
1225              this  variable  is  assigned  a value, the history file is trun‐
1226              cated, if necessary, to contain no  more  than  that  number  of
1227              lines  by removing the oldest entries.  The history file is also
1228              truncated to this size after writing it when a shell exits.   If
1229              the  value  is  0,  the  history file is truncated to zero size.
1230              Non-numeric values and numeric values  less  than  zero  inhibit
1231              truncation.   The  shell  sets the default value to the value of
1232              HISTSIZE after reading any startup files.
1233       HISTIGNORE
1234              A colon-separated list of patterns used to decide which  command
1235              lines  should be saved on the history list.  Each pattern is an‐
1236              chored at the beginning of the line and must match the  complete
1237              line  (no  implicit  `*'  is  appended).  Each pattern is tested
1238              against the line after the checks specified by  HISTCONTROL  are
1239              applied.  In addition to the normal shell pattern matching char‐
1240              acters, `&' matches the previous history line.  `&' may  be  es‐
1241              caped  using  a  backslash;  the backslash is removed before at‐
1242              tempting a match.  The second and subsequent lines of  a  multi-
1243              line  compound command are not tested, and are added to the his‐
1244              tory regardless of the value of HISTIGNORE.  The pattern  match‐
1245              ing honors the setting of the extglob shell option.
1246       HISTSIZE
1247              The  number  of commands to remember in the command history (see
1248              HISTORY below).  If the value is 0, commands are  not  saved  in
1249              the history list.  Numeric values less than zero result in every
1250              command being saved on the history list  (there  is  no  limit).
1251              The  shell  sets  the  default  value  to  500 after reading any
1252              startup files.
1253       HISTTIMEFORMAT
1254              If this variable is set and not null, its value  is  used  as  a
1255              format string for strftime(3) to print the time stamp associated
1256              with each history entry displayed by the  history  builtin.   If
1257              this  variable  is  set,  time stamps are written to the history
1258              file so they may be preserved across shell sessions.  This  uses
1259              the  history  comment  character  to distinguish timestamps from
1260              other history lines.
1261       HOME   The home directory of the current user; the default argument for
1262              the cd builtin command.  The value of this variable is also used
1263              when performing tilde expansion.
1264       HOSTFILE
1265              Contains the name of a file in the  same  format  as  /etc/hosts
1266              that should be read when the shell needs to complete a hostname.
1267              The list of possible hostname completions may be  changed  while
1268              the  shell  is running; the next time hostname completion is at‐
1269              tempted after the value is changed, bash adds  the  contents  of
1270              the  new file to the existing list.  If HOSTFILE is set, but has
1271              no value, or does not name a readable  file,  bash  attempts  to
1272              read  /etc/hosts to obtain the list of possible hostname comple‐
1273              tions.  When HOSTFILE is unset, the hostname list is cleared.
1274       IFS    The Internal Field Separator that is used for word splitting af‐
1275              ter  expansion  and  to  split  lines  into  words with the read
1276              builtin  command.   The  default  value  is  ``<space><tab><new‐
1277              line>''.
1278       IGNOREEOF
1279              Controls the action of an interactive shell on receipt of an EOF
1280              character as the sole input.  If set, the value is the number of
1281              consecutive  EOF  characters  which  must  be typed as the first
1282              characters on an input line before bash exits.  If the  variable
1283              exists  but  does not have a numeric value, or has no value, the
1284              default value is 10.  If it does not exist,  EOF  signifies  the
1285              end of input to the shell.
1286       INPUTRC
1287              The  filename  for the readline startup file, overriding the de‐
1288              fault of ~/.inputrc (see READLINE below).
1289       INSIDE_EMACS
1290              If this variable appears  in  the  environment  when  the  shell
1291              starts,  bash  assumes  that it is running inside an Emacs shell
1292              buffer and may disable line editing, depending on the  value  of
1293              TERM.
1294       LANG   Used  to  determine  the  locale  category  for any category not
1295              specifically selected with a variable starting with LC_.
1296       LC_ALL This variable overrides the value of  LANG  and  any  other  LC_
1297              variable specifying a locale category.
1298       LC_COLLATE
1299              This  variable  determines the collation order used when sorting
1300              the results of pathname expansion, and determines  the  behavior
1301              of  range  expressions,  equivalence  classes, and collating se‐
1302              quences within pathname expansion and pattern matching.
1303       LC_CTYPE
1304              This variable determines the interpretation  of  characters  and
1305              the  behavior of character classes within pathname expansion and
1306              pattern matching.
1307       LC_MESSAGES
1308              This variable determines the locale used  to  translate  double-
1309              quoted strings preceded by a $.
1310       LC_NUMERIC
1311              This  variable  determines  the  locale category used for number
1312              formatting.
1313       LC_TIME
1314              This variable determines the locale category used for  data  and
1315              time formatting.
1316       LINES  Used  by  the  select  compound  command to determine the column
1317              length for printing selection lists.  Automatically set  if  the
1318              checkwinsize  option  is enabled or in an interactive shell upon
1319              receipt of a SIGWINCH.
1320       MAIL   If this parameter is set to a file or  directory  name  and  the
1321              MAILPATH  variable  is not set, bash informs the user of the ar‐
1322              rival of mail in the specified file or Maildir-format directory.
1323       MAILCHECK
1324              Specifies how often (in seconds) bash checks for mail.  The  de‐
1325              fault  is  60  seconds.   When it is time to check for mail, the
1326              shell does so before displaying the  primary  prompt.   If  this
1327              variable  is  unset,  or  set  to  a  value that is not a number
1328              greater than or equal to zero, the shell disables mail checking.
1329       MAILPATH
1330              A colon-separated list of filenames to be checked for mail.  The
1331              message to be printed when mail arrives in a particular file may
1332              be specified by separating the filename from the message with  a
1333              `?'.   When  used  in the text of the message, $_ expands to the
1334              name of the current mailfile.  Example:
1335              MAILPATH='/var/mail/bfox?"You  have  mail":~/shell-mail?"$_  has
1336              mail!"'
1337              Bash  can be configured to supply a default value for this vari‐
1338              able (there is no value by default), but  the  location  of  the
1339              user  mail  files  that  it  uses  is  system  dependent  (e.g.,
1340              /var/mail/$USER).
1341       OPTERR If set to the value 1, bash displays error messages generated by
1342              the  getopts builtin command (see SHELL BUILTIN COMMANDS below).
1343              OPTERR is initialized to 1 each time the shell is invoked  or  a
1344              shell script is executed.
1345       PATH   The  search  path for commands.  It is a colon-separated list of
1346              directories in which the shell looks for commands  (see  COMMAND
1347              EXECUTION  below).   A  zero-length (null) directory name in the
1348              value of PATH indicates the current directory.  A null directory
1349              name  may  appear  as  two  adjacent colons, or as an initial or
1350              trailing colon.  The default path is  system-dependent,  and  is
1351              set by the administrator who installs bash.  A common value is
1352              ``/usr/local/bin:/usr/lo‐
1353              cal/sbin:/usr/bin:/usr/sbin:/bin:/sbin''.
1354       POSIXLY_CORRECT
1355              If  this  variable  is  in the environment when bash starts, the
1356              shell enters posix mode before reading the startup files, as  if
1357              the  --posix  invocation option had been supplied.  If it is set
1358              while the shell is running, bash enables posix mode, as  if  the
1359              command  set  -o posix had been executed.  When the shell enters
1360              posix mode, it sets this variable if it was not already set.
1361       PROMPT_COMMAND
1362              If this variable is set, and is an array, the value of each  set
1363              element  is  executed as a command prior to issuing each primary
1364              prompt.  If this is set but not an array variable, its value  is
1365              used as a command to execute instead.
1366       PROMPT_DIRTRIM
1367              If  set  to a number greater than zero, the value is used as the
1368              number of trailing directory components to retain when expanding
1369              the  \w  and  \W  prompt  string  escapes (see PROMPTING below).
1370              Characters removed are replaced with an ellipsis.
1371       PS0    The value of this parameter is expanded  (see  PROMPTING  below)
1372              and  displayed by interactive shells after reading a command and
1373              before the command is executed.
1374       PS1    The value of this parameter is expanded  (see  PROMPTING  below)
1375              and  used  as  the  primary prompt string.  The default value is
1376              ``\s-\v\$ ''.
1377       PS2    The value of this parameter is expanded as with PS1 and used  as
1378              the secondary prompt string.  The default is ``> ''.
1379       PS3    The value of this parameter is used as the prompt for the select
1380              command (see SHELL GRAMMAR above).
1381       PS4    The value of this parameter is expanded  as  with  PS1  and  the
1382              value is printed before each command bash displays during an ex‐
1383              ecution trace.  The first character of the expanded value of PS4
1384              is replicated multiple times, as necessary, to indicate multiple
1385              levels of indirection.  The default is ``+ ''.
1386       SHELL  This variable expands to the full pathname to the shell.  If  it
1387              is  not  set  when the shell starts, bash assigns to it the full
1388              pathname of the current user's login shell.
1389       TIMEFORMAT
1390              The value of this parameter is used as a format string  specify‐
1391              ing  how  the timing information for pipelines prefixed with the
1392              time reserved word should be displayed.  The % character  intro‐
1393              duces  an  escape  sequence  that is expanded to a time value or
1394              other information.  The escape sequences and their meanings  are
1395              as follows; the braces denote optional portions.
1396              %%        A literal %.
1397              %[p][l]R  The elapsed time in seconds.
1398              %[p][l]U  The number of CPU seconds spent in user mode.
1399              %[p][l]S  The number of CPU seconds spent in system mode.
1400              %P        The CPU percentage, computed as (%U + %S) / %R.
1401
1402              The  optional  p is a digit specifying the precision, the number
1403              of fractional digits after a decimal point.  A value of 0 causes
1404              no decimal point or fraction to be output.  At most three places
1405              after the decimal point may be specified; values  of  p  greater
1406              than  3 are changed to 3.  If p is not specified, the value 3 is
1407              used.
1408
1409              The optional l specifies a longer format, including minutes,  of
1410              the  form  MMmSS.FFs.   The value of p determines whether or not
1411              the fraction is included.
1412
1413              If this variable is not set, bash acts as if it  had  the  value
1414              $'\nreal\t%3lR\nuser\t%3lU\nsys\t%3lS'.   If  the value is null,
1415              no timing information is displayed.  A trailing newline is added
1416              when the format string is displayed.
1417       TMOUT  If set to a value greater than zero, TMOUT is treated as the de‐
1418              fault timeout for the read builtin.  The select  command  termi‐
1419              nates if input does not arrive after TMOUT seconds when input is
1420              coming from a terminal.  In an interactive shell, the  value  is
1421              interpreted as the number of seconds to wait for a line of input
1422              after issuing the primary prompt.  Bash terminates after waiting
1423              for  that number of seconds if a complete line of input does not
1424              arrive.
1425       TMPDIR If set, bash uses its value as the name of a directory in  which
1426              bash creates temporary files for the shell's use.
1427       auto_resume
1428              This variable controls how the shell interacts with the user and
1429              job control.  If this variable is set, single word  simple  com‐
1430              mands without redirections are treated as candidates for resump‐
1431              tion of an existing stopped job.  There is no ambiguity allowed;
1432              if  there  is more than one job beginning with the string typed,
1433              the job most recently accessed  is  selected.   The  name  of  a
1434              stopped  job, in this context, is the command line used to start
1435              it.  If set to the value exact, the string supplied  must  match
1436              the  name  of  a  stopped  job exactly; if set to substring, the
1437              string supplied needs to match a substring  of  the  name  of  a
1438              stopped  job.  The substring value provides functionality analo‐
1439              gous to the %?  job identifier (see JOB CONTROL below).  If  set
1440              to  any  other  value, the supplied string must be a prefix of a
1441              stopped job's name; this provides functionality analogous to the
1442              %string job identifier.
1443       histchars
1444              The  two or three characters which control history expansion and
1445              tokenization (see HISTORY EXPANSION below).  The first character
1446              is  the history expansion character, the character which signals
1447              the start of a history  expansion,  normally  `!'.   The  second
1448              character  is the quick substitution character, which is used as
1449              shorthand for re-running the previous command  entered,  substi‐
1450              tuting  one  string  for another in the command.  The default is
1451              `^'.  The optional third character is the character which  indi‐
1452              cates  that the remainder of the line is a comment when found as
1453              the first character of a word, normally `#'.  The  history  com‐
1454              ment character causes history substitution to be skipped for the
1455              remaining words on the line.  It does not necessarily cause  the
1456              shell parser to treat the rest of the line as a comment.
1457
1458   Arrays
1459       Bash  provides one-dimensional indexed and associative array variables.
1460       Any variable may be used as an indexed array; the declare builtin  will
1461       explicitly  declare an array.  There is no maximum limit on the size of
1462       an array, nor any requirement that members be indexed or assigned  con‐
1463       tiguously.   Indexed  arrays  are  referenced using integers (including
1464       arithmetic expressions) and are zero-based; associative arrays are ref‐
1465       erenced using arbitrary strings.  Unless otherwise noted, indexed array
1466       indices must be non-negative integers.
1467
1468       An indexed array is created automatically if any variable  is  assigned
1469       to using the syntax name[subscript]=value.  The subscript is treated as
1470       an arithmetic expression that must evaluate to a number.  To explicitly
1471       declare  an  indexed array, use declare -a name (see SHELL BUILTIN COM‐
1472       MANDS below).  declare -a name[subscript] is also  accepted;  the  sub‐
1473       script is ignored.
1474
1475       Associative arrays are created using declare -A name.
1476
1477       Attributes may be specified for an array variable using the declare and
1478       readonly builtins.  Each attribute applies to all members of an array.
1479
1480       Arrays  are  assigned  to  using  compound  assignments  of  the   form
1481       name=(value1  ...  valuen),  where  each value may be of the form [sub‐
1482       script]=string.  Indexed array assignments do not require anything  but
1483       string.   Each value in the list is expanded using all the shell expan‐
1484       sions described below under EXPANSION.  When assigning to  indexed  ar‐
1485       rays,  if  the optional brackets and subscript are supplied, that index
1486       is assigned to; otherwise the index of the element assigned is the last
1487       index assigned to by the statement plus one.  Indexing starts at zero.
1488
1489       When assigning to an associative array, the words in a compound assign‐
1490       ment may be either assignment statements, for which  the  subscript  is
1491       required,  or  a list of words that is interpreted as a sequence of al‐
1492       ternating keys and values: name=( key1 value1 key2 value2 ...).   These
1493       are  treated  identically  to  name=( [key1]=value1 [key2]=value2 ...).
1494       The first word in the list determines how the remaining words  are  in‐
1495       terpreted;  all  assignments  in a list must be of the same type.  When
1496       using key/value pairs, the keys may not be missing or  empty;  a  final
1497       missing value is treated like the empty string.
1498
1499       This  syntax is also accepted by the declare builtin.  Individual array
1500       elements may be assigned to using the name[subscript]=value syntax  in‐
1501       troduced  above.   When  assigning to an indexed array, if name is sub‐
1502       scripted by a negative number, that number is interpreted  as  relative
1503       to  one  greater  than  the  maximum index of name, so negative indices
1504       count back from the end of the array, and an index of -1 references the
1505       last element.
1506
1507       The  +=  operator will append to an array variable when assigning using
1508       the compound assignment syntax; see PARAMETERS above.
1509
1510       Any element of an array may  be  referenced  using  ${name[subscript]}.
1511       The braces are required to avoid conflicts with pathname expansion.  If
1512       subscript is @ or *, the word expands to all members  of  name.   These
1513       subscripts  differ only when the word appears within double quotes.  If
1514       the word is double-quoted, ${name[*]} expands to a single word with the
1515       value  of each array member separated by the first character of the IFS
1516       special variable, and ${name[@]} expands each element of name to a sep‐
1517       arate  word.   When  there  are no array members, ${name[@]} expands to
1518       nothing.  If the double-quoted expansion occurs within a word, the  ex‐
1519       pansion of the first parameter is joined with the beginning part of the
1520       original word, and the expansion of the last parameter is  joined  with
1521       the last part of the original word.  This is analogous to the expansion
1522       of the special parameters *  and  @  (see  Special  Parameters  above).
1523       ${#name[subscript]}  expands  to  the length of ${name[subscript]}.  If
1524       subscript is * or @, the expansion is the number of elements in the ar‐
1525       ray.  If the subscript used to reference an element of an indexed array
1526       evaluates to a number less than zero, it is interpreted as relative  to
1527       one  greater  than  the maximum index of the array, so negative indices
1528       count back from the end of the array, and an index of -1 references the
1529       last element.
1530
1531       Referencing an array variable without a subscript is equivalent to ref‐
1532       erencing the array with a subscript of 0.  Any reference to a  variable
1533       using a valid subscript is legal, and bash will create an array if nec‐
1534       essary.
1535
1536       An array variable is considered set if a subscript has been assigned  a
1537       value.  The null string is a valid value.
1538
1539       It  is possible to obtain the keys (indices) of an array as well as the
1540       values.  ${!name[@]} and ${!name[*]} expand to the indices assigned  in
1541       array variable name.  The treatment when in double quotes is similar to
1542       the expansion of the special parameters @ and * within double quotes.
1543
1544       The unset builtin is used to destroy arrays.  unset name[subscript] de‐
1545       stroys the array element at index subscript, for both indexed and asso‐
1546       ciative arrays.  Negative subscripts to indexed arrays are  interpreted
1547       as  described  above.   Unsetting the last element of an array variable
1548       does not unset the variable.  unset name, where name is an  array,  re‐
1549       moves the entire array.  unset name[subscript], where subscript is * or
1550       @, behaves differently depending on whether name is an indexed or asso‐
1551       ciative  array.   If name is an associative array, this unsets the ele‐
1552       ment with subscript * or @.  If name is an indexed array, unset removes
1553       all of the elements but does not remove the array itself.
1554
1555       When  using  a  variable name with a subscript as an argument to a com‐
1556       mand, such as with unset, without using the word expansion  syntax  de‐
1557       scribed above, the argument is subject to pathname expansion.  If path‐
1558       name expansion is not desired, the argument should be quoted.
1559
1560       The declare, local, and readonly builtins each accept a  -a  option  to
1561       specify  an indexed array and a -A option to specify an associative ar‐
1562       ray.  If both options are supplied,  -A  takes  precedence.   The  read
1563       builtin  accepts  a  -a  option to assign a list of words read from the
1564       standard input to an array.  The set and declare builtins display array
1565       values in a way that allows them to be reused as assignments.
1566

EXPANSION

1568       Expansion is performed on the command line after it has been split into
1569       words.  There are seven kinds of expansion performed: brace  expansion,
1570       tilde  expansion,  parameter  and variable expansion, command substitu‐
1571       tion, arithmetic expansion, word splitting, and pathname expansion.
1572
1573       The order of expansions is: brace expansion; tilde expansion, parameter
1574       and  variable expansion, arithmetic expansion, and command substitution
1575       (done in a left-to-right fashion); word splitting; and pathname  expan‐
1576       sion.
1577
1578       On systems that can support it, there is an additional expansion avail‐
1579       able: process substitution.  This is performed  at  the  same  time  as
1580       tilde,  parameter,  variable, and arithmetic expansion and command sub‐
1581       stitution.
1582
1583       After these expansions are performed, quote characters present  in  the
1584       original  word  are  removed  unless  they  have been quoted themselves
1585       (quote removal).
1586
1587       Only brace expansion, word splitting, and pathname  expansion  can  in‐
1588       crease  the number of words of the expansion; other expansions expand a
1589       single word to a single word.  The only exceptions to this are the  ex‐
1590       pansions  of  "$@"  and  "${name[@]}",  and,  in  most  cases,  $*  and
1591       ${name[*]} as explained above (see PARAMETERS).
1592
1593   Brace Expansion
1594       Brace expansion is a mechanism by which arbitrary strings may be gener‐
1595       ated.   This  mechanism is similar to pathname expansion, but the file‐
1596       names generated need not exist.  Patterns to be brace expanded take the
1597       form of an optional preamble, followed by either a series of comma-sep‐
1598       arated strings or a sequence expression between a pair of braces,  fol‐
1599       lowed  by  an  optional  postscript.   The preamble is prefixed to each
1600       string contained within the braces, and the postscript is then appended
1601       to each resulting string, expanding left to right.
1602
1603       Brace  expansions  may  be nested.  The results of each expanded string
1604       are not sorted;  left  to  right  order  is  preserved.   For  example,
1605       a{d,c,b}e expands into `ade ace abe'.
1606
1607       A  sequence expression takes the form {x..y[..incr]}, where x and y are
1608       either integers or single letters, and incr, an optional increment,  is
1609       an integer.  When integers are supplied, the expression expands to each
1610       number between x and y, inclusive.  Supplied integers may  be  prefixed
1611       with  0  to force each term to have the same width.  When either x or y
1612       begins with a zero, the shell attempts to force all generated terms  to
1613       contain  the same number of digits, zero-padding where necessary.  When
1614       letters are supplied, the expression expands to each character  lexico‐
1615       graphically  between  x  and  y, inclusive, using the default C locale.
1616       Note that both x and y must be of the same type  (integer  or  letter).
1617       When  the  increment  is supplied, it is used as the difference between
1618       each term.  The default increment is 1 or -1 as appropriate.
1619
1620       Brace expansion is performed before any other expansions, and any char‐
1621       acters  special to other expansions are preserved in the result.  It is
1622       strictly textual.  Bash does not apply any syntactic interpretation  to
1623       the context of the expansion or the text between the braces.
1624
1625       A  correctly-formed  brace  expansion must contain unquoted opening and
1626       closing braces, and at least one unquoted comma or a valid sequence ex‐
1627       pression.  Any incorrectly formed brace expansion is left unchanged.  A
1628       { or , may be quoted with a backslash to prevent its  being  considered
1629       part  of  a brace expression.  To avoid conflicts with parameter expan‐
1630       sion, the string ${ is not considered eligible for brace expansion, and
1631       inhibits brace expansion until the closing }.
1632
1633       This construct is typically used as shorthand when the common prefix of
1634       the strings to be generated is longer than in the above example:
1635
1636              mkdir /usr/local/src/bash/{old,new,dist,bugs}
1637       or
1638              chown root /usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}}
1639
1640       Brace expansion introduces a  slight  incompatibility  with  historical
1641       versions  of sh.  sh does not treat opening or closing braces specially
1642       when they appear as part of a word, and preserves them in  the  output.
1643       Bash  removes  braces  from  words as a consequence of brace expansion.
1644       For example, a word entered to sh as file{1,2} appears  identically  in
1645       the  output.  The same word is output as file1 file2 after expansion by
1646       bash.  If strict compatibility with sh is desired, start bash with  the
1647       +B option or disable brace expansion with the +B option to the set com‐
1648       mand (see SHELL BUILTIN COMMANDS below).
1649
1650   Tilde Expansion
1651       If a word begins with an unquoted tilde character  (`~'),  all  of  the
1652       characters  preceding  the  first unquoted slash (or all characters, if
1653       there is no unquoted slash) are considered a tilde-prefix.  If none  of
1654       the  characters  in  the tilde-prefix are quoted, the characters in the
1655       tilde-prefix following the tilde are treated as a possible login  name.
1656       If  this  login name is the null string, the tilde is replaced with the
1657       value of the shell parameter HOME.  If HOME is unset, the  home  direc‐
1658       tory  of  the  user executing the shell is substituted instead.  Other‐
1659       wise, the tilde-prefix is replaced with the home  directory  associated
1660       with the specified login name.
1661
1662       If  the tilde-prefix is a `~+', the value of the shell variable PWD re‐
1663       places the tilde-prefix.  If the tilde-prefix is a `~-', the  value  of
1664       the  shell variable OLDPWD, if it is set, is substituted.  If the char‐
1665       acters following the tilde in the tilde-prefix consist of a  number  N,
1666       optionally  prefixed  by  a  `+' or a `-', the tilde-prefix is replaced
1667       with the corresponding element from the directory stack, as it would be
1668       displayed by the dirs builtin invoked with the tilde-prefix as an argu‐
1669       ment.  If the characters following the tilde in the  tilde-prefix  con‐
1670       sist of a number without a leading `+' or `-', `+' is assumed.
1671
1672       If the login name is invalid, or the tilde expansion fails, the word is
1673       unchanged.
1674
1675       Each variable assignment is checked for unquoted tilde-prefixes immedi‐
1676       ately following a : or the first =.  In these cases, tilde expansion is
1677       also performed.  Consequently, one may use filenames with tildes in as‐
1678       signments  to PATH, MAILPATH, and CDPATH, and the shell assigns the ex‐
1679       panded value.
1680
1681       Bash also performs tilde expansion on words satisfying  the  conditions
1682       of variable assignments (as described above under PARAMETERS) when they
1683       appear as arguments to simple commands.  Bash does not do this,  except
1684       for the declaration commands listed above, when in posix mode.
1685
1686   Parameter Expansion
1687       The `$' character introduces parameter expansion, command substitution,
1688       or arithmetic expansion.  The parameter name or symbol to  be  expanded
1689       may  be enclosed in braces, which are optional but serve to protect the
1690       variable to be expanded from characters immediately following it  which
1691       could be interpreted as part of the name.
1692
1693       When  braces  are  used, the matching ending brace is the first `}' not
1694       escaped by a backslash or within a quoted string, and not within an em‐
1695       bedded  arithmetic expansion, command substitution, or parameter expan‐
1696       sion.
1697
1698       ${parameter}
1699              The value of parameter is substituted.  The braces are  required
1700              when  parameter  is  a  positional  parameter with more than one
1701              digit, or when parameter is followed by a character which is not
1702              to be interpreted as part of its name.  The parameter is a shell
1703              parameter as described above PARAMETERS) or an  array  reference
1704              (Arrays).
1705
1706       If  the  first  character of parameter is an exclamation point (!), and
1707       parameter is not a nameref, it introduces a level of indirection.  Bash
1708       uses the value formed by expanding the rest of parameter as the new pa‐
1709       rameter; this is then expanded and that value is used in  the  rest  of
1710       the  expansion,  rather  than  the expansion of the original parameter.
1711       This is known as indirect expansion.  The value is subject to tilde ex‐
1712       pansion,  parameter expansion, command substitution, and arithmetic ex‐
1713       pansion.  If parameter is a nameref, this expands to the  name  of  the
1714       parameter  referenced  by  parameter instead of performing the complete
1715       indirect expansion.  The exceptions  to  this  are  the  expansions  of
1716       ${!prefix*}  and  ${!name[@]}  described  below.  The exclamation point
1717       must immediately follow the left brace in order to  introduce  indirec‐
1718       tion.
1719
1720       In each of the cases below, word is subject to tilde expansion, parame‐
1721       ter expansion, command substitution, and arithmetic expansion.
1722
1723       When not performing substring expansion, using the forms documented be‐
1724       low  (e.g.,  :-),  bash  tests  for  a parameter that is unset or null.
1725       Omitting the colon results in a test only for a parameter that  is  un‐
1726       set.
1727
1728       ${parameter:-word}
1729              Use  Default  Values.  If parameter is unset or null, the expan‐
1730              sion of word is substituted.  Otherwise, the value of  parameter
1731              is substituted.
1732       ${parameter:=word}
1733              Assign  Default  Values.  If parameter is unset or null, the ex‐
1734              pansion of word is assigned to parameter.  The value of  parame‐
1735              ter  is then substituted.  Positional parameters and special pa‐
1736              rameters may not be assigned to in this way.
1737       ${parameter:?word}
1738              Display Error if Null or Unset.  If parameter is null or  unset,
1739              the  expansion  of  word (or a message to that effect if word is
1740              not present) is written to the standard error and the shell,  if
1741              it is not interactive, exits.  Otherwise, the value of parameter
1742              is substituted.
1743       ${parameter:+word}
1744              Use Alternate Value.  If parameter is null or unset, nothing  is
1745              substituted, otherwise the expansion of word is substituted.
1746       ${parameter:offset}
1747       ${parameter:offset:length}
1748              Substring  Expansion.  Expands to up to length characters of the
1749              value of parameter starting at the character specified  by  off‐
1750              set.   If parameter is @ or *, an indexed array subscripted by @
1751              or *, or an associative array name, the results  differ  as  de‐
1752              scribed  below.   If length is omitted, expands to the substring
1753              of the value of parameter starting at the character specified by
1754              offset and extending to the end of the value.  length and offset
1755              are arithmetic expressions (see ARITHMETIC EVALUATION below).
1756
1757              If offset evaluates to a number less than  zero,  the  value  is
1758              used as an offset in characters from the end of the value of pa‐
1759              rameter.  If length evaluates to a number less than zero, it  is
1760              interpreted as an offset in characters from the end of the value
1761              of parameter rather than a number of characters, and the  expan‐
1762              sion  is  the  characters  between offset and that result.  Note
1763              that a negative offset must be separated from the  colon  by  at
1764              least one space to avoid being confused with the :- expansion.
1765
1766              If  parameter is @ or *, the result is length positional parame‐
1767              ters beginning at offset.  A negative offset is  taken  relative
1768              to  one  greater  than  the greatest positional parameter, so an
1769              offset of -1 evaluates to the last positional parameter.  It  is
1770              an  expansion  error  if  length evaluates to a number less than
1771              zero.
1772
1773              If parameter is an indexed array name subscripted by @ or *, the
1774              result  is  the length members of the array beginning with ${pa‐
1775              rameter[offset]}.  A negative offset is taken  relative  to  one
1776              greater than the maximum index of the specified array.  It is an
1777              expansion error if length evaluates to a number less than zero.
1778
1779              Substring expansion applied to an associative array produces un‐
1780              defined results.
1781
1782              Substring  indexing  is zero-based unless the positional parame‐
1783              ters are used, in which case the indexing starts  at  1  by  de‐
1784              fault.   If offset is 0, and the positional parameters are used,
1785              $0 is prefixed to the list.
1786
1787       ${!prefix*}
1788       ${!prefix@}
1789              Names matching prefix.  Expands to the names of variables  whose
1790              names begin with prefix, separated by the first character of the
1791              IFS special variable.  When @ is used and the expansion  appears
1792              within  double  quotes, each variable name expands to a separate
1793              word.
1794
1795       ${!name[@]}
1796       ${!name[*]}
1797              List of array keys.  If name is an array  variable,  expands  to
1798              the  list  of array indices (keys) assigned in name.  If name is
1799              not an array, expands to 0 if name is set  and  null  otherwise.
1800              When  @  is used and the expansion appears within double quotes,
1801              each key expands to a separate word.
1802
1803       ${#parameter}
1804              Parameter length.  The length in characters of the value of  pa‐
1805              rameter  is substituted.  If parameter is * or @, the value sub‐
1806              stituted is the number of positional parameters.   If  parameter
1807              is an array name subscripted by * or @, the value substituted is
1808              the number of elements in the array.  If parameter is an indexed
1809              array  name subscripted by a negative number, that number is in‐
1810              terpreted as relative to one greater than the maximum  index  of
1811              parameter,  so  negative  indices count back from the end of the
1812              array, and an index of -1 references the last element.
1813
1814       ${parameter#word}
1815       ${parameter##word}
1816              Remove matching prefix pattern.  The word is expanded to produce
1817              a pattern just as in pathname expansion, and matched against the
1818              expanded value of parameter using the rules described under Pat‐
1819              tern  Matching  below.   If the pattern matches the beginning of
1820              the value of parameter, then the result of the expansion is  the
1821              expanded  value  of parameter with the shortest matching pattern
1822              (the ``#'' case) or the longest  matching  pattern  (the  ``##''
1823              case)  deleted.  If parameter is @ or *, the pattern removal op‐
1824              eration is applied to each positional parameter in turn, and the
1825              expansion is the resultant list.  If parameter is an array vari‐
1826              able subscripted with @ or *, the pattern removal  operation  is
1827              applied  to  each member of the array in turn, and the expansion
1828              is the resultant list.
1829
1830       ${parameter%word}
1831       ${parameter%%word}
1832              Remove matching suffix pattern.  The word is expanded to produce
1833              a pattern just as in pathname expansion, and matched against the
1834              expanded value of parameter using the rules described under Pat‐
1835              tern  Matching below.  If the pattern matches a trailing portion
1836              of the expanded value of parameter, then the result of  the  ex‐
1837              pansion  is  the  expanded  value of parameter with the shortest
1838              matching pattern (the ``%'' case) or the longest  matching  pat‐
1839              tern  (the  ``%%''  case)  deleted.  If parameter is @ or *, the
1840              pattern removal operation is applied to each positional  parame‐
1841              ter in turn, and the expansion is the resultant list.  If param‐
1842              eter is an array variable subscripted with @ or *,  the  pattern
1843              removal  operation  is  applied  to  each member of the array in
1844              turn, and the expansion is the resultant list.
1845
1846       ${parameter/pattern/string}
1847       ${parameter//pattern/string}
1848       ${parameter/#pattern/string}
1849       ${parameter/%pattern/string}
1850              Pattern substitution.  The pattern is expanded to produce a pat‐
1851              tern  just  as in pathname expansion.  Parameter is expanded and
1852              the longest match of pattern against its value is replaced  with
1853              string.   string  undergoes tilde expansion, parameter and vari‐
1854              able expansion, arithmetic expansion, command and  process  sub‐
1855              stitution,  and quote removal.  The match is performed using the
1856              rules described under Pattern Matching below.  In the first form
1857              above,  only  the  first  match  is  replaced.  If there are two
1858              slashes  separating  parameter  and  pattern  (the  second  form
1859              above),  all  matches  of  pattern are replaced with string.  If
1860              pattern is preceded by # (the third form above), it  must  match
1861              at the beginning of the expanded value of parameter.  If pattern
1862              is preceded by % (the fourth form above), it must match  at  the
1863              end  of  the  expanded  value of parameter.  If the expansion of
1864              string is null, matches of pattern are deleted.   If  string  is
1865              null, matches of pattern are deleted and the / following pattern
1866              may be omitted.
1867
1868              If the patsub_replacement shell option is enabled  using  shopt,
1869              any  unquoted  instances  of  &  in string are replaced with the
1870              matching portion of pattern.
1871
1872              Quoting any part of string inhibits replacement in the expansion
1873              of  the  quoted portion, including replacement strings stored in
1874              shell variables.  Backslash will escape & in string;  the  back‐
1875              slash  is removed in order to permit a literal & in the replace‐
1876              ment string.  Backslash can also be used to escape a  backslash;
1877              \\  results  in  a  literal backslash in the replacement.  Users
1878              should take care if string is double-quoted  to  avoid  unwanted
1879              interactions  between  the  backslash  and double-quoting, since
1880              backslash has special meaning  within  double  quotes.   Pattern
1881              substitution  performs  the check for unquoted & after expanding
1882              string; shell programmers should quote any occurrences of & they
1883              want to be taken literally in the replacement and ensure any in‐
1884              stances of & they want to be replaced are unquoted.
1885
1886              If the nocasematch shell option is enabled, the  match  is  per‐
1887              formed  without regard to the case of alphabetic characters.  If
1888              parameter is @ or *, the substitution operation  is  applied  to
1889              each  positional parameter in turn, and the expansion is the re‐
1890              sultant list.  If parameter is  an  array  variable  subscripted
1891              with  @ or *, the substitution operation is applied to each mem‐
1892              ber of the array in turn, and the  expansion  is  the  resultant
1893              list.
1894
1895       ${parameter^pattern}
1896       ${parameter^^pattern}
1897       ${parameter,pattern}
1898       ${parameter,,pattern}
1899              Case  modification.   This expansion modifies the case of alpha‐
1900              betic characters in parameter.  The pattern is expanded to  pro‐
1901              duce a pattern just as in pathname expansion.  Each character in
1902              the expanded value of parameter is tested against pattern,  and,
1903              if  it  matches the pattern, its case is converted.  The pattern
1904              should not attempt to match more than one character.  The ^  op‐
1905              erator converts lowercase letters matching pattern to uppercase;
1906              the , operator converts matching uppercase letters to lowercase.
1907              The  ^^  and ,, expansions convert each matched character in the
1908              expanded value; the ^ and , expansions match  and  convert  only
1909              the  first character in the expanded value.  If pattern is omit‐
1910              ted, it is treated like a ?, which matches every character.   If
1911              parameter  is @ or *, the case modification operation is applied
1912              to each positional parameter in turn, and the expansion  is  the
1913              resultant  list.   If parameter is an array variable subscripted
1914              with @ or *, the case modification operation is applied to  each
1915              member  of the array in turn, and the expansion is the resultant
1916              list.
1917
1918       ${parameter@operator}
1919              Parameter transformation.  The expansion is either a transforma‐
1920              tion  of  the  value of parameter or information about parameter
1921              itself, depending on the value of operator.  Each operator is  a
1922              single letter:
1923
1924              U      The  expansion is a string that is the value of parameter
1925                     with lowercase alphabetic characters converted to  upper‐
1926                     case.
1927              u      The  expansion is a string that is the value of parameter
1928                     with the first character converted to uppercase, if it is
1929                     alphabetic.
1930              L      The  expansion is a string that is the value of parameter
1931                     with uppercase alphabetic characters converted to  lower‐
1932                     case.
1933              Q      The  expansion is a string that is the value of parameter
1934                     quoted in a format that can be reused as input.
1935              E      The expansion is a string that is the value of  parameter
1936                     with  backslash  escape  sequences  expanded  as with the
1937                     $'...' quoting mechanism.
1938              P      The expansion is a string that is the result of expanding
1939                     the value of parameter as if it were a prompt string (see
1940                     PROMPTING below).
1941              A      The expansion is a string in the form  of  an  assignment
1942                     statement  or  declare  command  that, if evaluated, will
1943                     recreate parameter with its attributes and value.
1944              K      Produces a possibly-quoted version of the value of param‐
1945                     eter, except that it prints the values of indexed and as‐
1946                     sociative arrays as a sequence of quoted key-value  pairs
1947                     (see Arrays above).
1948              a      The  expansion is a string consisting of flag values rep‐
1949                     resenting parameter's attributes.
1950              k      Like the K transformation, but expands the keys and  val‐
1951                     ues  of  indexed and associative arrays to separate words
1952                     after word splitting.
1953
1954              If parameter is @ or *, the operation is applied to  each  posi‐
1955              tional  parameter  in  turn,  and the expansion is the resultant
1956              list.  If parameter is an array variable subscripted with  @  or
1957              *, the operation is applied to each member of the array in turn,
1958              and the expansion is the resultant list.
1959
1960              The result of the expansion is subject  to  word  splitting  and
1961              pathname expansion as described below.
1962
1963   Command Substitution
1964       Command substitution allows the output of a command to replace the com‐
1965       mand name.  There are two forms:
1966
1967              $(command)
1968       or
1969              `command`
1970
1971       Bash performs the expansion by executing command in a subshell environ‐
1972       ment and replacing the command substitution with the standard output of
1973       the command, with any trailing newlines deleted.  Embedded newlines are
1974       not  deleted,  but they may be removed during word splitting.  The com‐
1975       mand substitution $(cat file) can be replaced  by  the  equivalent  but
1976       faster $(< file).
1977
1978       When  the  old-style  backquote form of substitution is used, backslash
1979       retains its literal meaning except when followed by $, `,  or  \.   The
1980       first backquote not preceded by a backslash terminates the command sub‐
1981       stitution.  When using the $(command) form, all characters between  the
1982       parentheses make up the command; none are treated specially.
1983
1984       Command substitutions may be nested.  To nest when using the backquoted
1985       form, escape the inner backquotes with backslashes.
1986
1987       If the substitution appears within double quotes,  word  splitting  and
1988       pathname expansion are not performed on the results.
1989
1990   Arithmetic Expansion
1991       Arithmetic  expansion allows the evaluation of an arithmetic expression
1992       and the substitution of the result.  The format for  arithmetic  expan‐
1993       sion is:
1994
1995              $((expression))
1996
1997       The  expression undergoes the same expansions as if it were within dou‐
1998       ble quotes, but double quote characters in expression are  not  treated
1999       specially and are removed.  All tokens in the expression undergo param‐
2000       eter and variable expansion, command substitution, and  quote  removal.
2001       The  result  is  treated  as the arithmetic expression to be evaluated.
2002       Arithmetic expansions may be nested.
2003
2004       The evaluation is performed according to the rules listed  below  under
2005       ARITHMETIC EVALUATION.  If expression is invalid, bash prints a message
2006       indicating failure and no substitution occurs.
2007
2008   Process Substitution
2009       Process substitution allows a process's input or output to be  referred
2010       to  using  a  filename.   It takes the form of <(list) or >(list).  The
2011       process list is run asynchronously, and its input or output appears  as
2012       a filename.  This filename is passed as an argument to the current com‐
2013       mand as the result of the expansion.  If  the  >(list)  form  is  used,
2014       writing  to  the file will provide input for list.  If the <(list) form
2015       is used, the file passed as an argument should be read  to  obtain  the
2016       output of list.  Process substitution is supported on systems that sup‐
2017       port named pipes (FIFOs) or the /dev/fd method of naming open files.
2018
2019       When available, process substitution is performed  simultaneously  with
2020       parameter  and variable expansion, command substitution, and arithmetic
2021       expansion.
2022
2023   Word Splitting
2024       The shell scans the results of parameter expansion,  command  substitu‐
2025       tion,  and arithmetic expansion that did not occur within double quotes
2026       for word splitting.
2027
2028       The shell treats each character of IFS as a delimiter, and  splits  the
2029       results  of  the  other expansions into words using these characters as
2030       field  terminators.   If  IFS  is  unset,  or  its  value  is   exactly
2031       <space><tab><newline>,  the  default, then sequences of <space>, <tab>,
2032       and <newline> at the beginning and end of the results of  the  previous
2033       expansions  are  ignored, and any sequence of IFS characters not at the
2034       beginning or end serves to delimit words.  If IFS  has  a  value  other
2035       than  the  default,  then sequences of the whitespace characters space,
2036       tab, and newline are ignored at the beginning and end of the  word,  as
2037       long  as the whitespace character is in the value of IFS (an IFS white‐
2038       space character).  Any character in IFS that  is  not  IFS  whitespace,
2039       along with any adjacent IFS whitespace characters, delimits a field.  A
2040       sequence of IFS whitespace characters is also treated as  a  delimiter.
2041       If the value of IFS is null, no word splitting occurs.
2042
2043       Explicit  null arguments ("" or '') are retained and passed to commands
2044       as empty strings.  Unquoted implicit null arguments, resulting from the
2045       expansion of parameters that have no values, are removed.  If a parame‐
2046       ter with no value is expanded within double quotes, a null argument re‐
2047       sults and is retained and passed to a command as an empty string.  When
2048       a quoted null argument appears as part of a  word  whose  expansion  is
2049       non-null, the null argument is removed.  That is, the word -d'' becomes
2050       -d after word splitting and null argument removal.
2051
2052       Note that if no expansion occurs, no splitting is performed.
2053
2054   Pathname Expansion
2055       After word splitting, unless the -f option has  been  set,  bash  scans
2056       each  word  for the characters *, ?, and [.  If one of these characters
2057       appears, and is not quoted, then the word is regarded as a pattern, and
2058       replaced  with  an alphabetically sorted list of filenames matching the
2059       pattern (see Pattern Matching below).  If  no  matching  filenames  are
2060       found,  and  the shell option nullglob is not enabled, the word is left
2061       unchanged.  If the nullglob option is set, and no  matches  are  found,
2062       the  word  is  removed.   If  the  failglob shell option is set, and no
2063       matches are found, an error message is printed and the command  is  not
2064       executed.  If the shell option nocaseglob is enabled, the match is per‐
2065       formed without regard to the case of  alphabetic  characters.   When  a
2066       pattern  is  used  for  pathname expansion, the character ``.''  at the
2067       start of a name or immediately following a slash must  be  matched  ex‐
2068       plicitly,  unless  the  shell option dotglob is set.  In order to match
2069       the filenames ``.''  and ``..'', the pattern must begin with ``.'' (for
2070       example,  ``.?''),  even  if dotglob is set.  If the globskipdots shell
2071       option is enabled, the filenames ``.''  and ``..''  are never  matched,
2072       even  if the pattern begins with a ``.''.  When not matching pathnames,
2073       the ``.''  character is not treated specially.  When matching  a  path‐
2074       name,  the slash character must always be matched explicitly by a slash
2075       in the pattern, but in other matching contexts it can be matched  by  a
2076       special  pattern  character  as described below under Pattern Matching.
2077       See the description of shopt below under SHELL BUILTIN COMMANDS  for  a
2078       description  of  the  nocaseglob, nullglob, globskipdots, failglob, and
2079       dotglob shell options.
2080
2081       The GLOBIGNORE shell variable may be used to restrict the set  of  file
2082       names  matching  a  pattern.   If GLOBIGNORE is set, each matching file
2083       name that also matches one of the patterns  in  GLOBIGNORE  is  removed
2084       from  the list of matches.  If the nocaseglob option is set, the match‐
2085       ing against the patterns in GLOBIGNORE is performed without  regard  to
2086       case.  The filenames ``.''  and ``..''  are always ignored when GLOBIG‐
2087       NORE is set and not null.  However, setting GLOBIGNORE  to  a  non-null
2088       value has the effect of enabling the dotglob shell option, so all other
2089       filenames beginning with a ``.''  will match.  To get the old  behavior
2090       of  ignoring  filenames beginning with a ``.'', make ``.*''  one of the
2091       patterns in GLOBIGNORE.  The dotglob option is disabled when GLOBIGNORE
2092       is unset.  The pattern matching honors the setting of the extglob shell
2093       option.
2094
2095       Pattern Matching
2096
2097       Any character that appears in a pattern, other than the special pattern
2098       characters  described below, matches itself.  The NUL character may not
2099       occur in a pattern.  A backslash escapes the following  character;  the
2100       escaping  backslash  is  discarded  when matching.  The special pattern
2101       characters must be quoted if they are to be matched literally.
2102
2103       The special pattern characters have the following meanings:
2104
2105              *      Matches any string, including the null string.  When  the
2106                     globstar  shell  option  is  enabled,  and * is used in a
2107                     pathname expansion context, two adjacent  *s  used  as  a
2108                     single  pattern will match all files and zero or more di‐
2109                     rectories and subdirectories.  If followed by  a  /,  two
2110                     adjacent  *s  will match only directories and subdirecto‐
2111                     ries.
2112              ?      Matches any single character.
2113              [...]  Matches any one of the enclosed characters.   A  pair  of
2114                     characters  separated by a hyphen denotes a range expres‐
2115                     sion; any character that falls between those two  charac‐
2116                     ters, inclusive, using the current locale's collating se‐
2117                     quence and character set, is matched.  If the first char‐
2118                     acter  following  the [ is a !  or a ^ then any character
2119                     not enclosed is matched.  The sorting order of characters
2120                     in  range expressions, and the characters included in the
2121                     range, are determined by the current locale and the  val‐
2122                     ues  of the LC_COLLATE or LC_ALL shell variables, if set.
2123                     To obtain the traditional interpretation of range expres‐
2124                     sions,  where [a-d] is equivalent to [abcd], set value of
2125                     the LC_ALL shell variable to C, or enable  the  globasci‐
2126                     iranges shell option.  A - may be matched by including it
2127                     as the first or last character in the set.  A  ]  may  be
2128                     matched  by  including  it  as the first character in the
2129                     set.
2130
2131                     Within [ and ], character classes can be specified  using
2132                     the syntax [:class:], where class is one of the following
2133                     classes defined in the POSIX standard:
2134                     alnum alpha ascii blank cntrl  digit  graph  lower  print
2135                     punct space upper word xdigit
2136                     A character class matches any character belonging to that
2137                     class.  The word character class matches letters, digits,
2138                     and the character _.
2139
2140                     Within [ and ], an equivalence class can be specified us‐
2141                     ing the syntax [=c=], which matches all  characters  with
2142                     the  same collation weight (as defined by the current lo‐
2143                     cale) as the character c.
2144
2145                     Within [ and ], the syntax [.symbol.] matches the collat‐
2146                     ing symbol symbol.
2147
2148       If  the  extglob  shell  option is enabled using the shopt builtin, the
2149       shell recognizes several extended pattern matching operators.   In  the
2150       following description, a pattern-list is a list of one or more patterns
2151       separated by a |.  Composite patterns may be formed using one  or  more
2152       of the following sub-patterns:
2153
2154              ?(pattern-list)
2155                     Matches zero or one occurrence of the given patterns
2156              *(pattern-list)
2157                     Matches zero or more occurrences of the given patterns
2158              +(pattern-list)
2159                     Matches one or more occurrences of the given patterns
2160              @(pattern-list)
2161                     Matches one of the given patterns
2162              !(pattern-list)
2163                     Matches anything except one of the given patterns
2164
2165       Theextglob  option changes the behavior of the parser, since the paren‐
2166       theses are normally treated as operators with  syntactic  meaning.   To
2167       ensure  that extended matching patterns are parsed correctly, make sure
2168       that extglob is enabled before parsing constructs containing  the  pat‐
2169       terns, including shell functions and command substitutions.
2170
2171       When matching filenames, the dotglob shell option determines the set of
2172       filenames that are tested: when dotglob is enabled, the  set  of  file‐
2173       names  includes  all  files  beginning with ``.'', but ``.'' and ``..''
2174       must be matched by a pattern or sub-pattern that  begins  with  a  dot;
2175       when  it  is disabled, the set does not include any filenames beginning
2176       with ``.'' unless the pattern or sub-pattern begins with a  ``.''.   As
2177       above, ``.'' only has a special meaning when matching filenames.
2178
2179       Complicated extended pattern matching against long strings is slow, es‐
2180       pecially when the patterns contain alternations and the strings contain
2181       multiple  matches.   Using separate matches against shorter strings, or
2182       using arrays of strings instead of a single long string, may be faster.
2183
2184   Quote Removal
2185       After the preceding expansions, all unquoted occurrences of the charac‐
2186       ters  \,  ', and " that did not result from one of the above expansions
2187       are removed.
2188

REDIRECTION

2190       Before a command is executed, its input and output  may  be  redirected
2191       using  a special notation interpreted by the shell.  Redirection allows
2192       commands' file handles to be duplicated, opened, closed, made to  refer
2193       to different files, and can change the files the command reads from and
2194       writes to.  Redirection may also be used to modify file handles in  the
2195       current  shell execution environment.  The following redirection opera‐
2196       tors may precede or appear anywhere within a simple command or may fol‐
2197       low  a  command.   Redirections are processed in the order they appear,
2198       from left to right.
2199
2200       Each redirection that may be preceded by a file descriptor  number  may
2201       instead be preceded by a word of the form {varname}.  In this case, for
2202       each redirection operator except >&- and <&-, the shell will allocate a
2203       file  descriptor  greater than or equal to 10 and assign it to varname.
2204       If >&- or <&- is preceded by {varname}, the value  of  varname  defines
2205       the  file descriptor to close.  If {varname} is supplied, the redirect‐
2206       ion persists beyond the scope of the command, allowing the  shell  pro‐
2207       grammer  to  manage  the  file  descriptor's  lifetime  manually.   The
2208       varredir_close shell option manages this behavior.
2209
2210       In the following descriptions, if the file descriptor number  is  omit‐
2211       ted,  and the first character of the redirection operator is <, the re‐
2212       direction refers to the standard input (file  descriptor  0).   If  the
2213       first  character  of  the  redirection  operator  is >, the redirection
2214       refers to the standard output (file descriptor 1).
2215
2216       The word following the redirection operator in the  following  descrip‐
2217       tions,  unless  otherwise noted, is subjected to brace expansion, tilde
2218       expansion, parameter  and  variable  expansion,  command  substitution,
2219       arithmetic  expansion,  quote  removal,  pathname  expansion,  and word
2220       splitting.  If it expands to more than one word, bash reports an error.
2221
2222       Note that the order of redirections is significant.  For  example,  the
2223       command
2224
2225              ls > dirlist 2>&1
2226
2227       directs  both  standard  output and standard error to the file dirlist,
2228       while the command
2229
2230              ls 2>&1 > dirlist
2231
2232       directs only the standard output to file dirlist, because the  standard
2233       error  was duplicated from the standard output before the standard out‐
2234       put was redirected to dirlist.
2235
2236       Bash handles several filenames specially when they are used in redirec‐
2237       tions, as described in the following table.  If the operating system on
2238       which bash is running provides these special files, bash will use them;
2239       otherwise  it  will emulate them internally with the behavior described
2240       below.
2241
2242              /dev/fd/fd
2243                     If fd is a valid integer, file descriptor  fd  is  dupli‐
2244                     cated.
2245              /dev/stdin
2246                     File descriptor 0 is duplicated.
2247              /dev/stdout
2248                     File descriptor 1 is duplicated.
2249              /dev/stderr
2250                     File descriptor 2 is duplicated.
2251              /dev/tcp/host/port
2252                     If host is a valid hostname or Internet address, and port
2253                     is an integer port number or service name, bash  attempts
2254                     to open the corresponding TCP socket.
2255              /dev/udp/host/port
2256                     If host is a valid hostname or Internet address, and port
2257                     is an integer port number or service name, bash  attempts
2258                     to open the corresponding UDP socket.
2259
2260       A failure to open or create a file causes the redirection to fail.
2261
2262       Redirections  using file descriptors greater than 9 should be used with
2263       care, as they may conflict with file descriptors the shell uses  inter‐
2264       nally.
2265
2266   Redirecting Input
2267       Redirection of input causes the file whose name results from the expan‐
2268       sion of word to be opened for reading on  file  descriptor  n,  or  the
2269       standard input (file descriptor 0) if n is not specified.
2270
2271       The general format for redirecting input is:
2272
2273              [n]<word
2274
2275   Redirecting Output
2276       Redirection  of  output causes the file whose name results from the ex‐
2277       pansion of word to be opened for writing on file descriptor n,  or  the
2278       standard output (file descriptor 1) if n is not specified.  If the file
2279       does not exist it is created; if it does exist it is truncated to  zero
2280       size.
2281
2282       The general format for redirecting output is:
2283
2284              [n]>word
2285
2286       If  the  redirection operator is >, and the noclobber option to the set
2287       builtin has been enabled, the redirection will fail if the  file  whose
2288       name  results  from the expansion of word exists and is a regular file.
2289       If the redirection operator is >|, or the redirection operator is > and
2290       the noclobber option to the set builtin command is not enabled, the re‐
2291       direction is attempted even if the file named by word exists.
2292
2293   Appending Redirected Output
2294       Redirection of output in this fashion causes the file  whose  name  re‐
2295       sults from the expansion of word to be opened for appending on file de‐
2296       scriptor n, or the standard output (file descriptor  1)  if  n  is  not
2297       specified.  If the file does not exist it is created.
2298
2299       The general format for appending output is:
2300
2301              [n]>>word
2302
2303   Redirecting Standard Output and Standard Error
2304       This  construct allows both the standard output (file descriptor 1) and
2305       the standard error output (file descriptor 2) to be redirected  to  the
2306       file whose name is the expansion of word.
2307
2308       There  are two formats for redirecting standard output and standard er‐
2309       ror:
2310
2311              &>word
2312       and
2313              >&word
2314
2315       Of the two forms, the first is preferred.  This is semantically equiva‐
2316       lent to
2317
2318              >word 2>&1
2319
2320       When  using  the second form, word may not expand to a number or -.  If
2321       it does, other redirection operators apply (see  Duplicating  File  De‐
2322       scriptors below) for compatibility reasons.
2323
2324   Appending Standard Output and Standard Error
2325       This  construct allows both the standard output (file descriptor 1) and
2326       the standard error output (file descriptor 2) to  be  appended  to  the
2327       file whose name is the expansion of word.
2328
2329       The format for appending standard output and standard error is:
2330
2331              &>>word
2332
2333       This is semantically equivalent to
2334
2335              >>word 2>&1
2336
2337       (see Duplicating File Descriptors below).
2338
2339   Here Documents
2340       This  type  of  redirection  instructs the shell to read input from the
2341       current source until a line containing only delimiter (with no trailing
2342       blanks)  is seen.  All of the lines read up to that point are then used
2343       as the standard input (or file descriptor n if n is  specified)  for  a
2344       command.
2345
2346       The format of here-documents is:
2347
2348              [n]<<[-]word
2349                      here-document
2350              delimiter
2351
2352       No  parameter  and variable expansion, command substitution, arithmetic
2353       expansion, or pathname expansion is performed on word.  If any part  of
2354       word  is  quoted, the delimiter is the result of quote removal on word,
2355       and the lines in the here-document are not expanded.  If  word  is  un‐
2356       quoted,  all  lines of the here-document are subjected to parameter ex‐
2357       pansion, command substitution, and arithmetic expansion, the  character
2358       sequence \<newline> is ignored, and \ must be used to quote the charac‐
2359       ters \, $, and `.
2360
2361       If the redirection operator is <<-, then all leading tab characters are
2362       stripped  from input lines and the line containing delimiter.  This al‐
2363       lows here-documents within shell scripts to be indented  in  a  natural
2364       fashion.
2365
2366   Here Strings
2367       A variant of here documents, the format is:
2368
2369              [n]<<<word
2370
2371       The  word  undergoes tilde expansion, parameter and variable expansion,
2372       command substitution, arithmetic expansion, and quote  removal.   Path‐
2373       name  expansion  and  word  splitting are not performed.  The result is
2374       supplied as a single string, with a newline appended, to the command on
2375       its standard input (or file descriptor n if n is specified).
2376
2377   Duplicating File Descriptors
2378       The redirection operator
2379
2380              [n]<&word
2381
2382       is used to duplicate input file descriptors.  If word expands to one or
2383       more digits, the file descriptor denoted by n is made to be a  copy  of
2384       that  file descriptor.  If the digits in word do not specify a file de‐
2385       scriptor open for input, a redirection error occurs.  If word evaluates
2386       to -, file descriptor n is closed.  If n is not specified, the standard
2387       input (file descriptor 0) is used.
2388
2389       The operator
2390
2391              [n]>&word
2392
2393       is used similarly to duplicate output file descriptors.  If  n  is  not
2394       specified,  the  standard  output  (file descriptor 1) is used.  If the
2395       digits in word do not specify a file descriptor open for output, a  re‐
2396       direction  error  occurs.  If word evaluates to -, file descriptor n is
2397       closed.  As a special case, if n is omitted, and word does  not  expand
2398       to  one or more digits or -, the standard output and standard error are
2399       redirected as described previously.
2400
2401   Moving File Descriptors
2402       The redirection operator
2403
2404              [n]<&digit-
2405
2406       moves the file descriptor digit to file descriptor n, or  the  standard
2407       input (file descriptor 0) if n is not specified.  digit is closed after
2408       being duplicated to n.
2409
2410       Similarly, the redirection operator
2411
2412              [n]>&digit-
2413
2414       moves the file descriptor digit to file descriptor n, or  the  standard
2415       output (file descriptor 1) if n is not specified.
2416
2417   Opening File Descriptors for Reading and Writing
2418       The redirection operator
2419
2420              [n]<>word
2421
2422       causes  the  file  whose name is the expansion of word to be opened for
2423       both reading and writing on file descriptor n, or on file descriptor  0
2424       if n is not specified.  If the file does not exist, it is created.
2425

ALIASES

2427       Aliases  allow a string to be substituted for a word when it is used as
2428       the first word of a simple command.  The  shell  maintains  a  list  of
2429       aliases  that  may  be set and unset with the alias and unalias builtin
2430       commands (see SHELL BUILTIN COMMANDS below).  The first  word  of  each
2431       simple  command, if unquoted, is checked to see if it has an alias.  If
2432       so, that word is replaced by the text of the alias.  The characters  /,
2433       $,  `,  and = and any of the shell metacharacters or quoting characters
2434       listed above may not appear in an alias name.  The replacement text may
2435       contain  any  valid  shell  input, including shell metacharacters.  The
2436       first word of the replacement text is tested for aliases,  but  a  word
2437       that  is  identical to an alias being expanded is not expanded a second
2438       time.  This means that one may alias ls to ls  -F,  for  instance,  and
2439       bash  does  not try to recursively expand the replacement text.  If the
2440       last character of the alias value is a blank,  then  the  next  command
2441       word following the alias is also checked for alias expansion.
2442
2443       Aliases are created and listed with the alias command, and removed with
2444       the unalias command.
2445
2446       There is no mechanism for using arguments in the replacement text.   If
2447       arguments are needed, use a shell function (see FUNCTIONS below).
2448
2449       Aliases  are not expanded when the shell is not interactive, unless the
2450       expand_aliases shell option is set using shopt (see the description  of
2451       shopt under SHELL BUILTIN COMMANDS below).
2452
2453       The  rules  concerning  the  definition and use of aliases are somewhat
2454       confusing.  Bash always reads at least one complete line of input,  and
2455       all  lines that make up a compound command, before executing any of the
2456       commands on that line or the compound command.   Aliases  are  expanded
2457       when  a  command is read, not when it is executed.  Therefore, an alias
2458       definition appearing on the same line as another command does not  take
2459       effect  until  the  next line of input is read.  The commands following
2460       the alias definition on that line are not affected by  the  new  alias.
2461       This  behavior  is  also an issue when functions are executed.  Aliases
2462       are expanded when a function definition is read, not when the  function
2463       is  executed,  because a function definition is itself a command.  As a
2464       consequence, aliases defined in a function are not available until  af‐
2465       ter  that  function  is executed.  To be safe, always put alias defini‐
2466       tions on a separate line, and do not use alias in compound commands.
2467
2468       For almost every purpose, aliases are superseded by shell functions.
2469

FUNCTIONS

2471       A shell function, defined  as  described  above  under  SHELL  GRAMMAR,
2472       stores  a  series  of commands for later execution.  When the name of a
2473       shell function is used as a simple command name, the list  of  commands
2474       associated with that function name is executed.  Functions are executed
2475       in the context of the current shell; no new process is created  to  in‐
2476       terpret  them  (contrast  this  with  the execution of a shell script).
2477       When a function is executed, the arguments to the function  become  the
2478       positional parameters during its execution.  The special parameter # is
2479       updated to reflect the change.  Special parameter 0 is unchanged.   The
2480       first  element of the FUNCNAME variable is set to the name of the func‐
2481       tion while the function is executing.
2482
2483       All other aspects of the shell execution environment are identical  be‐
2484       tween  a  function  and its caller with these exceptions: the DEBUG and
2485       RETURN traps (see the description  of  the  trap  builtin  under  SHELL
2486       BUILTIN  COMMANDS below) are not inherited unless the function has been
2487       given the trace attribute (see the description of the  declare  builtin
2488       below)  or  the -o functrace shell option has been enabled with the set
2489       builtin (in which case all  functions  inherit  the  DEBUG  and  RETURN
2490       traps),  and the ERR trap is not inherited unless the -o errtrace shell
2491       option has been enabled.
2492
2493       Variables local to the function may be declared with the local  builtin
2494       command  (local variables).  Ordinarily, variables and their values are
2495       shared between the function and its caller.  If a variable is  declared
2496       local,  the variable's visible scope is restricted to that function and
2497       its children (including the functions it calls).
2498
2499       In the following description, the current scope is a currently- execut‐
2500       ing function.  Previous scopes consist of that function's caller and so
2501       on, back to the "global" scope, where the shell is  not  executing  any
2502       shell function.  Consequently, a local variable at the current scope is
2503       a variable declared using the local or declare builtins in the function
2504       that is currently executing.
2505
2506       Local  variables "shadow" variables with the same name declared at pre‐
2507       vious scopes.  For instance, a local variable declared  in  a  function
2508       hides  a  global  variable of the same name: references and assignments
2509       refer to the local variable, leaving the  global  variable  unmodified.
2510       When the function returns, the global variable is once again visible.
2511
2512       The  shell  uses  dynamic  scoping  to  control a variable's visibility
2513       within functions.  With dynamic scoping, visible  variables  and  their
2514       values  are a result of the sequence of function calls that caused exe‐
2515       cution to reach the current function.  The value of a variable  that  a
2516       function  sees  depends on its value within its caller, if any, whether
2517       that caller is the "global" scope or another shell function.   This  is
2518       also  the  value  that  a local variable declaration "shadows", and the
2519       value that is restored when the function returns.
2520
2521       For example, if a variable var is declared as local in function  func1,
2522       and  func1  calls  another  function func2, references to var made from
2523       within func2 will resolve to the local variable var from func1, shadow‐
2524       ing any global variable named var.
2525
2526       The unset builtin also acts using the same dynamic scope: if a variable
2527       is local to the current scope, unset will unset it; otherwise the unset
2528       will  refer  to  the  variable  found in any calling scope as described
2529       above.  If a variable at the current local scope is unset, it will  re‐
2530       main  so  (appearing as unset) until it is reset in that scope or until
2531       the function returns.  Once the function returns, any instance  of  the
2532       variable at a previous scope will become visible.  If the unset acts on
2533       a variable at a previous scope, any instance of a  variable  with  that
2534       name  that had been shadowed will become visible (see below how the lo‐
2535       calvar_unset shell option changes this behavior).
2536
2537       The FUNCNEST variable, if set to a numeric value greater  than  0,  de‐
2538       fines  a maximum function nesting level.  Function invocations that ex‐
2539       ceed the limit cause the entire command to abort.
2540
2541       If the builtin command return is executed in a function,  the  function
2542       completes  and  execution resumes with the next command after the func‐
2543       tion call.  Any command associated with the RETURN trap is executed be‐
2544       fore  execution  resumes.  When a function completes, the values of the
2545       positional parameters and the special parameter # are restored  to  the
2546       values they had prior to the function's execution.
2547
2548       Function  names and definitions may be listed with the -f option to the
2549       declare or typeset builtin commands.  The -F option to declare or type‐
2550       set  will  list the function names only (and optionally the source file
2551       and line number, if the extdebug shell option is  enabled).   Functions
2552       may  be exported so that child shell processes (those created when exe‐
2553       cuting a separate shell invocation)  automatically  have  them  defined
2554       with the -f option to the export builtin.  A function definition may be
2555       deleted using the -f option to the unset builtin.
2556
2557       Functions may be recursive.  The FUNCNEST variable may be used to limit
2558       the  depth  of the function call stack and restrict the number of func‐
2559       tion invocations.  By default, no limit is imposed on the number of re‐
2560       cursive calls.
2561

ARITHMETIC EVALUATION

2563       The  shell allows arithmetic expressions to be evaluated, under certain
2564       circumstances (see the let and declare builtin commands,  the  ((  com‐
2565       pound command, and Arithmetic Expansion).  Evaluation is done in fixed-
2566       width integers with no check for overflow,  though  division  by  0  is
2567       trapped  and  flagged as an error.  The operators and their precedence,
2568       associativity, and values are the same as in the C language.  The  fol‐
2569       lowing list of operators is grouped into levels of equal-precedence op‐
2570       erators.  The levels are listed in order of decreasing precedence.
2571
2572       id++ id--
2573              variable post-increment and post-decrement
2574       - +    unary minus and plus
2575       ++id --id
2576              variable pre-increment and pre-decrement
2577       ! ~    logical and bitwise negation
2578       **     exponentiation
2579       * / %  multiplication, division, remainder
2580       + -    addition, subtraction
2581       << >>  left and right bitwise shifts
2582       <= >= < >
2583              comparison
2584       == !=  equality and inequality
2585       &      bitwise AND
2586       ^      bitwise exclusive OR
2587       |      bitwise OR
2588       &&     logical AND
2589       ||     logical OR
2590       expr?expr:expr
2591              conditional operator
2592       = *= /= %= += -= <<= >>= &= ^= |=
2593              assignment
2594       expr1 , expr2
2595              comma
2596
2597       Shell variables are allowed as operands; parameter  expansion  is  per‐
2598       formed before the expression is evaluated.  Within an expression, shell
2599       variables may also be referenced by name without  using  the  parameter
2600       expansion  syntax.  A shell variable that is null or unset evaluates to
2601       0 when referenced by name without using the parameter expansion syntax.
2602       The  value  of a variable is evaluated as an arithmetic expression when
2603       it is referenced, or when a variable which has been given  the  integer
2604       attribute using declare -i is assigned a value.  A null value evaluates
2605       to 0.  A shell variable need not have its integer attribute  turned  on
2606       to be used in an expression.
2607
2608       Integer constants follow the C language definition, without suffixes or
2609       character constants.  Constants with a leading 0 are interpreted as oc‐
2610       tal  numbers.  A leading 0x or 0X denotes hexadecimal.  Otherwise, num‐
2611       bers take the form [base#]n, where the optional base is a decimal  num‐
2612       ber  between 2 and 64 representing the arithmetic base, and n is a num‐
2613       ber in that base.  If base# is omitted, then base  10  is  used.   When
2614       specifying n, if a non-digit is required, the digits greater than 9 are
2615       represented by the lowercase letters, the uppercase letters, @, and  _,
2616       in  that order.  If base is less than or equal to 36, lowercase and up‐
2617       percase letters may be used interchangeably to  represent  numbers  be‐
2618       tween 10 and 35.
2619
2620       Operators  are  evaluated  in  order of precedence.  Sub-expressions in
2621       parentheses are evaluated first and may override the  precedence  rules
2622       above.
2623

CONDITIONAL EXPRESSIONS

2625       Conditional  expressions  are  used  by the [[ compound command and the
2626       test and [ builtin commands to test file attributes and perform  string
2627       and  arithmetic  comparisons.   The test and [ commands determine their
2628       behavior based on the number of  arguments;  see  the  descriptions  of
2629       those commands for any other command-specific actions.
2630
2631       Expressions  are  formed  from the following unary or binary primaries.
2632       Bash handles several filenames specially when they are used in  expres‐
2633       sions.  If the operating system on which bash is running provides these
2634       special files, bash will use them; otherwise it will emulate  them  in‐
2635       ternally  with  this  behavior: If any file argument to one of the pri‐
2636       maries is of the form /dev/fd/n, then file descriptor n is checked.  If
2637       the  file  argument  to  one  of  the  primaries  is one of /dev/stdin,
2638       /dev/stdout, or /dev/stderr, file descriptor 0, 1, or 2,  respectively,
2639       is checked.
2640
2641       Unless otherwise specified, primaries that operate on files follow sym‐
2642       bolic links and operate on the target of the link, rather than the link
2643       itself.
2644
2645       When  used  with [[, the < and > operators sort lexicographically using
2646       the current locale.  The test command sorts using ASCII ordering.
2647
2648       -a file
2649              True if file exists.
2650       -b file
2651              True if file exists and is a block special file.
2652       -c file
2653              True if file exists and is a character special file.
2654       -d file
2655              True if file exists and is a directory.
2656       -e file
2657              True if file exists.
2658       -f file
2659              True if file exists and is a regular file.
2660       -g file
2661              True if file exists and is set-group-id.
2662       -h file
2663              True if file exists and is a symbolic link.
2664       -k file
2665              True if file exists and its ``sticky'' bit is set.
2666       -p file
2667              True if file exists and is a named pipe (FIFO).
2668       -r file
2669              True if file exists and is readable.
2670       -s file
2671              True if file exists and has a size greater than zero.
2672       -t fd  True if file descriptor fd is open and refers to a terminal.
2673       -u file
2674              True if file exists and its set-user-id bit is set.
2675       -w file
2676              True if file exists and is writable.
2677       -x file
2678              True if file exists and is executable.
2679       -G file
2680              True if file exists and is owned by the effective group id.
2681       -L file
2682              True if file exists and is a symbolic link.
2683       -N file
2684              True if file exists and has been  modified  since  it  was  last
2685              read.
2686       -O file
2687              True if file exists and is owned by the effective user id.
2688       -S file
2689              True if file exists and is a socket.
2690       file1 -ef file2
2691              True  if file1 and file2 refer to the same device and inode num‐
2692              bers.
2693       file1 -nt file2
2694              True if file1 is newer (according  to  modification  date)  than
2695              file2, or if file1 exists and file2 does not.
2696       file1 -ot file2
2697              True  if file1 is older than file2, or if file2 exists and file1
2698              does not.
2699       -o optname
2700              True if the shell option optname is enabled.  See  the  list  of
2701              options  under  the  description  of  the  -o  option to the set
2702              builtin below.
2703       -v varname
2704              True if the shell variable varname is set (has been  assigned  a
2705              value).
2706       -R varname
2707              True  if  the shell variable varname is set and is a name refer‐
2708              ence.
2709       -z string
2710              True if the length of string is zero.
2711       string
2712       -n string
2713              True if the length of string is non-zero.
2714
2715       string1 == string2
2716       string1 = string2
2717              True if the strings are equal.  = should be used with  the  test
2718              command  for  POSIX conformance.  When used with the [[ command,
2719              this performs pattern matching as described above (Compound Com‐
2720              mands).
2721
2722       string1 != string2
2723              True if the strings are not equal.
2724
2725       string1 < string2
2726              True if string1 sorts before string2 lexicographically.
2727
2728       string1 > string2
2729              True if string1 sorts after string2 lexicographically.
2730
2731       arg1 OP arg2
2732              OP  is one of -eq, -ne, -lt, -le, -gt, or -ge.  These arithmetic
2733              binary operators return true if arg1 is equal to, not equal  to,
2734              less  than, less than or equal to, greater than, or greater than
2735              or equal to arg2, respectively.  Arg1 and arg2 may  be  positive
2736              or  negative  integers.  When used with the [[ command, Arg1 and
2737              Arg2 are evaluated as  arithmetic  expressions  (see  ARITHMETIC
2738              EVALUATION above).
2739

SIMPLE COMMAND EXPANSION

2741       When a simple command is executed, the shell performs the following ex‐
2742       pansions, assignments, and redirections, from left  to  right,  in  the
2743       following order.
2744
2745       1.     The  words  that  the  parser has marked as variable assignments
2746              (those preceding the command name) and  redirections  are  saved
2747              for later processing.
2748
2749       2.     The  words that are not variable assignments or redirections are
2750              expanded.  If any words remain after expansion, the  first  word
2751              is  taken  to be the name of the command and the remaining words
2752              are the arguments.
2753
2754       3.     Redirections are performed as described above under REDIRECTION.
2755
2756       4.     The text after the = in each variable assignment undergoes tilde
2757              expansion, parameter expansion, command substitution, arithmetic
2758              expansion, and quote removal before being assigned to the  vari‐
2759              able.
2760
2761       If no command name results, the variable assignments affect the current
2762       shell environment.  In the case of such a command  (one  that  consists
2763       only  of assignment statements and redirections), assignment statements
2764       are performed before redirections.  Otherwise, the variables are  added
2765       to  the  environment of the executed command and do not affect the cur‐
2766       rent shell environment.  If any of the assignments attempts to assign a
2767       value  to  a  readonly variable, an error occurs, and the command exits
2768       with a non-zero status.
2769
2770       If no command name results, redirections are performed, but do not  af‐
2771       fect  the  current  shell  environment.  A redirection error causes the
2772       command to exit with a non-zero status.
2773
2774       If there is a command name left after expansion, execution proceeds  as
2775       described  below.   Otherwise, the command exits.  If one of the expan‐
2776       sions contained a command substitution, the exit status of the  command
2777       is  the  exit  status  of  the last command substitution performed.  If
2778       there were no command substitutions, the command exits with a status of
2779       zero.
2780

COMMAND EXECUTION

2782       After  a  command  has been split into words, if it results in a simple
2783       command and an optional list of arguments, the  following  actions  are
2784       taken.
2785
2786       If  the  command name contains no slashes, the shell attempts to locate
2787       it.  If there exists a shell function by that name,  that  function  is
2788       invoked  as described above in FUNCTIONS.  If the name does not match a
2789       function, the shell searches for it in the list of shell builtins.   If
2790       a match is found, that builtin is invoked.
2791
2792       If  the name is neither a shell function nor a builtin, and contains no
2793       slashes, bash searches each element of the PATH for  a  directory  con‐
2794       taining an executable file by that name.  Bash uses a hash table to re‐
2795       member the full pathnames of executable files  (see  hash  under  SHELL
2796       BUILTIN  COMMANDS  below).  A full search of the directories in PATH is
2797       performed only if the command is not found in the hash table.   If  the
2798       search is unsuccessful, the shell searches for a defined shell function
2799       named command_not_found_handle.  If that function exists, it is invoked
2800       in  a  separate execution environment with the original command and the
2801       original command's arguments as its arguments, and the function's  exit
2802       status  becomes  the exit status of that subshell.  If that function is
2803       not defined, the shell prints an error message and returns an exit sta‐
2804       tus of 127.
2805
2806       If  the  search  is  successful, or if the command name contains one or
2807       more slashes, the shell executes the named program in a separate execu‐
2808       tion environment.  Argument 0 is set to the name given, and the remain‐
2809       ing arguments to the command are set to the arguments given, if any.
2810
2811       If this execution fails because the file is not in  executable  format,
2812       and  the file is not a directory, it is assumed to be a shell script, a
2813       file containing shell commands, and the shell creates a new instance of
2814       itself  to execute it.  This subshell reinitializes itself, so that the
2815       effect is as if a new shell had been invoked to handle the script, with
2816       the  exception  that the locations of commands remembered by the parent
2817       (see hash below under SHELL  BUILTIN  COMMANDS)  are  retained  by  the
2818       child.
2819
2820       If  the program is a file beginning with #!, the remainder of the first
2821       line specifies an interpreter for the program.  The shell executes  the
2822       specified interpreter on operating systems that do not handle this exe‐
2823       cutable format themselves.  The arguments to the interpreter consist of
2824       a  single optional argument following the interpreter name on the first
2825       line of the program, followed by the name of the program,  followed  by
2826       the command arguments, if any.
2827

COMMAND EXECUTION ENVIRONMENT

2829       The  shell  has an execution environment, which consists of the follow‐
2830       ing:
2831
2832       •      open files inherited by the shell at invocation, as modified  by
2833              redirections supplied to the exec builtin
2834
2835       •      the  current  working directory as set by cd, pushd, or popd, or
2836              inherited by the shell at invocation
2837
2838       •      the file creation mode mask as set by umask  or  inherited  from
2839              the shell's parent
2840
2841       •      current traps set by trap
2842
2843       •      shell parameters that are set by variable assignment or with set
2844              or inherited from the shell's parent in the environment
2845
2846       •      shell functions defined during execution or inherited  from  the
2847              shell's parent in the environment
2848
2849       •      options  enabled  at  invocation (either by default or with com‐
2850              mand-line arguments) or by set
2851
2852       •      options enabled by shopt
2853
2854       •      shell aliases defined with alias
2855
2856       •      various process IDs, including those  of  background  jobs,  the
2857              value of $$, and the value of PPID
2858
2859       When  a  simple command other than a builtin or shell function is to be
2860       executed, it is invoked in a separate execution environment  that  con‐
2861       sists  of the following.  Unless otherwise noted, the values are inher‐
2862       ited from the shell.
2863
2864
2865       •      the shell's open files, plus  any  modifications  and  additions
2866              specified by redirections to the command
2867
2868       •      the current working directory
2869
2870       •      the file creation mode mask
2871
2872       •      shell  variables  and  functions  marked  for export, along with
2873              variables exported for the command, passed in the environment
2874
2875       •      traps caught by the shell are reset to the values inherited from
2876              the shell's parent, and traps ignored by the shell are ignored
2877
2878       A  command  invoked  in  this  separate  environment  cannot affect the
2879       shell's execution environment.
2880
2881       A subshell is a copy of the shell process.
2882
2883       Command substitution, commands grouped with parentheses, and  asynchro‐
2884       nous commands are invoked in a subshell environment that is a duplicate
2885       of the shell environment, except that traps caught by the shell are re‐
2886       set  to  the values that the shell inherited from its parent at invoca‐
2887       tion.  Builtin commands that are invoked as part of a pipeline are also
2888       executed in a subshell environment.  Changes made to the subshell envi‐
2889       ronment cannot affect the shell's execution environment.
2890
2891       Subshells spawned to execute command substitutions inherit the value of
2892       the  -e  option  from  the  parent shell.  When not in posix mode, bash
2893       clears the -e option in such subshells.
2894
2895       If a command is followed by a & and job control is not active, the  de‐
2896       fault standard input for the command is the empty file /dev/null.  Oth‐
2897       erwise, the invoked command inherits the file descriptors of the  call‐
2898       ing shell as modified by redirections.
2899

ENVIRONMENT

2901       When  a  program  is invoked it is given an array of strings called the
2902       environment.   This  is  a  list  of  name-value  pairs,  of  the  form
2903       name=value.
2904
2905       The  shell provides several ways to manipulate the environment.  On in‐
2906       vocation, the shell scans its own environment and creates  a  parameter
2907       for  each name found, automatically marking it for export to child pro‐
2908       cesses.  Executed commands inherit the environment.  The export and de‐
2909       clare  -x  commands  allow  parameters and functions to be added to and
2910       deleted from the environment.  If the value of a parameter in the envi‐
2911       ronment is modified, the new value becomes part of the environment, re‐
2912       placing the old.  The environment inherited  by  any  executed  command
2913       consists  of the shell's initial environment, whose values may be modi‐
2914       fied in the shell, less any pairs removed by the  unset  command,  plus
2915       any additions via the export and declare -x commands.
2916
2917       The  environment  for  any  simple command or function may be augmented
2918       temporarily by prefixing it with parameter  assignments,  as  described
2919       above in PARAMETERS.  These assignment statements affect only the envi‐
2920       ronment seen by that command.
2921
2922       If the -k option is set (see the set builtin command below),  then  all
2923       parameter  assignments are placed in the environment for a command, not
2924       just those that precede the command name.
2925
2926       When bash invokes an external command, the variable _  is  set  to  the
2927       full filename of the command and passed to that command in its environ‐
2928       ment.
2929

EXIT STATUS

2931       The exit status of an executed command is the  value  returned  by  the
2932       waitpid system call or equivalent function.  Exit statuses fall between
2933       0 and 255, though, as explained below, the shell may use  values  above
2934       125 specially.  Exit statuses from shell builtins and compound commands
2935       are also limited to this range.  Under certain circumstances, the shell
2936       will use special values to indicate specific failure modes.
2937
2938       For the shell's purposes, a command which exits with a zero exit status
2939       has succeeded.  An exit status of zero indicates success.   A  non-zero
2940       exit  status  indicates  failure.  When a command terminates on a fatal
2941       signal N, bash uses the value of 128+N as the exit status.
2942
2943       If a command is not found, the child process created to execute it  re‐
2944       turns  a  status  of 127.  If a command is found but is not executable,
2945       the return status is 126.
2946
2947       If a command fails because of an error during expansion or redirection,
2948       the exit status is greater than zero.
2949
2950       Shell  builtin  commands return a status of 0 (true) if successful, and
2951       non-zero (false) if an error occurs while they execute.   All  builtins
2952       return  an  exit status of 2 to indicate incorrect usage, generally in‐
2953       valid options or missing arguments.
2954
2955       The exit status of the last command is available in the special parame‐
2956       ter $?.
2957
2958       Bash  itself  returns the exit status of the last command executed, un‐
2959       less a syntax error occurs, in which case  it  exits  with  a  non-zero
2960       value.  See also the exit builtin command below.
2961

SIGNALS

2963       When  bash  is  interactive,  in  the  absence of any traps, it ignores
2964       SIGTERM (so that kill 0 does not kill an interactive shell), and SIGINT
2965       is  caught and handled (so that the wait builtin is interruptible).  In
2966       all cases, bash ignores SIGQUIT.  If job control is in effect, bash ig‐
2967       nores SIGTTIN, SIGTTOU, and SIGTSTP.
2968
2969       Non-builtin commands run by bash have signal handlers set to the values
2970       inherited by the shell from its parent.  When job control is not in ef‐
2971       fect,  asynchronous  commands  ignore SIGINT and SIGQUIT in addition to
2972       these inherited handlers.  Commands run as a result of command  substi‐
2973       tution ignore the keyboard-generated job control signals SIGTTIN, SIGT‐
2974       TOU, and SIGTSTP.
2975
2976       The shell exits by default upon receipt of a SIGHUP.   Before  exiting,
2977       an  interactive  shell  resends  the  SIGHUP  to  all  jobs, running or
2978       stopped.  Stopped jobs are sent SIGCONT to ensure that they receive the
2979       SIGHUP.   To  prevent the shell from sending the signal to a particular
2980       job, it should be removed from the jobs table with the  disown  builtin
2981       (see  SHELL BUILTIN COMMANDS below) or marked to not receive SIGHUP us‐
2982       ing disown -h.
2983
2984       If the huponexit shell option has been set with  shopt,  bash  sends  a
2985       SIGHUP to all jobs when an interactive login shell exits.
2986
2987       If  bash is waiting for a command to complete and receives a signal for
2988       which a trap has been set, the trap will not be executed until the com‐
2989       mand  completes.   When bash is waiting for an asynchronous command via
2990       the wait builtin, the reception of a signal for which a trap  has  been
2991       set will cause the wait builtin to return immediately with an exit sta‐
2992       tus greater than 128, immediately after which the trap is executed.
2993
2994       When job control is not enabled, and bash is waiting for  a  foreground
2995       command to complete, the shell receives keyboard-generated signals such
2996       as SIGINT (usually generated by ^C) that users commonly intend to  send
2997       to that command.  This happens because the shell and the command are in
2998       the same process group as the terminal, and ^C sends SIGINT to all pro‐
2999       cesses in that process group.
3000
3001       When  bash  is  running without job control enabled and receives SIGINT
3002       while waiting for a foreground command, it waits until that  foreground
3003       command terminates and then decides what to do about the SIGINT:
3004
3005       1.     If the command terminates due to the SIGINT, bash concludes that
3006              the user meant to end the entire script, and acts on the  SIGINT
3007              (e.g., by running a SIGINT trap or exiting itself);
3008
3009       2.     If  the  command  does  not terminate due to SIGINT, the program
3010              handled the SIGINT itself and did not treat it as a  fatal  sig‐
3011              nal.   In  that case, bash does not treat SIGINT as a fatal sig‐
3012              nal, either, instead assuming that the SIGINT was used  as  part
3013              of  the program's normal operation (e.g., emacs uses it to abort
3014              editing commands) or deliberately discarded.  However, bash will
3015              run  any  trap  set on SIGINT, as it does with any other trapped
3016              signal it receives while it is waiting for the  foreground  com‐
3017              mand to complete, for compatibility.
3018

JOB CONTROL

3020       Job control refers to the ability to selectively stop (suspend) the ex‐
3021       ecution of processes and continue (resume) their execution at  a  later
3022       point.   A  user typically employs this facility via an interactive in‐
3023       terface supplied jointly by  the  operating  system  kernel's  terminal
3024       driver and bash.
3025
3026       The  shell  associates  a  job with each pipeline.  It keeps a table of
3027       currently executing jobs, which may be listed with  the  jobs  command.
3028       When  bash starts a job asynchronously (in the background), it prints a
3029       line that looks like:
3030
3031              [1] 25647
3032
3033       indicating that this job is job number 1 and that the process ID of the
3034       last process in the pipeline associated with this job is 25647.  All of
3035       the processes in a single pipeline are members of the same  job.   Bash
3036       uses the job abstraction as the basis for job control.
3037
3038       To  facilitate the implementation of the user interface to job control,
3039       the operating system maintains the notion of a current terminal process
3040       group ID.  Members of this process group (processes whose process group
3041       ID is equal to the current terminal process group ID) receive keyboard-
3042       generated  signals  such  as SIGINT.  These processes are said to be in
3043       the foreground.  Background processes are those whose process group  ID
3044       differs from the terminal's; such processes are immune to keyboard-gen‐
3045       erated signals.  Only foreground processes are allowed to read from or,
3046       if  the  user  so  specifies  with  stty tostop, write to the terminal.
3047       Background processes which attempt to read from  (write  to  when  stty
3048       tostop  is  in effect) the terminal are sent a SIGTTIN (SIGTTOU) signal
3049       by the kernel's terminal driver, which,  unless  caught,  suspends  the
3050       process.
3051
3052       If  the operating system on which bash is running supports job control,
3053       bash contains facilities to use it.  Typing the suspend character (typ‐
3054       ically ^Z, Control-Z) while a process is running causes that process to
3055       be stopped and returns control to bash.   Typing  the  delayed  suspend
3056       character  (typically  ^Y,  Control-Y) causes the process to be stopped
3057       when it attempts to read input from the terminal, and control to be re‐
3058       turned  to  bash.   The user may then manipulate the state of this job,
3059       using the bg command to continue it in the background, the  fg  command
3060       to continue it in the foreground, or the kill command to kill it.  A ^Z
3061       takes effect immediately, and has the additional side effect of causing
3062       pending output and typeahead to be discarded.
3063
3064       There are a number of ways to refer to a job in the shell.  The charac‐
3065       ter % introduces a job specification (jobspec).  Job number  n  may  be
3066       referred to as %n.  A job may also be referred to using a prefix of the
3067       name used to start it, or using a substring that appears in its command
3068       line.   For example, %ce refers to a stopped job whose command name be‐
3069       gins with ce.  If a prefix matches more than one job, bash  reports  an
3070       error.  Using %?ce, on the other hand, refers to any job containing the
3071       string ce in its command line.  If the substring matches more than  one
3072       job, bash reports an error.  The symbols %% and %+ refer to the shell's
3073       notion of the current job, which is the last job stopped while  it  was
3074       in  the  foreground or started in the background.  The previous job may
3075       be referenced using %-.  If there is only a single job, %+ and  %-  can
3076       both be used to refer to that job.  In output pertaining to jobs (e.g.,
3077       the output of the jobs command), the current job is always flagged with
3078       a  +,  and the previous job with a -.  A single % (with no accompanying
3079       job specification) also refers to the current job.
3080
3081       Simply naming a job can be used to bring it into the foreground: %1  is
3082       a  synonym  for  ``fg %1'', bringing job 1 from the background into the
3083       foreground.  Similarly, ``%1 &''  resumes  job  1  in  the  background,
3084       equivalent to ``bg %1''.
3085
3086       The  shell  learns immediately whenever a job changes state.  Normally,
3087       bash waits until it is about to print a prompt before reporting changes
3088       in  a  job's status so as to not interrupt any other output.  If the -b
3089       option to the set builtin command is enabled, bash reports such changes
3090       immediately.   Any  trap on SIGCHLD is executed for each child that ex‐
3091       its.
3092
3093       If an attempt to exit bash is made while jobs are stopped (or,  if  the
3094       checkjobs  shell  option has been enabled using the shopt builtin, run‐
3095       ning), the shell prints a warning message, and, if the checkjobs option
3096       is  enabled,  lists  the jobs and their statuses.  The jobs command may
3097       then be used to inspect their status.  If a second attempt to  exit  is
3098       made  without  an intervening command, the shell does not print another
3099       warning, and any stopped jobs are terminated.
3100
3101       When the shell is waiting for a job or process using the wait  builtin,
3102       and  job  control  is  enabled,  wait  will return when the job changes
3103       state. The -f option causes wait to wait until the job or process  ter‐
3104       minates before returning.
3105

PROMPTING

3107       When executing interactively, bash displays the primary prompt PS1 when
3108       it is ready to read a command, and the secondary  prompt  PS2  when  it
3109       needs  more  input  to  complete a command.  Bash displays PS0 after it
3110       reads a command but before executing it.   Bash  displays  PS4  as  de‐
3111       scribed  above  before  tracing  each command when the -x option is en‐
3112       abled.  Bash allows these prompt strings to be customized by  inserting
3113       a  number  of  backslash-escaped special characters that are decoded as
3114       follows:
3115              \a     an ASCII bell character (07)
3116              \d     the date in "Weekday Month Date" format (e.g.,  "Tue  May
3117                     26")
3118              \D{format}
3119                     the format is passed to strftime(3) and the result is in‐
3120                     serted into the prompt string; an empty format results in
3121                     a  locale-specific  time  representation.  The braces are
3122                     required
3123              \e     an ASCII escape character (033)
3124              \h     the hostname up to the first `.'
3125              \H     the hostname
3126              \j     the number of jobs currently managed by the shell
3127              \l     the basename of the shell's terminal device name
3128              \n     newline
3129              \r     carriage return
3130              \s     the name of the shell, the basename of  $0  (the  portion
3131                     following the final slash)
3132              \t     the current time in 24-hour HH:MM:SS format
3133              \T     the current time in 12-hour HH:MM:SS format
3134              \@     the current time in 12-hour am/pm format
3135              \A     the current time in 24-hour HH:MM format
3136              \u     the username of the current user
3137              \v     the version of bash (e.g., 2.00)
3138              \V     the release of bash, version + patch level (e.g., 2.00.0)
3139              \w     the  value  of  the PWD shell variable ($PWD), with $HOME
3140                     abbreviated  with  a  tilde  (uses  the  value   of   the
3141                     PROMPT_DIRTRIM variable)
3142              \W     the basename of $PWD, with $HOME abbreviated with a tilde
3143              \!     the history number of this command
3144              \#     the command number of this command
3145              \$     if the effective UID is 0, a #, otherwise a $
3146              \nnn   the character corresponding to the octal number nnn
3147              \\     a backslash
3148              \[     begin  a sequence of non-printing characters, which could
3149                     be used to embed a terminal  control  sequence  into  the
3150                     prompt
3151              \]     end a sequence of non-printing characters
3152
3153       The  command  number  and the history number are usually different: the
3154       history number of a command is its position in the history list,  which
3155       may  include  commands  restored from the history file (see HISTORY be‐
3156       low), while the command number is the position in the sequence of  com‐
3157       mands  executed  during the current shell session.  After the string is
3158       decoded, it is expanded via parameter expansion, command  substitution,
3159       arithmetic  expansion,  and  quote removal, subject to the value of the
3160       promptvars shell option (see the description of the shopt command under
3161       SHELL  BUILTIN COMMANDS below).  This can have unwanted side effects if
3162       escaped portions of the string appear within  command  substitution  or
3163       contain characters special to word expansion.
3164

READLINE

3166       This  is  the library that handles reading input when using an interac‐
3167       tive shell, unless the --noediting option is given at shell invocation.
3168       Line editing is also used when using the -e option to the read builtin.
3169       By default, the line editing commands are similar to those of Emacs.  A
3170       vi-style line editing interface is also available.  Line editing can be
3171       enabled at any time using the -o emacs or -o  vi  options  to  the  set
3172       builtin  (see  SHELL BUILTIN COMMANDS below).  To turn off line editing
3173       after the shell is running, use the +o emacs or +o vi  options  to  the
3174       set builtin.
3175
3176   Readline Notation
3177       In this section, the Emacs-style notation is used to denote keystrokes.
3178       Control keys are denoted by C-key, e.g., C-n  means  Control-N.   Simi‐
3179       larly,  meta  keys are denoted by M-key, so M-x means Meta-X.  (On key‐
3180       boards without a meta key, M-x means ESC x, i.e., press the Escape  key
3181       then the x key.  This makes ESC the meta prefix.  The combination M-C-x
3182       means ESC-Control-x, or press the Escape key then hold the Control  key
3183       while pressing the x key.)
3184
3185       Readline commands may be given numeric arguments, which normally act as
3186       a repeat count.  Sometimes, however, it is the  sign  of  the  argument
3187       that  is  significant.   Passing  a negative argument to a command that
3188       acts in the forward direction (e.g., kill-line) causes that command  to
3189       act  in  a  backward direction.  Commands whose behavior with arguments
3190       deviates from this are noted below.
3191
3192       When a command is described as killing text, the text deleted is  saved
3193       for possible future retrieval (yanking).  The killed text is saved in a
3194       kill ring.  Consecutive kills cause the text to be accumulated into one
3195       unit, which can be yanked all at once.  Commands which do not kill text
3196       separate the chunks of text on the kill ring.
3197
3198   Readline Initialization
3199       Readline is customized by putting commands in  an  initialization  file
3200       (the  inputrc  file).  The name of this file is taken from the value of
3201       the INPUTRC variable.  If that variable is unset, the default is ~/.in‐
3202       putrc.   If  that  file  does not exist or cannot be read, the ultimate
3203       default is /etc/inputrc.  When a program which uses  the  readline  li‐
3204       brary  starts up, the initialization file is read, and the key bindings
3205       and variables are set.  There are only a few basic  constructs  allowed
3206       in  the  readline initialization file.  Blank lines are ignored.  Lines
3207       beginning with a # are comments.  Lines beginning  with  a  $  indicate
3208       conditional  constructs.   Other lines denote key bindings and variable
3209       settings.
3210
3211       The default key-bindings may be changed with an  inputrc  file.   Other
3212       programs that use this library may add their own commands and bindings.
3213
3214       For example, placing
3215
3216              M-Control-u: universal-argument
3217       or
3218              C-Meta-u: universal-argument
3219       into  the inputrc would make M-C-u execute the readline command univer‐
3220       sal-argument.
3221
3222       The following symbolic character names  are  recognized:  RUBOUT,  DEL,
3223       ESC, LFD, NEWLINE, RET, RETURN, SPC, SPACE, and TAB.
3224
3225       In  addition  to  command  names, readline allows keys to be bound to a
3226       string that is inserted when the key is pressed (a macro).
3227
3228   Readline Key Bindings
3229       The syntax for controlling key bindings in the inputrc file is  simple.
3230       All  that is required is the name of the command or the text of a macro
3231       and a key sequence to which it should be bound.  The name may be speci‐
3232       fied in one of two ways: as a symbolic key name, possibly with Meta- or
3233       Control- prefixes, or as a key sequence.
3234
3235       When using the form keyname:function-name or macro, keyname is the name
3236       of a key spelled out in English.  For example:
3237
3238              Control-u: universal-argument
3239              Meta-Rubout: backward-kill-word
3240              Control-o: "> output"
3241
3242       In  the above example, C-u is bound to the function universal-argument,
3243       M-DEL is bound to the function backward-kill-word, and C-o is bound  to
3244       run  the macro expressed on the right hand side (that is, to insert the
3245       text ``> output'' into the line).
3246
3247       In the second form, "keyseq":function-name  or  macro,  keyseq  differs
3248       from  keyname above in that strings denoting an entire key sequence may
3249       be specified by placing the sequence within double  quotes.   Some  GNU
3250       Emacs  style  key escapes can be used, as in the following example, but
3251       the symbolic character names are not recognized.
3252
3253              "\C-u": universal-argument
3254              "\C-x\C-r": re-read-init-file
3255              "\e[11~": "Function Key 1"
3256
3257       In this example, C-u is again bound to the function universal-argument.
3258       C-x  C-r is bound to the function re-read-init-file, and ESC [ 1 1 ~ is
3259       bound to insert the text ``Function Key 1''.
3260
3261       The full set of GNU Emacs style escape sequences is
3262              \C-    control prefix
3263              \M-    meta prefix
3264              \e     an escape character
3265              \\     backslash
3266              \"     literal "
3267              \'     literal '
3268
3269       In addition to the GNU Emacs style escape sequences, a  second  set  of
3270       backslash escapes is available:
3271              \a     alert (bell)
3272              \b     backspace
3273              \d     delete
3274              \f     form feed
3275              \n     newline
3276              \r     carriage return
3277              \t     horizontal tab
3278              \v     vertical tab
3279              \nnn   the  eight-bit  character  whose value is the octal value
3280                     nnn (one to three digits)
3281              \xHH   the eight-bit character whose value  is  the  hexadecimal
3282                     value HH (one or two hex digits)
3283
3284       When entering the text of a macro, single or double quotes must be used
3285       to indicate a macro definition.  Unquoted text is assumed to be a func‐
3286       tion  name.   In  the macro body, the backslash escapes described above
3287       are expanded.  Backslash will quote any other character  in  the  macro
3288       text, including " and '.
3289
3290       Bash  allows the current readline key bindings to be displayed or modi‐
3291       fied with the bind builtin command.  The editing mode may  be  switched
3292       during  interactive  use by using the -o option to the set builtin com‐
3293       mand (see SHELL BUILTIN COMMANDS below).
3294
3295   Readline Variables
3296       Readline has variables that can be used to further customize its behav‐
3297       ior.  A variable may be set in the inputrc file with a statement of the
3298       form
3299
3300              set variable-name value
3301       or using the bind builtin command (see SHELL BUILTIN COMMANDS below).
3302
3303       Except where noted, readline variables can take the values  On  or  Off
3304       (without  regard  to  case).   Unrecognized variable names are ignored.
3305       When a variable value is read, empty or null values, "on"  (case-insen‐
3306       sitive), and "1" are equivalent to On.  All other values are equivalent
3307       to Off.  The variables and their default values are:
3308
3309       active-region-start-color
3310              A string variable that controls the text  color  and  background
3311              when  displaying the text in the active region (see the descrip‐
3312              tion of enable-active-region below).  This string must not  take
3313              up any physical character positions on the display, so it should
3314              consist only of terminal escape sequences.  It is output to  the
3315              terminal  before displaying the text in the active region.  This
3316              variable is reset to the default  value  whenever  the  terminal
3317              type  changes.   The  default  value is the string that puts the
3318              terminal in standout mode, as obtained from the terminal's  ter‐
3319              minfo description.  A sample value might be "\e[01;33m".
3320       active-region-end-color
3321              A  string  variable  that  "undoes"  the  effects  of active-re‐
3322              gion-start-color and restores "normal" terminal display  appear‐
3323              ance  after  displaying  text in the active region.  This string
3324              must not take up any physical character positions  on  the  dis‐
3325              play,  so  it  should consist only of terminal escape sequences.
3326              It is output to the terminal after displaying the  text  in  the
3327              active  region.   This  variable  is  reset to the default value
3328              whenever the terminal type changes.  The default  value  is  the
3329              string  that  restores  the  terminal from standout mode, as ob‐
3330              tained from the terminal's terminfo description.  A sample value
3331              might be "\e[0m".
3332       bell-style (audible)
3333              Controls  what  happens when readline wants to ring the terminal
3334              bell.  If set to none, readline never rings the bell.  If set to
3335              visible,  readline  uses a visible bell if one is available.  If
3336              set to audible, readline attempts to ring the terminal's bell.
3337       bind-tty-special-chars (On)
3338              If set to On, readline attempts to bind the  control  characters
3339              treated specially by the kernel's terminal driver to their read‐
3340              line equivalents.
3341       blink-matching-paren (Off)
3342              If set to On, readline attempts to briefly move the cursor to an
3343              opening parenthesis when a closing parenthesis is inserted.
3344       colored-completion-prefix (Off)
3345              If  set  to  On, when listing completions, readline displays the
3346              common prefix of the set of possible completions using a differ‐
3347              ent  color.   The  color definitions are taken from the value of
3348              the LS_COLORS environment variable.  If there is a color defini‐
3349              tion  in $LS_COLORS for the custom suffix "readline-colored-com‐
3350              pletion-prefix", readline uses this color for the common  prefix
3351              instead of its default.
3352       colored-stats (Off)
3353              If  set to On, readline displays possible completions using dif‐
3354              ferent colors to indicate their file type.   The  color  defini‐
3355              tions  are  taken  from  the  value of the LS_COLORS environment
3356              variable.
3357       comment-begin (``#'')
3358              The string that is inserted  when  the  readline  insert-comment
3359              command is executed.  This command is bound to M-# in emacs mode
3360              and to # in vi command mode.
3361       completion-display-width (-1)
3362              The number of screen columns used to  display  possible  matches
3363              when  performing completion.  The value is ignored if it is less
3364              than 0 or greater than the terminal screen width.  A value of  0
3365              will  cause  matches  to be displayed one per line.  The default
3366              value is -1.
3367       completion-ignore-case (Off)
3368              If set to On, readline performs filename matching and completion
3369              in a case-insensitive fashion.
3370       completion-map-case (Off)
3371              If  set  to  On, and completion-ignore-case is enabled, readline
3372              treats hyphens (-) and underscores (_) as equivalent  when  per‐
3373              forming case-insensitive filename matching and completion.
3374       completion-prefix-display-length (0)
3375              The  length in characters of the common prefix of a list of pos‐
3376              sible completions that is displayed without modification.   When
3377              set  to  a  value greater than zero, common prefixes longer than
3378              this value are replaced with an ellipsis when displaying  possi‐
3379              ble completions.
3380       completion-query-items (100)
3381              This  determines when the user is queried about viewing the num‐
3382              ber of possible completions generated  by  the  possible-comple‐
3383              tions  command.  It may be set to any integer value greater than
3384              or equal to zero.  If the  number  of  possible  completions  is
3385              greater  than  or  equal to the value of this variable, readline
3386              will ask whether or not the user wishes to view them;  otherwise
3387              they  are  simply  listed  on  the terminal.  A zero value means
3388              readline should never ask; negative values are treated as zero.
3389       convert-meta (On)
3390              If set to On, readline will convert characters with  the  eighth
3391              bit set to an ASCII key sequence by stripping the eighth bit and
3392              prefixing an escape character (in effect, using  escape  as  the
3393              meta  prefix).   The  default is On, but readline will set it to
3394              Off if the locale contains eight-bit characters.  This  variable
3395              is  dependent on the LC_CTYPE locale category, and may change if
3396              the locale is changed.
3397       disable-completion (Off)
3398              If set to On, readline will inhibit word completion.  Completion
3399              characters  will  be  inserted into the line as if they had been
3400              mapped to self-insert.
3401       echo-control-characters (On)
3402              When set to On, on operating systems that indicate they  support
3403              it, readline echoes a character corresponding to a signal gener‐
3404              ated from the keyboard.
3405       editing-mode (emacs)
3406              Controls whether readline begins with a set of key bindings sim‐
3407              ilar to Emacs or vi.  editing-mode can be set to either emacs or
3408              vi.
3409       emacs-mode-string (@)
3410              If the show-mode-in-prompt variable is enabled, this  string  is
3411              displayed immediately before the last line of the primary prompt
3412              when emacs editing mode is active.  The value is expanded like a
3413              key  binding,  so the standard set of meta- and control prefixes
3414              and backslash escape sequences is available.  Use the \1 and  \2
3415              escapes  to  begin and end sequences of non-printing characters,
3416              which can be used to embed a terminal control sequence into  the
3417              mode string.
3418       enable-active-region (On)
3419              The  point  is the current cursor position, and mark refers to a
3420              saved cursor position.  The text between the point and  mark  is
3421              referred  to  as  the  region.  When this variable is set to On,
3422              readline allows certain commands to designate the region as  ac‐
3423              tive.   When  the region is active, readline highlights the text
3424              in the region using the value of the  active-region-start-color,
3425              which  defaults to the string that enables the terminal's stand‐
3426              out mode.  The active region shows the text inserted  by  brack‐
3427              eted-paste  and  any matching text found by incremental and non-
3428              incremental history searches.
3429       enable-bracketed-paste (On)
3430              When set to On, readline configures the terminal to insert  each
3431              paste  into the editing buffer as a single string of characters,
3432              instead of treating each character as if it had been  read  from
3433              the keyboard.  This prevents readline from executing any editing
3434              commands bound to key sequences appearing in the pasted text.
3435       enable-keypad (Off)
3436              When set to On, readline will try to enable the application key‐
3437              pad when it is called.  Some systems need this to enable the ar‐
3438              row keys.
3439       enable-meta-key (On)
3440              When set to On, readline will try to enable  any  meta  modifier
3441              key  the  terminal claims to support when it is called.  On many
3442              terminals, the meta key is used to send eight-bit characters.
3443       expand-tilde (Off)
3444              If set to On, tilde expansion is  performed  when  readline  at‐
3445              tempts word completion.
3446       history-preserve-point (Off)
3447              If  set  to  On, the history code attempts to place point at the
3448              same location on each history line retrieved with  previous-his‐
3449              tory or next-history.
3450       history-size (unset)
3451              Set  the  maximum number of history entries saved in the history
3452              list.  If set to zero, any existing history entries are  deleted
3453              and no new entries are saved.  If set to a value less than zero,
3454              the number of history entries is not limited.  By  default,  the
3455              number  of  history  entries is set to the value of the HISTSIZE
3456              shell variable.  If an attempt is made to set history-size to  a
3457              non-numeric value, the maximum number of history entries will be
3458              set to 500.
3459       horizontal-scroll-mode (Off)
3460              When set to On, makes readline use a single  line  for  display,
3461              scrolling the input horizontally on a single screen line when it
3462              becomes longer than the screen width rather than wrapping  to  a
3463              new  line.   This setting is automatically enabled for terminals
3464              of height 1.
3465       input-meta (Off)
3466              If set to On, readline will enable eight-bit input (that is,  it
3467              will not strip the eighth bit from the characters it reads), re‐
3468              gardless of what the terminal claims it can support.   The  name
3469              meta-flag  is  a synonym for this variable.  The default is Off,
3470              but readline will set it to On if the locale contains  eight-bit
3471              characters.   This  variable is dependent on the LC_CTYPE locale
3472              category, and may change if the locale is changed.
3473       isearch-terminators (``C-[C-J'')
3474              The string of characters that should  terminate  an  incremental
3475              search  without  subsequently  executing the character as a com‐
3476              mand.  If this variable has not been given a value, the  charac‐
3477              ters ESC and C-J will terminate an incremental search.
3478       keymap (emacs)
3479              Set  the current readline keymap.  The set of valid keymap names
3480              is emacs, emacs-standard, emacs-meta,  emacs-ctlx,  vi,  vi-com‐
3481              mand,  and  vi-insert.  vi is equivalent to vi-command; emacs is
3482              equivalent to emacs-standard.  The default value is  emacs;  the
3483              value of editing-mode also affects the default keymap.
3484       keyseq-timeout (500)
3485              Specifies  the  duration readline will wait for a character when
3486              reading an ambiguous key sequence (one that can form a  complete
3487              key sequence using the input read so far, or can take additional
3488              input to complete a longer key sequence).  If no  input  is  re‐
3489              ceived  within  the  timeout,  readline will use the shorter but
3490              complete key sequence.  The value is specified in  milliseconds,
3491              so  a value of 1000 means that readline will wait one second for
3492              additional input.  If this variable is set to a value less  than
3493              or  equal to zero, or to a non-numeric value, readline will wait
3494              until another key is pressed to decide  which  key  sequence  to
3495              complete.
3496       mark-directories (On)
3497              If set to On, completed directory names have a slash appended.
3498       mark-modified-lines (Off)
3499              If  set  to  On,  history lines that have been modified are dis‐
3500              played with a preceding asterisk (*).
3501       mark-symlinked-directories (Off)
3502              If set to On, completed names which are symbolic links to direc‐
3503              tories  have  a slash appended (subject to the value of mark-di‐
3504              rectories).
3505       match-hidden-files (On)
3506              This variable, when set to On, causes readline  to  match  files
3507              whose  names  begin  with  a  `.' (hidden files) when performing
3508              filename completion.  If set to Off, the  leading  `.'  must  be
3509              supplied by the user in the filename to be completed.
3510       menu-complete-display-prefix (Off)
3511              If  set to On, menu completion displays the common prefix of the
3512              list of possible completions (which may be empty) before cycling
3513              through the list.
3514       output-meta (Off)
3515              If  set  to On, readline will display characters with the eighth
3516              bit set directly rather than as a meta-prefixed escape sequence.
3517              The default is Off, but readline will set it to On if the locale
3518              contains eight-bit characters.  This variable  is  dependent  on
3519              the  LC_CTYPE  locale  category, and may change if the locale is
3520              changed.
3521       page-completions (On)
3522              If set to On, readline uses an internal more-like pager to  dis‐
3523              play a screenful of possible completions at a time.
3524       print-completions-horizontally (Off)
3525              If  set  to  On,  readline will display completions with matches
3526              sorted horizontally in alphabetical order, rather than down  the
3527              screen.
3528       revert-all-at-newline (Off)
3529              If  set  to  On, readline will undo all changes to history lines
3530              before returning when accept-line is executed.  By default, his‐
3531              tory  lines  may  be  modified  and retain individual undo lists
3532              across calls to readline.
3533       show-all-if-ambiguous (Off)
3534              This alters the default behavior of  the  completion  functions.
3535              If set to On, words which have more than one possible completion
3536              cause the matches to be listed immediately  instead  of  ringing
3537              the bell.
3538       show-all-if-unmodified (Off)
3539              This  alters the default behavior of the completion functions in
3540              a fashion similar to show-all-if-ambiguous.  If set to On, words
3541              which  have more than one possible completion without any possi‐
3542              ble partial completion (the possible completions don't  share  a
3543              common  prefix)  cause  the matches to be listed immediately in‐
3544              stead of ringing the bell.
3545       show-mode-in-prompt (Off)
3546              If set to On, add a string to the beginning of the prompt  indi‐
3547              cating  the  editing  mode:  emacs, vi command, or vi insertion.
3548              The mode strings are user-settable (e.g., emacs-mode-string).
3549       skip-completed-text (Off)
3550              If set to On, this alters the default completion  behavior  when
3551              inserting  a  single match into the line.  It's only active when
3552              performing completion in the middle  of  a  word.   If  enabled,
3553              readline  does  not  insert  characters from the completion that
3554              match characters after point in the  word  being  completed,  so
3555              portions of the word following the cursor are not duplicated.
3556       vi-cmd-mode-string ((cmd))
3557              If  the  show-mode-in-prompt variable is enabled, this string is
3558              displayed immediately before the last line of the primary prompt
3559              when  vi  editing mode is active and in command mode.  The value
3560              is expanded like a key binding, so the standard set of meta- and
3561              control  prefixes  and  backslash escape sequences is available.
3562              Use the \1 and \2 escapes to begin and  end  sequences  of  non-
3563              printing  characters, which can be used to embed a terminal con‐
3564              trol sequence into the mode string.
3565       vi-ins-mode-string ((ins))
3566              If the show-mode-in-prompt variable is enabled, this  string  is
3567              displayed immediately before the last line of the primary prompt
3568              when vi editing mode is active and in insertion mode.  The value
3569              is expanded like a key binding, so the standard set of meta- and
3570              control prefixes and backslash escape  sequences  is  available.
3571              Use  the  \1  and  \2 escapes to begin and end sequences of non-
3572              printing characters, which can be used to embed a terminal  con‐
3573              trol sequence into the mode string.
3574       visible-stats (Off)
3575              If  set to On, a character denoting a file's type as reported by
3576              stat(2) is appended to the filename when listing  possible  com‐
3577              pletions.
3578
3579   Readline Conditional Constructs
3580       Readline  implements  a  facility  similar in spirit to the conditional
3581       compilation features of the C preprocessor which  allows  key  bindings
3582       and  variable  settings  to be performed as the result of tests.  There
3583       are four parser directives used.
3584
3585       $if    The $if construct allows bindings to be made based on the  edit‐
3586              ing  mode,  the  terminal  being  used, or the application using
3587              readline.  The text of the test, after any comparison operator,
3588               extends to the end of the  line;  unless  otherwise  noted,  no
3589              characters are required to isolate it.
3590
3591              mode   The  mode=  form  of  the  $if  directive is used to test
3592                     whether readline is in emacs or vi  mode.   This  may  be
3593                     used  in conjunction with the set keymap command, for in‐
3594                     stance,  to  set  bindings  in  the  emacs-standard   and
3595                     emacs-ctlx  keymaps  only  if readline is starting out in
3596                     emacs mode.
3597
3598              term   The term= form may be used to  include  terminal-specific
3599                     key bindings, perhaps to bind the key sequences output by
3600                     the terminal's function keys.  The word on the right side
3601                     of the = is tested against both the full name of the ter‐
3602                     minal and the portion of the  terminal  name  before  the
3603                     first  -.  This allows sun to match both sun and sun-cmd,
3604                     for instance.
3605
3606              version
3607                     The version test  may  be  used  to  perform  comparisons
3608                     against  specific readline versions.  The version expands
3609                     to the current readline version.  The set  of  comparison
3610                     operators  includes  =,  (and  ==), !=, <=, >=, <, and >.
3611                     The version number supplied on the right side of the  op‐
3612                     erator  consists  of  a major version number, an optional
3613                     decimal point, and an optional minor version (e.g., 7.1).
3614                     If  the  minor version is omitted, it is assumed to be 0.
3615                     The operator may be separated from the string version and
3616                     from the version number argument by whitespace.
3617
3618              application
3619                     The application construct is used to include application-
3620                     specific settings.  Each program using the  readline  li‐
3621                     brary  sets  the  application name, and an initialization
3622                     file can test for a particular value.  This could be used
3623                     to  bind key sequences to functions useful for a specific
3624                     program.  For instance, the following command adds a  key
3625                     sequence  that  quotes  the  current  or previous word in
3626                     bash:
3627
3628                     $if Bash
3629                     # Quote the current or previous word
3630                     "\C-xq": "\eb\"\ef\""
3631                     $endif
3632
3633              variable
3634                     The variable construct provides simple equality tests for
3635                     readline  variables and values.  The permitted comparison
3636                     operators are =, ==, and !=.  The variable name  must  be
3637                     separated from the comparison operator by whitespace; the
3638                     operator may be separated from the  value  on  the  right
3639                     hand  side  by whitespace.  Both string and boolean vari‐
3640                     ables may be tested. Boolean  variables  must  be  tested
3641                     against the values on and off.
3642
3643       $endif This command, as seen in the previous example, terminates an $if
3644              command.
3645
3646       $else  Commands in this branch of the $if directive are executed if the
3647              test fails.
3648
3649       $include
3650              This  directive takes a single filename as an argument and reads
3651              commands and bindings from that file.  For example, the  follow‐
3652              ing directive would read /etc/inputrc:
3653
3654              $include  /etc/inputrc
3655
3656   Searching
3657       Readline  provides  commands  for searching through the command history
3658       (see HISTORY below) for lines containing a specified string.  There are
3659       two search modes: incremental and non-incremental.
3660
3661       Incremental  searches  begin  before  the  user has finished typing the
3662       search string.  As each character of the search string is typed,  read‐
3663       line displays the next entry from the history matching the string typed
3664       so far.  An incremental search requires  only  as  many  characters  as
3665       needed  to  find  the desired history entry.  The characters present in
3666       the value of the isearch-terminators variable are used to terminate  an
3667       incremental search.  If that variable has not been assigned a value the
3668       Escape and Control-J characters will terminate an  incremental  search.
3669       Control-G  will  abort  an  incremental search and restore the original
3670       line.  When the search is terminated, the history entry containing  the
3671       search string becomes the current line.
3672
3673       To  find  other matching entries in the history list, type Control-S or
3674       Control-R as appropriate.  This will search backward or forward in  the
3675       history  for  the  next  entry matching the search string typed so far.
3676       Any other key sequence bound to a readline command will  terminate  the
3677       search  and  execute that command.  For instance, a newline will termi‐
3678       nate the search and accept the line, thereby executing the command from
3679       the history list.
3680
3681       Readline remembers the last incremental search string.  If two Control-
3682       Rs are typed without any intervening characters defining a  new  search
3683       string, any remembered search string is used.
3684
3685       Non-incremental  searches read the entire search string before starting
3686       to search for matching history lines.  The search string may  be  typed
3687       by the user or be part of the contents of the current line.
3688
3689   Readline Command Names
3690       The  following  is  a list of the names of the commands and the default
3691       key sequences to which they are bound.  Command names without an accom‐
3692       panying key sequence are unbound by default.  In the following descrip‐
3693       tions, point refers to the current cursor position, and mark refers  to
3694       a  cursor position saved by the set-mark command.  The text between the
3695       point and mark is referred to as the region.
3696
3697   Commands for Moving
3698       beginning-of-line (C-a)
3699              Move to the start of the current line.
3700       end-of-line (C-e)
3701              Move to the end of the line.
3702       forward-char (C-f)
3703              Move forward a character.
3704       backward-char (C-b)
3705              Move back a character.
3706       forward-word (M-f)
3707              Move forward to the end of the next word.  Words are composed of
3708              alphanumeric characters (letters and digits).
3709       backward-word (M-b)
3710              Move  back  to the start of the current or previous word.  Words
3711              are composed of alphanumeric characters (letters and digits).
3712       shell-forward-word
3713              Move forward to the end of the next word.  Words  are  delimited
3714              by non-quoted shell metacharacters.
3715       shell-backward-word
3716              Move  back  to the start of the current or previous word.  Words
3717              are delimited by non-quoted shell metacharacters.
3718       previous-screen-line
3719              Attempt to move point to the same physical screen column on  the
3720              previous  physical  screen  line. This will not have the desired
3721              effect if the current readline line does not take up  more  than
3722              one  physical line or if point is not greater than the length of
3723              the prompt plus the screen width.
3724       next-screen-line
3725              Attempt to move point to the same physical screen column on  the
3726              next physical screen line. This will not have the desired effect
3727              if the current readline line does not  take  up  more  than  one
3728              physical  line  or if the length of the current readline line is
3729              not greater than the length of the prompt plus the screen width.
3730       clear-display (M-C-l)
3731              Clear the screen and, if  possible,  the  terminal's  scrollback
3732              buffer,  then  redraw the current line, leaving the current line
3733              at the top of the screen.
3734       clear-screen (C-l)
3735              Clear the screen, then redraw the current line, leaving the cur‐
3736              rent  line  at the top of the screen.  With an argument, refresh
3737              the current line without clearing the screen.
3738       redraw-current-line
3739              Refresh the current line.
3740
3741   Commands for Manipulating the History
3742       accept-line (Newline, Return)
3743              Accept the line regardless of where the cursor is.  If this line
3744              is  non-empty, add it to the history list according to the state
3745              of the HISTCONTROL variable.  If the line is a modified  history
3746              line, then restore the history line to its original state.
3747       previous-history (C-p)
3748              Fetch the previous command from the history list, moving back in
3749              the list.
3750       next-history (C-n)
3751              Fetch the next command from the history list, moving forward  in
3752              the list.
3753       beginning-of-history (M-<)
3754              Move to the first line in the history.
3755       end-of-history (M->)
3756              Move  to  the end of the input history, i.e., the line currently
3757              being entered.
3758       operate-and-get-next (C-o)
3759              Accept the current line for execution and fetch  the  next  line
3760              relative  to  the  current line from the history for editing.  A
3761              numeric argument, if supplied, specifies the  history  entry  to
3762              use instead of the current line.
3763       fetch-history
3764              With  a numeric argument, fetch that entry from the history list
3765              and make it the current line.  Without an argument, move back to
3766              the first entry in the history list.
3767       reverse-search-history (C-r)
3768              Search  backward  starting  at  the current line and moving `up'
3769              through the  history  as  necessary.   This  is  an  incremental
3770              search.
3771       forward-search-history (C-s)
3772              Search  forward  starting  at the current line and moving `down'
3773              through the  history  as  necessary.   This  is  an  incremental
3774              search.
3775       non-incremental-reverse-search-history (M-p)
3776              Search backward through the history starting at the current line
3777              using a non-incremental search for  a  string  supplied  by  the
3778              user.
3779       non-incremental-forward-search-history (M-n)
3780              Search  forward  through  the  history  using  a non-incremental
3781              search for a string supplied by the user.
3782       history-search-forward
3783              Search forward through the history for the string of  characters
3784              between  the start of the current line and the point.  This is a
3785              non-incremental search.
3786       history-search-backward
3787              Search backward through the history for the string of characters
3788              between  the start of the current line and the point.  This is a
3789              non-incremental search.
3790       history-substring-search-backward
3791              Search backward through the history for the string of characters
3792              between the start of the current line and the current cursor po‐
3793              sition (the point).  The search string may match anywhere  in  a
3794              history line.  This is a non-incremental search.
3795       history-substring-search-forward
3796              Search  forward through the history for the string of characters
3797              between the start of the current line and the point.  The search
3798              string  may match anywhere in a history line.  This is a non-in‐
3799              cremental search.
3800       yank-nth-arg (M-C-y)
3801              Insert the first argument to the previous command  (usually  the
3802              second word on the previous line) at point.  With an argument n,
3803              insert the nth word from the previous command (the words in  the
3804              previous  command  begin  with word 0).  A negative argument in‐
3805              serts the nth word from the end of the previous  command.   Once
3806              the  argument n is computed, the argument is extracted as if the
3807              "!n" history expansion had been specified.
3808       yank-last-arg (M-., M-_)
3809              Insert the last argument to the previous command (the last  word
3810              of the previous history entry).  With a numeric argument, behave
3811              exactly like yank-nth-arg.  Successive  calls  to  yank-last-arg
3812              move  back through the history list, inserting the last word (or
3813              the word specified by the argument to the first  call)  of  each
3814              line in turn.  Any numeric argument supplied to these successive
3815              calls determines the direction to move through the  history.   A
3816              negative  argument  switches  the  direction through the history
3817              (back or forward).  The history expansion facilities are used to
3818              extract the last word, as if the "!$" history expansion had been
3819              specified.
3820       shell-expand-line (M-C-e)
3821              Expand the line as the shell does.  This performs alias and his‐
3822              tory expansion as well as all of the shell word expansions.  See
3823              HISTORY EXPANSION below for a description of history expansion.
3824       history-expand-line (M-^)
3825              Perform history expansion on the current line.  See HISTORY  EX‐
3826              PANSION below for a description of history expansion.
3827       magic-space
3828              Perform  history  expansion  on  the  current  line and insert a
3829              space.  See HISTORY EXPANSION below for a description of history
3830              expansion.
3831       alias-expand-line
3832              Perform  alias expansion on the current line.  See ALIASES above
3833              for a description of alias expansion.
3834       history-and-alias-expand-line
3835              Perform history and alias expansion on the current line.
3836       insert-last-argument (M-., M-_)
3837              A synonym for yank-last-arg.
3838       edit-and-execute-command (C-x C-e)
3839              Invoke an editor on the current command line,  and  execute  the
3840              result as shell commands.  Bash attempts to invoke $VISUAL, $ED‐
3841              ITOR, and emacs as the editor, in that order.
3842
3843   Commands for Changing Text
3844       end-of-file (usually C-d)
3845              The character indicating end-of-file as  set,  for  example,  by
3846              ``stty''.   If  this character is read when there are no charac‐
3847              ters on the line, and point is at the  beginning  of  the  line,
3848              readline interprets it as the end of input and returns EOF.
3849       delete-char (C-d)
3850              Delete the character at point.  If this function is bound to the
3851              same character as the tty EOF character, as C-d commonly is, see
3852              above for the effects.
3853       backward-delete-char (Rubout)
3854              Delete  the  character  behind the cursor.  When given a numeric
3855              argument, save the deleted text on the kill ring.
3856       forward-backward-delete-char
3857              Delete the character under the cursor, unless the cursor  is  at
3858              the end of the line, in which case the character behind the cur‐
3859              sor is deleted.
3860       quoted-insert (C-q, C-v)
3861              Add the next character typed to the line verbatim.  This is  how
3862              to insert characters like C-q, for example.
3863       tab-insert (C-v TAB)
3864              Insert a tab character.
3865       self-insert (a, b, A, 1, !, ...)
3866              Insert the character typed.
3867       transpose-chars (C-t)
3868              Drag  the  character  before point forward over the character at
3869              point, moving point forward as well.  If point is at the end  of
3870              the  line, then this transposes the two characters before point.
3871              Negative arguments have no effect.
3872       transpose-words (M-t)
3873              Drag the word before point past the  word  after  point,  moving
3874              point  over  that  word  as well.  If point is at the end of the
3875              line, this transposes the last two words on the line.
3876       upcase-word (M-u)
3877              Uppercase the current (or following) word.  With a negative  ar‐
3878              gument, uppercase the previous word, but do not move point.
3879       downcase-word (M-l)
3880              Lowercase  the current (or following) word.  With a negative ar‐
3881              gument, lowercase the previous word, but do not move point.
3882       capitalize-word (M-c)
3883              Capitalize the current (or following) word.  With a negative ar‐
3884              gument, capitalize the previous word, but do not move point.
3885       overwrite-mode
3886              Toggle  overwrite mode.  With an explicit positive numeric argu‐
3887              ment, switches to overwrite mode.  With an explicit non-positive
3888              numeric argument, switches to insert mode.  This command affects
3889              only emacs mode; vi mode does overwrite differently.  Each  call
3890              to readline() starts in insert mode.  In overwrite mode, charac‐
3891              ters bound to self-insert replace the text at point rather  than
3892              pushing  the  text  to  the  right.   Characters  bound to back‐
3893              ward-delete-char replace  the  character  before  point  with  a
3894              space.  By default, this command is unbound.
3895
3896   Killing and Yanking
3897       kill-line (C-k)
3898              Kill the text from point to the end of the line.
3899       backward-kill-line (C-x Rubout)
3900              Kill backward to the beginning of the line.
3901       unix-line-discard (C-u)
3902              Kill  backward  from  point  to  the beginning of the line.  The
3903              killed text is saved on the kill-ring.
3904       kill-whole-line
3905              Kill all characters on the current line, no matter  where  point
3906              is.
3907       kill-word (M-d)
3908              Kill  from  point  to the end of the current word, or if between
3909              words, to the end of the next word.   Word  boundaries  are  the
3910              same as those used by forward-word.
3911       backward-kill-word (M-Rubout)
3912              Kill  the  word  behind  point.  Word boundaries are the same as
3913              those used by backward-word.
3914       shell-kill-word
3915              Kill from point to the end of the current word,  or  if  between
3916              words,  to  the  end  of the next word.  Word boundaries are the
3917              same as those used by shell-forward-word.
3918       shell-backward-kill-word
3919              Kill the word behind point.  Word boundaries  are  the  same  as
3920              those used by shell-backward-word.
3921       unix-word-rubout (C-w)
3922              Kill  the  word behind point, using white space as a word bound‐
3923              ary.  The killed text is saved on the kill-ring.
3924       unix-filename-rubout
3925              Kill the word behind point, using  white  space  and  the  slash
3926              character  as  the word boundaries.  The killed text is saved on
3927              the kill-ring.
3928       delete-horizontal-space (M-\)
3929              Delete all spaces and tabs around point.
3930       kill-region
3931              Kill the text in the current region.
3932       copy-region-as-kill
3933              Copy the text in the region to the kill buffer.
3934       copy-backward-word
3935              Copy the word before point to the kill buffer.  The word  bound‐
3936              aries are the same as backward-word.
3937       copy-forward-word
3938              Copy  the  word  following  point  to the kill buffer.  The word
3939              boundaries are the same as forward-word.
3940       yank (C-y)
3941              Yank the top of the kill ring into the buffer at point.
3942       yank-pop (M-y)
3943              Rotate the kill ring, and yank the new top.  Only works  follow‐
3944              ing yank or yank-pop.
3945
3946   Numeric Arguments
3947       digit-argument (M-0, M-1, ..., M--)
3948              Add  this digit to the argument already accumulating, or start a
3949              new argument.  M-- starts a negative argument.
3950       universal-argument
3951              This is another way to specify an argument.  If this command  is
3952              followed  by one or more digits, optionally with a leading minus
3953              sign, those digits define the argument.  If the command is  fol‐
3954              lowed by digits, executing universal-argument again ends the nu‐
3955              meric argument, but is otherwise ignored.  As a special case, if
3956              this command is immediately followed by a character that is nei‐
3957              ther a digit nor minus sign, the argument  count  for  the  next
3958              command  is multiplied by four.  The argument count is initially
3959              one, so executing this function the first time makes  the  argu‐
3960              ment count four, a second time makes the argument count sixteen,
3961              and so on.
3962
3963   Completing
3964       complete (TAB)
3965              Attempt to perform completion on the text  before  point.   Bash
3966              attempts completion treating the text as a variable (if the text
3967              begins with $), username (if the text begins with  ~),  hostname
3968              (if  the  text begins with @), or command (including aliases and
3969              functions) in turn.  If none of these produces a match, filename
3970              completion is attempted.
3971       possible-completions (M-?)
3972              List the possible completions of the text before point.
3973       insert-completions (M-*)
3974              Insert  all completions of the text before point that would have
3975              been generated by possible-completions.
3976       menu-complete
3977              Similar to complete, but replaces the word to be completed  with
3978              a  single match from the list of possible completions.  Repeated
3979              execution of menu-complete steps through the  list  of  possible
3980              completions,  inserting  each  match in turn.  At the end of the
3981              list of completions, the bell is rung (subject to the setting of
3982              bell-style) and the original text is restored.  An argument of n
3983              moves n positions forward in the list of matches; a negative ar‐
3984              gument may be used to move backward through the list.  This com‐
3985              mand is intended to be bound to TAB, but is unbound by default.
3986       menu-complete-backward
3987              Identical to menu-complete, but moves backward through the  list
3988              of  possible  completions,  as if menu-complete had been given a
3989              negative argument.  This command is unbound by default.
3990       delete-char-or-list
3991              Deletes the character under the cursor if not at  the  beginning
3992              or  end  of  the  line (like delete-char).  If at the end of the
3993              line, behaves identically to possible-completions.  This command
3994              is unbound by default.
3995       complete-filename (M-/)
3996              Attempt filename completion on the text before point.
3997       possible-filename-completions (C-x /)
3998              List the possible completions of the text before point, treating
3999              it as a filename.
4000       complete-username (M-~)
4001              Attempt completion on the text before point, treating  it  as  a
4002              username.
4003       possible-username-completions (C-x ~)
4004              List the possible completions of the text before point, treating
4005              it as a username.
4006       complete-variable (M-$)
4007              Attempt completion on the text before point, treating  it  as  a
4008              shell variable.
4009       possible-variable-completions (C-x $)
4010              List the possible completions of the text before point, treating
4011              it as a shell variable.
4012       complete-hostname (M-@)
4013              Attempt completion on the text before point, treating  it  as  a
4014              hostname.
4015       possible-hostname-completions (C-x @)
4016              List the possible completions of the text before point, treating
4017              it as a hostname.
4018       complete-command (M-!)
4019              Attempt completion on the text before point, treating  it  as  a
4020              command  name.   Command  completion  attempts to match the text
4021              against  aliases,  reserved  words,   shell   functions,   shell
4022              builtins, and finally executable filenames, in that order.
4023       possible-command-completions (C-x !)
4024              List the possible completions of the text before point, treating
4025              it as a command name.
4026       dynamic-complete-history (M-TAB)
4027              Attempt completion on the text before point, comparing the  text
4028              against  lines  from  the  history  list for possible completion
4029              matches.
4030       dabbrev-expand
4031              Attempt menu completion on the text before point, comparing  the
4032              text against lines from the history list for possible completion
4033              matches.
4034       complete-into-braces (M-{)
4035              Perform filename completion and insert the list of possible com‐
4036              pletions  enclosed within braces so the list is available to the
4037              shell (see Brace Expansion above).
4038
4039   Keyboard Macros
4040       start-kbd-macro (C-x ()
4041              Begin saving the characters  typed  into  the  current  keyboard
4042              macro.
4043       end-kbd-macro (C-x ))
4044              Stop saving the characters typed into the current keyboard macro
4045              and store the definition.
4046       call-last-kbd-macro (C-x e)
4047              Re-execute the last keyboard macro defined, by making the  char‐
4048              acters in the macro appear as if typed at the keyboard.
4049       print-last-kbd-macro ()
4050              Print  the  last keyboard macro defined in a format suitable for
4051              the inputrc file.
4052
4053   Miscellaneous
4054       re-read-init-file (C-x C-r)
4055              Read in the contents of the inputrc file,  and  incorporate  any
4056              bindings or variable assignments found there.
4057       abort (C-g)
4058              Abort  the  current editing command and ring the terminal's bell
4059              (subject to the setting of bell-style).
4060       do-lowercase-version (M-A, M-B, M-x, ...)
4061              If the metafied character x is uppercase, run the  command  that
4062              is bound to the corresponding metafied lowercase character.  The
4063              behavior is undefined if x is already lowercase.
4064       prefix-meta (ESC)
4065              Metafy the next character typed.  ESC f is equivalent to Meta-f.
4066       undo (C-_, C-x C-u)
4067              Incremental undo, separately remembered for each line.
4068       revert-line (M-r)
4069              Undo all changes made to this line.  This is like executing  the
4070              undo  command  enough  times  to  return the line to its initial
4071              state.
4072       tilde-expand (M-&)
4073              Perform tilde expansion on the current word.
4074       set-mark (C-@, M-<space>)
4075              Set the mark to the point.  If a numeric argument  is  supplied,
4076              the mark is set to that position.
4077       exchange-point-and-mark (C-x C-x)
4078              Swap  the  point  with the mark.  The current cursor position is
4079              set to the saved position, and the old cursor position is  saved
4080              as the mark.
4081       character-search (C-])
4082              A character is read and point is moved to the next occurrence of
4083              that character.  A negative argument searches for  previous  oc‐
4084              currences.
4085       character-search-backward (M-C-])
4086              A  character  is  read and point is moved to the previous occur‐
4087              rence of that character.  A negative argument searches for  sub‐
4088              sequent occurrences.
4089       skip-csi-sequence
4090              Read  enough  characters to consume a multi-key sequence such as
4091              those defined for keys like Home and End.  Such sequences  begin
4092              with a Control Sequence Indicator (CSI), usually ESC-[.  If this
4093              sequence is bound to "\[", keys producing  such  sequences  will
4094              have  no  effect  unless explicitly bound to a readline command,
4095              instead of inserting stray characters into the  editing  buffer.
4096              This is unbound by default, but usually bound to ESC-[.
4097       insert-comment (M-#)
4098              Without  a  numeric  argument,  the  value  of the readline com‐
4099              ment-begin variable is inserted at the beginning of the  current
4100              line.  If a numeric argument is supplied, this command acts as a
4101              toggle: if the characters at the beginning of the  line  do  not
4102              match  the value of comment-begin, the value is inserted, other‐
4103              wise the characters in comment-begin are deleted from the begin‐
4104              ning  of the line.  In either case, the line is accepted as if a
4105              newline had been typed.   The  default  value  of  comment-begin
4106              causes  this  command  to make the current line a shell comment.
4107              If a numeric argument causes the comment  character  to  be  re‐
4108              moved, the line will be executed by the shell.
4109       spell-correct-word (C-x s)
4110              Perform  spelling correction on the current word, treating it as
4111              a directory or filename, in the same way as  the  cdspell  shell
4112              option.    Word  boundaries  are  the  same  as  those  used  by
4113              shell-forward-word.
4114       glob-complete-word (M-g)
4115              The word before point is treated as a pattern for  pathname  ex‐
4116              pansion,  with an asterisk implicitly appended.  This pattern is
4117              used to generate a list of matching filenames for possible  com‐
4118              pletions.
4119       glob-expand-word (C-x *)
4120              The  word  before point is treated as a pattern for pathname ex‐
4121              pansion, and the list of matching filenames is inserted, replac‐
4122              ing the word.  If a numeric argument is supplied, an asterisk is
4123              appended before pathname expansion.
4124       glob-list-expansions (C-x g)
4125              The list  of  expansions  that  would  have  been  generated  by
4126              glob-expand-word  is  displayed,  and the line is redrawn.  If a
4127              numeric argument is supplied, an  asterisk  is  appended  before
4128              pathname expansion.
4129       dump-functions
4130              Print  all  of the functions and their key bindings to the read‐
4131              line output stream.  If a numeric argument is supplied, the out‐
4132              put  is  formatted  in such a way that it can be made part of an
4133              inputrc file.
4134       dump-variables
4135              Print all of the settable readline variables and their values to
4136              the  readline output stream.  If a numeric argument is supplied,
4137              the output is formatted in such a way that it can be  made  part
4138              of an inputrc file.
4139       dump-macros
4140              Print  all of the readline key sequences bound to macros and the
4141              strings they output.  If a numeric  argument  is  supplied,  the
4142              output is formatted in such a way that it can be made part of an
4143              inputrc file.
4144       display-shell-version (C-x C-v)
4145              Display version information about the current instance of bash.
4146
4147   Programmable Completion
4148       When word completion is attempted for an  argument  to  a  command  for
4149       which  a  completion  specification (a compspec) has been defined using
4150       the complete builtin (see SHELL BUILTIN COMMANDS below),  the  program‐
4151       mable completion facilities are invoked.
4152
4153       First,  the  command  name  is  identified.  If the command word is the
4154       empty string (completion attempted at the beginning of an empty  line),
4155       any  compspec  defined  with  the  -E option to complete is used.  If a
4156       compspec has been defined for that command, the  compspec  is  used  to
4157       generate the list of possible completions for the word.  If the command
4158       word is a full pathname, a compspec for the full pathname  is  searched
4159       for  first.   If no compspec is found for the full pathname, an attempt
4160       is made to find a compspec for the portion following the  final  slash.
4161       If  those  searches  do  not result in a compspec, any compspec defined
4162       with the -D option to complete is used as the default.  If there is  no
4163       default  compspec, bash attempts alias expansion on the command word as
4164       a final resort, and attempts to find a compspec for  the  command  word
4165       from any successful expansion.
4166
4167       Once  a  compspec  has  been  found, it is used to generate the list of
4168       matching words.  If a compspec is not found, the default  bash  comple‐
4169       tion as described above under Completing is performed.
4170
4171       First,  the  actions  specified by the compspec are used.  Only matches
4172       which are prefixed by the word being completed are returned.  When  the
4173       -f  or -d option is used for filename or directory name completion, the
4174       shell variable FIGNORE is used to filter the matches.
4175
4176       Any completions specified by a pathname expansion pattern to the -G op‐
4177       tion  are  generated next.  The words generated by the pattern need not
4178       match the word being completed.  The GLOBIGNORE shell variable  is  not
4179       used to filter the matches, but the FIGNORE variable is used.
4180
4181       Next,  the string specified as the argument to the -W option is consid‐
4182       ered.  The string is first split using the characters in the  IFS  spe‐
4183       cial  variable  as delimiters.  Shell quoting is honored.  Each word is
4184       then expanded using brace expansion,  tilde  expansion,  parameter  and
4185       variable  expansion, command substitution, and arithmetic expansion, as
4186       described above under EXPANSION.  The results are split using the rules
4187       described above under Word Splitting.  The results of the expansion are
4188       prefix-matched against the word being completed, and the matching words
4189       become the possible completions.
4190
4191       After  these matches have been generated, any shell function or command
4192       specified with the -F and -C options is invoked.  When the  command  or
4193       function is invoked, the COMP_LINE, COMP_POINT, COMP_KEY, and COMP_TYPE
4194       variables are assigned values as described above under Shell Variables.
4195       If  a  shell  function  is being invoked, the COMP_WORDS and COMP_CWORD
4196       variables are also set.  When the function or command is  invoked,  the
4197       first  argument ($1) is the name of the command whose arguments are be‐
4198       ing completed, the second argument ($2) is the  word  being  completed,
4199       and  the  third argument ($3) is the word preceding the word being com‐
4200       pleted on the current command line.  No filtering of the generated com‐
4201       pletions against the word being completed is performed; the function or
4202       command has complete freedom in generating the matches.
4203
4204       Any function specified with -F is invoked first.  The function may  use
4205       any  of  the  shell facilities, including the compgen builtin described
4206       below, to generate the matches.  It must put the  possible  completions
4207       in the COMPREPLY array variable, one per array element.
4208
4209       Next,  any  command specified with the -C option is invoked in an envi‐
4210       ronment equivalent to command substitution.  It should print a list  of
4211       completions,  one  per  line, to the standard output.  Backslash may be
4212       used to escape a newline, if necessary.
4213
4214       After all of the possible completions are generated, any filter  speci‐
4215       fied  with  the -X option is applied to the list.  The filter is a pat‐
4216       tern as used for pathname expansion; a & in  the  pattern  is  replaced
4217       with  the text of the word being completed.  A literal & may be escaped
4218       with a backslash; the backslash is removed before attempting  a  match.
4219       Any  completion that matches the pattern will be removed from the list.
4220       A leading ! negates the pattern; in this case any completion not match‐
4221       ing  the  pattern  will be removed.  If the nocasematch shell option is
4222       enabled, the match is performed without regard to the  case  of  alpha‐
4223       betic characters.
4224
4225       Finally, any prefix and suffix specified with the -P and -S options are
4226       added to each member of the completion list, and the result is returned
4227       to the readline completion code as the list of possible completions.
4228
4229       If  the previously-applied actions do not generate any matches, and the
4230       -o dirnames option was supplied to complete when the compspec  was  de‐
4231       fined, directory name completion is attempted.
4232
4233       If  the  -o  plusdirs option was supplied to complete when the compspec
4234       was defined, directory name completion is attempted and any matches are
4235       added to the results of the other actions.
4236
4237       By  default,  if a compspec is found, whatever it generates is returned
4238       to the completion code as the full set of  possible  completions.   The
4239       default bash completions are not attempted, and the readline default of
4240       filename completion is disabled.  If the -o bashdefault option was sup‐
4241       plied  to complete when the compspec was defined, the bash default com‐
4242       pletions are attempted if the compspec generates no matches.  If the -o
4243       default  option was supplied to complete when the compspec was defined,
4244       readline's default completion will be performed if the  compspec  (and,
4245       if attempted, the default bash completions) generate no matches.
4246
4247       When  a  compspec  indicates that directory name completion is desired,
4248       the programmable completion functions force readline to append a  slash
4249       to  completed names which are symbolic links to directories, subject to
4250       the value of the mark-directories readline variable, regardless of  the
4251       setting of the mark-symlinked-directories readline variable.
4252
4253       There  is  some support for dynamically modifying completions.  This is
4254       most useful when used in combination with a default  completion  speci‐
4255       fied  with  complete -D.  It's possible for shell functions executed as
4256       completion handlers to indicate that completion should  be  retried  by
4257       returning  an exit status of 124.  If a shell function returns 124, and
4258       changes the compspec associated with the command on which completion is
4259       being  attempted  (supplied  as the first argument when the function is
4260       executed), programmable completion restarts from the beginning, with an
4261       attempt  to find a new compspec for that command.  This allows a set of
4262       completions to be built dynamically as completion is attempted,  rather
4263       than being loaded all at once.
4264
4265       For  instance, assuming that there is a library of compspecs, each kept
4266       in a file corresponding to the name of the command, the  following  de‐
4267       fault completion function would load completions dynamically:
4268
4269       _completion_loader()
4270       {
4271            . "/etc/bash_completion.d/$1.sh" >/dev/null 2>&1 && return 124
4272       }
4273       complete -D -F _completion_loader -o bashdefault -o default
4274
4275

HISTORY

4277       When  the  -o  history  option to the set builtin is enabled, the shell
4278       provides access to the command history, the list of commands previously
4279       typed.   The  value  of  the HISTSIZE variable is used as the number of
4280       commands to save in a history list.  The text of the last HISTSIZE com‐
4281       mands  (default  500)  is  saved.  The shell stores each command in the
4282       history list prior to parameter and variable expansion  (see  EXPANSION
4283       above)  but after history expansion is performed, subject to the values
4284       of the shell variables HISTIGNORE and HISTCONTROL.
4285
4286       On startup, the history is initialized from the file named by the vari‐
4287       able  HISTFILE  (default ~/.bash_history).  The file named by the value
4288       of HISTFILE is truncated, if necessary, to contain  no  more  than  the
4289       number  of  lines specified by the value of HISTFILESIZE.  If HISTFILE‐
4290       SIZE is unset, or set to null, a non-numeric value, or a numeric  value
4291       less  than  zero,  the history file is not truncated.  When the history
4292       file is read, lines beginning with the history comment  character  fol‐
4293       lowed immediately by a digit are interpreted as timestamps for the fol‐
4294       lowing history line.  These timestamps are optionally displayed depend‐
4295       ing  on  the  value  of the HISTTIMEFORMAT variable.  When a shell with
4296       history enabled exits, the last $HISTSIZE lines  are  copied  from  the
4297       history  list  to $HISTFILE.  If the histappend shell option is enabled
4298       (see the description of shopt under SHELL BUILTIN COMMANDS below),  the
4299       lines  are  appended to the history file, otherwise the history file is
4300       overwritten.  If HISTFILE is unset, or  if  the  history  file  is  un‐
4301       writable,  the history is not saved.  If the HISTTIMEFORMAT variable is
4302       set, time stamps are written to the history file, marked with the  his‐
4303       tory comment character, so they may be preserved across shell sessions.
4304       This uses the history comment character to distinguish timestamps  from
4305       other  history  lines.   After  saving the history, the history file is
4306       truncated to contain no more than HISTFILESIZE lines.  If  HISTFILESIZE
4307       is  unset, or set to null, a non-numeric value, or a numeric value less
4308       than zero, the history file is not truncated.
4309
4310       The builtin command fc (see SHELL BUILTIN COMMANDS below) may  be  used
4311       to list or edit and re-execute a portion of the history list.  The his‐
4312       tory builtin may be used to display or modify the history list and  ma‐
4313       nipulate  the  history  file.   When using command-line editing, search
4314       commands are available in each editing mode that provide access to  the
4315       history list.
4316
4317       The  shell  allows control over which commands are saved on the history
4318       list.  The HISTCONTROL and HISTIGNORE variables may be set to cause the
4319       shell to save only a subset of the commands entered.  The cmdhist shell
4320       option, if enabled, causes the shell to attempt to save each line of  a
4321       multi-line  command  in the same history entry, adding semicolons where
4322       necessary to preserve syntactic correctness.  The lithist shell  option
4323       causes  the shell to save the command with embedded newlines instead of
4324       semicolons.  See the description of the shopt builtin below under SHELL
4325       BUILTIN  COMMANDS  for  information  on setting and unsetting shell op‐
4326       tions.
4327

HISTORY EXPANSION

4329       The shell supports a history expansion feature that is similar  to  the
4330       history  expansion in csh.  This section describes what syntax features
4331       are available.  This feature is  enabled  by  default  for  interactive
4332       shells, and can be disabled using the +H option to the set builtin com‐
4333       mand (see SHELL BUILTIN COMMANDS below).  Non-interactive shells do not
4334       perform history expansion by default.
4335
4336       History expansions introduce words from the history list into the input
4337       stream, making it easy to repeat commands, insert the  arguments  to  a
4338       previous command into the current input line, or fix errors in previous
4339       commands quickly.
4340
4341       History expansion is performed immediately after  a  complete  line  is
4342       read,  before  the shell breaks it into words, and is performed on each
4343       line individually without taking quoting on  previous  lines  into  ac‐
4344       count.   It  takes place in two parts.  The first is to determine which
4345       line from the history list to use during substitution.  The  second  is
4346       to  select  portions  of  that line for inclusion into the current one.
4347       The line selected from the history is the event, and  the  portions  of
4348       that  line that are acted upon are words.  Various modifiers are avail‐
4349       able to manipulate the selected words.  The line is broken  into  words
4350       in  the same fashion as when reading input, so that several metacharac‐
4351       ter-separated words surrounded by quotes are considered one word.  His‐
4352       tory  expansions are introduced by the appearance of the history expan‐
4353       sion character, which is ! by default.  Only backslash (\)  and  single
4354       quotes  can  quote the history expansion character, but the history ex‐
4355       pansion character is also treated as quoted if it immediately  precedes
4356       the closing double quote in a double-quoted string.
4357
4358       Several  characters inhibit history expansion if found immediately fol‐
4359       lowing the history expansion character, even if it is unquoted:  space,
4360       tab,  newline,  carriage return, and =.  If the extglob shell option is
4361       enabled, ( will also inhibit expansion.
4362
4363       Several shell options settable with the shopt builtin may  be  used  to
4364       tailor  the behavior of history expansion.  If the histverify shell op‐
4365       tion is enabled (see the description of the shopt builtin  below),  and
4366       readline  is  being  used,  history  substitutions  are not immediately
4367       passed to the shell parser.  Instead, the  expanded  line  is  reloaded
4368       into the readline editing buffer for further modification.  If readline
4369       is being used, and the histreedit shell option  is  enabled,  a  failed
4370       history  substitution will be reloaded into the readline editing buffer
4371       for correction.  The -p option to the history builtin  command  may  be
4372       used  to  see what a history expansion will do before using it.  The -s
4373       option to the history builtin may be used to add commands to the end of
4374       the  history  list  without  actually  executing them, so that they are
4375       available for subsequent recall.
4376
4377       The shell allows control of the various characters used by the  history
4378       expansion mechanism (see the description of histchars above under Shell
4379       Variables).  The shell uses the history comment character to mark  his‐
4380       tory timestamps when writing the history file.
4381
4382   Event Designators
4383       An  event designator is a reference to a command line entry in the his‐
4384       tory list.  Unless the reference is absolute, events  are  relative  to
4385       the current position in the history list.
4386
4387       !      Start  a  history substitution, except when followed by a blank,
4388              newline, carriage return, = or ( (when the extglob shell  option
4389              is enabled using the shopt builtin).
4390       !n     Refer to command line n.
4391       !-n    Refer to the current command minus n.
4392       !!     Refer to the previous command.  This is a synonym for `!-1'.
4393       !string
4394              Refer  to the most recent command preceding the current position
4395              in the history list starting with string.
4396       !?string[?]
4397              Refer to the most recent command preceding the current  position
4398              in  the  history  list containing string.  The trailing ? may be
4399              omitted if string is followed  immediately  by  a  newline.   If
4400              string  is  missing,  the  string from the most recent search is
4401              used; it is an error if there is no previous search string.
4402       ^string1^string2^
4403              Quick substitution.   Repeat  the  previous  command,  replacing
4404              string1  with  string2.  Equivalent to ``!!:s^string1^string2^''
4405              (see Modifiers below).
4406       !#     The entire command line typed so far.
4407
4408   Word Designators
4409       Word designators are used to select desired words from the event.  A  :
4410       separates  the event specification from the word designator.  It may be
4411       omitted if the word designator begins with a ^, $, *, -, or  %.   Words
4412       are  numbered from the beginning of the line, with the first word being
4413       denoted by 0 (zero).  Words are inserted into the  current  line  sepa‐
4414       rated by single spaces.
4415
4416       0 (zero)
4417              The zeroth word.  For the shell, this is the command word.
4418       n      The nth word.
4419       ^      The first argument.  That is, word 1.
4420       $      The  last word.  This is usually the last argument, but will ex‐
4421              pand to the zeroth word if there is only one word in the line.
4422       %      The first word matched by the most recent `?string?' search,  if
4423              the  search  string  begins  with  a character that is part of a
4424              word.
4425       x-y    A range of words; `-y' abbreviates `0-y'.
4426       *      All of the words but the zeroth.  This is a synonym  for  `1-$'.
4427              It  is  not  an  error to use * if there is just one word in the
4428              event; the empty string is returned in that case.
4429       x*     Abbreviates x-$.
4430       x-     Abbreviates x-$ like x*, but omits the last word.  If x is miss‐
4431              ing, it defaults to 0.
4432
4433       If  a  word  designator is supplied without an event specification, the
4434       previous command is used as the event.
4435
4436   Modifiers
4437       After the optional word designator, there may appear a sequence of  one
4438       or more of the following modifiers, each preceded by a `:'.  These mod‐
4439       ify, or edit, the word or words selected from the history event.
4440
4441       h      Remove a trailing filename component, leaving only the head.
4442       t      Remove all leading filename components, leaving the tail.
4443       r      Remove a trailing suffix of the form .xxx, leaving the basename.
4444       e      Remove all but the trailing suffix.
4445       p      Print the new command but do not execute it.
4446       q      Quote the substituted words, escaping further substitutions.
4447       x      Quote the substituted words as with q, but break into  words  at
4448              blanks  and newlines.  The q and x modifiers are mutually exclu‐
4449              sive; the last one supplied is used.
4450       s/old/new/
4451              Substitute new for the first occurrence  of  old  in  the  event
4452              line.  Any character may be used as the delimiter in place of /.
4453              The final delimiter is optional if it is the last  character  of
4454              the event line.  The delimiter may be quoted in old and new with
4455              a single backslash.  If & appears in new, it is replaced by old.
4456              A  single backslash will quote the &.  If old is null, it is set
4457              to the last old substituted, or, if no previous history  substi‐
4458              tutions  took  place,  the last string in a !?string[?]  search.
4459              If new is null, each matching old is deleted.
4460       &      Repeat the previous substitution.
4461       g      Cause changes to be applied over the entire event line.  This is
4462              used  in  conjunction  with `:s' (e.g., `:gs/old/new/') or `:&'.
4463              If used with `:s', any delimiter can be used in place of /,  and
4464              the  final  delimiter is optional if it is the last character of
4465              the event line.  An a may be used as a synonym for g.
4466       G      Apply the following `s' or `&' modifier once to each word in the
4467              event line.
4468

SHELL BUILTIN COMMANDS

4470       Unless otherwise noted, each builtin command documented in this section
4471       as accepting options preceded by - accepts -- to signify the end of the
4472       options.  The :, true, false, and test/[ builtins do not accept options
4473       and do not treat -- specially.  The exit, logout, return,  break,  con‐
4474       tinue,  let,  and shift builtins accept and process arguments beginning
4475       with - without requiring --.  Other builtins that accept arguments  but
4476       are  not  specified  as accepting options interpret arguments beginning
4477       with - as invalid options and require -- to  prevent  this  interpreta‐
4478       tion.
4479       : [arguments]
4480              No  effect;  the command does nothing beyond expanding arguments
4481              and performing any specified redirections.  The return status is
4482              zero.
4483
4484        .  filename [arguments]
4485       source filename [arguments]
4486              Read and execute commands from filename in the current shell en‐
4487              vironment and return the exit status of the  last  command  exe‐
4488              cuted  from  filename.   If  filename  does not contain a slash,
4489              filenames in PATH are used  to  find  the  directory  containing
4490              filename, but filename does not need to be executable.  The file
4491              searched for in PATH need not be executable.  When bash  is  not
4492              in  posix  mode, it searches the current directory if no file is
4493              found in PATH.  If the sourcepath option to  the  shopt  builtin
4494              command  is  turned off, the PATH is not searched.  If any argu‐
4495              ments are supplied, they become the positional  parameters  when
4496              filename  is  executed.  Otherwise the positional parameters are
4497              unchanged.  If the -T option is enabled, . inherits any trap  on
4498              DEBUG; if it is not, any DEBUG trap string is saved and restored
4499              around the call to ., and . unsets the DEBUG trap while it  exe‐
4500              cutes.  If -T is not set, and the sourced file changes the DEBUG
4501              trap, the new value is retained when .  completes.   The  return
4502              status  is  the  status  of  the  last command exited within the
4503              script (0 if no commands are executed), and false if filename is
4504              not found or cannot be read.
4505
4506       alias [-p] [name[=value] ...]
4507              Alias with no arguments or with the -p option prints the list of
4508              aliases in the form alias name=value on standard  output.   When
4509              arguments  are supplied, an alias is defined for each name whose
4510              value is given.  A trailing space in value causes the next  word
4511              to be checked for alias substitution when the alias is expanded.
4512              For each name in the argument list for which no  value  is  sup‐
4513              plied,  the  name  and value of the alias is printed.  Alias re‐
4514              turns true unless a name is given for which no  alias  has  been
4515              defined.
4516
4517       bg [jobspec ...]
4518              Resume  each  suspended  job jobspec in the background, as if it
4519              had been started with &.  If jobspec is not present, the shell's
4520              notion  of the current job is used.  bg jobspec returns 0 unless
4521              run when job control is disabled or, when run with  job  control
4522              enabled,  any  specified  jobspec  was  not found or was started
4523              without job control.
4524
4525       bind [-m keymap] [-lpsvPSVX]
4526       bind [-m keymap] [-q function] [-u function] [-r keyseq]
4527       bind [-m keymap] -f filename
4528       bind [-m keymap] -x keyseq:shell-command
4529       bind [-m keymap] keyseq:function-name
4530       bind [-m keymap] keyseq:readline-command
4531       bind readline-command-line
4532              Display current readline key and function bindings, bind  a  key
4533              sequence  to  a  readline  function  or macro, or set a readline
4534              variable.  Each non-option argument is a command as it would ap‐
4535              pear  in  a  readline  initialization file such as .inputrc, but
4536              each binding or command must be passed as a  separate  argument;
4537              e.g.,  '"\C-x\C-r":  re-read-init-file'.   Options, if supplied,
4538              have the following meanings:
4539              -m keymap
4540                     Use keymap as the keymap to be affected by the subsequent
4541                     bindings.  Acceptable keymap names are emacs, emacs-stan‐
4542                     dard, emacs-meta, emacs-ctlx,  vi,  vi-move,  vi-command,
4543                     and  vi-insert.   vi is equivalent to vi-command (vi-move
4544                     is also a synonym); emacs is  equivalent  to  emacs-stan‐
4545                     dard.
4546              -l     List the names of all readline functions.
4547              -p     Display  readline  function  names and bindings in such a
4548                     way that they can be re-read.
4549              -P     List current readline function names and bindings.
4550              -s     Display readline key sequences bound to  macros  and  the
4551                     strings  they  output  in such a way that they can be re-
4552                     read.
4553              -S     Display readline key sequences bound to  macros  and  the
4554                     strings they output.
4555              -v     Display  readline variable names and values in such a way
4556                     that they can be re-read.
4557              -V     List current readline variable names and values.
4558              -f filename
4559                     Read key bindings from filename.
4560              -q function
4561                     Query about which keys invoke the named function.
4562              -u function
4563                     Unbind all keys bound to the named function.
4564              -r keyseq
4565                     Remove any current binding for keyseq.
4566              -x keyseq:shell-command
4567                     Cause shell-command to be executed whenever keyseq is en‐
4568                     tered.   When  shell-command  is executed, the shell sets
4569                     the READLINE_LINE variable to the contents of  the  read‐
4570                     line line buffer and the READLINE_POINT and READLINE_MARK
4571                     variables to the current location of the insertion  point
4572                     and  the  saved insertion point (the mark), respectively.
4573                     The shell assigns any numeric argument the user  supplied
4574                     to the READLINE_ARGUMENT variable.  If there was no argu‐
4575                     ment, that variable is not set.  If the executed  command
4576                     changes   the   value  of  any  of  READLINE_LINE,  READ‐
4577                     LINE_POINT, or READLINE_MARK, those new  values  will  be
4578                     reflected in the editing state.
4579              -X     List  all  key  sequences bound to shell commands and the
4580                     associated commands in a format that can be reused as in‐
4581                     put.
4582
4583              The  return value is 0 unless an unrecognized option is given or
4584              an error occurred.
4585
4586       break [n]
4587              Exit from within a for, while, until, or select loop.  If  n  is
4588              specified, break n levels.  n must be ≥ 1.  If n is greater than
4589              the number of enclosing loops, all enclosing loops  are  exited.
4590              The  return  value is 0 unless n is not greater than or equal to
4591              1.
4592
4593       builtin shell-builtin [arguments]
4594              Execute the specified shell builtin, passing it  arguments,  and
4595              return its exit status.  This is useful when defining a function
4596              whose name is the same as a shell builtin, retaining  the  func‐
4597              tionality of the builtin within the function.  The cd builtin is
4598              commonly redefined this way.  The  return  status  is  false  if
4599              shell-builtin is not a shell builtin command.
4600
4601       caller [expr]
4602              Returns the context of any active subroutine call (a shell func‐
4603              tion or a script executed with the . or source builtins).  With‐
4604              out expr, caller displays the line number and source filename of
4605              the current subroutine call.  If a non-negative integer is  sup‐
4606              plied as expr, caller displays the line number, subroutine name,
4607              and source file corresponding to that position  in  the  current
4608              execution  call  stack.  This extra information may be used, for
4609              example, to print a stack trace.  The current frame is frame  0.
4610              The  return  value is 0 unless the shell is not executing a sub‐
4611              routine call or expr does not correspond to a valid position  in
4612              the call stack.
4613
4614       cd [-L|[-P [-e]] [-@]] [dir]
4615              Change  the  current  directory to dir.  if dir is not supplied,
4616              the value of the HOME shell variable is the default.  The  vari‐
4617              able CDPATH defines the search path for the directory containing
4618              dir: each directory name in CDPATH is searched for dir.   Alter‐
4619              native  directory  names in CDPATH are separated by a colon (:).
4620              A null directory name in CDPATH is the same as the  current  di‐
4621              rectory,  i.e., ``.''.  If dir begins with a slash (/), then CD‐
4622              PATH is not used.  The -P option causes cd to use  the  physical
4623              directory structure by resolving symbolic links while traversing
4624              dir and before processing instances of .. in dir (see  also  the
4625              -P option to the set builtin command); the -L option forces sym‐
4626              bolic links to be followed by resolving the link after  process‐
4627              ing  instances  of  .. in dir.  If .. appears in dir, it is pro‐
4628              cessed by removing the immediately previous  pathname  component
4629              from  dir,  back  to a slash or the beginning of dir.  If the -e
4630              option is supplied with -P, and the  current  working  directory
4631              cannot  be  successfully determined after a successful directory
4632              change, cd will return an unsuccessful status.  On systems  that
4633              support it, the -@ option presents the extended attributes asso‐
4634              ciated with a file as a directory.  An argument  of  -  is  con‐
4635              verted  to $OLDPWD before the directory change is attempted.  If
4636              a non-empty directory name from CDPATH is used, or if -  is  the
4637              first  argument, and the directory change is successful, the ab‐
4638              solute pathname of the new working directory is written  to  the
4639              standard output.  If the directory change is successful, cd sets
4640              the value of the PWD environment variable to the  new  directory
4641              name,  and  sets the OLDPWD environment variable to the value of
4642              the current working directory before  the  change.   The  return
4643              value  is  true if the directory was successfully changed; false
4644              otherwise.
4645
4646       command [-pVv] command [arg ...]
4647              Run command with args  suppressing  the  normal  shell  function
4648              lookup.  Only builtin commands or commands found in the PATH are
4649              executed.  If the -p option is given, the search for command  is
4650              performed  using  a default value for PATH that is guaranteed to
4651              find all of the standard utilities.  If either the -V or -v  op‐
4652              tion  is  supplied, a description of command is printed.  The -v
4653              option causes a single word indicating the command  or  filename
4654              used to invoke command to be displayed; the -V option produces a
4655              more verbose description.  If the -V or -v option  is  supplied,
4656              the  exit  status  is  0 if command was found, and 1 if not.  If
4657              neither option is supplied and an error occurred or command can‐
4658              not  be found, the exit status is 127.  Otherwise, the exit sta‐
4659              tus of the command builtin is the exit status of command.
4660
4661       compgen [option] [word]
4662              Generate possible completion matches for word according  to  the
4663              options,  which  may  be  any  option  accepted  by the complete
4664              builtin with the exception of -p and -r, and write  the  matches
4665              to  the  standard  output.  When using the -F or -C options, the
4666              various shell variables set by the programmable  completion  fa‐
4667              cilities, while available, will not have useful values.
4668
4669              The matches will be generated in the same way as if the program‐
4670              mable completion code had generated them directly from a comple‐
4671              tion  specification  with the same flags.  If word is specified,
4672              only those completions matching word will be displayed.
4673
4674              The return value is true unless an invalid option  is  supplied,
4675              or no matches were generated.
4676
4677       complete  [-abcdefgjksuv] [-o comp-option] [-DEI] [-A action] [-G glob‐
4678       pat] [-W wordlist]
4679              [-F function] [-C command] [-X filterpat] [-P prefix]  [-S  suf‐
4680              fix] name [name ...]
4681       complete -pr [-DEI] [name ...]
4682              Specify  how arguments to each name should be completed.  If the
4683              -p option is supplied, or if no options are  supplied,  existing
4684              completion  specifications are printed in a way that allows them
4685              to be reused as input.  The -r option removes a completion spec‐
4686              ification  for each name, or, if no names are supplied, all com‐
4687              pletion specifications.  The -D option indicates that other sup‐
4688              plied  options  and actions should apply to the ``default'' com‐
4689              mand completion; that is, completion attempted on a command  for
4690              which  no completion has previously been defined.  The -E option
4691              indicates that other supplied options and actions  should  apply
4692              to  ``empty''  command completion; that is, completion attempted
4693              on a blank line.  The -I option indicates  that  other  supplied
4694              options  and  actions  should apply to completion on the initial
4695              non-assignment word on the line, or after  a  command  delimiter
4696              such  as  ;  or |, which is usually command name completion.  If
4697              multiple options are supplied, the -D  option  takes  precedence
4698              over -E, and both take precedence over -I.  If any of -D, -E, or
4699              -I are supplied, any other name  arguments  are  ignored;  these
4700              completions only apply to the case specified by the option.
4701
4702              The  process  of  applying  these completion specifications when
4703              word completion is attempted is described above  under  Program‐
4704              mable Completion.
4705
4706              Other  options,  if specified, have the following meanings.  The
4707              arguments to the -G, -W, and -X options (and, if necessary,  the
4708              -P  and -S options) should be quoted to protect them from expan‐
4709              sion before the complete builtin is invoked.
4710              -o comp-option
4711                      The comp-option controls several aspects  of  the  comp‐
4712                      spec's  behavior beyond the simple generation of comple‐
4713                      tions.  comp-option may be one of:
4714                      bashdefault
4715                              Perform the rest of the default bash completions
4716                              if the compspec generates no matches.
4717                      default Use  readline's  default  filename completion if
4718                              the compspec generates no matches.
4719                      dirnames
4720                              Perform directory name completion if  the  comp‐
4721                              spec generates no matches.
4722                      filenames
4723                              Tell  readline that the compspec generates file‐
4724                              names, so it can perform  any  filename-specific
4725                              processing  (like  adding  a  slash to directory
4726                              names, quoting special characters, or  suppress‐
4727                              ing  trailing spaces).  Intended to be used with
4728                              shell functions.
4729                      noquote Tell readline not to quote the  completed  words
4730                              if  they are filenames (quoting filenames is the
4731                              default).
4732                      nosort  Tell readline not to sort the list  of  possible
4733                              completions alphabetically.
4734                      nospace Tell  readline  not  to  append a space (the de‐
4735                              fault) to words completed  at  the  end  of  the
4736                              line.
4737                      plusdirs
4738                              After  any  matches  defined by the compspec are
4739                              generated,  directory  name  completion  is  at‐
4740                              tempted and any matches are added to the results
4741                              of the other actions.
4742              -A action
4743                      The action may be one of the  following  to  generate  a
4744                      list of possible completions:
4745                      alias   Alias names.  May also be specified as -a.
4746                      arrayvar
4747                              Array variable names.
4748                      binding Readline key binding names.
4749                      builtin Names  of  shell  builtin commands.  May also be
4750                              specified as -b.
4751                      command Command names.  May also be specified as -c.
4752                      directory
4753                              Directory names.  May also be specified as -d.
4754                      disabled
4755                              Names of disabled shell builtins.
4756                      enabled Names of enabled shell builtins.
4757                      export  Names of exported shell variables.  May also  be
4758                              specified as -e.
4759                      file    File names.  May also be specified as -f.
4760                      function
4761                              Names of shell functions.
4762                      group   Group names.  May also be specified as -g.
4763                      helptopic
4764                              Help topics as accepted by the help builtin.
4765                      hostname
4766                              Hostnames,  as  taken from the file specified by
4767                              the HOSTFILE shell variable.
4768                      job     Job names, if job control is active.   May  also
4769                              be specified as -j.
4770                      keyword Shell  reserved words.  May also be specified as
4771                              -k.
4772                      running Names of running jobs, if job control is active.
4773                      service Service names.  May also be specified as -s.
4774                      setopt  Valid arguments for the -o  option  to  the  set
4775                              builtin.
4776                      shopt   Shell  option  names  as  accepted  by the shopt
4777                              builtin.
4778                      signal  Signal names.
4779                      stopped Names of stopped jobs, if job control is active.
4780                      user    User names.  May also be specified as -u.
4781                      variable
4782                              Names of all shell variables.  May also be spec‐
4783                              ified as -v.
4784              -C command
4785                      command  is  executed in a subshell environment, and its
4786                      output is used as the possible  completions.   Arguments
4787                      are passed as with the -F option.
4788              -F function
4789                      The  shell  function function is executed in the current
4790                      shell environment.  When the function is  executed,  the
4791                      first argument ($1) is the name of the command whose ar‐
4792                      guments are being completed, the second argument ($2) is
4793                      the word being completed, and the third argument ($3) is
4794                      the word preceding the word being completed on the  cur‐
4795                      rent  command line.  When it finishes, the possible com‐
4796                      pletions are retrieved from the value of  the  COMPREPLY
4797                      array variable.
4798              -G globpat
4799                      The  pathname  expansion  pattern globpat is expanded to
4800                      generate the possible completions.
4801              -P prefix
4802                      prefix is added at the beginning of each  possible  com‐
4803                      pletion after all other options have been applied.
4804              -S suffix
4805                      suffix is appended to each possible completion after all
4806                      other options have been applied.
4807              -W wordlist
4808                      The wordlist is split using the characters  in  the  IFS
4809                      special  variable as delimiters, and each resultant word
4810                      is expanded.  Shell quoting is honored within  wordlist,
4811                      in order to provide a mechanism for the words to contain
4812                      shell metacharacters or characters in the value of  IFS.
4813                      The  possible  completions are the members of the resul‐
4814                      tant list which match the word being completed.
4815              -X filterpat
4816                      filterpat is a pattern as used for  pathname  expansion.
4817                      It is applied to the list of possible completions gener‐
4818                      ated by the preceding options and  arguments,  and  each
4819                      completion  matching filterpat is removed from the list.
4820                      A leading ! in filterpat negates the  pattern;  in  this
4821                      case, any completion not matching filterpat is removed.
4822
4823              The  return  value is true unless an invalid option is supplied,
4824              an option other than -p or -r is supplied without a  name  argu‐
4825              ment,  an  attempt  is made to remove a completion specification
4826              for a name for which no specification exists, or an error occurs
4827              adding a completion specification.
4828
4829       compopt [-o option] [-DEI] [+o option] [name]
4830              Modify  completion  options  for  each name according to the op‐
4831              tions, or for the currently-executing completion if no names are
4832              supplied.   If  no options are given, display the completion op‐
4833              tions for each name or the  current  completion.   The  possible
4834              values  of  option  are those valid for the complete builtin de‐
4835              scribed above.  The -D option indicates that other supplied  op‐
4836              tions  should  apply to the ``default'' command completion; that
4837              is, completion attempted on a command for  which  no  completion
4838              has previously been defined.  The -E option indicates that other
4839              supplied options should apply to ``empty''  command  completion;
4840              that  is,  completion  attempted on a blank line.  The -I option
4841              indicates that other supplied options should apply to completion
4842              on  the initial non-assignment word on the line, or after a com‐
4843              mand delimiter such as ; or |, which  is  usually  command  name
4844              completion.
4845
4846              The  return  value is true unless an invalid option is supplied,
4847              an attempt is made to modify the options for a name for which no
4848              completion specification exists, or an output error occurs.
4849
4850       continue [n]
4851              Resume the next iteration of the enclosing for, while, until, or
4852              select loop.  If n is specified, resume  at  the  nth  enclosing
4853              loop.   n  must  be ≥ 1.  If n is greater than the number of en‐
4854              closing loops, the last enclosing loop (the ``top-level''  loop)
4855              is  resumed.  The return value is 0 unless n is not greater than
4856              or equal to 1.
4857
4858       declare [-aAfFgiIlnrtux] [-p] [name[=value] ...]
4859       typeset [-aAfFgiIlnrtux] [-p] [name[=value] ...]
4860              Declare variables and/or give them attributes.  If no names  are
4861              given  then display the values of variables.  The -p option will
4862              display the attributes and values of each name.  When -p is used
4863              with  name  arguments, additional options, other than -f and -F,
4864              are ignored.  When -p is supplied  without  name  arguments,  it
4865              will  display  the attributes and values of all variables having
4866              the attributes specified by the additional options.  If no other
4867              options  are  supplied  with  -p,  declare  will display the at‐
4868              tributes and values of all shell variables.  The -f option  will
4869              restrict the display to shell functions.  The -F option inhibits
4870              the display of function definitions; only the function name  and
4871              attributes are printed.  If the extdebug shell option is enabled
4872              using shopt, the source file name and  line  number  where  each
4873              name  is  defined  are displayed as well.  The -F option implies
4874              -f.  The -g option forces variables to be created or modified at
4875              the global scope, even when declare is executed in a shell func‐
4876              tion.  It is ignored in all other cases.  The -I  option  causes
4877              local  variables  to  inherit the attributes (except the nameref
4878              attribute) and value of any existing variable with the same name
4879              at  a  surrounding scope.  If there is no existing variable, the
4880              local variable is initially unset.  The following options can be
4881              used  to  restrict output to variables with the specified attri‐
4882              bute or to give variables attributes:
4883              -a     Each name  is  an  indexed  array  variable  (see  Arrays
4884                     above).
4885              -A     Each  name  is  an associative array variable (see Arrays
4886                     above).
4887              -f     Use function names only.
4888              -i     The variable is treated as an integer; arithmetic evalua‐
4889                     tion  (see ARITHMETIC EVALUATION above) is performed when
4890                     the variable is assigned a value.
4891              -l     When the variable is assigned  a  value,  all  upper-case
4892                     characters  are  converted to lower-case.  The upper-case
4893                     attribute is disabled.
4894              -n     Give each name the nameref attribute, making  it  a  name
4895                     reference  to  another  variable.  That other variable is
4896                     defined by the value of name.   All  references,  assign‐
4897                     ments,  and attribute modifications to name, except those
4898                     using or changing the -n attribute itself, are  performed
4899                     on  the variable referenced by name's value.  The nameref
4900                     attribute cannot be applied to array variables.
4901              -r     Make names readonly.  These names cannot then be assigned
4902                     values by subsequent assignment statements or unset.
4903              -t     Give each name the trace attribute.  Traced functions in‐
4904                     herit the DEBUG and RETURN traps from the calling  shell.
4905                     The trace attribute has no special meaning for variables.
4906              -u     When  the  variable  is  assigned a value, all lower-case
4907                     characters are converted to upper-case.   The  lower-case
4908                     attribute is disabled.
4909              -x     Mark  names for export to subsequent commands via the en‐
4910                     vironment.
4911
4912              Using `+' instead of `-' turns off the attribute  instead,  with
4913              the  exceptions  that +a and +A may not be used to destroy array
4914              variables and +r will not remove the readonly  attribute.   When
4915              used in a function, declare and typeset make each name local, as
4916              with the local command, unless the -g option is supplied.  If  a
4917              variable  name  is followed by =value, the value of the variable
4918              is set to value.  When using -a or -A and the  compound  assign‐
4919              ment  syntax to create array variables, additional attributes do
4920              not take effect until subsequent assignments.  The return  value
4921              is 0 unless an invalid option is encountered, an attempt is made
4922              to define a function using ``-f foo=bar'', an attempt is made to
4923              assign a value to a readonly variable, an attempt is made to as‐
4924              sign a value to an array variable without using the compound as‐
4925              signment  syntax  (see  Arrays above), one of the names is not a
4926              valid shell variable name, an attempt is made to turn off  read‐
4927              only  status for a readonly variable, an attempt is made to turn
4928              off array status for an array variable, or an attempt is made to
4929              display a non-existent function with -f.
4930
4931       dirs [-clpv] [+n] [-n]
4932              Without  options,  displays the list of currently remembered di‐
4933              rectories.  The default display is on a single line with  direc‐
4934              tory  names  separated  by spaces.  Directories are added to the
4935              list with the pushd command; the popd  command  removes  entries
4936              from the list.  The current directory is always the first direc‐
4937              tory in the stack.
4938              -c     Clears the directory stack by deleting  all  of  the  en‐
4939                     tries.
4940              -l     Produces  a  listing  using  full  pathnames; the default
4941                     listing format uses a tilde to denote the home directory.
4942              -p     Print the directory stack with one entry per line.
4943              -v     Print the directory stack with one entry per  line,  pre‐
4944                     fixing each entry with its index in the stack.
4945              +n     Displays the nth entry counting from the left of the list
4946                     shown by dirs when invoked without options, starting with
4947                     zero.
4948              -n     Displays  the  nth  entry  counting from the right of the
4949                     list shown by dirs when invoked without options, starting
4950                     with zero.
4951
4952              The  return value is 0 unless an invalid option is supplied or n
4953              indexes beyond the end of the directory stack.
4954
4955       disown [-ar] [-h] [jobspec ... | pid ... ]
4956              Without options, remove each jobspec from the  table  of  active
4957              jobs.   If jobspec is not present, and neither the -a nor the -r
4958              option is supplied, the current job is used.  If the  -h  option
4959              is  given,  each  jobspec  is not removed from the table, but is
4960              marked so that SIGHUP is not sent to the job if  the  shell  re‐
4961              ceives a SIGHUP.  If no jobspec is supplied, the -a option means
4962              to remove or mark all jobs; the -r option without a jobspec  ar‐
4963              gument restricts operation to running jobs.  The return value is
4964              0 unless a jobspec does not specify a valid job.
4965
4966       echo [-neE] [arg ...]
4967              Output the args, separated by spaces,  followed  by  a  newline.
4968              The  return  status  is 0 unless a write error occurs.  If -n is
4969              specified, the trailing newline is suppressed.  If the -e option
4970              is  given,  interpretation  of  the  following backslash-escaped
4971              characters is enabled.  The -E option disables  the  interpreta‐
4972              tion  of these escape characters, even on systems where they are
4973              interpreted by default.  The xpg_echo shell option may  be  used
4974              to  dynamically  determine whether or not echo expands these es‐
4975              cape characters by default.  echo does not interpret -- to  mean
4976              the  end  of  options.  echo interprets the following escape se‐
4977              quences:
4978              \a     alert (bell)
4979              \b     backspace
4980              \c     suppress further output
4981              \e
4982              \E     an escape character
4983              \f     form feed
4984              \n     new line
4985              \r     carriage return
4986              \t     horizontal tab
4987              \v     vertical tab
4988              \\     backslash
4989              \0nnn  the eight-bit character whose value is  the  octal  value
4990                     nnn (zero to three octal digits)
4991              \xHH   the  eight-bit  character  whose value is the hexadecimal
4992                     value HH (one or two hex digits)
4993              \uHHHH the Unicode (ISO/IEC 10646) character whose value is  the
4994                     hexadecimal value HHHH (one to four hex digits)
4995              \UHHHHHHHH
4996                     the  Unicode (ISO/IEC 10646) character whose value is the
4997                     hexadecimal value HHHHHHHH (one to eight hex digits)
4998
4999       enable [-a] [-dnps] [-f filename] [name ...]
5000              Enable and disable builtin shell commands.  Disabling a  builtin
5001              allows a disk command which has the same name as a shell builtin
5002              to be executed without specifying a full pathname,  even  though
5003              the  shell  normally searches for builtins before disk commands.
5004              If -n is used, each name is disabled; otherwise, names  are  en‐
5005              abled.   For  example, to use the test binary found via the PATH
5006              instead of the shell builtin version, run  ``enable  -n  test''.
5007              The  -f  option  means to load the new builtin command name from
5008              shared object filename, on systems that support dynamic loading.
5009              Bash will use the value of the BASH_LOADABLES_PATH variable as a
5010              colon-separated list of directories in which to search for file‐
5011              name.   The  default  is  system-dependent.   The -d option will
5012              delete a builtin previously loaded with -f.  If  no  name  argu‐
5013              ments  are  given,  or  if  the -p option is supplied, a list of
5014              shell builtins is printed.  With no other option arguments,  the
5015              list consists of all enabled shell builtins.  If -n is supplied,
5016              only disabled builtins are printed.  If -a is supplied, the list
5017              printed  includes all builtins, with an indication of whether or
5018              not each is enabled.  If -s  is  supplied,  the  output  is  re‐
5019              stricted  to the POSIX special builtins.  If no options are sup‐
5020              plied and a name is not a shell builtin, enable will attempt  to
5021              load  name  from  a  shared object named name, as if the command
5022              were ``enable -f name name .  The return value  is  0  unless  a
5023              name  is  not a shell builtin or there is an error loading a new
5024              builtin from a shared object.
5025
5026       eval [arg ...]
5027              The args are read and concatenated together into a  single  com‐
5028              mand.   This command is then read and executed by the shell, and
5029              its exit status is returned as the value of eval.  If there  are
5030              no args, or only null arguments, eval returns 0.
5031
5032       exec [-cl] [-a name] [command [arguments]]
5033              If  command is specified, it replaces the shell.  No new process
5034              is created.  The arguments become the arguments to command.   If
5035              the -l option is supplied, the shell places a dash at the begin‐
5036              ning of the zeroth argument passed to command.  This is what lo‐
5037              gin(1)  does.   The -c option causes command to be executed with
5038              an empty environment.  If -a is supplied, the shell passes  name
5039              as the zeroth argument to the executed command.  If command can‐
5040              not be executed for some reason, a non-interactive shell  exits,
5041              unless  the  execfail shell option is enabled.  In that case, it
5042              returns failure.  An interactive shell returns  failure  if  the
5043              file  cannot  be  executed.  A subshell exits unconditionally if
5044              exec fails.  If command is not specified, any redirections  take
5045              effect  in  the  current  shell, and the return status is 0.  If
5046              there is a redirection error, the return status is 1.
5047
5048       exit [n]
5049              Cause the shell to exit with a status of n.  If  n  is  omitted,
5050              the exit status is that of the last command executed.  A trap on
5051              EXIT is executed before the shell terminates.
5052
5053       export [-fn] [name[=word]] ...
5054       export -p
5055              The supplied names are marked for automatic export to the  envi‐
5056              ronment  of subsequently executed commands.  If the -f option is
5057              given, the names refer to functions.  If no names are given,  or
5058              if  the  -p  option is supplied, a list of names of all exported
5059              variables is printed.  The -n option causes the export  property
5060              to be removed from each name.  If a variable name is followed by
5061              =word, the value of the variable is set to word.  export returns
5062              an exit status of 0 unless an invalid option is encountered, one
5063              of the names is not a valid shell variable name, or -f  is  sup‐
5064              plied with a name that is not a function.
5065
5066       fc [-e ename] [-lnr] [first] [last]
5067       fc -s [pat=rep] [cmd]
5068              The  first  form  selects a range of commands from first to last
5069              from the history list and  displays  or  edits  and  re-executes
5070              them.   First  and  last may be specified as a string (to locate
5071              the last command beginning with that string) or as a number  (an
5072              index  into the history list, where a negative number is used as
5073              an offset from the current command  number).   When  listing,  a
5074              first  or  last of 0 is equivalent to -1 and -0 is equivalent to
5075              the current command (usually the fc  command);  otherwise  0  is
5076              equivalent  to  -1 and -0 is invalid.  If last is not specified,
5077              it is set to the current command for listing (so  that  ``fc  -l
5078              -10''  prints  the last 10 commands) and to first otherwise.  If
5079              first is not specified, it is set to the  previous  command  for
5080              editing and -16 for listing.
5081
5082              The  -n option suppresses the command numbers when listing.  The
5083              -r option reverses the order of the commands.  If the -l  option
5084              is  given,  the  commands are listed on standard output.  Other‐
5085              wise, the editor given by ename is invoked on a file  containing
5086              those  commands.  If ename is not given, the value of the FCEDIT
5087              variable is used, and the value of EDITOR if FCEDIT is not  set.
5088              If  neither  variable  is set, vi is used.  When editing is com‐
5089              plete, the edited commands are echoed and executed.
5090
5091              In the second form, command is re-executed after  each  instance
5092              of  pat  is replaced by rep.  Command is interpreted the same as
5093              first above.  A useful alias to use with this is ``r="fc  -s"'',
5094              so  that  typing  ``r  cc'' runs the last command beginning with
5095              ``cc'' and typing ``r'' re-executes the last command.
5096
5097              If the first form is used, the return value is 0 unless  an  in‐
5098              valid  option  is  encountered  or first or last specify history
5099              lines out of range.  If the -e option is  supplied,  the  return
5100              value is the value of the last command executed or failure if an
5101              error occurs with the temporary file of commands.  If the second
5102              form  is  used, the return status is that of the command re-exe‐
5103              cuted, unless cmd does not specify  a  valid  history  line,  in
5104              which case fc returns failure.
5105
5106       fg [jobspec]
5107              Resume  jobspec  in the foreground, and make it the current job.
5108              If jobspec is not present, the shell's notion of the current job
5109              is  used.   The  return value is that of the command placed into
5110              the foreground, or failure if run when job control  is  disabled
5111              or, when run with job control enabled, if jobspec does not spec‐
5112              ify a valid job or jobspec specifies  a  job  that  was  started
5113              without job control.
5114
5115       getopts optstring name [arg ...]
5116              getopts  is used by shell procedures to parse positional parame‐
5117              ters.  optstring contains the option  characters  to  be  recog‐
5118              nized;  if a character is followed by a colon, the option is ex‐
5119              pected to have an argument, which should be separated from it by
5120              white  space.  The colon and question mark characters may not be
5121              used as option characters.  Each time  it  is  invoked,  getopts
5122              places  the next option in the shell variable name, initializing
5123              name if it does not exist, and the index of the next argument to
5124              be processed into the variable OPTIND.  OPTIND is initialized to
5125              1 each time the shell or a shell script is invoked.  When an op‐
5126              tion requires an argument, getopts places that argument into the
5127              variable OPTARG.  The shell does not reset OPTIND automatically;
5128              it  must  be  manually  reset  between multiple calls to getopts
5129              within the same shell invocation if a new set of  parameters  is
5130              to be used.
5131
5132              When the end of options is encountered, getopts exits with a re‐
5133              turn value greater than zero.  OPTIND is set to the index of the
5134              first non-option argument, and name is set to ?.
5135
5136              getopts  normally  parses the positional parameters, but if more
5137              arguments are supplied as arg values, getopts parses  those  in‐
5138              stead.
5139
5140              getopts  can  report errors in two ways.  If the first character
5141              of optstring is a colon, silent error  reporting  is  used.   In
5142              normal  operation,  diagnostic messages are printed when invalid
5143              options or missing option arguments  are  encountered.   If  the
5144              variable  OPTERR  is  set  to  0, no error messages will be dis‐
5145              played, even if the first character of optstring is not a colon.
5146
5147              If an invalid option is seen, getopts places ? into name and, if
5148              not  silent,  prints  an  error  message  and unsets OPTARG.  If
5149              getopts is silent, the option character found is placed  in  OP‐
5150              TARG and no diagnostic message is printed.
5151
5152              If  a required argument is not found, and getopts is not silent,
5153              a question mark (?) is placed in name, OPTARG is  unset,  and  a
5154              diagnostic  message  is  printed.   If getopts is silent, then a
5155              colon (:) is placed in name and OPTARG  is  set  to  the  option
5156              character found.
5157
5158              getopts  returns true if an option, specified or unspecified, is
5159              found.  It returns false if the end of options is encountered or
5160              an error occurs.
5161
5162       hash [-lr] [-p filename] [-dt] [name]
5163              Each time hash is invoked, the full pathname of the command name
5164              is determined by searching the directories in $PATH  and  remem‐
5165              bered.  Any previously-remembered pathname is discarded.  If the
5166              -p option is supplied, no path search is performed, and filename
5167              is  used  as  the  full  filename of the command.  The -r option
5168              causes the shell to forget all remembered locations.  The -d op‐
5169              tion  causes the shell to forget the remembered location of each
5170              name.  If the -t option is supplied, the full pathname to  which
5171              each  name  corresponds  is printed.  If multiple name arguments
5172              are supplied with -t, the name is printed before the hashed full
5173              pathname.  The -l option causes output to be displayed in a for‐
5174              mat that may be reused as input.  If no arguments are given,  or
5175              if only -l is supplied, information about remembered commands is
5176              printed.  The return status is true unless a name is  not  found
5177              or an invalid option is supplied.
5178
5179       help [-dms] [pattern]
5180              Display  helpful information about builtin commands.  If pattern
5181              is specified, help gives detailed help on all commands  matching
5182              pattern;  otherwise  help for all the builtins and shell control
5183              structures is printed.
5184              -d     Display a short description of each pattern
5185              -m     Display the description of each pattern in a manpage-like
5186                     format
5187              -s     Display only a short usage synopsis for each pattern
5188
5189              The return status is 0 unless no command matches pattern.
5190
5191       history [n]
5192       history -c
5193       history -d offset
5194       history -d start-end
5195       history -anrw [filename]
5196       history -p arg [arg ...]
5197       history -s arg [arg ...]
5198              With no options, display the command history list with line num‐
5199              bers.  Lines listed with a * have been modified.  An argument of
5200              n  lists only the last n lines.  If the shell variable HISTTIME‐
5201              FORMAT is set and not null, it is used as a  format  string  for
5202              strftime(3)  to display the time stamp associated with each dis‐
5203              played history entry.  No intervening blank is  printed  between
5204              the  formatted  time stamp and the history line.  If filename is
5205              supplied, it is used as the name of the history  file;  if  not,
5206              the  value  of HISTFILE is used.  Options, if supplied, have the
5207              following meanings:
5208              -c     Clear the history list by deleting all the entries.
5209              -d offset
5210                     Delete the history entry at position offset.   If  offset
5211                     is negative, it is interpreted as relative to one greater
5212                     than the last history position, so negative indices count
5213                     back  from  the  end  of  the history, and an index of -1
5214                     refers to the current history -d command.
5215              -d start-end
5216                     Delete the range of  history  entries  between  positions
5217                     start  and  end, inclusive.  Positive and negative values
5218                     for start and end are interpreted as described above.
5219              -a     Append the ``new'' history lines  to  the  history  file.
5220                     These  are  history  lines entered since the beginning of
5221                     the current bash session, but not already appended to the
5222                     history file.
5223              -n     Read  the history lines not already read from the history
5224                     file into the current history list.  These are lines  ap‐
5225                     pended  to  the  history  file since the beginning of the
5226                     current bash session.
5227              -r     Read the contents of the history file and append them  to
5228                     the current history list.
5229              -w     Write the current history list to the history file, over‐
5230                     writing the history file's contents.
5231              -p     Perform history substitution on the  following  args  and
5232                     display  the  result  on  the  standard output.  Does not
5233                     store the results in the history list.  Each arg must  be
5234                     quoted to disable normal history expansion.
5235              -s     Store  the  args  in  the history list as a single entry.
5236                     The last command in the history list  is  removed  before
5237                     the args are added.
5238
5239              If  the  HISTTIMEFORMAT variable is set, the time stamp informa‐
5240              tion associated with each history entry is written to  the  his‐
5241              tory  file, marked with the history comment character.  When the
5242              history file is read, lines beginning with the  history  comment
5243              character  followed  immediately  by  a digit are interpreted as
5244              timestamps for the following history entry.  The return value is
5245              0 unless an invalid option is encountered, an error occurs while
5246              reading or writing the history file, an invalid offset or  range
5247              is  supplied as an argument to -d, or the history expansion sup‐
5248              plied as an argument to -p fails.
5249
5250       jobs [-lnprs] [ jobspec ... ]
5251       jobs -x command [ args ... ]
5252              The first form lists the active jobs.  The options have the fol‐
5253              lowing meanings:
5254              -l     List process IDs in addition to the normal information.
5255              -n     Display  information  only  about  jobs that have changed
5256                     status since the user was last notified of their status.
5257              -p     List only the process  ID  of  the  job's  process  group
5258                     leader.
5259              -r     Display only running jobs.
5260              -s     Display only stopped jobs.
5261
5262              If  jobspec  is given, output is restricted to information about
5263              that job.  The return status is 0 unless an  invalid  option  is
5264              encountered or an invalid jobspec is supplied.
5265
5266              If the -x option is supplied, jobs replaces any jobspec found in
5267              command or args with the corresponding process group ID, and ex‐
5268              ecutes command passing it args, returning its exit status.
5269
5270       kill [-s sigspec | -n signum | -sigspec] [pid | jobspec] ...
5271       kill -l|-L [sigspec | exit_status]
5272              Send  the  signal  named  by  sigspec or signum to the processes
5273              named by pid or jobspec.  sigspec is either  a  case-insensitive
5274              signal  name such as SIGKILL (with or without the SIG prefix) or
5275              a signal number; signum is a signal number.  If sigspec  is  not
5276              present,  then  SIGTERM is assumed.  An argument of -l lists the
5277              signal names.  If any arguments are supplied when -l  is  given,
5278              the  names  of  the  signals  corresponding to the arguments are
5279              listed, and the return status is 0.  The exit_status argument to
5280              -l  is  a  number  specifying either a signal number or the exit
5281              status of a process terminated by a signal.  The  -L  option  is
5282              equivalent  to -l.  kill returns true if at least one signal was
5283              successfully sent, or false if an error occurs or an invalid op‐
5284              tion is encountered.
5285
5286       let arg [arg ...]
5287              Each arg is an arithmetic expression to be evaluated (see ARITH‐
5288              METIC EVALUATION above).  If the last arg evaluates  to  0,  let
5289              returns 1; 0 is returned otherwise.
5290
5291       local [option] [name[=value] ... | - ]
5292              For  each  argument, a local variable named name is created, and
5293              assigned value.  The option can be any of the  options  accepted
5294              by declare.  When local is used within a function, it causes the
5295              variable name to have a visible scope restricted to  that  func‐
5296              tion  and  its children.  If name is -, the set of shell options
5297              is made local to the function in which local is  invoked:  shell
5298              options  changed  using  the set builtin inside the function are
5299              restored to their original values  when  the  function  returns.
5300              The restore is effected as if a series of set commands were exe‐
5301              cuted to restore the values that were in place before the  func‐
5302              tion.   With no operands, local writes a list of local variables
5303              to the standard output.  It is an error to use  local  when  not
5304              within  a function.  The return status is 0 unless local is used
5305              outside a function, an invalid name is supplied, or  name  is  a
5306              readonly variable.
5307
5308       logout Exit a login shell.
5309
5310       mapfile  [-d  delim] [-n count] [-O origin] [-s count] [-t] [-u fd] [-C
5311       callback] [-c quantum] [array]
5312       readarray [-d delim] [-n count] [-O origin] [-s count] [-t] [-u fd] [-C
5313       callback] [-c quantum] [array]
5314              Read  lines from the standard input into the indexed array vari‐
5315              able array, or from file descriptor fd if the -u option is  sup‐
5316              plied.   The variable MAPFILE is the default array.  Options, if
5317              supplied, have the following meanings:
5318              -d     The first character of delim is used  to  terminate  each
5319                     input  line,  rather than newline.  If delim is the empty
5320                     string, mapfile will terminate a line when it reads a NUL
5321                     character.
5322              -n     Copy  at  most count lines.  If count is 0, all lines are
5323                     copied.
5324              -O     Begin assigning to array at index  origin.   The  default
5325                     index is 0.
5326              -s     Discard the first count lines read.
5327              -t     Remove  a trailing delim (default newline) from each line
5328                     read.
5329              -u     Read lines from file descriptor fd instead of  the  stan‐
5330                     dard input.
5331              -C     Evaluate  callback each time quantum lines are read.  The
5332                     -c option specifies quantum.
5333              -c     Specify the number of lines read  between  each  call  to
5334                     callback.
5335
5336              If  -C  is  specified  without  -c, the default quantum is 5000.
5337              When callback is evaluated, it is supplied the index of the next
5338              array element to be assigned and the line to be assigned to that
5339              element as additional arguments.  callback  is  evaluated  after
5340              the line is read but before the array element is assigned.
5341
5342              If  not supplied with an explicit origin, mapfile will clear ar‐
5343              ray before assigning to it.
5344
5345              mapfile returns successfully unless an invalid option or  option
5346              argument  is  supplied,  array is invalid or unassignable, or if
5347              array is not an indexed array.
5348
5349       popd [-n] [+n] [-n]
5350              Removes entries from the directory stack.  The elements are num‐
5351              bered  from  0  starting  at the first directory listed by dirs.
5352              With no arguments, popd  removes  the  top  directory  from  the
5353              stack, and changes to the new top directory.  Arguments, if sup‐
5354              plied, have the following meanings:
5355              -n     Suppresses the normal change of directory  when  removing
5356                     directories from the stack, so that only the stack is ma‐
5357                     nipulated.
5358              +n     Removes the nth entry counting from the left of the  list
5359                     shown  by  dirs, starting with zero, from the stack.  For
5360                     example: ``popd +0'' removes the first directory,  ``popd
5361                     +1'' the second.
5362              -n     Removes the nth entry counting from the right of the list
5363                     shown by dirs, starting with zero.  For  example:  ``popd
5364                     -0''  removes the last directory, ``popd -1'' the next to
5365                     last.
5366
5367              If the top element of the directory stack is modified,  and  the
5368              -n  option  was not supplied, popd uses the cd builtin to change
5369              to the directory at the top of the stack.  If the cd fails, popd
5370              returns a non-zero value.
5371
5372              Otherwise,  popd  returns  false if an invalid option is encoun‐
5373              tered, the directory stack is empty, or a non-existent directory
5374              stack entry is specified.
5375
5376              If  the  popd  command is successful, bash runs dirs to show the
5377              final contents of the directory stack, and the return status  is
5378              0.
5379
5380       printf [-v var] format [arguments]
5381              Write  the  formatted arguments to the standard output under the
5382              control of the format.  The -v option causes the  output  to  be
5383              assigned  to  the  variable var rather than being printed to the
5384              standard output.
5385
5386              The format is a character string which contains three  types  of
5387              objects:  plain  characters, which are simply copied to standard
5388              output, character escape  sequences,  which  are  converted  and
5389              copied  to  the standard output, and format specifications, each
5390              of which causes printing of the next  successive  argument.   In
5391              addition to the standard printf(1) format specifications, printf
5392              interprets the following extensions:
5393              %b     causes printf to expand backslash escape sequences in the
5394                     corresponding argument in the same way as echo -e.
5395              %q     causes  printf  to output the corresponding argument in a
5396                     format that can be reused as shell input.
5397              %Q     like %q, but applies any supplied precision to the  argu‐
5398                     ment before quoting it.
5399              %(datefmt)T
5400                     causes  printf  to  output the date-time string resulting
5401                     from using datefmt as a format  string  for  strftime(3).
5402                     The corresponding argument is an integer representing the
5403                     number of seconds since the epoch.  Two special  argument
5404                     values  may  be used: -1 represents the current time, and
5405                     -2 represents the time the shell was invoked.  If no  ar‐
5406                     gument is specified, conversion behaves as if -1 had been
5407                     given.  This is an exception to the usual  printf  behav‐
5408                     ior.
5409
5410              The %b, %q, and %T directives all use the field width and preci‐
5411              sion arguments from the format specification and write that many
5412              bytes from (or use that wide a field for) the expanded argument,
5413              which usually contains more characters than the original.
5414
5415              Arguments to non-string format specifiers are treated as C  con‐
5416              stants, except that a leading plus or minus sign is allowed, and
5417              if the leading character is a single or double quote, the  value
5418              is the ASCII value of the following character.
5419
5420              The  format  is  reused as necessary to consume all of the argu‐
5421              ments.  If the format requires more arguments than are supplied,
5422              the  extra  format  specifications  behave as if a zero value or
5423              null string, as appropriate,  had  been  supplied.   The  return
5424              value is zero on success, non-zero on failure.
5425
5426       pushd [-n] [+n] [-n]
5427       pushd [-n] [dir]
5428              Adds  a  directory to the top of the directory stack, or rotates
5429              the stack, making the new top of the stack the  current  working
5430              directory.   With no arguments, pushd exchanges the top two ele‐
5431              ments of the directory stack.  Arguments, if supplied, have  the
5432              following meanings:
5433              -n     Suppresses  the  normal change of directory when rotating
5434                     or adding directories to the  stack,  so  that  only  the
5435                     stack is manipulated.
5436              +n     Rotates  the  stack  so  that the nth directory (counting
5437                     from the left of the list shown by  dirs,  starting  with
5438                     zero) is at the top.
5439              -n     Rotates  the  stack  so  that the nth directory (counting
5440                     from the right of the list shown by dirs,  starting  with
5441                     zero) is at the top.
5442              dir    Adds dir to the directory stack at the top
5443
5444              After the stack has been modified, if the -n option was not sup‐
5445              plied, pushd uses the cd builtin to change to the  directory  at
5446              the top of the stack.  If the cd fails, pushd returns a non-zero
5447              value.
5448
5449              Otherwise, if no arguments are supplied, pushd returns 0  unless
5450              the  directory  stack  is  empty.   When  rotating the directory
5451              stack, pushd returns 0 unless the directory stack is empty or  a
5452              non-existent directory stack element is specified.
5453
5454              If  the  pushd command is successful, bash runs dirs to show the
5455              final contents of the directory stack.
5456
5457       pwd [-LP]
5458              Print the absolute pathname of the  current  working  directory.
5459              The pathname printed contains no symbolic links if the -P option
5460              is supplied or the -o physical option to the set builtin command
5461              is  enabled.  If the -L option is used, the pathname printed may
5462              contain symbolic links.  The return status is 0 unless an  error
5463              occurs while reading the name of the current directory or an in‐
5464              valid option is supplied.
5465
5466       read [-ers] [-a aname] [-d delim] [-i text] [-n nchars] [-N nchars] [-p
5467       prompt] [-t timeout] [-u fd] [name ...]
5468              One  line  is read from the standard input, or from the file de‐
5469              scriptor fd supplied as an argument to the -u option, split into
5470              words  as  described  above  under Word Splitting, and the first
5471              word is assigned to the first name, the second word to the  sec‐
5472              ond  name,  and  so on.  If there are more words than names, the
5473              remaining words and their intervening delimiters are assigned to
5474              the  last  name.   If  there are fewer words read from the input
5475              stream than names, the remaining names are assigned  empty  val‐
5476              ues.   The  characters  in  IFS  are used to split the line into
5477              words using the same rules the shell  uses  for  expansion  (de‐
5478              scribed  above  under  Word Splitting).  The backslash character
5479              (\) may be used to remove any special meaning for the next char‐
5480              acter  read  and  for  line continuation.  Options, if supplied,
5481              have the following meanings:
5482              -a aname
5483                     The words are assigned to sequential indices of the array
5484                     variable aname, starting at 0.  aname is unset before any
5485                     new values are assigned.  Other name  arguments  are  ig‐
5486                     nored.
5487              -d delim
5488                     The first character of delim is used to terminate the in‐
5489                     put line, rather than newline.  If  delim  is  the  empty
5490                     string,  read  will  terminate a line when it reads a NUL
5491                     character.
5492              -e     If the standard input is coming from a terminal, readline
5493                     (see  READLINE  above) is used to obtain the line.  Read‐
5494                     line uses the current (or default, if  line  editing  was
5495                     not  previously  active) editing settings, but uses read‐
5496                     line's default filename completion.
5497              -i text
5498                     If readline is being used  to  read  the  line,  text  is
5499                     placed into the editing buffer before editing begins.
5500              -n nchars
5501                     read  returns after reading nchars characters rather than
5502                     waiting for a complete line of input, but honors a delim‐
5503                     iter  if fewer than nchars characters are read before the
5504                     delimiter.
5505              -N nchars
5506                     read returns  after  reading  exactly  nchars  characters
5507                     rather  than waiting for a complete line of input, unless
5508                     EOF is encountered or read times out.  Delimiter  charac‐
5509                     ters  encountered  in the input are not treated specially
5510                     and do not cause read to return until  nchars  characters
5511                     are  read.   The result is not split on the characters in
5512                     IFS; the intent is that the variable is assigned  exactly
5513                     the characters read (with the exception of backslash; see
5514                     the -r option below).
5515              -p prompt
5516                     Display prompt on standard error, without a trailing new‐
5517                     line, before attempting to read any input.  The prompt is
5518                     displayed only if input is coming from a terminal.
5519              -r     Backslash does not act as an escape character.  The back‐
5520                     slash  is considered to be part of the line.  In particu‐
5521                     lar, a backslash-newline pair may not then be used  as  a
5522                     line continuation.
5523              -s     Silent mode.  If input is coming from a terminal, charac‐
5524                     ters are not echoed.
5525              -t timeout
5526                     Cause read to time out and return failure if  a  complete
5527                     line  of  input  (or a specified number of characters) is
5528                     not read within timeout seconds.  timeout may be a  deci‐
5529                     mal  number with a fractional portion following the deci‐
5530                     mal point.  This option is  only  effective  if  read  is
5531                     reading  input  from  a  terminal, pipe, or other special
5532                     file; it has no effect when reading from  regular  files.
5533                     If read times out, read saves any partial input read into
5534                     the specified variable name.  If timeout is 0,  read  re‐
5535                     turns  immediately, without trying to read any data.  The
5536                     exit status is 0 if input is available on  the  specified
5537                     file  descriptor,  or  the read will return EOF, non-zero
5538                     otherwise.  The exit status is greater than  128  if  the
5539                     timeout is exceeded.
5540              -u fd  Read input from file descriptor fd.
5541
5542              If  no names are supplied, the line read, without the ending de‐
5543              limiter but otherwise unmodified, is assigned  to  the  variable
5544              REPLY.   The  exit status is zero, unless end-of-file is encoun‐
5545              tered, read times out (in which case the status is greater  than
5546              128),  a variable assignment error (such as assigning to a read‐
5547              only variable) occurs, or an invalid file descriptor is supplied
5548              as the argument to -u.
5549
5550       readonly [-aAf] [-p] [name[=word] ...]
5551              The  given  names are marked readonly; the values of these names
5552              may not be changed by subsequent assignment.  If the  -f  option
5553              is  supplied,  the  functions  corresponding to the names are so
5554              marked.  The -a option restricts the variables  to  indexed  ar‐
5555              rays;  the  -A option restricts the variables to associative ar‐
5556              rays.  If both options are supplied, -A takes precedence.  If no
5557              name  arguments  are  given,  or if the -p option is supplied, a
5558              list of all readonly names is printed.  The other options may be
5559              used  to  restrict the output to a subset of the set of readonly
5560              names.  The -p option causes output to be displayed in a  format
5561              that  may be reused as input.  If a variable name is followed by
5562              =word, the value of the variable is set  to  word.   The  return
5563              status  is 0 unless an invalid option is encountered, one of the
5564              names is not a valid shell variable name, or -f is supplied with
5565              a name that is not a function.
5566
5567       return [n]
5568              Causes  a function to stop executing and return the value speci‐
5569              fied by n to its caller.  If n is omitted, the return status  is
5570              that  of the last command executed in the function body.  If re‐
5571              turn is executed by a trap handler, the last command used to de‐
5572              termine  the status is the last command executed before the trap
5573              handler.  If return is executed during a DEBUG  trap,  the  last
5574              command  used  to  determine the status is the last command exe‐
5575              cuted by the trap handler before return was invoked.  If  return
5576              is  used outside a function, but during execution of a script by
5577              the .  (source) command, it causes the shell to  stop  executing
5578              that  script  and return either n or the exit status of the last
5579              command executed within the script as the  exit  status  of  the
5580              script.  If n is supplied, the return value is its least signif‐
5581              icant 8 bits.  The return status is non-zero if return  is  sup‐
5582              plied  a non-numeric argument, or is used outside a function and
5583              not during execution of a script by . or  source.   Any  command
5584              associated with the RETURN trap is executed before execution re‐
5585              sumes after the function or script.
5586
5587       set [-abefhkmnptuvxBCEHPT] [-o option-name] [--] [-] [arg ...]
5588       set [+abefhkmnptuvxBCEHPT] [+o option-name] [--] [-] [arg ...]
5589              Without options, display the name and value of each shell  vari‐
5590              able  in a format that can be reused as input for setting or re‐
5591              setting the currently-set variables.  Read-only variables cannot
5592              be  reset.  In posix mode, only shell variables are listed.  The
5593              output is sorted according to the current locale.  When  options
5594              are  specified,  they  set or unset shell attributes.  Any argu‐
5595              ments remaining after option processing are  treated  as  values
5596              for the positional parameters and are assigned, in order, to $1,
5597              $2, ...  $n.  Options, if specified, have  the  following  mean‐
5598              ings:
5599              -a      Each variable or function that is created or modified is
5600                      given the export attribute and marked for export to  the
5601                      environment of subsequent commands.
5602              -b      Report  the status of terminated background jobs immedi‐
5603                      ately, rather than before the next primary prompt.  This
5604                      is effective only when job control is enabled.
5605              -e      Exit  immediately  if a pipeline (which may consist of a
5606                      single simple command), a list, or  a  compound  command
5607                      (see SHELL GRAMMAR above), exits with a non-zero status.
5608                      The shell does not exit if the  command  that  fails  is
5609                      part  of  the command list immediately following a while
5610                      or until keyword, part of the test following the  if  or
5611                      elif  reserved  words, part of any command executed in a
5612                      && or || list except the command following the final  &&
5613                      or ||, any command in a pipeline but the last, or if the
5614                      command's return value is being inverted with !.   If  a
5615                      compound  command  other  than a subshell returns a non-
5616                      zero status because a command failed while -e was  being
5617                      ignored,  the  shell  does  not exit.  A trap on ERR, if
5618                      set, is executed before the shell  exits.   This  option
5619                      applies to the shell environment and each subshell envi‐
5620                      ronment separately (see  COMMAND  EXECUTION  ENVIRONMENT
5621                      above), and may cause subshells to exit before executing
5622                      all the commands in the subshell.
5623
5624                      If a compound command or shell function  executes  in  a
5625                      context  where -e is being ignored, none of the commands
5626                      executed within the compound command  or  function  body
5627                      will  be  affected  by the -e setting, even if -e is set
5628                      and a command returns a failure status.  If  a  compound
5629                      command  or  shell function sets -e while executing in a
5630                      context where -e is ignored, that setting will not  have
5631                      any  effect  until  the  compound command or the command
5632                      containing the function call completes.
5633              -f      Disable pathname expansion.
5634              -h      Remember the location of commands as they are looked  up
5635                      for execution.  This is enabled by default.
5636              -k      All  arguments  in the form of assignment statements are
5637                      placed in the environment for a command, not just  those
5638                      that precede the command name.
5639              -m      Monitor  mode.   Job control is enabled.  This option is
5640                      on by default for interactive  shells  on  systems  that
5641                      support  it  (see JOB CONTROL above).  All processes run
5642                      in a separate process group.  When a background job com‐
5643                      pletes, the shell prints a line containing its exit sta‐
5644                      tus.
5645              -n      Read commands but do not execute them.  This may be used
5646                      to  check a shell script for syntax errors.  This is ig‐
5647                      nored by interactive shells.
5648              -o option-name
5649                      The option-name can be one of the following:
5650                      allexport
5651                              Same as -a.
5652                      braceexpand
5653                              Same as -B.
5654                      emacs   Use an emacs-style command line  editing  inter‐
5655                              face.  This is enabled by default when the shell
5656                              is interactive, unless the shell is started with
5657                              the  --noediting  option.  This also affects the
5658                              editing interface used for read -e.
5659                      errexit Same as -e.
5660                      errtrace
5661                              Same as -E.
5662                      functrace
5663                              Same as -T.
5664                      hashall Same as -h.
5665                      histexpand
5666                              Same as -H.
5667                      history Enable command history, as described above under
5668                              HISTORY.  This option is on by default in inter‐
5669                              active shells.
5670                      ignoreeof
5671                              The effect is as  if  the  shell  command  ``IG‐
5672                              NOREEOF=10''  had been executed (see Shell Vari‐
5673                              ables above).
5674                      keyword Same as -k.
5675                      monitor Same as -m.
5676                      noclobber
5677                              Same as -C.
5678                      noexec  Same as -n.
5679                      noglob  Same as -f.
5680                      nolog   Currently ignored.
5681                      notify  Same as -b.
5682                      nounset Same as -u.
5683                      onecmd  Same as -t.
5684                      physical
5685                              Same as -P.
5686                      pipefail
5687                              If set, the return value of a  pipeline  is  the
5688                              value  of  the  last (rightmost) command to exit
5689                              with a non-zero status, or zero if all  commands
5690                              in  the pipeline exit successfully.  This option
5691                              is disabled by default.
5692                      posix   Change the behavior of bash  where  the  default
5693                              operation  differs  from  the  POSIX standard to
5694                              match the standard (posix mode).  See  SEE  ALSO
5695                              below for a reference to a document that details
5696                              how posix mode affects bash's behavior.
5697                      privileged
5698                              Same as -p.
5699                      verbose Same as -v.
5700                      vi      Use a vi-style command line  editing  interface.
5701                              This also affects the editing interface used for
5702                              read -e.
5703                      xtrace  Same as -x.
5704                      If -o is supplied with no option-name, the values of the
5705                      current  options are printed.  If +o is supplied with no
5706                      option-name, a series of set commands  to  recreate  the
5707                      current  option  settings  is  displayed on the standard
5708                      output.
5709              -p      Turn on privileged mode.  In this  mode,  the  $ENV  and
5710                      $BASH_ENV  files  are not processed, shell functions are
5711                      not inherited from the environment, and  the  SHELLOPTS,
5712                      BASHOPTS,  CDPATH, and GLOBIGNORE variables, if they ap‐
5713                      pear in the environment, are ignored.  If the  shell  is
5714                      started  with the effective user (group) id not equal to
5715                      the real user (group) id, and the -p option is not  sup‐
5716                      plied, these actions are taken and the effective user id
5717                      is set to the real user id.  If the -p  option  is  sup‐
5718                      plied  at  startup,  the effective user id is not reset.
5719                      Turning this option off causes the  effective  user  and
5720                      group ids to be set to the real user and group ids.
5721              -r      Enable restricted shell mode.  This option cannot be un‐
5722                      set once it has been set.
5723              -t      Exit after reading and executing one command.
5724              -u      Treat unset variables and parameters other than the spe‐
5725                      cial  parameters  "@"  and  "*", or array variables sub‐
5726                      scripted with "@" or "*", as an  error  when  performing
5727                      parameter  expansion.   If  expansion is attempted on an
5728                      unset variable or parameter, the shell prints  an  error
5729                      message,  and, if not interactive, exits with a non-zero
5730                      status.
5731              -v      Print shell input lines as they are read.
5732              -x      After expanding each simple command, for  command,  case
5733                      command, select command, or arithmetic for command, dis‐
5734                      play the expanded value of PS4, followed by the  command
5735                      and its expanded arguments or associated word list.
5736              -B      The  shell performs brace expansion (see Brace Expansion
5737                      above).  This is on by default.
5738              -C      If set, bash does not overwrite an  existing  file  with
5739                      the  >,  >&,  and <> redirection operators.  This may be
5740                      overridden when creating output files by using the redi‐
5741                      rection operator >| instead of >.
5742              -E      If set, any trap on ERR is inherited by shell functions,
5743                      command substitutions, and commands executed in  a  sub‐
5744                      shell  environment.  The ERR trap is normally not inher‐
5745                      ited in such cases.
5746              -H      Enable !  style history substitution.  This option is on
5747                      by default when the shell is interactive.
5748              -P      If  set,  the shell does not resolve symbolic links when
5749                      executing commands such as cd that  change  the  current
5750                      working  directory.   It  uses  the  physical  directory
5751                      structure instead.  By default, bash follows the logical
5752                      chain  of  directories  when  performing  commands which
5753                      change the current directory.
5754              -T      If set, any traps on DEBUG and RETURN are  inherited  by
5755                      shell functions, command substitutions, and commands ex‐
5756                      ecuted in a subshell environment.  The DEBUG and  RETURN
5757                      traps are normally not inherited in such cases.
5758              --      If  no arguments follow this option, then the positional
5759                      parameters are unset.  Otherwise, the positional parame‐
5760                      ters  are  set  to  the args, even if some of them begin
5761                      with a -.
5762              -       Signal the end of options, cause all remaining  args  to
5763                      be assigned to the positional parameters.  The -x and -v
5764                      options are turned off.  If there are no args, the posi‐
5765                      tional parameters remain unchanged.
5766
5767              The  options are off by default unless otherwise noted.  Using +
5768              rather than - causes these options to be turned  off.   The  op‐
5769              tions can also be specified as arguments to an invocation of the
5770              shell.  The current set of options may be found in $-.  The  re‐
5771              turn  status  is always true unless an invalid option is encoun‐
5772              tered.
5773
5774       shift [n]
5775              The positional parameters from n+1 ... are renamed  to  $1  ....
5776              Parameters  represented by the numbers $# down to $#-n+1 are un‐
5777              set.  n must be a non-negative number less than or equal to  $#.
5778              If  n is 0, no parameters are changed.  If n is not given, it is
5779              assumed to be 1.  If n is greater than $#, the positional param‐
5780              eters  are  not changed.  The return status is greater than zero
5781              if n is greater than $# or less than zero; otherwise 0.
5782
5783       shopt [-pqsu] [-o] [optname ...]
5784              Toggle the values of settings controlling optional shell  behav‐
5785              ior.   The settings can be either those listed below, or, if the
5786              -o option is used, those available with the -o option to the set
5787              builtin command.  With no options, or with the -p option, a list
5788              of all settable options is  displayed,  with  an  indication  of
5789              whether or not each is set; if optnames are supplied, the output
5790              is restricted to those options.  The -p option causes output  to
5791              be  displayed  in a form that may be reused as input.  Other op‐
5792              tions have the following meanings:
5793              -s     Enable (set) each optname.
5794              -u     Disable (unset) each optname.
5795              -q     Suppresses normal output (quiet mode); the return  status
5796                     indicates whether the optname is set or unset.  If multi‐
5797                     ple optname arguments are given with -q, the return  sta‐
5798                     tus  is zero if all optnames are enabled; non-zero other‐
5799                     wise.
5800              -o     Restricts the values of optname to be those  defined  for
5801                     the -o option to the set builtin.
5802
5803              If  either  -s  or  -u  is used with no optname arguments, shopt
5804              shows only those options which are set or  unset,  respectively.
5805              Unless  otherwise  noted, the shopt options are disabled (unset)
5806              by default.
5807
5808              The return status when listing options is zero if  all  optnames
5809              are  enabled, non-zero otherwise.  When setting or unsetting op‐
5810              tions, the return status is zero unless  an  optname  is  not  a
5811              valid shell option.
5812
5813              The list of shopt options is:
5814
5815              assoc_expand_once
5816                      If  set, the shell suppresses multiple evaluation of as‐
5817                      sociative array subscripts during arithmetic  expression
5818                      evaluation,  while  executing  builtins that can perform
5819                      variable assignments, and while executing builtins  that
5820                      perform array dereferencing.
5821              autocd  If  set,  a command name that is the name of a directory
5822                      is executed as if it were the argument to  the  cd  com‐
5823                      mand.  This option is only used by interactive shells.
5824              cdable_vars
5825                      If  set,  an  argument to the cd builtin command that is
5826                      not a directory is assumed to be the name of a  variable
5827                      whose value is the directory to change to.
5828              cdspell If set, minor errors in the spelling of a directory com‐
5829                      ponent in a cd command will be  corrected.   The  errors
5830                      checked for are transposed characters, a missing charac‐
5831                      ter, and one character too many.   If  a  correction  is
5832                      found,  the  corrected filename is printed, and the com‐
5833                      mand proceeds.  This option is only used by  interactive
5834                      shells.
5835              checkhash
5836                      If set, bash checks that a command found in the hash ta‐
5837                      ble exists before trying to execute  it.   If  a  hashed
5838                      command  no  longer exists, a normal path search is per‐
5839                      formed.
5840              checkjobs
5841                      If set, bash lists the status of any stopped and running
5842                      jobs  before  exiting an interactive shell.  If any jobs
5843                      are running, this causes the exit to be deferred until a
5844                      second  exit is attempted without an intervening command
5845                      (see JOB CONTROL above).  The shell always postpones ex‐
5846                      iting if any jobs are stopped.
5847              checkwinsize
5848                      If  set, bash checks the window size after each external
5849                      (non-builtin) command and,  if  necessary,  updates  the
5850                      values  of LINES and COLUMNS.  This option is enabled by
5851                      default.
5852              cmdhist If set, bash attempts to save all lines of  a  multiple-
5853                      line  command  in  the  same history entry.  This allows
5854                      easy re-editing of multi-line commands.  This option  is
5855                      enabled  by  default,  but only has an effect if command
5856                      history is enabled, as described above under HISTORY.
5857              compat31
5858              compat32
5859              compat40
5860              compat41
5861              compat42
5862              compat43
5863              compat44
5864              compat50
5865                      These control aspects of the shell's compatibility  mode
5866                      (see SHELL COMPATIBILITY MODE below).
5867
5868              complete_fullquote
5869                      If  set,  bash  quotes all shell metacharacters in file‐
5870                      names and directory names  when  performing  completion.
5871                      If not set, bash removes metacharacters such as the dol‐
5872                      lar sign from the set of characters that will be  quoted
5873                      in  completed filenames when these metacharacters appear
5874                      in shell variable references in words to  be  completed.
5875                      This  means that dollar signs in variable names that ex‐
5876                      pand to directories will not  be  quoted;  however,  any
5877                      dollar  signs appearing in filenames will not be quoted,
5878                      either.  This is active only when bash  is  using  back‐
5879                      slashes  to quote completed filenames.  This variable is
5880                      set by default, which is the default  bash  behavior  in
5881                      versions through 4.2.
5882
5883              direxpand
5884                      If  set,  bash replaces directory names with the results
5885                      of word expansion when performing  filename  completion.
5886                      This  changes  the contents of the readline editing buf‐
5887                      fer.  If not set, bash attempts  to  preserve  what  the
5888                      user typed.
5889
5890              dirspell
5891                      If  set,  bash attempts spelling correction on directory
5892                      names during word completion if the directory name  ini‐
5893                      tially supplied does not exist.
5894
5895              dotglob If  set, bash includes filenames beginning with a `.' in
5896                      the results of pathname expansion.  The filenames  ``.''
5897                      and  ``..''   must always be matched explicitly, even if
5898                      dotglob is set.
5899
5900              execfail
5901                      If set, a non-interactive shell will not exit if it can‐
5902                      not  execute  the  file  specified as an argument to the
5903                      exec builtin command.  An  interactive  shell  does  not
5904                      exit if exec fails.
5905
5906              expand_aliases
5907                      If  set,  aliases  are expanded as described above under
5908                      ALIASES.  This option is enabled by default for interac‐
5909                      tive shells.
5910
5911              extdebug
5912                      If  set at shell invocation, or in a shell startup file,
5913                      arrange to execute the debugger profile before the shell
5914                      starts,  identical to the --debugger option.  If set af‐
5915                      ter invocation, behavior intended for use  by  debuggers
5916                      is enabled:
5917
5918                      1.     The -F option to the declare builtin displays the
5919                             source file name and line number corresponding to
5920                             each function name supplied as an argument.
5921
5922                      2.     If  the  command  run by the DEBUG trap returns a
5923                             non-zero value, the next command is  skipped  and
5924                             not executed.
5925
5926                      3.     If  the  command  run by the DEBUG trap returns a
5927                             value of 2, and the shell is executing in a  sub‐
5928                             routine  (a shell function or a shell script exe‐
5929                             cuted by the . or  source  builtins),  the  shell
5930                             simulates a call to return.
5931
5932                      4.     BASH_ARGC  and BASH_ARGV are updated as described
5933                             in their descriptions above).
5934
5935                      5.     Function tracing is  enabled:  command  substitu‐
5936                             tion, shell functions, and subshells invoked with
5937                             ( command ) inherit the DEBUG and RETURN traps.
5938
5939                      6.     Error tracing is enabled:  command  substitution,
5940                             shell  functions,  and  subshells  invoked with (
5941                             command ) inherit the ERR trap.
5942
5943              extglob If set, the extended pattern matching features described
5944                      above under Pathname Expansion are enabled.
5945
5946              extquote
5947                      If  set,  $'string'  and  $"string" quoting is performed
5948                      within  ${parameter}  expansions  enclosed   in   double
5949                      quotes.  This option is enabled by default.
5950
5951              failglob
5952                      If  set,  patterns  which fail to match filenames during
5953                      pathname expansion result in an expansion error.
5954
5955              force_fignore
5956                      If set, the suffixes  specified  by  the  FIGNORE  shell
5957                      variable  cause words to be ignored when performing word
5958                      completion even if the ignored words are the only possi‐
5959                      ble  completions.   See  SHELL VARIABLES above for a de‐
5960                      scription of FIGNORE.  This option  is  enabled  by  de‐
5961                      fault.
5962
5963              globasciiranges
5964                      If  set,  range  expressions  used  in  pattern matching
5965                      bracket expressions (see Pattern Matching above)  behave
5966                      as  if  in the traditional C locale when performing com‐
5967                      parisons.  That is, the current locale's  collating  se‐
5968                      quence  is not taken into account, so b will not collate
5969                      between A and B, and  upper-case  and  lower-case  ASCII
5970                      characters will collate together.
5971
5972              globskipdots
5973                      If  set,  pathname  expansion will never match the file‐
5974                      names ``.''  and ``..'', even if the pattern begins with
5975                      a ``.''.  This option is enabled by default.
5976
5977              globstar
5978                      If set, the pattern ** used in a pathname expansion con‐
5979                      text will match all files and zero or  more  directories
5980                      and  subdirectories.  If the pattern is followed by a /,
5981                      only directories and subdirectories match.
5982
5983              gnu_errfmt
5984                      If set, shell error messages are written in the standard
5985                      GNU error message format.
5986
5987              histappend
5988                      If  set,  the history list is appended to the file named
5989                      by the value of the HISTFILE variable when the shell ex‐
5990                      its, rather than overwriting the file.
5991
5992              histreedit
5993                      If  set, and readline is being used, a user is given the
5994                      opportunity to re-edit a failed history substitution.
5995
5996              histverify
5997                      If set, and readline is being used, the results of  his‐
5998                      tory  substitution  are  not  immediately  passed to the
5999                      shell parser.  Instead, the  resulting  line  is  loaded
6000                      into the readline editing buffer, allowing further modi‐
6001                      fication.
6002
6003              hostcomplete
6004                      If set, and readline is being used, bash will attempt to
6005                      perform  hostname  completion when a word containing a @
6006                      is  being  completed  (see  Completing  under   READLINE
6007                      above).  This is enabled by default.
6008
6009              huponexit
6010                      If set, bash will send SIGHUP to all jobs when an inter‐
6011                      active login shell exits.
6012
6013              inherit_errexit
6014                      If set, command substitution inherits the value  of  the
6015                      errexit  option, instead of unsetting it in the subshell
6016                      environment.  This option is enabled when posix mode  is
6017                      enabled.
6018
6019              interactive_comments
6020                      If set, allow a word beginning with # to cause that word
6021                      and all remaining characters on that line to be  ignored
6022                      in  an interactive shell (see COMMENTS above).  This op‐
6023                      tion is enabled by default.
6024
6025              lastpipe
6026                      If set, and job control is not active,  the  shell  runs
6027                      the last command of a pipeline not executed in the back‐
6028                      ground in the current shell environment.
6029
6030              lithist If set, and the cmdhist option  is  enabled,  multi-line
6031                      commands are saved to the history with embedded newlines
6032                      rather than using semicolon separators where possible.
6033
6034              localvar_inherit
6035                      If set, local variables inherit the value and attributes
6036                      of a variable of the same name that exists at a previous
6037                      scope before any new value is assigned.  The nameref at‐
6038                      tribute is not inherited.
6039
6040              localvar_unset
6041                      If  set,  calling  unset  on local variables in previous
6042                      function scopes marks them so  subsequent  lookups  find
6043                      them  unset until that function returns. This is identi‐
6044                      cal to the behavior of unsetting local variables at  the
6045                      current function scope.
6046
6047              login_shell
6048                      The  shell  sets this option if it is started as a login
6049                      shell (see INVOCATION above).   The  value  may  not  be
6050                      changed.
6051
6052              mailwarn
6053                      If  set,  and  a file that bash is checking for mail has
6054                      been accessed since the last time it  was  checked,  the
6055                      message  ``The  mail in mailfile has been read'' is dis‐
6056                      played.
6057
6058              no_empty_cmd_completion
6059                      If set, and readline is being used, bash  will  not  at‐
6060                      tempt  to  search the PATH for possible completions when
6061                      completion is attempted on an empty line.
6062
6063              nocaseglob
6064                      If set, bash matches  filenames  in  a  case-insensitive
6065                      fashion when performing pathname expansion (see Pathname
6066                      Expansion above).
6067
6068              nocasematch
6069                      If set, bash  matches  patterns  in  a  case-insensitive
6070                      fashion when performing matching while executing case or
6071                      [[ conditional commands, when performing pattern substi‐
6072                      tution  word expansions, or when filtering possible com‐
6073                      pletions as part of programmable completion.
6074
6075              noexpand_translation
6076                      If set, bash encloses the translated results  of  $"..."
6077                      quoting  in  single quotes instead of double quotes.  If
6078                      the string is not translated, this has no effect.
6079
6080              nullglob
6081                      If set, bash allows patterns which match no  files  (see
6082                      Pathname  Expansion  above)  to expand to a null string,
6083                      rather than themselves.
6084
6085              patsub_replacement
6086                      If set, bash expands occurrences of & in the replacement
6087                      string  of  pattern  substitution to the text matched by
6088                      the pattern,  as  described  under  Parameter  Expansion
6089                      above.  This option is enabled by default.
6090
6091              progcomp
6092                      If set, the programmable completion facilities (see Pro‐
6093                      grammable Completion above) are enabled.  This option is
6094                      enabled by default.
6095
6096              progcomp_alias
6097                      If  set,  and  programmable  completion is enabled, bash
6098                      treats a command name that doesn't have any  completions
6099                      as  a possible alias and attempts alias expansion. If it
6100                      has an alias, bash attempts programmable completion  us‐
6101                      ing the command word resulting from the expanded alias.
6102
6103              promptvars
6104                      If set, prompt strings undergo parameter expansion, com‐
6105                      mand substitution, arithmetic expansion, and  quote  re‐
6106                      moval  after  being  expanded  as described in PROMPTING
6107                      above.  This option is enabled by default.
6108
6109              restricted_shell
6110                      The shell sets this option  if  it  is  started  in  re‐
6111                      stricted  mode  (see RESTRICTED SHELL below).  The value
6112                      may not be changed.  This is not reset when the  startup
6113                      files  are  executed, allowing the startup files to dis‐
6114                      cover whether or not a shell is restricted.
6115
6116              shift_verbose
6117                      If set, the shift builtin prints an error  message  when
6118                      the shift count exceeds the number of positional parame‐
6119                      ters.
6120
6121              sourcepath
6122                      If set, the . (source) builtin uses the value of PATH to
6123                      find  the  directory  containing the file supplied as an
6124                      argument.  This option is enabled by default.
6125
6126              varredir_close
6127                      If set, the shell automatically closes file  descriptors
6128                      assigned using the {varname} redirection syntax (see RE‐
6129                      DIRECTION above) instead of leaving them open  when  the
6130                      command completes.
6131
6132              syslog_history
6133                      If set, command history is logged to syslog.
6134
6135              xpg_echo
6136                      If  set,  the  echo builtin expands backslash-escape se‐
6137                      quences by default.
6138
6139       suspend [-f]
6140              Suspend the execution of this shell until it receives a  SIGCONT
6141              signal.   A login shell, or a shell without job control enabled,
6142              cannot be suspended; the -f option can be used to override  this
6143              and  force  the  suspension.   The return status is 0 unless the
6144              shell is a login shell or job control is not enabled and  -f  is
6145              not supplied.
6146
6147       test expr
6148       [ expr ]
6149              Return a status of 0 (true) or 1 (false) depending on the evalu‐
6150              ation of the conditional expression expr.  Each operator and op‐
6151              erand  must be a separate argument.  Expressions are composed of
6152              the primaries described  above  under  CONDITIONAL  EXPRESSIONS.
6153              test  does not accept any options, nor does it accept and ignore
6154              an argument of -- as signifying the end of options.
6155
6156              Expressions may  be  combined  using  the  following  operators,
6157              listed  in  decreasing  order of precedence.  The evaluation de‐
6158              pends on the number of arguments; see  below.   Operator  prece‐
6159              dence is used when there are five or more arguments.
6160              ! expr True if expr is false.
6161              ( expr )
6162                     Returns  the value of expr.  This may be used to override
6163                     the normal precedence of operators.
6164              expr1 -a expr2
6165                     True if both expr1 and expr2 are true.
6166              expr1 -o expr2
6167                     True if either expr1 or expr2 is true.
6168
6169              test and [ evaluate conditional expressions using a set of rules
6170              based on the number of arguments.
6171
6172              0 arguments
6173                     The expression is false.
6174              1 argument
6175                     The expression is true if and only if the argument is not
6176                     null.
6177              2 arguments
6178                     If the first argument is !, the expression is true if and
6179                     only  if the second argument is null.  If the first argu‐
6180                     ment is one of the  unary  conditional  operators  listed
6181                     above  under  CONDITIONAL  EXPRESSIONS, the expression is
6182                     true if the unary test is true.  If the first argument is
6183                     not a valid unary conditional operator, the expression is
6184                     false.
6185              3 arguments
6186                     The following conditions are applied in the order listed.
6187                     If  the  second argument is one of the binary conditional
6188                     operators listed above under CONDITIONAL EXPRESSIONS, the
6189                     result of the expression is the result of the binary test
6190                     using the first and third arguments as operands.  The  -a
6191                     and  -o  operators  are  considered binary operators when
6192                     there are three arguments.  If the first argument  is  !,
6193                     the  value is the negation of the two-argument test using
6194                     the second and third arguments.  If the first argument is
6195                     exactly ( and the third argument is exactly ), the result
6196                     is the one-argument test of the second argument.   Other‐
6197                     wise, the expression is false.
6198              4 arguments
6199                     The following conditions are applied in the order listed.
6200                     If the first argument is !, the result is the negation of
6201                     the  three-argument  expression composed of the remaining
6202                     arguments.  the two-argument test using  the  second  and
6203                     third  arguments.  If the first argument is exactly ( and
6204                     the fourth argument is exactly ), the result is the  two-
6205                     argument  test of the second and third arguments.  Other‐
6206                     wise, the expression is parsed and evaluated according to
6207                     precedence using the rules listed above.
6208              5 or more arguments
6209                     The  expression  is  parsed  and  evaluated  according to
6210                     precedence using the rules listed above.
6211
6212              When used with test or [, the < and  >  operators  sort  lexico‐
6213              graphically using ASCII ordering.
6214
6215       times  Print  the  accumulated  user and system times for the shell and
6216              for processes run from the shell.  The return status is 0.
6217
6218       trap [-lp] [[arg] sigspec ...]
6219              The command arg is to be read and executed when  the  shell  re‐
6220              ceives signal(s) sigspec.  If arg is absent (and there is a sin‐
6221              gle sigspec) or -, each specified signal is reset to its  origi‐
6222              nal  disposition  (the value it had upon entrance to the shell).
6223              If arg is the null string the signal specified by  each  sigspec
6224              is  ignored by the shell and by the commands it invokes.  If arg
6225              is not present and -p has been supplied, then the trap  commands
6226              associated with each sigspec are displayed.  If no arguments are
6227              supplied or if only -p is given, trap prints the  list  of  com‐
6228              mands  associated  with  each  signal.  The -l option causes the
6229              shell to print a list of signal names  and  their  corresponding
6230              numbers.   Each sigspec is either a signal name defined in <sig‐
6231              nal.h>, or a signal number.  Signal names are  case  insensitive
6232              and the SIG prefix is optional.
6233
6234              If  a  sigspec  is  EXIT (0) the command arg is executed on exit
6235              from the shell.  If a sigspec is DEBUG, the command arg is  exe‐
6236              cuted  before  every  simple command, for command, case command,
6237              select command, every arithmetic for  command,  and  before  the
6238              first  command  executes  in a shell function (see SHELL GRAMMAR
6239              above).  Refer to the description of the extdebug option to  the
6240              shopt builtin for details of its effect on the DEBUG trap.  If a
6241              sigspec is RETURN, the command arg is executed each time a shell
6242              function or a script executed with the . or source builtins fin‐
6243              ishes executing.
6244
6245              If a sigspec is ERR, the command  arg  is  executed  whenever  a
6246              pipeline (which may consist of a single simple command), a list,
6247              or a compound command returns a non-zero exit status, subject to
6248              the  following  conditions.  The ERR trap is not executed if the
6249              failed command is part of the command list immediately following
6250              a  while  or until keyword, part of the test in an if statement,
6251              part of a command executed in a && or || list except the command
6252              following  the final && or ||, any command in a pipeline but the
6253              last, or if the command's return value is being  inverted  using
6254              !.  These are the same conditions obeyed by the errexit (-e) op‐
6255              tion.
6256
6257              Signals ignored upon entry to the shell cannot be trapped, reset
6258              or listed.  Trapped signals that are not being ignored are reset
6259              to their original values in a subshell or  subshell  environment
6260              when  one is created.  The return status is false if any sigspec
6261              is invalid; otherwise trap returns true.
6262
6263       type [-aftpP] name [name ...]
6264              With no options, indicate how each name would be interpreted  if
6265              used as a command name.  If the -t option is used, type prints a
6266              string which is one of alias,  keyword,  function,  builtin,  or
6267              file  if  name  is  an  alias,  shell  reserved  word, function,
6268              builtin, or disk file, respectively.  If the name is not  found,
6269              then  nothing  is  printed,  and  an exit status of false is re‐
6270              turned.  If the -p option is used, type either returns the  name
6271              of  the  disk file that would be executed if name were specified
6272              as a command name, or nothing if ``type -t name'' would not  re‐
6273              turn  file.   The  -P option forces a PATH search for each name,
6274              even if ``type -t name'' would not return file.  If a command is
6275              hashed, -p and -P print the hashed value, which is not necessar‐
6276              ily the file that appears first in PATH.  If the  -a  option  is
6277              used,  type  prints all of the places that contain an executable
6278              named name.  This includes aliases and functions, if and only if
6279              the -p option is not also used.  The table of hashed commands is
6280              not consulted when using -a.  The  -f  option  suppresses  shell
6281              function lookup, as with the command builtin.  type returns true
6282              if all of the arguments are found, false if any are not found.
6283
6284       ulimit [-HS] -a
6285       ulimit [-HS] [-bcdefiklmnpqrstuvxPRT [limit]]
6286              Provides control over the resources available to the  shell  and
6287              to  processes started by it, on systems that allow such control.
6288              The -H and -S options specify that the hard or soft limit is set
6289              for  the  given resource.  A hard limit cannot be increased by a
6290              non-root user once it is set; a soft limit may be  increased  up
6291              to  the value of the hard limit.  If neither -H nor -S is speci‐
6292              fied, both the soft and hard limits are set.  The value of limit
6293              can be a number in the unit specified for the resource or one of
6294              the special values hard, soft, or unlimited, which stand for the
6295              current  hard  limit,  the current soft limit, and no limit, re‐
6296              spectively.  If limit is omitted, the current value of the  soft
6297              limit of the resource is printed, unless the -H option is given.
6298              When more than one resource is specified,  the  limit  name  and
6299              unit,  if  appropriate, are printed before the value.  Other op‐
6300              tions are interpreted as follows:
6301              -a     All current limits are reported; no limits are set
6302              -b     The maximum socket buffer size
6303              -c     The maximum size of core files created
6304              -d     The maximum size of a process's data segment
6305              -e     The maximum scheduling priority ("nice")
6306              -f     The maximum size of files written by the  shell  and  its
6307                     children
6308              -i     The maximum number of pending signals
6309              -k     The maximum number of kqueues that may be allocated
6310              -l     The maximum size that may be locked into memory
6311              -m     The  maximum resident set size (many systems do not honor
6312                     this limit)
6313              -n     The maximum number of open file descriptors (most systems
6314                     do not allow this value to be set)
6315              -p     The pipe size in 512-byte blocks (this may not be set)
6316              -q     The maximum number of bytes in POSIX message queues
6317              -r     The maximum real-time scheduling priority
6318              -s     The maximum stack size
6319              -t     The maximum amount of cpu time in seconds
6320              -u     The  maximum  number  of  processes available to a single
6321                     user
6322              -v     The maximum amount of virtual  memory  available  to  the
6323                     shell and, on some systems, to its children
6324              -x     The maximum number of file locks
6325              -P     The maximum number of pseudoterminals
6326              -R     The  maximum  time  a  real-time  process  can run before
6327                     blocking, in microseconds
6328              -T     The maximum number of threads
6329
6330              If limit is given, and the -a option is not used, limit  is  the
6331              new  value  of  the  specified resource.  If no option is given,
6332              then -f is assumed.  Values are in 1024-byte increments,  except
6333              for  -t,  which is in seconds; -R, which is in microseconds; -p,
6334              which is in units of 512-byte blocks; -P, -T, -b,  -k,  -n,  and
6335              -u,  which  are unscaled values; and, when in posix mode, -c and
6336              -f, which are in 512-byte increments.  The return  status  is  0
6337              unless  an  invalid  option or argument is supplied, or an error
6338              occurs while setting a new limit.  In POSIX Mode 512-byte blocks
6339              are used for the `-c' and `-f' options.
6340
6341       umask [-p] [-S] [mode]
6342              The user file-creation mask is set to mode.  If mode begins with
6343              a digit, it is interpreted as an octal number; otherwise  it  is
6344              interpreted  as a symbolic mode mask similar to that accepted by
6345              chmod(1).  If mode is omitted, the current value of the mask  is
6346              printed.   The  -S  option causes the mask to be printed in sym‐
6347              bolic form; the default output is an octal number.   If  the  -p
6348              option is supplied, and mode is omitted, the output is in a form
6349              that may be reused as input.  The return status is 0 if the mode
6350              was  successfully  changed  or if no mode argument was supplied,
6351              and false otherwise.
6352
6353       unalias [-a] [name ...]
6354              Remove each name from the list of defined  aliases.   If  -a  is
6355              supplied,  all  alias definitions are removed.  The return value
6356              is true unless a supplied name is not a defined alias.
6357
6358       unset [-fv] [-n] [name ...]
6359              For each name, remove the corresponding  variable  or  function.
6360              If the -v option is given, each name refers to a shell variable,
6361              and that variable is removed.  Read-only variables  may  not  be
6362              unset.   If  -f  is specified, each name refers to a shell func‐
6363              tion, and the function definition is removed.  If the -n  option
6364              is  supplied, and name is a variable with the nameref attribute,
6365              name will be unset rather than the variable it  references.   -n
6366              has  no  effect if the -f option is supplied.  If no options are
6367              supplied, each name refers to a variable; if there is  no  vari‐
6368              able  by that name, a function with that name, if any, is unset.
6369              Each unset variable or function is removed from the  environment
6370              passed   to   subsequent  commands.   If  any  of  BASH_ALIASES,
6371              BASH_ARGV0,  BASH_CMDS,  BASH_COMMAND,  BASH_SUBSHELL,  BASHPID,
6372              COMP_WORDBREAKS,  DIRSTACK,  EPOCHREALTIME,  EPOCHSECONDS, FUNC‐
6373              NAME, GROUPS, HISTCMD, LINENO, RANDOM, SECONDS, or  SRANDOM  are
6374              unset, they lose their special properties, even if they are sub‐
6375              sequently reset.  The exit status is true unless a name is read‐
6376              only or may not be unset.
6377
6378       wait [-fn] [-p varname] [id ...]
6379              Wait for each specified child process and return its termination
6380              status.  Each id may be a process ID or a job specification;  if
6381              a  job  spec  is given, all processes in that job's pipeline are
6382              waited for.  If id is not given,  wait  waits  for  all  running
6383              background  jobs  and the last-executed process substitution, if
6384              its process id is the same as $!, and the return status is zero.
6385              If  the  -n option is supplied, wait waits for a single job from
6386              the list of ids or, if no ids are supplied, any job, to complete
6387              and  returns its exit status.  If none of the supplied arguments
6388              is a child of the shell, or if no arguments are supplied and the
6389              shell  has no unwaited-for children, the exit status is 127.  If
6390              the -p option is supplied, the process or job identifier of  the
6391              job  for  which  the  exit status is returned is assigned to the
6392              variable varname named by the  option  argument.   The  variable
6393              will  be unset initially, before any assignment.  This is useful
6394              only when the -n option is supplied.  Supplying the  -f  option,
6395              when  job control is enabled, forces wait to wait for id to ter‐
6396              minate before returning its status, instead of returning when it
6397              changes  status.  If id specifies a non-existent process or job,
6398              the return status is 127.  If wait is interrupted by  a  signal,
6399              the  return  status will be greater than 128, as described under
6400              SIGNALS above.  Otherwise, the return status is the exit  status
6401              of the last process or job waited for.
6402

SHELL COMPATIBILITY MODE

6404       Bash-4.0  introduced the concept of a shell compatibility level, speci‐
6405       fied as a set of options to the shopt  builtin  (  compat31,  compat32,
6406       compat40,  compat41, and so on).  There is only one current compatibil‐
6407       ity level -- each option  is  mutually  exclusive.   The  compatibility
6408       level  is intended to allow users to select behavior from previous ver‐
6409       sions that is incompatible  with  newer  versions  while  they  migrate
6410       scripts  to  use  current  features and behavior. It's intended to be a
6411       temporary solution.
6412
6413       This section does not mention behavior that is standard for a  particu‐
6414       lar  version  (e.g., setting compat32 means that quoting the rhs of the
6415       regexp matching operator quotes special regexp characters in the  word,
6416       which is default behavior in bash-3.2 and subsequent versions).
6417
6418       If  a  user enables, say, compat32, it may affect the behavior of other
6419       compatibility levels up to  and  including  the  current  compatibility
6420       level.   The  idea  is  that each compatibility level controls behavior
6421       that changed in that version of bash, but that behavior may  have  been
6422       present  in  earlier versions.  For instance, the change to use locale-
6423       based comparisons with the [[ command came  in  bash-4.1,  and  earlier
6424       versions used ASCII-based comparisons, so enabling compat32 will enable
6425       ASCII-based comparisons as well.  That granularity may  not  be  suffi‐
6426       cient  for  all uses, and as a result users should employ compatibility
6427       levels carefully.  Read the documentation for a particular  feature  to
6428       find out the current behavior.
6429
6430       Bash-4.3  introduced  a new shell variable: BASH_COMPAT.  The value as‐
6431       signed to this variable (a decimal version number like 4.2, or an inte‐
6432       ger  corresponding to the compatNN option, like 42) determines the com‐
6433       patibility level.
6434
6435       Starting with bash-4.4, Bash has begun deprecating older  compatibility
6436       levels.   Eventually, the options will be removed in favor of BASH_COM‐
6437       PAT.
6438
6439       Bash-5.0 is the final version for which there  will  be  an  individual
6440       shopt  option for the previous version. Users should use BASH_COMPAT on
6441       bash-5.0 and later versions.
6442
6443       The following table describes the behavior changes controlled  by  each
6444       compatibility level setting.  The compatNN tag is used as shorthand for
6445       setting the compatibility level to NN using one of the following mecha‐
6446       nisms.   For versions prior to bash-5.0, the compatibility level may be
6447       set using the corresponding compatNN shopt option.   For  bash-4.3  and
6448       later  versions,  the  BASH_COMPAT variable is preferred, and it is re‐
6449       quired for bash-5.1 and later versions.
6450
6451       compat31
6452              •      quoting the rhs of the [[ command's regexp matching oper‐
6453                     ator (=~) has no special effect
6454
6455       compat32
6456              •      interrupting  a  command  list such as "a ; b ; c" causes
6457                     the execution  of  the  next  command  in  the  list  (in
6458                     bash-4.0  and later versions, the shell acts as if it re‐
6459                     ceived the interrupt, so interrupting one  command  in  a
6460                     list aborts the execution of the entire list)
6461
6462       compat40
6463              •      the  <  and > operators to the [[ command do not consider
6464                     the current locale when comparing strings; they use ASCII
6465                     ordering.  Bash versions prior to bash-4.1 use ASCII col‐
6466                     lation and strcmp(3); bash-4.1 and later use the  current
6467                     locale's collation sequence and strcoll(3).
6468
6469       compat41
6470              •      in  posix mode, time may be followed by options and still
6471                     be recognized as a reserved word (this is POSIX interpre‐
6472                     tation 267)
6473              •      in posix mode, the parser requires that an even number of
6474                     single quotes occur in the  word  portion  of  a  double-
6475                     quoted  parameter expansion and treats them specially, so
6476                     that characters within the single quotes  are  considered
6477                     quoted (this is POSIX interpretation 221)
6478
6479       compat42
6480              •      the replacement string in double-quoted pattern substitu‐
6481                     tion does not undergo quote removal, as it does  in  ver‐
6482                     sions after bash-4.2
6483              •      in  posix mode, single quotes are considered special when
6484                     expanding the word portion of a  double-quoted  parameter
6485                     expansion  and  can  be  used to quote a closing brace or
6486                     other special character (this is part of POSIX  interpre‐
6487                     tation  221);  in  later  versions, single quotes are not
6488                     special within double-quoted word expansions
6489
6490       compat43
6491              •      the shell does not print a warning message if an  attempt
6492                     is  made  to use a quoted compound assignment as an argu‐
6493                     ment to declare (e.g., declare  -a  foo='(1  2)').  Later
6494                     versions warn that this usage is deprecated
6495              •      word  expansion  errors  are  considered non-fatal errors
6496                     that cause the current command to  fail,  even  in  posix
6497                     mode  (the  default behavior is to make them fatal errors
6498                     that cause the shell to exit)
6499              •      when  executing  a  shell  function,   the   loop   state
6500                     (while/until/etc.)  is not reset, so break or continue in
6501                     that function will break or continue loops in the calling
6502                     context.  Bash-4.4 and later reset the loop state to pre‐
6503                     vent this
6504
6505       compat44
6506              •      the shell sets  up  the  values  used  by  BASH_ARGV  and
6507                     BASH_ARGC  so  they  can expand to the shell's positional
6508                     parameters even if extended debugging mode is not enabled
6509              •      a subshell inherits loops from  its  parent  context,  so
6510                     break  or  continue  will  cause  the  subshell  to exit.
6511                     Bash-5.0 and later reset the loop state  to  prevent  the
6512                     exit
6513              •      variable  assignments  preceding builtins like export and
6514                     readonly that set attributes continue to affect variables
6515                     with the same name in the calling environment even if the
6516                     shell is not in posix mode
6517
6518       compat50
6519              •      Bash-5.1 changed the way $RANDOM is generated  to  intro‐
6520                     duce slightly more randomness. If the shell compatibility
6521                     level is set to 50 or lower, it  reverts  to  the  method
6522                     from  bash-5.0 and previous versions, so seeding the ran‐
6523                     dom number generator by assigning a value to RANDOM  will
6524                     produce the same sequence as in bash-5.0
6525              •      If  the  command hash table is empty, bash versions prior
6526                     to bash-5.1 printed an informational message to that  ef‐
6527                     fect,  even  when  producing output that can be reused as
6528                     input. Bash-5.1 suppresses that message when the  -l  op‐
6529                     tion is supplied.
6530
6531       compat51
6532              •      The  unset  builtin  treats  attempts to unset array sub‐
6533                     scripts @ and * differently depending on whether the  ar‐
6534                     ray  is  indexed  or associative, and differently than in
6535                     previous versions.
6536

RESTRICTED SHELL

6538       If bash is started with the name rbash, or the -r option is supplied at
6539       invocation,  the  shell becomes restricted.  A restricted shell is used
6540       to set up an environment more controlled than the standard  shell.   It
6541       behaves  identically  to bash with the exception that the following are
6542       disallowed or not performed:
6543
6544       •      changing directories with cd
6545
6546       •      setting or unsetting the values of SHELL, PATH,  HISTFILE,  ENV,
6547              or BASH_ENV
6548
6549       •      specifying command names containing /
6550
6551       •      specifying  a  filename  containing  a / as an argument to the .
6552              builtin command
6553
6554       •      specifying a filename containing a slash as an argument  to  the
6555              history builtin command
6556
6557       •      specifying  a  filename containing a slash as an argument to the
6558              -p option to the hash builtin command
6559
6560       •      importing function definitions from  the  shell  environment  at
6561              startup
6562
6563       •      parsing  the  value  of  SHELLOPTS from the shell environment at
6564              startup
6565
6566       •      redirecting output using the >, >|, <>, >&, &>, and >> redirect‐
6567              ion operators
6568
6569       •      using the exec builtin command to replace the shell with another
6570              command
6571
6572       •      adding or deleting builtin commands with the -f and  -d  options
6573              to the enable builtin command
6574
6575       •      using  the  enable  builtin  command  to  enable  disabled shell
6576              builtins
6577
6578       •      specifying the -p option to the command builtin command
6579
6580       •      turning off  restricted  mode  with  set  +r  or  shopt  -u  re‐
6581              stricted_shell.
6582
6583       These restrictions are enforced after any startup files are read.
6584
6585       When a command that is found to be a shell script is executed (see COM‐
6586       MAND EXECUTION above), rbash turns off any restrictions  in  the  shell
6587       spawned to execute the script.
6588

SEE ALSO

6590       Bash Reference Manual, Brian Fox and Chet Ramey
6591       The Gnu Readline Library, Brian Fox and Chet Ramey
6592       The Gnu History Library, Brian Fox and Chet Ramey
6593       Portable  Operating  System  Interface (POSIX) Part 2: Shell and Utili‐
6594       ties, IEEE --
6595              http://pubs.opengroup.org/onlinepubs/9699919799/
6596       http://tiswww.case.edu/~chet/bash/POSIX -- a description of posix mode
6597       sh(1), ksh(1), csh(1)
6598       emacs(1), vi(1)
6599       readline(3)
6600

FILES

6602       /bin/bash
6603              The bash executable
6604       /etc/profile
6605              The systemwide initialization file, executed for login shells
6606       /etc/bash.bash_logout
6607              The systemwide login shell cleanup file, executed when  a  login
6608              shell exits
6609       ~/.bash_profile
6610              The personal initialization file, executed for login shells
6611       ~/.bashrc
6612              The individual per-interactive-shell startup file
6613       ~/.bash_logout
6614              The  individual  login shell cleanup file, executed when a login
6615              shell exits
6616       ~/.bash_history
6617              The default value of HISTFILE, the file in which bash saves  the
6618              command history
6619       ~/.inputrc
6620              Individual readline initialization file
6621

AUTHORS

6623       Brian Fox, Free Software Foundation
6624       bfox@gnu.org
6625
6626       Chet Ramey, Case Western Reserve University
6627       chet.ramey@case.edu
6628

BUG REPORTS

6630       If you find a bug in bash, you should report it.  But first, you should
6631       make sure that it really is a bug, and that it appears  in  the  latest
6632       version   of  bash.   The  latest  version  is  always  available  from
6633       ftp://ftp.gnu.org/pub/gnu/bash/          and          http://git.savan
6634       nah.gnu.org/cgit/bash.git/snapshot/bash-master.tar.gz.
6635
6636       Once  you  have  determined that a bug actually exists, use the bashbug
6637       command to submit a bug report.  If you have a fix, you are  encouraged
6638       to  mail that as well!  Suggestions and `philosophical' bug reports may
6639       be mailed  to  bug-bash@gnu.org  or  posted  to  the  Usenet  newsgroup
6640       gnu.bash.bug.
6641
6642       ALL bug reports should include:
6643
6644       The version number of bash
6645       The hardware and operating system
6646       The compiler used to compile
6647       A description of the bug behaviour
6648       A short script or `recipe' which exercises the bug
6649
6650       bashbug  inserts  the first three items automatically into the template
6651       it provides for filing a bug report.
6652
6653       Comments and bug reports concerning this manual page should be directed
6654       to chet.ramey@case.edu.
6655

BUGS

6657       It's too big and too slow.
6658
6659       There are some subtle differences between bash and traditional versions
6660       of sh, mostly because of the POSIX specification.
6661
6662       Aliases are confusing in some uses.
6663
6664       Shell builtin commands and functions are not stoppable/restartable.
6665
6666       Compound commands and command sequences of the form `a ; b ; c' are not
6667       handled  gracefully  when  process  suspension  is  attempted.   When a
6668       process is stopped, the shell immediately executes the next command  in
6669       the  sequence.   It  suffices to place the sequence of commands between
6670       parentheses to force it into a subshell, which  may  be  stopped  as  a
6671       unit.
6672
6673       Array variables may not (yet) be exported.
6674
6675       There may be only one active coprocess at a time.
6676
6677
6678
6679GNU Bash 5.2                   2022 September 19                       BASH(1)
Impressum