d1b64895c3c7b1b6a1fe114ad22f7ccdafcafb3b
[platform/upstream/bash.git] / doc / bash.html
1 <HTML><HEAD>
2 <TITLE>BASH(1) Manual Page</TITLE>
3 </HEAD>
4 <BODY><TABLE WIDTH=100%>
5 <TR>
6 <TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2010 December 28<TH ALIGN=RIGHT width=33%>BASH(1)
7 </TR>
8 </TABLE>
9 <BR><A HREF="#index">Index</A>
10 <HR>
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 <A NAME="lbAB">&nbsp;</A>
31 <H3>NAME</H3>
32
33 bash - GNU Bourne-Again SHell
34 <A NAME="lbAC">&nbsp;</A>
35 <H3>SYNOPSIS</H3>
36
37 <B>bash</B>
38
39 [options]
40 [file]
41 <A NAME="lbAD">&nbsp;</A>
42 <H3>COPYRIGHT</H3>
43
44
45 Bash is Copyright &#169; 1989-2010 by the Free Software Foundation, Inc.
46 <A NAME="lbAE">&nbsp;</A>
47 <H3>DESCRIPTION</H3>
48
49 <B>Bash</B>
50
51 is an <B>sh</B>-compatible command language interpreter that
52 executes commands read from the standard input or from a file.
53 <B>Bash</B>
54
55 also incorporates useful features from the <I>Korn</I> and <I>C</I>
56 shells (<B>ksh</B> and <B>csh</B>).
57 <P>
58
59 <B>Bash</B>
60
61 is intended to be a conformant implementation of the
62 Shell and Utilities portion of the IEEE POSIX specification
63 (IEEE Standard 1003.1).
64 <B>Bash</B>
65
66 can be configured to be POSIX-conformant by default.
67 <A NAME="lbAF">&nbsp;</A>
68 <H3>OPTIONS</H3>
69
70 All of the  single-character shell options documented in the
71 description of the <B>set</B> builtin command can be used as options
72 when the shell is invoked.
73 In addition, <B>bash</B>
74 interprets the following options when it is invoked:
75 <P>
76
77
78 <DL COMPACT>
79 <DT><B>-c</B><I> string</I>
80
81 <DD>
82 If the
83 <B>-c</B>
84
85 option is present, then commands are read from
86 <I>string</I>.
87
88 If there are arguments after the
89 <I>string</I>,
90
91 they are assigned to the positional parameters, starting with
92 <B>$0</B>.
93
94 <DT><B>-i</B>
95
96 <DD>
97 If the
98 <B>-i</B>
99
100 option is present, the shell is
101 <I>interactive</I>.
102
103 <DT><B>-l</B>
104
105 <DD>
106 Make
107 <B>bash</B>
108
109 act as if it had been invoked as a login shell (see
110 <FONT SIZE=-1><B>INVOCATION</B>
111
112 </FONT>
113 below).
114 <DT><B>-r</B>
115
116 <DD>
117 If the
118 <B>-r</B>
119
120 option is present, the shell becomes
121 <I>restricted</I>
122
123 (see
124 <FONT SIZE=-1><B>RESTRICTED SHELL</B>
125
126 </FONT>
127 below).
128 <DT><B>-s</B>
129
130 <DD>
131 If the
132 <B>-s</B>
133
134 option is present, or if no arguments remain after option
135 processing, then commands are read from the standard input.
136 This option allows the positional parameters to be set
137 when invoking an interactive shell.
138 <DT><B>-D</B>
139
140 <DD>
141 A list of all double-quoted strings preceded by <B>$</B>
142 is printed on the standard output.
143 These are the strings that
144 are subject to language translation when the current locale
145 is not <B>C</B> or <B>POSIX</B>.
146 This implies the <B>-n</B> option; no commands will be executed.
147 <DT><B>[-+]O [</B><I>shopt_option</I>]
148
149 <DD>
150 <I>shopt_option</I> is one of the shell options accepted by the
151 <B>shopt</B> builtin (see
152 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
153
154 </FONT>
155 below).
156 If <I>shopt_option</I> is present, <B>-O</B> sets the value of that option;
157 <B>+O</B> unsets it.
158 If <I>shopt_option</I> is not supplied, the names and values of the shell
159 options accepted by <B>shopt</B> are printed on the standard output.
160 If the invocation option is <B>+O</B>, the output is displayed in a format
161 that may be reused as input.
162 <DT><B>--</B>
163
164 <DD>
165 A
166 <B>--</B>
167
168 signals the end of options and disables further option processing.
169 Any arguments after the
170 <B>--</B>
171
172 are treated as filenames and arguments.  An argument of
173 <B>-</B>
174
175 is equivalent to <B>--</B>.
176
177 </DL>
178 <P>
179
180 <B>Bash</B>
181
182 also interprets a number of multi-character options.
183 These options must appear on the command line before the
184 single-character options to be recognized.
185 <P>
186
187
188 <DL COMPACT>
189 <DT><B>--debugger</B>
190
191 <DD>
192 Arrange for the debugger profile to be executed before the shell
193 starts.
194 Turns on extended debugging mode (see the description of the
195 <B>extdebug</B>
196
197 option to the
198 <B>shopt</B>
199
200 builtin below).
201 <DT><B>--dump-po-strings</B>
202
203 <DD>
204 Equivalent to <B>-D</B>, but the output is in the GNU <I>gettext</I>
205 <B>po</B> (portable object) file format.
206 <DT><B>--dump-strings</B>
207
208 <DD>
209 Equivalent to <B>-D</B>.
210 <DT><B>--help</B>
211
212 <DD>
213 Display a usage message on standard output and exit successfully.
214 <DT><B>--init-file</B> <I>file</I><DD>
215
216 <DT><B>--rcfile</B> <I>file</I><DD>
217
218 Execute commands from
219 <I>file</I>
220
221 instead of the standard personal initialization file
222 <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>
223
224 if the shell is interactive (see
225 <FONT SIZE=-1><B>INVOCATION</B>
226
227 </FONT>
228 below).
229 <DT><B>--login</B>
230
231 <DD>
232 Equivalent to <B>-l</B>.
233 <DT><B>--noediting</B>
234
235 <DD>
236 Do not use the GNU
237 <B>readline</B>
238
239 library to read command lines when the shell is interactive.
240 <DT><B>--noprofile</B>
241
242 <DD>
243 Do not read either the system-wide startup file
244
245 <A HREF="file:/etc/profile"><I>/etc/profile</I></A>
246
247 or any of the personal initialization files
248 <A HREF="file:~/.bash_profile"><I>~/.bash_profile</I></A>,
249
250 <A HREF="file:~/.bash_login"><I>~/.bash_login</I></A>,
251
252 or
253 <A HREF="file:~/.profile"><I>~/.profile</I></A>.
254
255 By default,
256 <B>bash</B>
257
258 reads these files when it is invoked as a login shell (see
259 <FONT SIZE=-1><B>INVOCATION</B>
260
261 </FONT>
262 below).
263 <DT><B>--norc</B>
264
265 <DD>
266 Do not read and execute the personal initialization file
267 <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>
268
269 if the shell is interactive.
270 This option is on by default if the shell is invoked as
271 <B>sh</B>.
272
273 <DT><B>--posix</B>
274
275 <DD>
276 Change the behavior of <B>bash</B> where the default operation differs
277 from the POSIX standard to match the standard (<I>posix mode</I>).
278 <DT><B>--restricted</B>
279
280 <DD>
281 The shell becomes restricted (see
282 <FONT SIZE=-1><B>RESTRICTED SHELL</B>
283
284 </FONT>
285 below).
286 <DT><B>--verbose</B>
287
288 <DD>
289 Equivalent to  <B>-v</B>.
290 <DT><B>--version</B>
291
292 <DD>
293 Show version information for this instance of
294 <B>bash</B>
295
296 on the standard output and exit successfully.
297
298 </DL>
299 <A NAME="lbAG">&nbsp;</A>
300 <H3>ARGUMENTS</H3>
301
302 If arguments remain after option processing, and neither the
303 <B>-c</B>
304
305 nor the
306 <B>-s</B>
307
308 option has been supplied, the first argument is assumed to
309 be the name of a file containing shell commands.
310 If
311 <B>bash</B>
312
313 is invoked in this fashion, 
314 <B>$0</B>
315
316 is set to the name of the file, and the positional parameters
317 are set to the remaining arguments.
318 <B>Bash</B>
319
320 reads and executes commands from this file, then exits.
321 <B>Bash</B>'s exit status is the exit status of the last command
322 executed in the script.
323 If no commands are executed, the exit status is 0.
324 An attempt is first made to open the file in the current directory, and,
325 if no file is found, then the shell searches the directories in
326 <FONT SIZE=-1><B>PATH</B>
327
328 </FONT>
329 for the script.
330 <A NAME="lbAH">&nbsp;</A>
331 <H3>INVOCATION</H3>
332
333 A <I>login shell</I> is one whose first character of argument zero is a
334 <B>-</B>,
335
336 or one started with the 
337 <B>--login</B>
338
339 option.
340 <P>
341
342 An <I>interactive</I> shell is one started without non-option arguments
343 and without the
344 <B>-c</B>
345
346 option
347 whose standard input and error are
348 both connected to terminals (as determined by
349 <I>isatty</I>(3)),
350
351 or one started with the
352 <B>-i</B>
353
354 option.
355 <FONT SIZE=-1><B>PS1</B>
356
357 </FONT>
358 is set and
359 <B>$-</B>
360
361 includes
362 <B>i</B>
363
364 if
365 <B>bash</B>
366
367 is interactive,
368 allowing a shell script or a startup file to test this state.
369 <P>
370
371 The following paragraphs describe how
372 <B>bash</B>
373
374 executes its startup files.
375 If any of the files exist but cannot be read,
376 <B>bash</B>
377
378 reports an error.
379 Tildes are expanded in file names as described below under
380 <B>Tilde Expansion</B>
381
382 in the
383 <FONT SIZE=-1><B>EXPANSION</B>
384
385 </FONT>
386 section.
387 <P>
388
389 When
390 <B>bash</B>
391
392 is invoked as an interactive login shell, or as a non-interactive shell
393 with the <B>--login</B> option, it first reads and
394 executes commands from the file <A HREF="file:/etc/profile"><I>/etc/profile</I></A>, if that
395 file exists.
396 After reading that file, it looks for <A HREF="file:~/.bash_profile"><I>~/.bash_profile</I></A>,
397 <A HREF="file:~/.bash_login"><I>~/.bash_login</I></A>, and <A HREF="file:~/.profile"><I>~/.profile</I></A>, in that order, and reads
398 and executes commands from the first one that exists and is readable.
399 The
400 <B>--noprofile</B>
401
402 option may be used when the shell is started to inhibit this behavior.
403 <P>
404
405 When a login shell exits,
406 <B>bash</B>
407
408 reads and executes commands from the file <A HREF="file:~/.bash_logout"><I>~/.bash_logout</I></A>, if it
409 exists.
410 <P>
411
412 When an interactive shell that is not a login shell is started,
413 <B>bash</B>
414
415 reads and executes commands from <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>, if that file exists.
416 This may be inhibited by using the
417 <B>--norc</B>
418
419 option.
420 The <B>--rcfile</B> <I>file</I> option will force
421 <B>bash</B>
422
423 to read and execute commands from <I>file</I> instead of <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>.
424 <P>
425
426 When
427 <B>bash</B>
428
429 is started non-interactively, to run a shell script, for example, it
430 looks for the variable
431 <FONT SIZE=-1><B>BASH_ENV</B>
432
433 </FONT>
434 in the environment, expands its value if it appears there, and uses the
435 expanded value as the name of a file to read and execute.
436 <B>Bash</B>
437
438 behaves as if the following command were executed:
439 <P>
440 <DL COMPACT><DT><DD>
441 <TT>if [ -n &quot;$BASH_ENV&quot; ]; then . &quot;$BASH_ENV&quot;; fi</TT>
442
443 </DL>
444
445 <P>
446 but the value of the
447 <FONT SIZE=-1><B>PATH</B>
448
449 </FONT>
450 variable is not used to search for the file name.
451 <P>
452
453 If
454 <B>bash</B>
455
456 is invoked with the name
457 <B>sh</B>,
458
459 it tries to mimic the startup behavior of historical versions of
460 <B>sh</B>
461
462 as closely as possible,
463 while conforming to the POSIX standard as well.
464 When invoked as an interactive login shell, or a non-interactive
465 shell with the <B>--login</B> option, it first attempts to
466 read and execute commands from
467 <A HREF="file:/etc/profile"><I>/etc/profile</I></A>
468
469 and
470 <A HREF="file:~/.profile"><I>~/.profile</I></A>,
471
472 in that order.
473 The
474 <B>--noprofile</B>
475
476 option may be used to inhibit this behavior.
477 When invoked as an interactive shell with the name
478 <B>sh</B>,
479
480 <B>bash</B>
481
482 looks for the variable
483 <FONT SIZE=-1><B>ENV</B>,
484
485 </FONT>
486 expands its value if it is defined, and uses the
487 expanded value as the name of a file to read and execute.
488 Since a shell invoked as
489 <B>sh</B>
490
491 does not attempt to read and execute commands from any other startup
492 files, the
493 <B>--rcfile</B>
494
495 option has no effect.
496 A non-interactive shell invoked with the name
497 <B>sh</B>
498
499 does not attempt to read any other startup files. 
500 When invoked as
501 <B>sh</B>,
502
503 <B>bash</B>
504
505 enters
506 <I>posix</I>
507
508 mode after the startup files are read.
509 <P>
510
511 When
512 <B>bash</B>
513
514 is started in
515 <I>posix</I>
516
517 mode, as with the
518 <B>--posix</B>
519
520 command line option, it follows the POSIX standard for startup files.
521 In this mode, interactive shells expand the
522 <FONT SIZE=-1><B>ENV</B>
523
524 </FONT>
525 variable and commands are read and executed from the file
526 whose name is the expanded value.
527 No other startup files are read.
528 <P>
529
530 <B>Bash</B>
531
532 attempts to determine when it is being run with its standard input
533 connected to a network connection, as when executed by the remote shell
534 daemon, usually <I>rshd</I>, or the secure shell daemon <I>sshd</I>.
535 If
536 <B>bash</B>
537
538 determines it is being run in this fashion, it reads and executes
539 commands from <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>, if that file exists and is readable.
540 It will not do this if invoked as <B>sh</B>.
541 The
542 <B>--norc</B>
543
544 option may be used to inhibit this behavior, and the
545 <B>--rcfile</B>
546
547 option may be used to force another file to be read, but
548 <I>rshd</I> does not generally invoke the shell with those options
549 or allow them to be specified.
550 <P>
551
552 If the shell is started with the effective user (group) id not equal to the
553 real user (group) id, and the <B>-p</B> option is not supplied, no startup
554 files are read, shell functions are not inherited from the environment, the
555 <FONT SIZE=-1><B>SHELLOPTS</B>,
556
557 </FONT>
558 <FONT SIZE=-1><B>BASHOPTS</B>,
559
560 </FONT>
561 <FONT SIZE=-1><B>CDPATH</B>,
562
563 </FONT>
564 and
565 <FONT SIZE=-1><B>GLOBIGNORE</B>
566
567 </FONT>
568 variables, if they appear in the environment, are ignored,
569 and the effective user id is set to the real user id.
570 If the <B>-p</B> option is supplied at invocation, the startup behavior is
571 the same, but the effective user id is not reset.
572 <A NAME="lbAI">&nbsp;</A>
573 <H3>DEFINITIONS</H3>
574
575 <P>
576
577 The following definitions are used throughout the rest of this
578 document.
579
580 <DL COMPACT>
581 <DT><B>blank </B>
582
583 <DD>
584 A space or tab.
585 <DT><B>word</B>
586
587 <DD>
588 A sequence of characters considered as a single unit by the shell.
589 Also known as a
590 <B>token</B>.
591
592 <DT><B>name</B>
593
594 <DD>
595
596 <I>word</I>
597
598 consisting only of alphanumeric characters and underscores, and
599 beginning with an alphabetic character or an underscore.  Also
600 referred to as an
601 <B>identifier</B>.
602
603 <DT><B>metacharacter</B>
604
605 <DD>
606 A character that, when unquoted, separates words.  One of the following:
607 <BR>
608
609 <DL COMPACT><DT><DD>
610 <P>
611
612 <B>|  &amp;  ;  (  )  &lt;  &gt;  space  tab</B>
613
614 </DL>
615
616 </DL>
617 <P>
618
619 <DL COMPACT>
620 <DT><B>control operator</B>
621
622 <DD>
623 A <I>token</I> that performs a control function.  It is one of the following
624 symbols:
625 <DL COMPACT><DT><DD>
626 <P>
627
628 <B>||  &amp;  &amp;&amp;  ;  ;;  (  )  |  |&amp;    &lt;newline&gt;</B>
629
630 </DL>
631
632
633 </DL>
634 <A NAME="lbAJ">&nbsp;</A>
635 <H3>RESERVED WORDS</H3>
636
637 <I>Reserved words</I> are words that have a special meaning to the shell.
638 The following words are recognized as reserved when unquoted and either
639 the first word of a simple command (see
640 <FONT SIZE=-1><B>SHELL GRAMMAR</B>
641
642 </FONT>
643 below) or the third word of a 
644 <B>case </B>
645
646 or
647 <B>for</B>
648
649 command:
650 <DL COMPACT><DT><DD>
651
652 <P>
653
654 <B>
655 </B>
656
657 !    case    do    done    elif    else    esac    fi    for    function    if    in    select    then    until    while    {    }    time    [[    ]]
658 </DL>
659
660
661 <A NAME="lbAK">&nbsp;</A>
662 <H3>SHELL GRAMMAR</H3>
663
664 <A NAME="lbAL">&nbsp;</A>
665 <H4>Simple Commands</H4>
666
667 <P>
668
669 A <I>simple command</I> is a sequence of optional variable assignments
670 followed by <B>blank</B>-separated words and redirections, and
671 terminated by a <I>control operator</I>.  The first word
672 specifies the command to be executed, and is passed as argument zero.
673 The remaining words are passed as arguments to the invoked command.
674 <P>
675
676 The return value of a <I>simple command</I> is its exit status, or
677 128+<I>n</I> if the command is terminated by signal
678 <I>n</I>.
679
680 <A NAME="lbAM">&nbsp;</A>
681 <H4>Pipelines</H4>
682
683 <P>
684
685 A <I>pipeline</I> is a sequence of one or more commands separated by
686 one of the control operators
687 <B>|</B>
688
689 or <B>|&amp;</B>.
690 The format for a pipeline is:
691 <DL COMPACT><DT><DD>
692 <P>
693
694 [<B>time</B> [<B>-p</B>]] [ ! ] <I>command</I> [ [<B>|</B>|<B>|&amp;</B>] <I>command2</I> ... ]
695 </DL>
696
697 <P>
698
699 The standard output of
700 <I>command</I>
701
702 is connected via a pipe to the standard input of
703 <I>command2</I>.
704
705 This connection is performed before any redirections specified by the
706 command (see
707 <FONT SIZE=-1><B>REDIRECTION</B>
708
709 </FONT>
710 below).
711 If <B>|&amp;</B> is used, the standard error of <I>command</I> is connected to
712 <I>command2</I>'s standard input through the pipe; it is shorthand for
713 <B>2&gt;&amp;1 |</B>.
714 This implicit redirection of the standard error is performed after any
715 redirections specified by the command.
716 <P>
717
718 The return status of a pipeline is the exit status of the last
719 command, unless the <B>pipefail</B> option is enabled.
720 If <B>pipefail</B> is enabled, the pipeline's return status is the
721 value of the last (rightmost) command to exit with a non-zero status,
722 or zero if all commands exit successfully.
723 If the reserved word
724 <B>!</B>
725
726 precedes a pipeline, the exit status of that pipeline is the logical
727 negation of the exit status as described above.
728 The shell waits for all commands in the pipeline to
729 terminate before returning a value.
730 <P>
731
732 If the
733 <B>time</B>
734
735 reserved word precedes a pipeline, the elapsed as well as user and
736 system time consumed by its execution are reported when the pipeline
737 terminates.
738 The <B>-p</B> option changes the output format to that specified by POSIX.
739 When the shell is in <I>posix mode</I>, it does not recognize
740 <B>time</B> as a reserved word if the next token begins with a `-'.
741 The
742 <FONT SIZE=-1><B>TIMEFORMAT</B>
743
744 </FONT>
745 variable may be set to a format string that specifies how the timing
746 information should be displayed; see the description of
747 <FONT SIZE=-1><B>TIMEFORMAT</B>
748
749 </FONT>
750 under
751 <B>Shell Variables</B>
752
753 below.
754 <P>
755
756 When the shell is in <I>posix mode</I>, <B>time</B>
757 may be followed by a newline.  In this case, the shell displays the
758 total user and system time consumed by the shell and its children.
759 The
760 <FONT SIZE=-1><B>TIMEFORMAT</B>
761
762 </FONT>
763 variable may be used to specify the format of
764 the time information.
765 <P>
766
767 Each command in a pipeline is executed as a separate process (i.e., in a
768 subshell).
769 <A NAME="lbAN">&nbsp;</A>
770 <H4>Lists</H4>
771
772 <P>
773
774 A <I>list</I> is a sequence of one or more pipelines separated by one
775 of the operators
776 <B>;</B>,
777
778 <B>&amp;</B>,
779
780 <B>&amp;&amp;</B>,
781
782 or
783 <B>||</B>,
784
785 and optionally terminated by one of
786 <B>;</B>,
787
788 <B>&amp;</B>,
789
790 or
791 <B>&lt;newline&gt;</B>.
792
793 <P>
794
795 Of these list operators,
796 <B>&amp;&amp;</B>
797
798 and
799 <B>||</B>
800
801 have equal precedence, followed by
802 <B>;</B>
803
804 and
805 <B>&amp;</B>,
806
807 which have equal precedence.
808 <P>
809
810 A sequence of one or more newlines may appear in a <I>list</I> instead
811 of a semicolon to delimit commands.
812 <P>
813
814 If a command is terminated by the control operator
815 <B>&amp;</B>,
816
817 the shell executes the command in the <I>background</I>
818 in a subshell.  The shell does not wait for the command to
819 finish, and the return status is 0.  Commands separated by a
820 <B>;</B>
821
822 are executed sequentially; the shell waits for each
823 command to terminate in turn.  The return status is the
824 exit status of the last command executed.
825 <P>
826
827 AND and OR lists are sequences of one of more pipelines separated by the
828 <B>&amp;&amp;</B> and <B>||</B> control operators, respectively.
829 AND and OR lists are executed with left associativity.
830 An AND list has the form
831 <DL COMPACT><DT><DD>
832 <P>
833
834 <I>command1</I> <B>&amp;&amp;</B> <I>command2</I>
835 </DL>
836
837 <P>
838
839 <I>command2</I>
840
841 is executed if, and only if,
842 <I>command1</I>
843
844 returns an exit status of zero.
845 <P>
846
847 An OR list has the form
848 <DL COMPACT><DT><DD>
849 <P>
850
851 <I>command1</I> <B>||</B> <I>command2</I>
852 <P>
853
854 </DL>
855
856 <P>
857
858 <I>command2</I>
859
860 is executed if and only if
861 <I>command1</I>
862
863 returns a non-zero exit status.
864 The return status of
865 AND and OR lists is the exit status of the last command
866 executed in the list.
867 <A NAME="lbAO">&nbsp;</A>
868 <H4>Compound Commands</H4>
869
870 <P>
871
872 A <I>compound command</I> is one of the following:
873 <DL COMPACT>
874 <DT>(<I>list</I>)<DD>
875 <I>list</I> is executed in a subshell environment (see
876 <FONT SIZE=-1><B>COMMAND EXECUTION ENVIRONMENT</B></FONT>
877 below).
878 Variable assignments and builtin
879 commands that affect the shell's environment do not remain in effect
880 after the command completes.  The return status is the exit status of
881 <I>list</I>.
882 <DT>{ <I>list</I>; }<DD>
883 <I>list</I> is simply executed in the current shell environment.
884 <I>list</I> must be terminated with a newline or semicolon.
885 This is known as a <I>group command</I>.
886 The return status is the exit status of
887 <I>list</I>.
888 Note that unlike the metacharacters <B>(</B> and <B>)</B>, <B>{</B> and
889 <B>}</B> are <I>reserved words</I> and must occur where a reserved
890 word is permitted to be recognized.  Since they do not cause a word
891 break, they must be separated from <I>list</I> by whitespace or another
892 shell metacharacter.
893 <DT>((<I>expression</I>))<DD>
894 The <I>expression</I> is evaluated according to the rules described
895 below under
896 <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>.
897
898 </FONT>
899 If the value of the expression is non-zero, the return status is 0;
900 otherwise the return status is 1.  This is exactly equivalent to
901 <B>let &quot;</B><I>expression</I>&quot;.
902 <DT><B>[[</B> <I>expression</I> <B>]]</B><DD>
903 Return a status of 0 or 1 depending on the evaluation of
904 the conditional expression <I>expression</I>.
905 Expressions are composed of the primaries described below under
906 <FONT SIZE=-1><B>CONDITIONAL EXPRESSIONS</B>.
907
908 </FONT>
909 Word splitting and pathname expansion are not performed on the words
910 between the <B>[[</B> and <B>]]</B>; tilde expansion, parameter and
911 variable expansion, arithmetic expansion, command substitution, process
912 substitution, and quote removal are performed.
913 Conditional operators such as <B>-f</B> must be unquoted to be recognized
914 as primaries.
915 <P>
916
917
918 When used with <B>[[</B>, the <B>&lt;</B> and <B>&gt;</B> operators sort
919 lexicographically using the current locale.
920 <P>
921
922
923 When the <B>==</B> and <B>!=</B> operators are used, the string to the
924 right of the operator is considered a pattern and matched according
925 to the rules described below under <B>Pattern Matching</B>.
926 If the shell option
927 <B>nocasematch</B>
928
929 is enabled, the match is performed without regard to the case
930 of alphabetic characters.
931 The return value is 0 if the string matches (<B>==</B>) or does not match
932 (<B>!=</B>) the pattern, and 1 otherwise.
933 Any part of the pattern may be quoted to force it to be matched as a
934 string.
935 <P>
936
937
938 An additional binary operator, <B>=~</B>, is available, with the same
939 precedence as <B>==</B> and <B>!=</B>.
940 When it is used, the string to the right of the operator is considered
941 an extended regular expression and matched accordingly (as in <I>regex</I>(3)).  
942 The return value is 0 if the string matches
943 the pattern, and 1 otherwise.
944 If the regular expression is syntactically incorrect, the conditional
945 expression's return value is 2.
946 If the shell option
947 <B>nocasematch</B>
948
949 is enabled, the match is performed without regard to the case
950 of alphabetic characters.
951 Any part of the pattern may be quoted to force it to be matched as a
952 string.
953 Substrings matched by parenthesized subexpressions within the regular
954 expression are saved in the array variable
955 <FONT SIZE=-1><B>BASH_REMATCH</B>.
956
957 </FONT>
958 The element of
959 <FONT SIZE=-1><B>BASH_REMATCH</B>
960
961 </FONT>
962 with index 0 is the portion of the string
963 matching the entire regular expression.
964 The element of
965 <FONT SIZE=-1><B>BASH_REMATCH</B>
966
967 </FONT>
968 with index <I>n</I> is the portion of the
969 string matching the <I>n</I>th parenthesized subexpression.
970 <P>
971
972
973 Expressions may be combined using the following operators, listed
974 in decreasing order of precedence:
975 <P>
976
977
978 <DL COMPACT><DT><DD>
979
980 <DL COMPACT>
981 <DT><B>( </B><I>expression</I> )
982
983 <DD>
984 Returns the value of <I>expression</I>.
985 This may be used to override the normal precedence of operators.
986 <DT><B>! </B><I>expression</I>
987
988 <DD>
989 True if
990 <I>expression</I>
991
992 is false.
993 <DT><I>expression1</I> <B>&amp;&amp;</B> <I>expression2</I><DD>
994 True if both
995 <I>expression1</I>
996
997 and
998 <I>expression2</I>
999
1000 are true.
1001 <DT><I>expression1</I> <B>||</B> <I>expression2</I><DD>
1002 True if either
1003 <I>expression1</I>
1004
1005 or
1006 <I>expression2</I>
1007
1008 is true.
1009
1010 </DL>
1011 <P>
1012
1013 The <B>&amp;&amp;</B> and <B>||</B>
1014 operators do not evaluate <I>expression2</I> if the value of
1015 <I>expression1</I> is sufficient to determine the return value of
1016 the entire conditional expression.
1017 </DL>
1018
1019 <DT><B>for</B> <I>name</I> [ [ <B>in</B> [ <I>word ...</I> ] ] ; ] <B>do</B> <I>list</I> ; <B>done</B><DD>
1020 The list of words following <B>in</B> is expanded, generating a list
1021 of items.
1022 The variable <I>name</I> is set to each element of this list
1023 in turn, and <I>list</I> is executed each time.
1024 If the <B>in</B> <I>word</I> is omitted, the <B>for</B> command executes
1025 <I>list</I> once for each positional parameter that is set (see
1026 <FONT SIZE=-1><B>PARAMETERS</B>
1027
1028 </FONT>
1029 below).
1030 The return status is the exit status of the last command that executes.
1031 If the expansion of the items following <B>in</B> results in an empty
1032 list, no commands are executed, and the return status is 0.
1033 <DT><B>for</B> (( <I>expr1</I> ; <I>expr2</I> ; <I>expr3</I> )) ; <B>do</B> <I>list</I> ; <B>done</B><DD>
1034 First, the arithmetic expression <I>expr1</I> is evaluated according
1035 to the rules described below under
1036 <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>.
1037
1038 </FONT>
1039 The arithmetic expression <I>expr2</I> is then evaluated repeatedly
1040 until it evaluates to zero.
1041 Each time <I>expr2</I> evaluates to a non-zero value, <I>list</I> is
1042 executed and the arithmetic expression <I>expr3</I> is evaluated.
1043 If any expression is omitted, it behaves as if it evaluates to 1.
1044 The return value is the exit status of the last command in <I>list</I>
1045 that is executed, or false if any of the expressions is invalid.
1046 <DT><B>select</B> <I>name</I> [ <B>in</B> <I>word</I> ] ; <B>do</B> <I>list</I> ; <B>done</B><DD>
1047 The list of words following <B>in</B> is expanded, generating a list
1048 of items.  The set of expanded words is printed on the standard
1049 error, each preceded by a number.  If the <B>in</B>
1050 <I>word</I> is omitted, the positional parameters are printed (see
1051 <FONT SIZE=-1><B>PARAMETERS</B>
1052
1053 </FONT>
1054 below).  The
1055 <FONT SIZE=-1><B>PS3</B>
1056
1057 </FONT>
1058 prompt is then displayed and a line read from the standard input.
1059 If the line consists of a number corresponding to one of
1060 the displayed words, then the value of
1061 <I>name</I>
1062
1063 is set to that word.  If the line is empty, the words and prompt
1064 are displayed again.  If EOF is read, the command completes.  Any
1065 other value read causes
1066 <I>name</I>
1067
1068 to be set to null.  The line read is saved in the variable
1069 <FONT SIZE=-1><B>REPLY</B>.
1070
1071 </FONT>
1072 The
1073 <I>list</I>
1074
1075 is executed after each selection until a
1076 <B>break</B>
1077
1078 command is executed.
1079 The exit status of
1080 <B>select</B>
1081
1082 is the exit status of the last command executed in
1083 <I>list</I>,
1084
1085 or zero if no commands were executed.
1086 <DT><B>case</B> <I>word</I> <B>in</B> [ [(] <I>pattern</I> [ <B>|</B> <I>pattern</I> ] 
1087 <DD>
1088 A <B>case</B> command first expands <I>word</I>, and tries to match
1089 it against each <I>pattern</I> in turn, using the same matching rules
1090 as for pathname expansion (see
1091 <B>Pathname Expansion</B>
1092
1093 below).
1094 The <I>word</I> is expanded using tilde
1095 expansion, parameter and variable expansion, arithmetic substitution,
1096 command substitution, process substitution and quote removal.
1097 Each <I>pattern</I> examined is expanded using tilde
1098 expansion, parameter and variable expansion, arithmetic substitution,
1099 command substitution, and process substitution.
1100 If the shell option
1101 <B>nocasematch</B>
1102
1103 is enabled, the match is performed without regard to the case
1104 of alphabetic characters.
1105 When a match is found, the corresponding <I>list</I> is executed.
1106 If the <B>;;</B> operator is used, no subsequent matches are attempted after
1107 the first pattern match.
1108 Using <B>;&amp;</B> in place of <B>;;</B> causes execution to continue with
1109 the <I>list</I> associated with the next set of patterns.
1110 Using <B>;;&amp;</B> in place of <B>;;</B> causes the shell to test the next
1111 pattern list in the statement, if any, and execute any associated <I>list</I>
1112 on a successful match.
1113 The exit status is zero if no
1114 pattern matches.  Otherwise, it is the exit status of the
1115 last command executed in <I>list</I>.
1116 <DT><B>if</B> <I>list</I>; <B>then</B> <I>list;</I> [ <B>elif</B> <I>list</I>; <B>then</B> <I>list</I>; ] ... [ <B>else</B> <I>list</I>; ] <B>fi</B><DD>
1117 The
1118 <B>if </B>
1119
1120 <I>list</I>
1121
1122 is executed.  If its exit status is zero, the
1123 <B>then</B> <I>list</I> is executed.  Otherwise, each <B>elif</B>
1124 <I>list</I> is executed in turn, and if its exit status is zero,
1125 the corresponding <B>then</B> <I>list</I> is executed and the
1126 command completes.  Otherwise, the <B>else</B> <I>list</I> is
1127 executed, if present.  The exit status is the exit status of the
1128 last command executed, or zero if no condition tested true.
1129 <DT><B>while</B> <I>list-1</I>; <B>do</B> <I>list-2</I>; <B>done</B><DD>
1130
1131 <DT><B>until</B> <I>list-1</I>; <B>do</B> <I>list-2</I>; <B>done</B><DD>
1132
1133 The <B>while</B> command continuously executes the list
1134 <I>list-2</I> as long as the last command in the list <I>list-1</I> returns
1135 an exit status of zero.  The <B>until</B> command is identical
1136 to the <B>while</B> command, except that the test is negated;
1137 <I>list-2</I>
1138
1139 is executed as long as the last command in
1140 <I>list-1</I>
1141
1142 returns a non-zero exit status.
1143 The exit status of the <B>while</B> and <B>until</B> commands
1144 is the exit status
1145 of the last command executed in <I>list-2</I>, or zero if
1146 none was executed.
1147 </DL>
1148 <A NAME="lbAP">&nbsp;</A>
1149 <H4>Coprocesses</H4>
1150
1151 <P>
1152
1153 A <I>coprocess</I> is a shell command preceded by the <B>coproc</B> reserved
1154 word.
1155 A coprocess is executed asynchronously in a subshell, as if the command
1156 had been terminated with the <B>&amp;</B> control operator, with a two-way pipe
1157 established between the executing shell and the coprocess.
1158 <P>
1159
1160 The format for a coprocess is:
1161 <DL COMPACT><DT><DD>
1162 <P>
1163
1164 <B>coproc</B> [<I>NAME</I>] <I>command</I> [<I>redirections</I>]
1165 </DL>
1166
1167 <P>
1168
1169 This creates a coprocess named <I>NAME</I>.
1170 If <I>NAME</I> is not supplied, the default name is <I>COPROC</I>.
1171 <I>NAME</I> must not be supplied if <I>command</I> is a <I>simple
1172 command</I> (see above); otherwise, it is interpreted as the first word
1173 of the simple command.
1174 When the coproc is executed, the shell creates an array variable (see
1175 <B>Arrays</B>
1176
1177 below) named <I>NAME</I> in the context of the executing shell.
1178 The standard output of
1179 <I>command</I>
1180
1181 is connected via a pipe to a file descriptor in the executing shell,
1182 and that file descriptor is assigned to <I>NAME</I>[0].
1183 The standard input of
1184 <I>command</I>
1185
1186 is connected via a pipe to a file descriptor in the executing shell,
1187 and that file descriptor is assigned to <I>NAME</I>[1].
1188 This pipe is established before any redirections specified by the
1189 command (see
1190 <FONT SIZE=-1><B>REDIRECTION</B>
1191
1192 </FONT>
1193 below).
1194 The file descriptors can be utilized as arguments to shell commands
1195 and redirections using standard word expansions.
1196 The process ID of the shell spawned to execute the coprocess is
1197 available as the value of the variable <I>NAME</I>_PID.
1198 The <B>wait</B>
1199 builtin command may be used to wait for the coprocess to terminate.
1200 <P>
1201
1202 The return status of a coprocess is the exit status of <I>command</I>.
1203 <A NAME="lbAQ">&nbsp;</A>
1204 <H4>Shell Function Definitions</H4>
1205
1206 <P>
1207
1208 A shell function is an object that is called like a simple command and
1209 executes a compound command with a new set of positional parameters.
1210 Shell functions are declared as follows:
1211 <DL COMPACT>
1212 <DT><I>name</I> () <I>compound-command</I> [<I>redirection</I>]<DD>
1213
1214 <DT><B>function</B> <I>name</I> [()] <I>compound-command</I> [<I>redirection</I>]<DD>
1215
1216 This defines a function named <I>name</I>.
1217 The reserved word <B>function</B> is optional.
1218 If the <B>function</B> reserved word is supplied, the parentheses are optional.
1219 The <I>body</I> of the function is the compound command
1220 <I>compound-command </I>
1221
1222 (see <B>Compound Commands</B> above).
1223 That command is usually a <I>list</I> of commands between { and }, but
1224 may be any command listed under <B>Compound Commands</B> above.
1225 <I>compound-command</I> is executed whenever <I>name</I> is specified as the
1226 name of a simple command.
1227 Any redirections (see
1228 <FONT SIZE=-1><B>REDIRECTION</B>
1229
1230 </FONT>
1231 below) specified when a function is defined are performed
1232 when the function is executed.
1233 The exit status of a function definition is zero unless a syntax error
1234 occurs or a readonly function with the same name already exists.
1235 When executed, the exit status of a function is the exit status of the
1236 last command executed in the body.  (See
1237 <FONT SIZE=-1><B>FUNCTIONS</B>
1238
1239 </FONT>
1240 below.)
1241 </DL>
1242 <A NAME="lbAR">&nbsp;</A>
1243 <H3>COMMENTS</H3>
1244
1245 In a non-interactive shell, or an interactive shell in which the
1246 <B>interactive_comments</B>
1247
1248 option to the
1249 <B>shopt</B>
1250
1251 builtin is enabled (see
1252 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
1253
1254 </FONT>
1255 below), a word beginning with
1256 <B>#</B>
1257
1258 causes that word and all remaining characters on that line to
1259 be ignored.  An interactive shell without the
1260 <B>interactive_comments</B>
1261
1262 option enabled does not allow comments.  The
1263 <B>interactive_comments</B>
1264
1265 option is on by default in interactive shells.
1266 <A NAME="lbAS">&nbsp;</A>
1267 <H3>QUOTING</H3>
1268
1269 <I>Quoting</I> is used to remove the special meaning of certain
1270 characters or words to the shell.  Quoting can be used to 
1271 disable special treatment for special characters, to prevent
1272 reserved words from being recognized as such, and to prevent
1273 parameter expansion.
1274 <P>
1275
1276 Each of the <I>metacharacters</I> listed above under
1277 <FONT SIZE=-1><B>DEFINITIONS</B>
1278
1279 </FONT>
1280 has special meaning to the shell and must be quoted if it is to
1281 represent itself.
1282 <P>
1283
1284 When the command history expansion facilities are being used
1285 (see
1286 <FONT SIZE=-1><B>HISTORY EXPANSION</B>
1287
1288 </FONT>
1289 below), the
1290 <I>history expansion</I> character, usually <B>!</B>, must be quoted
1291 to prevent history expansion.
1292 <P>
1293
1294 There are three quoting mechanisms: the
1295 <I>escape character</I>,
1296
1297 single quotes, and double quotes.
1298 <P>
1299
1300 A non-quoted backslash (<B>\</B>) is the
1301 <I>escape character</I>.
1302
1303 It preserves the literal value of the next character that follows,
1304 with the exception of &lt;newline&gt;.  If a <B>\</B>&lt;newline&gt; pair
1305 appears, and the backslash is not itself quoted, the <B>\</B>&lt;newline&gt;
1306 is treated as a line continuation (that is, it is removed from the
1307 input stream and effectively ignored).
1308 <P>
1309
1310 Enclosing characters in single quotes preserves the literal value
1311 of each character within the quotes.  A single quote may not occur
1312 between single quotes, even when preceded by a backslash.
1313 <P>
1314
1315 Enclosing characters in double quotes preserves the literal value
1316 of all characters within the quotes, with the exception of
1317 <B>$</B>,
1318
1319 <B>`</B>,
1320
1321 <B>\</B>,
1322
1323 and, when history expansion is enabled,
1324 <B>!</B>.
1325
1326 The characters
1327 <B>$</B>
1328
1329 and
1330 <B>`</B>
1331
1332 retain their special meaning within double quotes.  The backslash
1333 retains its special meaning only when followed by one of the following
1334 characters:
1335 <B>$</B>,
1336
1337 <B>`</B>,
1338
1339 <B>&quot;</B>,
1340 <B>\</B>,
1341
1342 or
1343 <B>&lt;newline&gt;</B>.
1344
1345 A double quote may be quoted within double quotes by preceding it with
1346 a backslash.
1347 If enabled, history expansion will be performed unless an
1348 <B>!</B>
1349
1350 appearing in double quotes is escaped using a backslash.
1351 The backslash preceding the
1352 <B>!</B>
1353
1354 is not removed.
1355 <P>
1356
1357 The special parameters
1358 <B>*</B>
1359
1360 and
1361 <B>@</B>
1362
1363 have special meaning when in double
1364 quotes (see
1365 <FONT SIZE=-1><B>PARAMETERS</B>
1366
1367 </FONT>
1368 below).
1369 <P>
1370
1371 Words of the form <B>$</B>aq<I>string</I>aq are treated specially.  The
1372 word expands to <I>string</I>, with backslash-escaped characters replaced
1373 as specified by the ANSI C standard.  Backslash escape sequences, if
1374 present, are decoded as follows:
1375 <DL COMPACT><DT><DD>
1376
1377 <DL COMPACT>
1378 <DT><B>\a</B>
1379
1380 <DD>
1381 alert (bell)
1382 <DT><B>\b</B>
1383
1384 <DD>
1385 backspace
1386 <DT><B>\e</B>
1387
1388 <DD>
1389 <DT><B>\E</B>
1390
1391 <DD>
1392 an escape character
1393 <DT><B>\f</B>
1394
1395 <DD>
1396 form feed
1397 <DT><B>\n</B>
1398
1399 <DD>
1400 new line
1401 <DT><B>\r</B>
1402
1403 <DD>
1404 carriage return
1405 <DT><B>\t</B>
1406
1407 <DD>
1408 horizontal tab
1409 <DT><B>\v</B>
1410
1411 <DD>
1412 vertical tab
1413 <DT><B>\\</B>
1414
1415 <DD>
1416 backslash
1417 <DT><B>\aq</B>
1418
1419 <DD>
1420 single quote
1421 <DT><B>\dq</B>
1422
1423 <DD>
1424 double quote
1425 <DT><B>\</B><I>nnn</I>
1426
1427 <DD>
1428 the eight-bit character whose value is the octal value <I>nnn</I>
1429 (one to three digits)
1430 <DT><B>\x</B><I>HH</I>
1431
1432 <DD>
1433 the eight-bit character whose value is the hexadecimal value <I>HH</I>
1434 (one or two hex digits)
1435 <DT><B>\u</B><I>HHHH</I>
1436
1437 <DD>
1438 the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value
1439 <I>HHHH</I> (one to four hex digits)
1440 <DT><B>\U</B><I>HHHHHHHH</I>
1441
1442 <DD>
1443 the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value
1444 <I>HHHHHHHH</I> (one to eight hex digits)
1445 <DT><B>\c</B><I>x</I>
1446
1447 <DD>
1448 a control-<I>x</I> character
1449
1450 </DL></DL>
1451
1452 <P>
1453
1454 The expanded result is single-quoted, as if the dollar sign had
1455 not been present.
1456 <P>
1457
1458 A double-quoted string preceded by a dollar sign (<B>$</B>dq<I>string</I>dq)
1459 will cause the string to be translated according to the current locale.
1460 If the current locale is <B>C</B> or <B>POSIX</B>, the dollar sign
1461 is ignored.
1462 If the string is translated and replaced, the replacement is
1463 double-quoted.
1464 <A NAME="lbAT">&nbsp;</A>
1465 <H3>PARAMETERS</H3>
1466
1467 A
1468 <I>parameter</I>
1469
1470 is an entity that stores values.
1471 It can be a
1472 <I>name</I>,
1473
1474 a number, or one of the special characters listed below under
1475 <B>Special Parameters</B>.
1476
1477 A
1478 <I>variable</I>
1479
1480 is a parameter denoted by a
1481 <I>name</I>.
1482
1483 A variable has a <I>value</I> and zero or more <I>attributes</I>.
1484 Attributes are assigned using the
1485 <B>declare</B>
1486
1487 builtin command (see
1488 <B>declare</B>
1489
1490 below in
1491 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>).
1492
1493 </FONT>
1494 <P>
1495
1496 A parameter is set if it has been assigned a value.  The null string is
1497 a valid value.  Once a variable is set, it may be unset only by using
1498 the
1499 <B>unset</B>
1500
1501 builtin command (see
1502 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
1503
1504 </FONT>
1505 below).
1506 <P>
1507
1508 A
1509 <I>variable</I>
1510
1511 may be assigned to by a statement of the form
1512 <DL COMPACT><DT><DD>
1513 <P>
1514
1515 <I>name</I>=[<I>value</I>]
1516 </DL>
1517
1518 <P>
1519
1520 If
1521 <I>value</I>
1522
1523 is not given, the variable is assigned the null string.  All
1524 <I>values</I>
1525
1526 undergo tilde expansion, parameter and variable expansion,
1527 command substitution, arithmetic expansion, and quote
1528 removal (see
1529 <FONT SIZE=-1><B>EXPANSION</B>
1530
1531 </FONT>
1532 below).  If the variable has its
1533 <B>integer</B>
1534
1535 attribute set, then
1536 <I>value</I>
1537
1538 is evaluated as an arithmetic expression even if the $((...)) expansion is
1539 not used (see
1540 <B>Arithmetic Expansion</B>
1541
1542 below).
1543 Word splitting is not performed, with the exception
1544 of <B>&quot;$@&quot;</B> as explained below under
1545 <B>Special Parameters</B>.
1546
1547 Pathname expansion is not performed.
1548 Assignment statements may also appear as arguments to the
1549 <B>alias</B>,
1550
1551 <B>declare</B>,
1552
1553 <B>typeset</B>,
1554
1555 <B>export</B>,
1556
1557 <B>readonly</B>,
1558
1559 and
1560 <B>local</B>
1561
1562 builtin commands.
1563 <P>
1564
1565 In the context where an assignment statement is assigning a value
1566 to a shell variable or array index, the += operator can be used to
1567 append to or add to the variable's previous value.
1568 When += is applied to a variable for which the <I>integer</I> attribute has been
1569 set, <I>value</I> is evaluated as an arithmetic expression and added to the
1570 variable's current value, which is also evaluated.
1571 When += is applied to an array variable using compound assignment (see
1572 <B>Arrays</B>
1573
1574 below), the
1575 variable's value is not unset (as it is when using =), and new values are
1576 appended to the array beginning at one greater than the array's maximum index
1577 (for indexed arrays) or added as additional key-value pairs in an
1578 associative array.
1579 When applied to a string-valued variable, <I>value</I> is expanded and
1580 appended to the variable's value.
1581 <A NAME="lbAU">&nbsp;</A>
1582 <H4>Positional Parameters</H4>
1583
1584 <P>
1585
1586 A
1587 <I>positional parameter</I>
1588
1589 is a parameter denoted by one or more
1590 digits, other than the single digit 0.  Positional parameters are
1591 assigned from the shell's arguments when it is invoked,
1592 and may be reassigned using the
1593 <B>set</B>
1594
1595 builtin command.  Positional parameters may not be assigned to
1596 with assignment statements.  The positional parameters are
1597 temporarily replaced when a shell function is executed (see
1598 <FONT SIZE=-1><B>FUNCTIONS</B>
1599
1600 </FONT>
1601 below).
1602 <P>
1603
1604 When a positional parameter consisting of more than a single
1605 digit is expanded, it must be enclosed in braces (see
1606 <FONT SIZE=-1><B>EXPANSION</B>
1607
1608 </FONT>
1609 below).
1610 <A NAME="lbAV">&nbsp;</A>
1611 <H4>Special Parameters</H4>
1612
1613 <P>
1614
1615 The shell treats several parameters specially.  These parameters may
1616 only be referenced; assignment to them is not allowed.
1617
1618 <DL COMPACT>
1619 <DT><B>*</B>
1620
1621 <DD>
1622 Expands to the positional parameters, starting from one.  When the
1623 expansion occurs within double quotes, it expands to a single word
1624 with the value of each parameter separated by the first character
1625 of the 
1626 <FONT SIZE=-1><B>IFS</B>
1627
1628 </FONT>
1629 special variable.  That is, &quot;<B>$*</B>&quot; is equivalent
1630 to &quot;<B>$1</B><I>c</I><B>$2</B><I>c</I><B>...</B>&quot;, where
1631 <I>c</I>
1632
1633 is the first character of the value of the
1634 <FONT SIZE=-1><B>IFS</B>
1635
1636 </FONT>
1637 variable.  If
1638 <FONT SIZE=-1><B>IFS</B>
1639
1640 </FONT>
1641 is unset, the parameters are separated by spaces.
1642 If
1643 <FONT SIZE=-1><B>IFS</B>
1644
1645 </FONT>
1646 is null, the parameters are joined without intervening separators.
1647 <DT><B>@</B>
1648
1649 <DD>
1650 Expands to the positional parameters, starting from one.  When the
1651 expansion occurs within double quotes, each parameter expands to a
1652 separate word.  That is, &quot;<B>$@</B>&quot; is equivalent to
1653 &quot;<B>$1</B>&quot; &quot;<B>$2</B>&quot; ...
1654 If the double-quoted expansion occurs within a word, the expansion of
1655 the first parameter is joined with the beginning part of the original
1656 word, and the expansion of the last parameter is joined with the last
1657 part of the original word.
1658 When there are no positional parameters, &quot;<B>$@</B>&quot; and 
1659 <B>$@</B>
1660
1661 expand to nothing (i.e., they are removed).
1662 <DT><B>#</B>
1663
1664 <DD>
1665 Expands to the number of positional parameters in decimal.
1666 <DT><B>?</B>
1667
1668 <DD>
1669 Expands to the exit status of the most recently executed foreground
1670 pipeline.
1671 <DT><B>-</B>
1672
1673 <DD>
1674 Expands to the current option flags as specified upon invocation, 
1675 by the
1676 <B>set</B>
1677
1678 builtin command, or those set by the shell itself
1679 (such as the
1680 <B>-i</B>
1681
1682 option).
1683 <DT><B>$</B>
1684
1685 <DD>
1686 Expands to the process ID of the shell.  In a () subshell, it
1687 expands to the process ID of the current shell, not the
1688 subshell.
1689 <DT><B>!</B>
1690
1691 <DD>
1692 Expands to the process ID of the most recently executed background
1693 (asynchronous) command.
1694 <DT><B>0</B>
1695
1696 <DD>
1697 Expands to the name of the shell or shell script.  This is set at
1698 shell initialization.  If
1699 <B>bash</B>
1700
1701 is invoked with a file of commands,
1702 <B>$0</B>
1703
1704 is set to the name of that file.  If
1705 <B>bash</B>
1706
1707 is started with the
1708 <B>-c</B>
1709
1710 option, then
1711 <B>$0</B>
1712
1713 is set to the first argument after the string to be
1714 executed, if one is present.  Otherwise, it is set
1715 to the file name used to invoke
1716 <B>bash</B>,
1717
1718 as given by argument zero.
1719 <DT><B>_</B>
1720
1721 <DD>
1722 At shell startup, set to the absolute pathname used to invoke the
1723 shell or shell script being executed as passed in the environment
1724 or argument list.
1725 Subsequently, expands to the last argument to the previous command,
1726 after expansion.
1727 Also set to the full pathname used to invoke each command executed
1728 and placed in the environment exported to that command.
1729 When checking mail, this parameter holds the name of the mail file
1730 currently being checked.
1731
1732 </DL>
1733 <A NAME="lbAW">&nbsp;</A>
1734 <H4>Shell Variables</H4>
1735
1736 <P>
1737
1738 The following variables are set by the shell:
1739 <P>
1740
1741
1742 <DL COMPACT>
1743 <DT><B>BASH</B>
1744
1745 <DD>
1746 Expands to the full file name used to invoke this instance of
1747 <B>bash</B>.
1748
1749 <DT><B>BASHOPTS</B>
1750
1751 <DD>
1752 A colon-separated list of enabled shell options.  Each word in
1753 the list is a valid argument for the
1754 <B>-s</B>
1755
1756 option to the
1757 <B>shopt</B>
1758
1759 builtin command (see
1760 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
1761
1762 </FONT>
1763 below).  The options appearing in
1764 <FONT SIZE=-1><B>BASHOPTS</B>
1765
1766 </FONT>
1767 are those reported as
1768 <I>on</I>
1769
1770 by <B>shopt</B>.
1771 If this variable is in the environment when
1772 <B>bash</B>
1773
1774 starts up, each shell option in the list will be enabled before
1775 reading any startup files.
1776 This variable is read-only.
1777 <DT><B>BASHPID</B>
1778
1779 <DD>
1780 Expands to the process ID of the current <B>bash</B> process.
1781 This differs from <B>$$</B> under certain circumstances, such as subshells
1782 that do not require <B>bash</B> to be re-initialized.
1783 <DT><B>BASH_ALIASES</B>
1784
1785 <DD>
1786 An associative array variable whose members correspond to the internal
1787 list of aliases as maintained by the <B>alias</B> builtin.
1788 Elements added to this array appear in the alias list; unsetting array
1789 elements cause aliases to be removed from the alias list.
1790 <DT><B>BASH_ARGC</B>
1791
1792 <DD>
1793 An array variable whose values are the number of parameters in each
1794 frame of the current <B>bash</B> execution call stack.
1795 The number of
1796 parameters to the current subroutine (shell function or script executed
1797 with <B>.</B> or <B>source</B>) is at the top of the stack.
1798 When a subroutine is executed, the number of parameters passed is pushed onto
1799 <FONT SIZE=-1><B>BASH_ARGC</B>.
1800
1801 </FONT>
1802 The shell sets
1803 <FONT SIZE=-1><B>BASH_ARGC</B>
1804
1805 </FONT>
1806 only when in extended debugging mode (see the description of the
1807 <B>extdebug</B>
1808
1809 option to the
1810 <B>shopt</B>
1811
1812 builtin below)
1813 <DT><B>BASH_ARGV</B>
1814
1815 <DD>
1816 An array variable containing all of the parameters in the current <B>bash</B>
1817 execution call stack.  The final parameter of the last subroutine call
1818 is at the top of the stack; the first parameter of the initial call is
1819 at the bottom.  When a subroutine is executed, the parameters supplied
1820 are pushed onto
1821 <FONT SIZE=-1><B>BASH_ARGV</B>.
1822
1823 </FONT>
1824 The shell sets
1825 <FONT SIZE=-1><B>BASH_ARGV</B>
1826
1827 </FONT>
1828 only when in extended debugging mode
1829 (see the description of the
1830 <B>extdebug</B>
1831
1832 option to the
1833 <B>shopt</B>
1834
1835 builtin below)
1836 <DT><B>BASH_CMDS</B>
1837
1838 <DD>
1839 An associative array variable whose members correspond to the internal
1840 hash table of commands as maintained by the <B>hash</B> builtin.
1841 Elements added to this array appear in the hash table; unsetting array
1842 elements cause commands to be removed from the hash table.
1843 <DT><B>BASH_COMMAND</B>
1844
1845 <DD>
1846 The command currently being executed or about to be executed, unless the
1847 shell is executing a command as the result of a trap,
1848 in which case it is the command executing at the time of the trap.
1849 <DT><B>BASH_EXECUTION_STRING</B>
1850
1851 <DD>
1852 The command argument to the <B>-c</B> invocation option.
1853 <DT><B>BASH_LINENO</B>
1854
1855 <DD>
1856 An array variable whose members are the line numbers in source files
1857 where each corresponding member of
1858 <FONT SIZE=-1><B>FUNCNAME</B>
1859
1860 </FONT>
1861 was invoked.
1862 <B>${BASH_LINENO[</B><I>$i</I><B>]}</B> is the line number in the source
1863 file (<B>${BASH_SOURCE[</B><I>$i+1</I><B>]}</B>) where
1864 <B>${FUNCNAME[</B><I>$i</I><B>]}</B> was called
1865 (or <B>${BASH_LINENO[</B><I>$i-1</I><B>]}</B> if referenced within another
1866 shell function).
1867 Use
1868 <FONT SIZE=-1><B>LINENO</B>
1869
1870 </FONT>
1871 to obtain the current line number.
1872 <DT><B>BASH_REMATCH</B>
1873
1874 <DD>
1875 An array variable whose members are assigned by the <B>=~</B> binary
1876 operator to the <B>[[</B> conditional command.
1877 The element with index 0 is the portion of the string
1878 matching the entire regular expression.
1879 The element with index <I>n</I> is the portion of the
1880 string matching the <I>n</I>th parenthesized subexpression.
1881 This variable is read-only.
1882 <DT><B>BASH_SOURCE</B>
1883
1884 <DD>
1885 An array variable whose members are the source filenames
1886 where the corresponding shell function names in the
1887 <FONT SIZE=-1><B>FUNCNAME</B>
1888
1889 </FONT>
1890 array variable are defined.
1891 The shell function
1892 <B>${FUNCNAME[</B><I>$i</I><B>]}</B> is defined in the file
1893 <B>${BASH_SOURCE[</B><I>$i</I><B>]}</B> and called from
1894 <B>${BASH_SOURCE[</B><I>$i+1</I><B>]}</B>.
1895 <DT><B>BASH_SUBSHELL</B>
1896
1897 <DD>
1898 Incremented by one each time a subshell or subshell environment is spawned.
1899 The initial value is 0.
1900 <DT><B>BASH_VERSINFO</B>
1901
1902 <DD>
1903 A readonly array variable whose members hold version information for
1904 this instance of
1905 <B>bash</B>.
1906
1907 The values assigned to the array members are as follows:
1908 <P>
1909 <DL COMPACT><DT><DD>
1910
1911 <DL COMPACT>
1912 <DT><B>BASH_VERSINFO[</B>0]
1913
1914 <DD>
1915 The major version number (the <I>release</I>).
1916 <DT><B>BASH_VERSINFO[</B>1]
1917
1918 <DD>
1919 The minor version number (the <I>version</I>).
1920 <DT><B>BASH_VERSINFO[</B>2]
1921
1922 <DD>
1923 The patch level.
1924 <DT><B>BASH_VERSINFO[</B>3]
1925
1926 <DD>
1927 The build version.
1928 <DT><B>BASH_VERSINFO[</B>4]
1929
1930 <DD>
1931 The release status (e.g., <I>beta1</I>).
1932 <DT><B>BASH_VERSINFO[</B>5]
1933
1934 <DD>
1935 The value of
1936 <FONT SIZE=-1><B>MACHTYPE</B>.
1937
1938 </FONT>
1939
1940 </DL></DL>
1941
1942 <DT><B>BASH_VERSION</B>
1943
1944 <DD>
1945 Expands to a string describing the version of this instance of
1946 <B>bash</B>.
1947
1948 <DT><B>COMP_CWORD</B>
1949
1950 <DD>
1951 An index into <B>${COMP_WORDS}</B> of the word containing the current
1952 cursor position.
1953 This variable is available only in shell functions invoked by the
1954 programmable completion facilities (see <B>Programmable Completion</B>
1955 below).
1956 <DT><B>COMP_KEY</B>
1957
1958 <DD>
1959 The key (or final key of a key sequence) used to invoke the current
1960 completion function.
1961 <DT><B>COMP_LINE</B>
1962
1963 <DD>
1964 The current command line.
1965 This variable is available only in shell functions and external
1966 commands invoked by the
1967 programmable completion facilities (see <B>Programmable Completion</B>
1968 below).
1969 <DT><B>COMP_POINT</B>
1970
1971 <DD>
1972 The index of the current cursor position relative to the beginning of
1973 the current command.
1974 If the current cursor position is at the end of the current command,
1975 the value of this variable is equal to <B>${#COMP_LINE}</B>.
1976 This variable is available only in shell functions and external
1977 commands invoked by the
1978 programmable completion facilities (see <B>Programmable Completion</B>
1979 below).
1980 <DT><B>COMP_TYPE</B>
1981
1982 <DD>
1983 Set to an integer value corresponding to the type of completion attempted
1984 that caused a completion function to be called:
1985 <I>TAB</I>, for normal completion,
1986 <I>?</I>, for listing completions after successive tabs,
1987 <I>!</I>, for listing alternatives on partial word completion,
1988 <I>@</I>, to list completions if the word is not unmodified,
1989 or
1990 <I>%</I>, for menu completion.
1991 This variable is available only in shell functions and external
1992 commands invoked by the
1993 programmable completion facilities (see <B>Programmable Completion</B>
1994 below).
1995 <DT><B>COMP_WORDBREAKS</B>
1996
1997 <DD>
1998 The set of characters that the <B>readline</B> library treats as word
1999 separators when performing word completion.
2000 If
2001 <FONT SIZE=-1><B>COMP_WORDBREAKS</B>
2002
2003 </FONT>
2004 is unset, it loses its special properties, even if it is
2005 subsequently reset.
2006 <DT><B>COMP_WORDS</B>
2007
2008 <DD>
2009 An array variable (see <B>Arrays</B> below) consisting of the individual
2010 words in the current command line.
2011 The line is split into words as <B>readline</B> would split it, using
2012 <FONT SIZE=-1><B>COMP_WORDBREAKS</B>
2013
2014 </FONT>
2015 as described above.
2016 This variable is available only in shell functions invoked by the
2017 programmable completion facilities (see <B>Programmable Completion</B>
2018 below).
2019 <DT><B>COPROC</B>
2020
2021 <DD>
2022 An array variable (see <B>Arrays</B> below) created to hold the file descriptors
2023 for output from and input to an unnamed coprocess (see <B>Coprocesses</B>
2024 above).
2025 <DT><B>DIRSTACK</B>
2026
2027 <DD>
2028 An array variable (see
2029 <B>Arrays</B>
2030
2031 below) containing the current contents of the directory stack.
2032 Directories appear in the stack in the order they are displayed by the
2033 <B>dirs</B>
2034
2035 builtin.
2036 Assigning to members of this array variable may be used to modify
2037 directories already in the stack, but the
2038 <B>pushd</B>
2039
2040 and
2041 <B>popd</B>
2042
2043 builtins must be used to add and remove directories.
2044 Assignment to this variable will not change the current directory.
2045 If
2046 <FONT SIZE=-1><B>DIRSTACK</B>
2047
2048 </FONT>
2049 is unset, it loses its special properties, even if it is
2050 subsequently reset.
2051 <DT><B>EUID</B>
2052
2053 <DD>
2054 Expands to the effective user ID of the current user, initialized at
2055 shell startup.  This variable is readonly.
2056 <DT><B>FUNCNAME</B>
2057
2058 <DD>
2059 An array variable containing the names of all shell functions
2060 currently in the execution call stack.
2061 The element with index 0 is the name of any currently-executing
2062 shell function.
2063 The bottom-most element (the one with the highest index) is
2064 <TT>&quot;main&quot;</TT>.
2065
2066 This variable exists only when a shell function is executing.
2067 Assignments to
2068 <FONT SIZE=-1><B>FUNCNAME</B>
2069
2070 </FONT>
2071 have no effect and return an error status.
2072 If
2073 <FONT SIZE=-1><B>FUNCNAME</B>
2074
2075 </FONT>
2076 is unset, it loses its special properties, even if it is
2077 subsequently reset.
2078 <P>
2079
2080
2081 This variable can be used with <B>BASH_LINENO</B> and <B>BASH_SOURCE</B>.
2082 Each element of <B>FUNCNAME</B> has corresponding elements in
2083 <B>BASH_LINENO</B> and <B>BASH_SOURCE</B> to describe the call stack.
2084 For instance, <B>${FUNCNAME[</B><I>$i</I><B>]}</B> was called from the file
2085 <B>${BASH_SOURCE[</B><I>$i+1</I><B>]}</B> at line number
2086 <B>${BASH_LINENO[</B><I>$i</I><B>]}</B>.
2087 The <B>caller</B> builtin displays the current call stack using this
2088 information.
2089 <DT><B>GROUPS</B>
2090
2091 <DD>
2092 An array variable containing the list of groups of which the current
2093 user is a member.
2094 Assignments to    
2095 <FONT SIZE=-1><B>GROUPS</B>
2096
2097 </FONT>
2098 have no effect and return an error status.
2099 If
2100 <FONT SIZE=-1><B>GROUPS</B>
2101
2102 </FONT>
2103 is unset, it loses its special properties, even if it is
2104 subsequently reset.
2105 <DT><B>HISTCMD</B>
2106
2107 <DD>
2108 The history number, or index in the history list, of the current
2109 command.
2110 If
2111 <FONT SIZE=-1><B>HISTCMD</B>
2112
2113 </FONT>
2114 is unset, it loses its special properties, even if it is
2115 subsequently reset.
2116 <DT><B>HOSTNAME</B>
2117
2118 <DD>
2119 Automatically set to the name of the current host.
2120 <DT><B>HOSTTYPE</B>
2121
2122 <DD>
2123 Automatically set to a string that uniquely
2124 describes the type of machine on which
2125 <B>bash</B>
2126
2127 is executing.
2128 The default is system-dependent.
2129 <DT><B>LINENO</B>
2130
2131 <DD>
2132 Each time this parameter is referenced, the shell substitutes
2133 a decimal number representing the current sequential line number
2134 (starting with 1) within a script or function.  When not in a
2135 script or function, the value substituted is not guaranteed to
2136 be meaningful.
2137 If
2138 <FONT SIZE=-1><B>LINENO</B>
2139
2140 </FONT>
2141 is unset, it loses its special properties, even if it is
2142 subsequently reset.
2143 <DT><B>MACHTYPE</B>
2144
2145 <DD>
2146 Automatically set to a string that fully describes the system
2147 type on which
2148 <B>bash</B>
2149
2150 is executing, in the standard GNU <I>cpu-company-system</I> format.
2151 The default is system-dependent.
2152 <DT><B>MAPFILE</B>
2153
2154 <DD>
2155 An array variable (see <B>Arrays</B> below) created to hold the text
2156 read by the <B>mapfile</B> builtin when no variable name is supplied.
2157 <DT><B>OLDPWD</B>
2158
2159 <DD>
2160 The previous working directory as set by the
2161 <B>cd</B>
2162
2163 command.
2164 <DT><B>OPTARG</B>
2165
2166 <DD>
2167 The value of the last option argument processed by the
2168 <B>getopts</B>
2169
2170 builtin command (see
2171 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
2172
2173 </FONT>
2174 below).
2175 <DT><B>OPTIND</B>
2176
2177 <DD>
2178 The index of the next argument to be processed by the
2179 <B>getopts</B>
2180
2181 builtin command (see
2182 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
2183
2184 </FONT>
2185 below).
2186 <DT><B>OSTYPE</B>
2187
2188 <DD>
2189 Automatically set to a string that
2190 describes the operating system on which
2191 <B>bash</B>
2192
2193 is executing.
2194 The default is system-dependent.
2195 <DT><B>PIPESTATUS</B>
2196
2197 <DD>
2198 An array variable (see
2199 <B>Arrays</B>
2200
2201 below) containing a list of exit status values from the processes
2202 in the most-recently-executed foreground pipeline (which may
2203 contain only a single command).
2204 <DT><B>PPID</B>
2205
2206 <DD>
2207 The process ID of the shell's parent.  This variable is readonly.
2208 <DT><B>PWD</B>
2209
2210 <DD>
2211 The current working directory as set by the
2212 <B>cd</B>
2213
2214 command.
2215 <DT><B>RANDOM</B>
2216
2217 <DD>
2218 Each time this parameter is referenced, a random integer between
2219 0 and 32767 is
2220 generated.  The sequence of random numbers may be initialized by assigning
2221 a value to
2222 <FONT SIZE=-1><B>RANDOM</B>.
2223
2224 </FONT>
2225 If
2226 <FONT SIZE=-1><B>RANDOM</B>
2227
2228 </FONT>
2229 is unset, it loses its special properties, even if it is
2230 subsequently reset.
2231 <DT><B>READLINE_LINE</B>
2232
2233 <DD>
2234 The contents of the
2235 <B>readline</B>
2236
2237 line buffer, for use with
2238 <TT>bind -x</TT>
2239
2240 (see
2241 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
2242
2243 </FONT>
2244 below).
2245 <DT><B>READLINE_POINT</B>
2246
2247 <DD>
2248 The position of the insertion point in the
2249 <B>readline</B>
2250
2251 line buffer, for use with
2252 <TT>bind -x</TT>
2253
2254 (see
2255 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
2256
2257 </FONT>
2258 below).
2259 <DT><B>REPLY</B>
2260
2261 <DD>
2262 Set to the line of input read by the
2263 <B>read</B>
2264
2265 builtin command when no arguments are supplied.
2266 <DT><B>SECONDS</B>
2267
2268 <DD>
2269 Each time this parameter is
2270 referenced, the number of seconds since shell invocation is returned.  If a
2271 value is assigned to 
2272 <FONT SIZE=-1><B>SECONDS</B>,
2273
2274 </FONT>
2275 the value returned upon subsequent
2276 references is
2277 the number of seconds since the assignment plus the value assigned.
2278 If
2279 <FONT SIZE=-1><B>SECONDS</B>
2280
2281 </FONT>
2282 is unset, it loses its special properties, even if it is
2283 subsequently reset.
2284 <DT><B>SHELLOPTS</B>
2285
2286 <DD>
2287 A colon-separated list of enabled shell options.  Each word in
2288 the list is a valid argument for the
2289 <B>-o</B>
2290
2291 option to the
2292 <B>set</B>
2293
2294 builtin command (see
2295 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
2296
2297 </FONT>
2298 below).  The options appearing in
2299 <FONT SIZE=-1><B>SHELLOPTS</B>
2300
2301 </FONT>
2302 are those reported as
2303 <I>on</I>
2304
2305 by <B>set -o</B>.
2306 If this variable is in the environment when
2307 <B>bash</B>
2308
2309 starts up, each shell option in the list will be enabled before
2310 reading any startup files.
2311 This variable is read-only.
2312 <DT><B>SHLVL</B>
2313
2314 <DD>
2315 Incremented by one each time an instance of
2316 <B>bash</B>
2317
2318 is started.
2319 <DT><B>UID</B>
2320
2321 <DD>
2322 Expands to the user ID of the current user, initialized at shell startup.
2323 This variable is readonly.
2324
2325 </DL>
2326 <P>
2327
2328 The following variables are used by the shell.  In some cases,
2329 <B>bash</B>
2330
2331 assigns a default value to a variable; these cases are noted
2332 below.
2333 <P>
2334
2335
2336 <DL COMPACT>
2337 <DT><B>BASH_ENV</B>
2338
2339 <DD>
2340 If this parameter is set when <B>bash</B> is executing a shell script,
2341 its value is interpreted as a filename containing commands to
2342 initialize the shell, as in
2343 <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>.
2344
2345 The value of
2346 <FONT SIZE=-1><B>BASH_ENV</B>
2347
2348 </FONT>
2349 is subjected to parameter expansion, command substitution, and arithmetic
2350 expansion before being interpreted as a file name.
2351 <FONT SIZE=-1><B>PATH</B>
2352
2353 </FONT>
2354 is not used to search for the resultant file name.
2355 <DT><B>BASH_XTRACEFD</B>
2356
2357 <DD>
2358 If set to an integer corresponding to a valid file descriptor, <B>bash</B>
2359 will write the trace output generated when
2360 <TT>set -x</TT>
2361
2362 is enabled to that file descriptor.
2363 The file descriptor is closed when
2364 <FONT SIZE=-1><B>BASH_XTRACEFD</B>
2365
2366 </FONT>
2367 is unset or assigned a new value.
2368 Unsetting
2369 <FONT SIZE=-1><B>BASH_XTRACEFD</B>
2370
2371 </FONT>
2372 or assigning it the empty string causes the
2373 trace output to be sent to the standard error.
2374 Note that setting
2375 <FONT SIZE=-1><B>BASH_XTRACEFD</B>
2376
2377 </FONT>
2378 to 2 (the standard error file
2379 descriptor) and then unsetting it will result in the standard error
2380 being closed.
2381 <DT><B>CDPATH</B>
2382
2383 <DD>
2384 The search path for the
2385 <B>cd</B>
2386
2387 command.
2388 This is a colon-separated list of directories in which the shell looks
2389 for destination directories specified by the
2390 <B>cd</B>
2391
2392 command.
2393 A sample value is
2394 <TT>&quot;.:~:/usr&quot;</TT>.
2395
2396 <DT><B>COLUMNS</B>
2397
2398 <DD>
2399 Used by the <B>select</B> compound command to determine the terminal width
2400 when printing selection lists.  Automatically set upon receipt of a
2401 <FONT SIZE=-1><B>SIGWINCH</B>.
2402
2403 </FONT>
2404 <DT><B>COMPREPLY</B>
2405
2406 <DD>
2407 An array variable from which <B>bash</B> reads the possible completions
2408 generated by a shell function invoked by the programmable completion
2409 facility (see <B>Programmable Completion</B> below).
2410 <DT><B>EMACS</B>
2411
2412 <DD>
2413 If <B>bash</B> finds this variable in the environment when the shell starts
2414 with value
2415 <TT>t</TT>,
2416
2417 it assumes that the shell is running in an Emacs shell buffer and disables
2418 line editing.
2419 <DT><B>ENV</B>
2420
2421 <DD>
2422 Similar to
2423 <FONT SIZE=-1><B>BASH_ENV</B>;
2424
2425 </FONT>
2426 used when the shell is invoked in POSIX mode.
2427 <DT><B>FCEDIT</B>
2428
2429 <DD>
2430 The default editor for the
2431 <B>fc</B>
2432
2433 builtin command.
2434 <DT><B>FIGNORE</B>
2435
2436 <DD>
2437 A colon-separated list of suffixes to ignore when performing
2438 filename completion (see
2439 <FONT SIZE=-1><B>READLINE</B>
2440
2441 </FONT>
2442 below).
2443 A filename whose suffix matches one of the entries in 
2444 <FONT SIZE=-1><B>FIGNORE</B>
2445
2446 </FONT>
2447 is excluded from the list of matched filenames.
2448 A sample value is
2449 <TT>&quot;.o:~&quot;</TT>.
2450
2451 <DT><B>FUNCNEST</B>
2452
2453 <DD>
2454 If set to a numeric value greater than 0, defines a maximum function
2455 nesting level.  Function invocations that exceed this nesting level
2456 will cause the current command to abort.
2457 <DT><B>GLOBIGNORE</B>
2458
2459 <DD>
2460 A colon-separated list of patterns defining the set of filenames to
2461 be ignored by pathname expansion.
2462 If a filename matched by a pathname expansion pattern also matches one
2463 of the patterns in
2464 <FONT SIZE=-1><B>GLOBIGNORE</B>,
2465
2466 </FONT>
2467 it is removed from the list of matches.
2468 <DT><B>HISTCONTROL</B>
2469
2470 <DD>
2471 A colon-separated list of values controlling how commands are saved on
2472 the history list.
2473 If the list of values includes
2474 <I>ignorespace</I>,
2475
2476 lines which begin with a
2477 <B>space</B>
2478
2479 character are not saved in the history list.
2480 A value of 
2481 <I>ignoredups</I>
2482
2483 causes lines matching the previous history entry to not be saved.
2484 A value of
2485 <I>ignoreboth</I>
2486
2487 is shorthand for <I>ignorespace</I> and <I>ignoredups</I>.
2488 A value of
2489 <I>erasedups</I>
2490
2491 causes all previous lines matching the current line to be removed from
2492 the history list before that line is saved.
2493 Any value not in the above list is ignored.
2494 If
2495 <FONT SIZE=-1><B>HISTCONTROL</B>
2496
2497 </FONT>
2498 is unset, or does not include a valid value,
2499 all lines read by the shell parser are saved on the history list,
2500 subject to the value of
2501 <FONT SIZE=-1><B>HISTIGNORE</B>.
2502
2503 </FONT>
2504 The second and subsequent lines of a multi-line compound command are
2505 not tested, and are added to the history regardless of the value of
2506 <FONT SIZE=-1><B>HISTCONTROL</B>.
2507
2508 </FONT>
2509 <DT><B>HISTFILE</B>
2510
2511 <DD>
2512 The name of the file in which command history is saved (see
2513 <FONT SIZE=-1><B>HISTORY</B>
2514
2515 </FONT>
2516 below).  The default value is <A HREF="file:~/.bash_history"><I>~/.bash_history</I></A>.  If unset, the
2517 command history is not saved when an interactive shell exits.
2518 <DT><B>HISTFILESIZE</B>
2519
2520 <DD>
2521 The maximum number of lines contained in the history file.  When this
2522 variable is assigned a value, the history file is truncated, if
2523 necessary, by removing the oldest entries,
2524 to contain no more than that number of lines.  The default
2525 value is 500.  The history file is also truncated to this size after
2526 writing it when an interactive shell exits.
2527 <DT><B>HISTIGNORE</B>
2528
2529 <DD>
2530 A colon-separated list of patterns used to decide which command lines
2531 should be saved on the history list.  Each pattern is anchored at the
2532 beginning of the line and must match the complete line (no implicit
2533 `<B>*</B>' is appended).  Each pattern is tested against the line
2534 after the checks specified by
2535 <FONT SIZE=-1><B>HISTCONTROL</B>
2536
2537 </FONT>
2538 are applied.
2539 In addition to the normal shell pattern matching characters, `<B>&amp;</B>'
2540 matches the previous history line.  `<B>&amp;</B>' may be escaped using a
2541 backslash; the backslash is removed before attempting a match.
2542 The second and subsequent lines of a multi-line compound command are
2543 not tested, and are added to the history regardless of the value of
2544 <FONT SIZE=-1><B>HISTIGNORE</B>.
2545
2546 </FONT>
2547 <DT><B>HISTSIZE</B>
2548
2549 <DD>
2550 The number of commands to remember in the command history (see
2551 <FONT SIZE=-1><B>HISTORY</B>
2552
2553 </FONT>
2554 below).  The default value is 500.
2555 <DT><B>HISTTIMEFORMAT</B>
2556
2557 <DD>
2558 If this variable is set and not null, its value is used as a format string
2559 for <I>strftime</I>(3) to print the time stamp associated with each history
2560 entry displayed by the <B>history</B> builtin.
2561 If this variable is set, time stamps are written to the history file so
2562 they may be preserved across shell sessions.
2563 This uses the history comment character to distinguish timestamps from
2564 other history lines.
2565 <DT><B>HOME</B>
2566
2567 <DD>
2568 The home directory of the current user; the default argument for the
2569 <B>cd</B> builtin command.
2570 The value of this variable is also used when performing tilde expansion.
2571 <DT><B>HOSTFILE</B>
2572
2573 <DD>
2574 Contains the name of a file in the same format as
2575
2576 <I>/etc/hosts</I>
2577
2578 that should be read when the shell needs to complete a
2579 hostname.
2580 The list of possible hostname completions may be changed while the
2581 shell is running;
2582 the next time hostname completion is attempted after the
2583 value is changed,
2584 <B>bash</B>
2585
2586 adds the contents of the new file to the existing list.
2587 If
2588 <FONT SIZE=-1><B>HOSTFILE</B>
2589
2590 </FONT>
2591 is set, but has no value, or does not name a readable file,
2592 <B>bash</B> attempts to read
2593
2594 <I>/etc/hosts</I>
2595
2596 to obtain the list of possible hostname completions.
2597 When
2598 <FONT SIZE=-1><B>HOSTFILE</B>
2599
2600 </FONT>
2601 is unset, the hostname list is cleared.
2602 <DT><B>IFS</B>
2603
2604 <DD>
2605 The
2606 <I>Internal Field Separator</I>
2607
2608 that is used
2609 for word splitting after expansion and to
2610 split lines into words with the
2611 <B>read</B>
2612
2613 builtin command.  The default value is
2614 ``&lt;space&gt;&lt;tab&gt;&lt;newline&gt;''.
2615 <DT><B>IGNOREEOF</B>
2616
2617 <DD>
2618 Controls the
2619 action of an interactive shell on receipt of an
2620 <FONT SIZE=-1><B>EOF</B>
2621
2622 </FONT>
2623 character as the sole input.  If set, the value is the number of
2624 consecutive
2625 <FONT SIZE=-1><B>EOF</B>
2626
2627 </FONT>
2628 characters which must be
2629 typed as the first characters on an input line before
2630 <B>bash</B>
2631
2632 exits.  If the variable exists but does not have a numeric value, or
2633 has no value, the default value is 10.  If it does not exist,
2634 <FONT SIZE=-1><B>EOF</B>
2635
2636 </FONT>
2637 signifies the end of input to the shell.
2638 <DT><B>INPUTRC</B>
2639
2640 <DD>
2641 The filename for the
2642 <B>readline</B>
2643
2644 startup file, overriding the default of
2645
2646 <A HREF="file:~/.inputrc"><I>~/.inputrc</I></A>
2647
2648 (see
2649 <FONT SIZE=-1><B>READLINE</B>
2650
2651 </FONT>
2652 below).
2653 <DT><B>LANG</B>
2654
2655 <DD>
2656 Used to determine the locale category for any category not specifically
2657 selected with a variable starting with <B>LC_</B>.
2658 <DT><B>LC_ALL</B>
2659
2660 <DD>
2661 This variable overrides the value of
2662 <FONT SIZE=-1><B>LANG</B>
2663
2664 </FONT>
2665 and any other
2666 <B>LC_</B> variable specifying a locale category.
2667 <DT><B>LC_COLLATE</B>
2668
2669 <DD>
2670 This variable determines the collation order used when sorting the
2671 results of pathname expansion, and determines the behavior of range
2672 expressions, equivalence classes, and collating sequences within
2673 pathname expansion and pattern matching.
2674 <DT><B>LC_CTYPE</B>
2675
2676 <DD>
2677 This variable determines the interpretation of characters and the
2678 behavior of character classes within pathname expansion and pattern
2679 matching.
2680 <DT><B>LC_MESSAGES</B>
2681
2682 <DD>
2683 This variable determines the locale used to translate double-quoted
2684 strings preceded by a <B>$</B>.
2685 <DT><B>LC_NUMERIC</B>
2686
2687 <DD>
2688 This variable determines the locale category used for number formatting.
2689 <DT><B>LINES</B>
2690
2691 <DD>
2692 Used by the <B>select</B> compound command to determine the column length
2693 for printing selection lists.  Automatically set upon receipt of a
2694 <FONT SIZE=-1><B>SIGWINCH</B>.
2695
2696 </FONT>
2697 <DT><B>MAIL</B>
2698
2699 <DD>
2700 If this parameter is set to a file or directory name and the
2701 <FONT SIZE=-1><B>MAILPATH</B>
2702
2703 </FONT>
2704 variable is not set,
2705 <B>bash</B>
2706
2707 informs the user of the arrival of mail in the specified file or
2708 Maildir-format directory.
2709 <DT><B>MAILCHECK</B>
2710
2711 <DD>
2712 Specifies how
2713 often (in seconds)
2714 <B>bash</B>
2715
2716 checks for mail.  The default is 60 seconds.  When it is time to check
2717 for mail, the shell does so before displaying the primary prompt.
2718 If this variable is unset, or set to a value that is not a number
2719 greater than or equal to zero, the shell disables mail checking.
2720 <DT><B>MAILPATH</B>
2721
2722 <DD>
2723 A colon-separated list of file names to be checked for mail. 
2724 The message to be printed when mail arrives in a particular file
2725 may be specified by separating the file name from the message with a `?'.
2726 When used in the text of the message, <B>$_</B> expands to the name of
2727 the current mailfile. 
2728 Example:
2729 <DL COMPACT><DT><DD>
2730 <P>
2731
2732 <B>MAILPATH</B>=aq/var/mail/bfox?&quot;You have mail&quot;:~/shell-mail?&quot;$_ has mail!&quot;aq
2733 <P>
2734
2735 <B>Bash</B>
2736
2737 supplies a default value for this variable, but the location of the user
2738 mail files that it uses is system dependent (e.g., /var/mail/<B>$USER</B>).
2739 </DL>
2740
2741 <DT><B>OPTERR</B>
2742
2743 <DD>
2744 If set to the value 1,
2745 <B>bash</B>
2746
2747 displays error messages generated by the
2748 <B>getopts</B>
2749
2750 builtin command (see
2751 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
2752
2753 </FONT>
2754 below).
2755 <FONT SIZE=-1><B>OPTERR</B>
2756
2757 </FONT>
2758 is initialized to 1 each time the shell is invoked or a shell
2759 script is executed.
2760 <DT><B>PATH</B>
2761
2762 <DD>
2763 The search path for commands.  It
2764 is a colon-separated list of directories in which
2765 the shell looks for commands (see
2766 <FONT SIZE=-1><B>COMMAND EXECUTION</B>
2767
2768 </FONT>
2769 below).
2770 A zero-length (null) directory name in the value of
2771 <FONT SIZE=-1><B>PATH</B>
2772
2773 </FONT>
2774 indicates the current directory.
2775 A null directory name may appear as two adjacent colons, or as an initial
2776 or trailing colon.
2777 The default path is system-dependent,
2778 and is set by the administrator who installs
2779 <B>bash</B>.
2780
2781 A common value is
2782 <TT>/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin</TT>.
2783
2784 <DT><B>POSIXLY_CORRECT</B>
2785
2786 <DD>
2787 If this variable is in the environment when <B>bash</B> starts, the shell
2788 enters <I>posix mode</I> before reading the startup files, as if the
2789 <B>--posix</B>
2790
2791 invocation option had been supplied.  If it is set while the shell is
2792 running, <B>bash</B> enables <I>posix mode</I>, as if the command
2793 <TT>set -o posix</TT>
2794
2795 had been executed.
2796 <DT><B>PROMPT_COMMAND</B>
2797
2798 <DD>
2799 If set, the value is executed as a command prior to issuing each primary
2800 prompt.
2801 <DT><B>PROMPT_DIRTRIM</B>
2802
2803 <DD>
2804 If set to a number greater than zero, the value is used as the number of
2805 trailing directory components to retain when expanding the <B>\w</B> and
2806 <B>\W</B> prompt string escapes (see
2807 <FONT SIZE=-1><B>PROMPTING</B>
2808
2809 </FONT>
2810 below).  Characters removed are replaced with an ellipsis.
2811 <DT><B>PS1</B>
2812
2813 <DD>
2814 The value of this parameter is expanded (see
2815 <FONT SIZE=-1><B>PROMPTING</B>
2816
2817 </FONT>
2818 below) and used as the primary prompt string.  The default value is
2819 ``<B>\s-\v\$ </B>''.
2820 <DT><B>PS2</B>
2821
2822 <DD>
2823 The value of this parameter is expanded as with
2824 <FONT SIZE=-1><B>PS1</B>
2825
2826 </FONT>
2827 and used as the secondary prompt string.  The default is
2828 ``<B>&gt; </B>''.
2829 <DT><B>PS3</B>
2830
2831 <DD>
2832 The value of this parameter is used as the prompt for the
2833 <B>select</B>
2834
2835 command (see
2836 <FONT SIZE=-1><B>SHELL GRAMMAR</B>
2837
2838 </FONT>
2839 above).
2840 <DT><B>PS4</B>
2841
2842 <DD>
2843 The value of this parameter is expanded as with
2844 <FONT SIZE=-1><B>PS1</B>
2845
2846 </FONT>
2847 and the value is printed before each command
2848 <B>bash</B>
2849
2850 displays during an execution trace.  The first character of
2851 <FONT SIZE=-1><B>PS4</B>
2852
2853 </FONT>
2854 is replicated multiple times, as necessary, to indicate multiple
2855 levels of indirection.  The default is ``<B>+ </B>''.
2856 <DT><B>SHELL</B>
2857
2858 <DD>
2859 The full pathname to the shell is kept in this environment variable.
2860 If it is not set when the shell starts,
2861 <B>bash</B>
2862
2863 assigns to it the full pathname of the current user's login shell.
2864 <DT><B>TIMEFORMAT</B>
2865
2866 <DD>
2867 The value of this parameter is used as a format string specifying
2868 how the timing information for pipelines prefixed with the
2869 <B>time</B>
2870
2871 reserved word should be displayed.
2872 The <B>%</B> character introduces an escape sequence that is
2873 expanded to a time value or other information.
2874 The escape sequences and their meanings are as follows; the
2875 braces denote optional portions.
2876 <P>
2877 <DL COMPACT><DT><DD>
2878
2879 <DL COMPACT>
2880 <DT><B>%%</B>
2881
2882 <DD>
2883 A literal <B>%</B>.
2884 <DT><B>%[</B><I>p</I>][l]R
2885
2886 <DD>
2887 The elapsed time in seconds.
2888 <DT><B>%[</B><I>p</I>][l]U
2889
2890 <DD>
2891 The number of CPU seconds spent in user mode.
2892 <DT><B>%[</B><I>p</I>][l]S
2893
2894 <DD>
2895 The number of CPU seconds spent in system mode.
2896 <DT><B>%P</B>
2897
2898 <DD>
2899 The CPU percentage, computed as (%U + %S) / %R.
2900
2901 </DL></DL>
2902
2903 <DT><DD>
2904 The optional <I>p</I> is a digit specifying the <I>precision</I>,
2905 the number of fractional digits after a decimal point.
2906 A value of 0 causes no decimal point or fraction to be output.
2907 At most three places after the decimal point may be specified;
2908 values of <I>p</I> greater than 3 are changed to 3.
2909 If <I>p</I> is not specified, the value 3 is used.
2910 <DT><DD>
2911 The optional <B>l</B> specifies a longer format, including
2912 minutes, of the form <I>MM</I>m<I>SS</I>.<I>FF</I>s.
2913 The value of <I>p</I> determines whether or not the fraction is
2914 included.
2915 <DT><DD>
2916 If this variable is not set, <B>bash</B> acts as if it had the
2917 value <B>$aq\nreal\t%3lR\nuser\t%3lU\nsys       %3lSaq</B>.
2918 If the value is null, no timing information is displayed.
2919 A trailing newline is added when the format string is displayed.
2920 <DT><B>TMOUT</B>
2921
2922 <DD>
2923 If set to a value greater than zero,
2924 <FONT SIZE=-1><B>TMOUT</B>
2925
2926 </FONT>
2927 is treated as the
2928 default timeout for the <B>read</B> builtin.
2929 The <B>select</B> command terminates if input does not arrive
2930 after
2931 <FONT SIZE=-1><B>TMOUT</B>
2932
2933 </FONT>
2934 seconds when input is coming from a terminal.
2935 In an interactive shell, the value is interpreted as the
2936 number of seconds to wait for input after issuing the primary prompt.
2937 <B>Bash</B>
2938
2939 terminates after waiting for that number of seconds if input does
2940 not arrive.
2941 <DT><B>TMPDIR</B>
2942
2943 <DD>
2944 If set, <B>bash</B> uses its value as the name of a directory in which
2945 <B>bash</B> creates temporary files for the shell's use.
2946 <DT><B>auto_resume</B>
2947
2948 <DD>
2949 This variable controls how the shell interacts with the user and
2950 job control.  If this variable is set, single word simple
2951 commands without redirections are treated as candidates for resumption
2952 of an existing stopped job.  There is no ambiguity allowed; if there is
2953 more than one job beginning with the string typed, the job most recently
2954 accessed is selected.  The
2955 <I>name</I>
2956
2957 of a stopped job, in this context, is the command line used to
2958 start it.
2959 If set to the value
2960 <I>exact</I>,
2961
2962 the string supplied must match the name of a stopped job exactly;
2963 if set to
2964 <I>substring</I>,
2965
2966 the string supplied needs to match a substring of the name of a
2967 stopped job.  The
2968 <I>substring</I>
2969
2970 value provides functionality analogous to the
2971 <B>%?</B>
2972
2973 job identifier (see
2974 <FONT SIZE=-1><B>JOB CONTROL</B>
2975
2976 </FONT>
2977 below).  If set to any other value, the supplied string must
2978 be a prefix of a stopped job's name; this provides functionality
2979 analogous to the <B>%</B><I>string</I> job identifier.
2980 <DT><B>histchars</B>
2981
2982 <DD>
2983 The two or three characters which control history expansion
2984 and tokenization (see
2985 <FONT SIZE=-1><B>HISTORY EXPANSION</B>
2986
2987 </FONT>
2988 below).  The first character is the <I>history expansion</I> character,
2989 the character which signals the start of a history
2990 expansion, normally `<B>!</B>'.
2991 The second character is the <I>quick substitution</I>
2992 character, which is used as shorthand for re-running the previous
2993 command entered, substituting one string for another in the command.
2994 The default is `<B>^</B>'.
2995 The optional third character is the character
2996 which indicates that the remainder of the line is a comment when found
2997 as the first character of a word, normally `<B>#</B>'.  The history
2998 comment character causes history substitution to be skipped for the
2999 remaining words on the line.  It does not necessarily cause the shell
3000 parser to treat the rest of the line as a comment.
3001
3002 </DL>
3003 <A NAME="lbAX">&nbsp;</A>
3004 <H4>Arrays</H4>
3005
3006 <B>Bash</B>
3007
3008 provides one-dimensional indexed and associative array variables.
3009 Any variable may be used as an indexed array; the
3010 <B>declare</B>
3011
3012 builtin will explicitly declare an array.
3013 There is no maximum
3014 limit on the size of an array, nor any requirement that members
3015 be indexed or assigned contiguously.
3016 Indexed arrays are referenced using integers (including arithmetic
3017 expressions)  and are zero-based; associative arrays are referenced
3018 using arbitrary strings.
3019 <P>
3020
3021 An indexed array is created automatically if any variable is assigned to
3022 using the syntax <I>name</I>[<I>subscript</I>]=<I>value</I>.  The
3023 <I>subscript</I>
3024
3025 is treated as an arithmetic expression that must evaluate to a number.
3026 If
3027 <I>subscript</I>
3028
3029 evaluates to a number less than zero, it is used as
3030 an offset from one greater than the array's maximum index (so a subcript
3031 of -1 refers to the last element of the array).
3032 To explicitly declare an indexed array, use
3033 <B>declare -a </B><I>name</I>
3034
3035 (see
3036 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
3037
3038 </FONT>
3039 below).
3040 <B>declare -a </B><I>name</I>[<I>subscript</I>]
3041
3042 is also accepted; the <I>subscript</I> is ignored.
3043 <P>
3044
3045 Associative arrays are created using
3046 <B>declare -A </B><I>name</I>.
3047
3048 <P>
3049
3050 Attributes may be
3051 specified for an array variable using the
3052 <B>declare</B>
3053
3054 and
3055 <B>readonly</B>
3056
3057 builtins.  Each attribute applies to all members of an array.
3058 <P>
3059
3060 Arrays are assigned to using compound assignments of the form
3061 <I>name</I>=<B>(</B>value<I>1</I> ... value<I>n</I><B>)</B>, where each
3062 <I>value</I> is of the form [<I>subscript</I>]=<I>string</I>.
3063 Indexed array assignments do not require the bracket and subscript.
3064 When assigning to indexed arrays, if the optional brackets and subscript
3065 are supplied, that index is assigned to;
3066 otherwise the index of the element assigned is the last index assigned
3067 to by the statement plus one.  Indexing starts at zero.
3068 <P>
3069
3070 When assigning to an associative array, the subscript is required.
3071 <P>
3072
3073 This syntax is also accepted by the
3074 <B>declare</B>
3075
3076 builtin.  Individual array elements may be assigned to using the
3077 <I>name</I>[<I>subscript</I>]=<I>value</I> syntax introduced above.
3078 <P>
3079
3080 Any element of an array may be referenced using
3081 ${<I>name</I>[<I>subscript</I>]}.  The braces are required to avoid
3082 conflicts with pathname expansion.  If
3083 <I>subscript</I> is <B>@</B> or <B>*</B>, the word expands to
3084 all members of <I>name</I>.  These subscripts differ only when the
3085 word appears within double quotes.  If the word is double-quoted,
3086 ${<I>name</I>[*]} expands to a single
3087 word with the value of each array member separated by the first
3088 character of the
3089 <FONT SIZE=-1><B>IFS</B>
3090
3091 </FONT>
3092 special variable, and ${<I>name</I>[@]} expands each element of
3093 <I>name</I> to a separate word.  When there are no array members,
3094 ${<I>name</I>[@]} expands to nothing.
3095 If the double-quoted expansion occurs within a word, the expansion of
3096 the first parameter is joined with the beginning part of the original
3097 word, and the expansion of the last parameter is joined with the last
3098 part of the original word.
3099 This is analogous to the expansion
3100 of the special parameters <B>*</B> and <B>@</B> (see
3101 <B>Special Parameters</B>
3102
3103 above).  ${#<I>name</I>[<I>subscript</I>]} expands to the length of
3104 ${<I>name</I>[<I>subscript</I>]}.  If <I>subscript</I> is <B>*</B> or
3105 <B>@</B>, the expansion is the number of elements in the array.
3106 Referencing an array variable without a subscript is equivalent to
3107 referencing the array with a subscript of 0.
3108 <P>
3109
3110 An array variable is considered set if a subscript has been assigned a
3111 value.  The null string is a valid value.
3112 <P>
3113
3114 The
3115 <B>unset</B>
3116
3117 builtin is used to destroy arrays.  <B>unset</B> <I>name</I>[<I>subscript</I>]
3118 destroys the array element at index <I>subscript</I>.
3119 Care must be taken to avoid unwanted side effects caused by pathname
3120 expansion.
3121 <B>unset</B> <I>name</I>, where <I>name</I> is an array, or
3122 <B>unset</B> <I>name</I>[<I>subscript</I>], where
3123 <I>subscript</I> is <B>*</B> or <B>@</B>, removes the entire array.
3124 <P>
3125
3126 The
3127 <B>declare</B>,
3128
3129 <B>local</B>,
3130
3131 and
3132 <B>readonly</B>
3133
3134 builtins each accept a
3135 <B>-a</B>
3136
3137 option to specify an indexed array and a
3138 <B>-A</B>
3139
3140 option to specify an associative array.
3141 The
3142 <B>read</B>
3143
3144 builtin accepts a
3145 <B>-a</B>
3146
3147 option to assign a list of words read from the standard input
3148 to an array.  The
3149 <B>set</B>
3150
3151 and
3152 <B>declare</B>
3153
3154 builtins display array values in a way that allows them to be
3155 reused as assignments.
3156 <A NAME="lbAY">&nbsp;</A>
3157 <H3>EXPANSION</H3>
3158
3159 Expansion is performed on the command line after it has been split into
3160 words.  There are seven kinds of expansion performed:
3161 <I>brace expansion</I>,
3162
3163 <I>tilde expansion</I>,
3164
3165 <I>parameter and variable expansion</I>,
3166
3167 <I>command substitution</I>,
3168
3169 <I>arithmetic expansion</I>,
3170
3171 <I>word splitting</I>,
3172
3173 and
3174 <I>pathname expansion</I>.
3175
3176 <P>
3177
3178 The order of expansions is: brace expansion, tilde expansion,
3179 parameter, variable and arithmetic expansion and
3180 command substitution
3181 (done in a left-to-right fashion), word splitting, and pathname
3182 expansion.
3183 <P>
3184
3185 On systems that can support it, there is an additional expansion
3186 available: <I>process substitution</I>.
3187 <P>
3188
3189 Only brace expansion, word splitting, and pathname expansion
3190 can change the number of words of the expansion; other expansions
3191 expand a single word to a single word.
3192 The only exceptions to this are the expansions of
3193 &quot;<B>$@</B>&quot; and &quot;<B>${</B><I>name</I><B>[@]}</B>&quot;
3194 as explained above (see
3195 <FONT SIZE=-1><B>PARAMETERS</B>).
3196
3197 </FONT>
3198 <A NAME="lbAZ">&nbsp;</A>
3199 <H4>Brace Expansion</H4>
3200
3201 <P>
3202
3203 <I>Brace expansion</I>
3204
3205 is a mechanism by which arbitrary strings
3206 may be generated.  This mechanism is similar to
3207 <I>pathname expansion</I>, but the filenames generated
3208 need not exist.  Patterns to be brace expanded take
3209 the form of an optional
3210 <I>preamble</I>,
3211
3212 followed by either a series of comma-separated strings or
3213 a sequence expression between a pair of braces, followed by
3214 an optional
3215 <I>postscript</I>.
3216
3217 The preamble is prefixed to each string contained
3218 within the braces, and the postscript is then appended
3219 to each resulting string, expanding left to right.
3220 <P>
3221
3222 Brace expansions may be nested.  The results of each expanded
3223 string are not sorted; left to right order is preserved.
3224 For example, a<B>{</B>d,c,b<B>}</B>e expands into `ade ace abe'.
3225 <P>
3226
3227 A sequence expression takes the form
3228 <B>{</B><I>x</I><B>..</B><I>y</I><B>[..</B><I>incr</I><B>]}</B>,
3229 where <I>x</I> and <I>y</I> are either integers or single characters,
3230 and <I>incr</I>, an optional increment, is an integer.
3231 When integers are supplied, the expression expands to each number between
3232 <I>x</I> and <I>y</I>, inclusive.
3233 Supplied integers may be prefixed with <I>0</I> to force each term to have the
3234 same width.  When either <I>x</I> or y begins with a zero, the shell
3235 attempts to force all generated terms to contain the same number of digits,
3236 zero-padding where necessary.
3237 When characters are supplied, the expression expands to each character
3238 lexicographically between <I>x</I> and <I>y</I>, inclusive.  Note that
3239 both <I>x</I> and <I>y</I> must be of the same type.
3240 When the increment is supplied, it is used as the difference between
3241 each term.  The default increment is 1 or -1 as appropriate.
3242 <P>
3243
3244 Brace expansion is performed before any other expansions,
3245 and any characters special to other expansions are preserved
3246 in the result.  It is strictly textual.
3247 <B>Bash</B>
3248
3249 does not apply any syntactic interpretation to the context of the
3250 expansion or the text between the braces.
3251 <P>
3252
3253 A correctly-formed brace expansion must contain unquoted opening
3254 and closing braces, and at least one unquoted comma or a valid
3255 sequence expression.
3256 Any incorrectly formed brace expansion is left unchanged.
3257 A <B>{</B> or <B>,</B> may be quoted with a backslash to prevent its
3258 being considered part of a brace expression.
3259 To avoid conflicts with parameter expansion, the string <B>${</B>
3260 is not considered eligible for brace expansion.
3261 <P>
3262
3263 This construct is typically used as shorthand when the common
3264 prefix of the strings to be generated is longer than in the
3265 above example:
3266 <DL COMPACT><DT><DD>
3267 <P>
3268
3269 mkdir /usr/local/src/bash/{old,new,dist,bugs}
3270 </DL>
3271
3272 or
3273 <DL COMPACT><DT><DD>
3274 chown root /usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}}
3275 </DL>
3276
3277 <P>
3278
3279 Brace expansion introduces a slight incompatibility with
3280 historical versions of
3281 <B>sh</B>.
3282
3283 <B>sh</B>
3284
3285 does not treat opening or closing braces specially when they
3286 appear as part of a word, and preserves them in the output.
3287 <B>Bash</B>
3288
3289 removes braces from words as a consequence of brace
3290 expansion.  For example, a word entered to
3291 <B>sh</B>
3292
3293 as <I>file{1,2}</I>
3294 appears identically in the output.  The same word is
3295 output as
3296 <I>file1 file2</I>
3297
3298 after expansion by
3299 <B>bash</B>.
3300
3301 If strict compatibility with
3302 <B>sh</B>
3303
3304 is desired, start
3305 <B>bash</B>
3306
3307 with the
3308 <B>+B </B>
3309
3310 option or disable brace expansion with the
3311 <B>+B</B>
3312
3313 option to the
3314 <B>set</B>
3315
3316 command (see
3317 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
3318
3319 </FONT>
3320 below).
3321 <A NAME="lbBA">&nbsp;</A>
3322 <H4>Tilde Expansion</H4>
3323
3324 <P>
3325
3326 If a word begins with an unquoted tilde character (`<B>~</B>'), all of
3327 the characters preceding the first unquoted slash (or all characters,
3328 if there is no unquoted slash) are considered a <I>tilde-prefix</I>.
3329 If none of the characters in the tilde-prefix are quoted, the
3330 characters in the tilde-prefix following the tilde are treated as a
3331 possible <I>login name</I>.
3332 If this login name is the null string, the tilde is replaced with the
3333 value of the shell parameter
3334 <FONT SIZE=-1><B>HOME</B>.
3335
3336 </FONT>
3337 If
3338 <FONT SIZE=-1><B>HOME</B>
3339
3340 </FONT>
3341 is unset, the home directory of the user executing the shell is
3342 substituted instead.
3343 Otherwise, the tilde-prefix is replaced with the home directory
3344 associated with the specified login name.
3345 <P>
3346
3347 If the tilde-prefix is a `~+', the value of the shell variable
3348 <FONT SIZE=-1><B>PWD</B>
3349
3350 </FONT>
3351 replaces the tilde-prefix.
3352 If the tilde-prefix is a `~-', the value of the shell variable
3353 <FONT SIZE=-1><B>OLDPWD</B>,
3354
3355 </FONT>
3356 if it is set, is substituted.
3357 If the characters following the tilde in the tilde-prefix consist
3358 of a number <I>N</I>, optionally prefixed
3359 by a `+' or a `-', the tilde-prefix is replaced with the corresponding
3360 element from the directory stack, as it would be displayed by the
3361 <B>dirs</B>
3362
3363 builtin invoked with the tilde-prefix as an argument.
3364 If the characters following the tilde in the tilde-prefix consist of a
3365 number without a leading `+' or `-', `+' is assumed.
3366 <P>
3367
3368 If the login name is invalid, or the tilde expansion fails, the word
3369 is unchanged.
3370 <P>
3371
3372 Each variable assignment is checked for unquoted tilde-prefixes immediately
3373 following a
3374 <B>:</B>
3375
3376 or the first
3377 <B>=</B>.
3378
3379 In these cases, tilde expansion is also performed.
3380 Consequently, one may use file names with tildes in assignments to
3381 <FONT SIZE=-1><B>PATH</B>,
3382
3383 </FONT>
3384 <FONT SIZE=-1><B>MAILPATH</B>,
3385
3386 </FONT>
3387 and
3388 <FONT SIZE=-1><B>CDPATH</B>,
3389
3390 </FONT>
3391 and the shell assigns the expanded value.
3392 <A NAME="lbBB">&nbsp;</A>
3393 <H4>Parameter Expansion</H4>
3394
3395 <P>
3396
3397 The `<B>$</B>' character introduces parameter expansion,
3398 command substitution, or arithmetic expansion.  The parameter name
3399 or symbol to be expanded may be enclosed in braces, which
3400 are optional but serve to protect the variable to be expanded from
3401 characters immediately following it which could be
3402 interpreted as part of the name.
3403 <P>
3404
3405 When braces are used, the matching ending brace is the first `<B>}</B>'
3406 not escaped by a backslash or within a quoted string, and not within an
3407 embedded arithmetic expansion, command substitution, or parameter
3408 expansion.
3409 <P>
3410
3411
3412 <DL COMPACT>
3413 <DT>${<I>parameter</I>}<DD>
3414 The value of <I>parameter</I> is substituted.  The braces are required
3415 when
3416 <I>parameter</I>
3417
3418 is a positional parameter with more than one digit,
3419 or when
3420 <I>parameter</I>
3421
3422 is followed by a character which is not to be
3423 interpreted as part of its name.
3424
3425 </DL>
3426 <P>
3427
3428 If the first character of <I>parameter</I> is an exclamation point (<B>!</B>),
3429 a level of variable indirection is introduced.
3430 <B>Bash</B> uses the value of the variable formed from the rest of
3431 <I>parameter</I> as the name of the variable; this variable is then
3432 expanded and that value is used in the rest of the substitution, rather
3433 than the value of <I>parameter</I> itself.
3434 This is known as <I>indirect expansion</I>.
3435 The exceptions to this are the expansions of ${<B>!\fPfIprefix</B><B>*</B>} and
3436 ${<B>!</B><I>name</I>[<I>@</I>]} described below.
3437 The exclamation point must immediately follow the left brace in order to
3438 introduce indirection.
3439 <P>
3440
3441 In each of the cases below, <I>word</I> is subject to tilde expansion,
3442 parameter expansion, command substitution, and arithmetic expansion.
3443 <P>
3444
3445 When not performing substring expansion, using the forms documented below,
3446 <B>bash</B> tests for a parameter that is unset or null.  Omitting the colon
3447 results in a test only for a parameter that is unset.
3448 <P>
3449
3450
3451 <DL COMPACT>
3452 <DT>${<I>parameter</I><B>:-</B><I>word</I>}<DD>
3453 <B>Use Default Values</B>.  If
3454 <I>parameter</I>
3455
3456 is unset or null, the expansion of
3457 <I>word</I>
3458
3459 is substituted.  Otherwise, the value of
3460 <I>parameter</I>
3461
3462 is substituted.
3463 <DT>${<I>parameter</I><B>:=</B><I>word</I>}<DD>
3464 <B>Assign Default Values</B>.
3465 If
3466 <I>parameter</I>
3467
3468 is unset or null, the expansion of
3469 <I>word</I>
3470
3471 is assigned to
3472 <I>parameter</I>.
3473
3474 The value of
3475 <I>parameter</I>
3476
3477 is then substituted.  Positional parameters and special parameters may
3478 not be assigned to in this way.
3479 <DT>${<I>parameter</I><B>:?</B><I>word</I>}<DD>
3480 <B>Display Error if Null or Unset</B>.
3481 If
3482 <I>parameter</I>
3483
3484 is null or unset, the expansion of <I>word</I> (or a message to that effect
3485 if
3486 <I>word</I>
3487
3488 is not present) is written to the standard error and the shell, if it
3489 is not interactive, exits.  Otherwise, the value of <I>parameter</I> is
3490 substituted.
3491 <DT>${<I>parameter</I><B>:+</B><I>word</I>}<DD>
3492 <B>Use Alternate Value</B>.
3493 If
3494 <I>parameter</I>
3495
3496 is null or unset, nothing is substituted, otherwise the expansion of
3497 <I>word</I>
3498
3499 is substituted.
3500 <DT>${<I>parameter</I><B>:</B><I>offset</I>}<DD>
3501
3502 <DT>${<I>parameter</I><B>:</B><I>offset</I><B>:</B><I>length</I>}<DD>
3503
3504 <B>Substring Expansion</B>.
3505 Expands to up to <I>length</I> characters of <I>parameter</I>
3506 starting at the character specified by <I>offset</I>.
3507 If <I>length</I> is omitted, expands to the substring of
3508 <I>parameter</I> starting at the character specified by <I>offset</I>.
3509 <I>length</I> and <I>offset</I> are arithmetic expressions (see
3510 <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>
3511
3512 </FONT>
3513 below).
3514 If <I>offset</I> evaluates to a number less than zero, the value
3515 is used as an offset from the end of the value of <I>parameter</I>.
3516 If <I>length</I> evaluates to a number less than zero, and <I>parameter</I>
3517 is not <B>@</B> and not an indexed or associative array, it is interpreted
3518 as an offset from the end of the value of <I>parameter</I> rather than
3519 a number of characters, and the expansion is the characters between the
3520 two offsets.
3521 If <I>parameter</I> is <B>@</B>, the result is <I>length</I> positional
3522 parameters beginning at <I>offset</I>.
3523 If <I>parameter</I> is an indexed array name subscripted by @ or *,
3524 the result is the <I>length</I>
3525 members of the array beginning with ${<I>parameter</I>[<I>offset</I>]}.
3526 A negative <I>offset</I> is taken relative to one greater than the maximum
3527 index of the specified array.
3528 Substring expansion applied to an associative array produces undefined
3529 results.
3530 Note that a negative offset must be separated from the colon by at least
3531 one space to avoid being confused with the :- expansion.
3532 Substring indexing is zero-based unless the positional parameters 
3533 are used, in which case the indexing starts at 1 by default.
3534 If <I>offset</I> is 0, and the positional parameters are used, <B>$0</B> is
3535 prefixed to the list.
3536 <DT>${<B>!</B><I>prefix</I><B>*</B>}<DD>
3537
3538 <DT>${<B>!</B><I>prefix</I><B>@</B>}<DD>
3539
3540 <B>Names matching prefix</B>.
3541 Expands to the names of variables whose names begin with <I>prefix</I>,
3542 separated by the first character of the
3543 <FONT SIZE=-1><B>IFS</B>
3544
3545 </FONT>
3546 special variable.
3547 When <I>@</I> is used and the expansion appears within double quotes, each
3548 variable name expands to a separate word.
3549 <DT>${<B>!</B><I>name</I>[<I>@</I>]}<DD>
3550
3551 <DT>${<B>!</B><I>name</I>[<I>*</I>]}<DD>
3552
3553 <B>List of array keys</B>.
3554 If <I>name</I> is an array variable, expands to the list of array indices
3555 (keys) assigned in <I>name</I>.
3556 If <I>name</I> is not an array, expands to 0 if <I>name</I> is set and null
3557 otherwise.
3558 When <I>@</I> is used and the expansion appears within double quotes, each
3559 key expands to a separate word.
3560 <DT>${<B>#</B><I>parameter</I>}<DD>
3561 <B>Parameter length</B>.
3562 The length in characters of the value of <I>parameter</I> is substituted.
3563 If
3564 <I>parameter</I>
3565
3566 is
3567 <B>*</B>
3568
3569 or 
3570 <B>@</B>,
3571
3572 the value substituted is the number of positional parameters.
3573 If
3574 <I>parameter</I>
3575
3576 is an array name subscripted by
3577 <B>*</B>
3578
3579 or
3580 <B>@</B>,
3581
3582 the value substituted is the number of elements in the array.
3583 <DT>${<I>parameter</I><B>#</B><I>word</I>}<DD>
3584
3585 <DT>${<I>parameter</I><B>##</B><I>word</I>}<DD>
3586
3587 <B>Remove matching prefix pattern</B>.
3588 The 
3589 <I>word</I>
3590
3591 is expanded to produce a pattern just as in pathname
3592 expansion.  If the pattern matches the beginning of
3593 the value of
3594 <I>parameter</I>,
3595
3596 then the result of the expansion is the expanded value of
3597 <I>parameter</I>
3598
3599 with the shortest matching pattern (the ``<B>#</B>'' case) or the
3600 longest matching pattern (the ``<B>##</B>'' case) deleted.
3601 If
3602 <I>parameter</I>
3603
3604 is
3605 <B>@</B>
3606
3607 or
3608 <B>*</B>,
3609
3610 the pattern removal operation is applied to each positional
3611 parameter in turn, and the expansion is the resultant list.
3612 If
3613 <I>parameter</I>
3614
3615 is an array variable subscripted with
3616 <B>@</B>
3617
3618 or
3619 <B>*</B>,
3620
3621 the pattern removal operation is applied to each member of the
3622 array in turn, and the expansion is the resultant list.
3623 <DT>${<I>parameter</I><B>%</B><I>word</I>}<DD>
3624
3625 <DT>${<I>parameter</I><B>%%</B><I>word</I>}<DD>
3626
3627 <B>Remove matching suffix pattern</B>.
3628 The <I>word</I> is expanded to produce a pattern just as in
3629 pathname expansion.
3630 If the pattern matches a trailing portion of the expanded value of
3631 <I>parameter</I>,
3632
3633 then the result of the expansion is the expanded value of
3634 <I>parameter</I>
3635
3636 with the shortest matching pattern (the ``<B>%</B>'' case) or the
3637 longest matching pattern (the ``<B>%%</B>'' case) deleted.
3638 If
3639 <I>parameter</I>
3640
3641 is
3642 <B>@</B>
3643
3644 or
3645 <B>*</B>,
3646
3647 the pattern removal operation is applied to each positional
3648 parameter in turn, and the expansion is the resultant list.
3649 If
3650 <I>parameter</I>
3651
3652 is an array variable subscripted with
3653 <B>@</B>
3654
3655 or
3656 <B>*</B>,
3657
3658 the pattern removal operation is applied to each member of the
3659 array in turn, and the expansion is the resultant list.
3660 <DT>${<I>parameter</I><B>/</B><I>pattern</I><B>/</B><I>string</I>}<DD>
3661 <B>Pattern substitution</B>.
3662 The <I>pattern</I> is expanded to produce a pattern just as in
3663 pathname expansion.
3664 <I>Parameter</I> is expanded and the longest match of <I>pattern</I>
3665 against its value is replaced with <I>string</I>.
3666 If <I>pattern</I> begins with <B>/</B>, all matches of <I>pattern</I> are
3667 replaced with <I>string</I>.  Normally only the first match is replaced.
3668 If <I>pattern</I> begins with <B>#</B>, it must match at the beginning
3669 of the expanded value of <I>parameter</I>.
3670 If <I>pattern</I> begins with <B>%</B>, it must match at the end
3671 of the expanded value of <I>parameter</I>.
3672 If <I>string</I> is null, matches of <I>pattern</I> are deleted
3673 and the <B>/</B> following <I>pattern</I> may be omitted.
3674 If
3675 <I>parameter</I>
3676
3677 is
3678 <B>@</B>
3679
3680 or
3681 <B>*</B>,
3682
3683 the substitution operation is applied to each positional
3684 parameter in turn, and the expansion is the resultant list.
3685 If
3686 <I>parameter</I>
3687
3688 is an array variable subscripted with
3689 <B>@</B>
3690
3691 or
3692 <B>*</B>,
3693
3694 the substitution operation is applied to each member of the
3695 array in turn, and the expansion is the resultant list.
3696 <DT>${<I>parameter</I><B>^</B><I>pattern</I>}<DD>
3697
3698 <DT>${<I>parameter</I><B>^^</B><I>pattern</I>}<DD>
3699 <DT>${<I>parameter</I><B>,</B><I>pattern</I>}<DD>
3700 <DT>${<I>parameter</I><B>,,</B><I>pattern</I>}<DD>
3701
3702 <B>Case modification</B>.
3703 This expansion modifies the case of alphabetic characters in <I>parameter</I>.
3704 The <I>pattern</I> is expanded to produce a pattern just as in
3705 pathname expansion.
3706 The <B>^</B> operator converts lowercase letters matching <I>pattern</I>
3707 to uppercase; the <B>,</B> operator converts matching uppercase letters
3708 to lowercase.
3709 The <B>^^</B> and <B>,,</B> expansions convert each matched character in the
3710 expanded value; the <B>^</B> and <B>,</B> expansions match and convert only
3711 the first character in the expanded value.
3712 If <I>pattern</I> is omitted, it is treated like a <B>?</B>, which matches
3713 every character.
3714 If
3715 <I>parameter</I>
3716
3717 is
3718 <B>@</B>
3719
3720 or
3721 <B>*</B>,
3722
3723 the case modification operation is applied to each positional
3724 parameter in turn, and the expansion is the resultant list.
3725 If
3726 <I>parameter</I>
3727
3728 is an array variable subscripted with
3729 <B>@</B>
3730
3731 or
3732 <B>*</B>,
3733
3734 the case modification operation is applied to each member of the
3735 array in turn, and the expansion is the resultant list.
3736 </DL>
3737 <A NAME="lbBC">&nbsp;</A>
3738 <H4>Command Substitution</H4>
3739
3740 <P>
3741
3742 <I>Command substitution</I> allows the output of a command to replace
3743 the command name.  There are two forms:
3744 <P>
3745
3746 <DL COMPACT><DT><DD>
3747 <P>
3748
3749 <B>$(</B><I>command</I><B>)</B>
3750 </DL>
3751
3752 or
3753 <DL COMPACT><DT><DD>
3754 <B>`</B><I>command</I><B>`</B>
3755 </DL>
3756
3757 <P>
3758
3759 <B>Bash</B>
3760
3761 performs the expansion by executing <I>command</I> and
3762 replacing the command substitution with the standard output of the
3763 command, with any trailing newlines deleted.
3764 Embedded newlines are not deleted, but they may be removed during
3765 word splitting.
3766 The command substitution <B>$(cat </B><I>file</I>) can be replaced by
3767 the equivalent but faster <B>$(&lt; </B><I>file</I>).
3768 <P>
3769
3770 When the old-style backquote form of substitution is used,
3771 backslash retains its literal meaning except when followed by
3772 <B>$</B>,
3773
3774 <B>`</B>,
3775
3776 or
3777 <B>\</B>.
3778
3779 The first backquote not preceded by a backslash terminates the
3780 command substitution.
3781 When using the $(<I>command</I>) form, all characters between the
3782 parentheses make up the command; none are treated specially.
3783 <P>
3784
3785 Command substitutions may be nested.  To nest when using the backquoted form,
3786 escape the inner backquotes with backslashes.
3787 <P>
3788
3789 If the substitution appears within double quotes, word splitting and
3790 pathname expansion are not performed on the results.
3791 <A NAME="lbBD">&nbsp;</A>
3792 <H4>Arithmetic Expansion</H4>
3793
3794 <P>
3795
3796 Arithmetic expansion allows the evaluation of an arithmetic expression
3797 and the substitution of the result.  The format for arithmetic expansion is:
3798 <DL COMPACT><DT><DD>
3799 <P>
3800
3801 <B>$((</B><I>expression</I><B>))</B>
3802 </DL>
3803
3804 <P>
3805
3806 The
3807 <I>expression</I>
3808
3809 is treated as if it were within double quotes, but a double quote
3810 inside the parentheses is not treated specially.
3811 All tokens in the expression undergo parameter expansion, string
3812 expansion, command substitution, and quote removal.
3813 Arithmetic expansions may be nested.
3814 <P>
3815
3816 The evaluation is performed according to the rules listed below under
3817 <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>.
3818
3819 </FONT>
3820 If
3821 <I>expression</I>
3822
3823 is invalid,
3824 <B>bash</B>
3825
3826 prints a message indicating failure and no substitution occurs.
3827 <A NAME="lbBE">&nbsp;</A>
3828 <H4>Process Substitution</H4>
3829
3830 <P>
3831
3832 <I>Process substitution</I> is supported on systems that support named
3833 pipes (<I>FIFOs</I>) or the <B>/dev/fd</B> method of naming open files.
3834 It takes the form of
3835 <B>&lt;(</B><I>list</I><B>)</B>
3836 or
3837 <B>&gt;(</B><I>list</I><B>)</B>.
3838 The process <I>list</I> is run with its input or output connected to a
3839 <I>FIFO</I> or some file in <B>/dev/fd</B>.  The name of this file is
3840 passed as an argument to the current command as the result of the
3841 expansion.  If the <B>&gt;(</B><I>list</I><B>)</B> form is used, writing to
3842 the file will provide input for <I>list</I>.  If the
3843 <B>&lt;(</B><I>list</I><B>)</B> form is used, the file passed as an
3844 argument should be read to obtain the output of <I>list</I>.
3845 <P>
3846
3847 When available, process substitution is performed
3848 simultaneously with parameter and variable expansion, 
3849 command substitution,
3850 and arithmetic expansion.
3851 <A NAME="lbBF">&nbsp;</A>
3852 <H4>Word Splitting</H4>
3853
3854 <P>
3855
3856 The shell scans the results of
3857 parameter expansion,
3858 command substitution,
3859 and
3860 arithmetic expansion
3861 that did not occur within double quotes for
3862 <I>word splitting</I>.
3863
3864 <P>
3865
3866 The shell treats each character of
3867 <FONT SIZE=-1><B>IFS</B>
3868
3869 </FONT>
3870 as a delimiter, and splits the results of the other
3871 expansions into words on these characters.  If
3872 <FONT SIZE=-1><B>IFS</B>
3873
3874 </FONT>
3875 is unset, or its
3876 value is exactly
3877 <B>&lt;space&gt;&lt;tab&gt;&lt;newline&gt;</B>,
3878
3879 the default, then
3880 sequences of
3881 <B>&lt;space&gt;</B>,
3882
3883 <B>&lt;tab&gt;</B>,
3884
3885 and
3886 <B>&lt;newline&gt;</B>
3887
3888 at the beginning and end of the results of the previous
3889 expansions are ignored, and
3890 any sequence of
3891 <FONT SIZE=-1><B>IFS</B>
3892
3893 </FONT>
3894 characters not at the beginning or end serves to delimit words.
3895 If
3896 <FONT SIZE=-1><B>IFS</B>
3897
3898 </FONT>
3899 has a value other than the default, then sequences of
3900 the whitespace characters
3901 <B>space</B>
3902
3903 and
3904 <B>tab</B>
3905
3906 are ignored at the beginning and end of the
3907 word, as long as the whitespace character is in the
3908 value of
3909 <FONT SIZE=-1><B>IFS</B>
3910
3911 </FONT>
3912 (an
3913 <FONT SIZE=-1><B>IFS</B>
3914
3915 </FONT>
3916 whitespace character).
3917 Any character in
3918 <FONT SIZE=-1><B>IFS</B>
3919
3920 </FONT>
3921 that is not
3922 <FONT SIZE=-1><B>IFS</B>
3923
3924 </FONT>
3925 whitespace, along with any adjacent
3926 <FONT SIZE=-1><B>IFS</B>
3927
3928 </FONT>
3929 whitespace characters, delimits a field.
3930 A sequence of
3931 <FONT SIZE=-1><B>IFS</B>
3932
3933 </FONT>
3934 whitespace characters is also treated as a delimiter.
3935 If the value of
3936 <FONT SIZE=-1><B>IFS</B>
3937
3938 </FONT>
3939 is null, no word splitting occurs.
3940 <P>
3941
3942 Explicit null arguments (<B>&quot;&quot;</B> or <B>aqaq</B>) are retained.
3943 Unquoted implicit null arguments, resulting from the expansion of
3944 parameters that have no values, are removed.
3945 If a parameter with no value is expanded within double quotes, a
3946 null argument results and is retained.
3947 <P>
3948
3949 Note that if no expansion occurs, no splitting
3950 is performed.
3951 <A NAME="lbBG">&nbsp;</A>
3952 <H4>Pathname Expansion</H4>
3953
3954 <P>
3955
3956 After word splitting,
3957 unless the
3958 <B>-f</B>
3959
3960 option has been set,
3961 <B>bash</B>
3962
3963 scans each word for the characters
3964 <B>*</B>,
3965
3966 <B>?</B>,
3967
3968 and
3969 <B>[</B>.
3970
3971 If one of these characters appears, then the word is
3972 regarded as a
3973 <I>pattern</I>,
3974
3975 and replaced with an alphabetically sorted list of
3976 file names matching the pattern.
3977 If no matching file names are found,
3978 and the shell option
3979 <B>nullglob</B>
3980
3981 is not enabled, the word is left unchanged.
3982 If the 
3983 <B>nullglob</B>
3984
3985 option is set, and no matches are found,
3986 the word is removed.
3987 If the
3988 <B>failglob</B>
3989
3990 shell option is set, and no matches are found, an error message
3991 is printed and the command is not executed.
3992 If the shell option
3993 <B>nocaseglob</B>
3994
3995 is enabled, the match is performed without regard to the case
3996 of alphabetic characters.
3997 When a pattern is used for pathname expansion,
3998 the character
3999 <B>``.''</B>
4000
4001 at the start of a name or immediately following a slash
4002 must be matched explicitly, unless the shell option
4003 <B>dotglob</B>
4004
4005 is set.
4006 When matching a pathname, the slash character must always be
4007 matched explicitly.
4008 In other cases, the
4009 <B>``.''</B>
4010
4011 character is not treated specially.
4012 See the description of
4013 <B>shopt</B>
4014
4015 below under
4016 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
4017
4018 </FONT>
4019 for a description of the
4020 <B>nocaseglob</B>,
4021
4022 <B>nullglob</B>,
4023
4024 <B>failglob</B>,
4025
4026 and
4027 <B>dotglob</B>
4028
4029 shell options.
4030 <P>
4031
4032 The
4033 <FONT SIZE=-1><B>GLOBIGNORE</B>
4034
4035 </FONT>
4036 shell variable may be used to restrict the set of file names matching a
4037 <I>pattern</I>.
4038
4039 If
4040 <FONT SIZE=-1><B>GLOBIGNORE</B>
4041
4042 </FONT>
4043 is set, each matching file name that also matches one of the patterns in
4044 <FONT SIZE=-1><B>GLOBIGNORE</B>
4045
4046 </FONT>
4047 is removed from the list of matches.
4048 The file names
4049 <B>``.''</B>
4050
4051 and
4052 <B>``..''</B>
4053
4054 are always ignored when
4055 <FONT SIZE=-1><B>GLOBIGNORE</B>
4056
4057 </FONT>
4058 is set and not null.  However, setting
4059 <FONT SIZE=-1><B>GLOBIGNORE</B>
4060
4061 </FONT>
4062 to a non-null value has the effect of enabling the
4063 <B>dotglob</B>
4064
4065 shell option, so all other file names beginning with a
4066 <B>``.''</B>
4067
4068 will match.
4069 To get the old behavior of ignoring file names beginning with a
4070 <B>``.''</B>,
4071
4072 make
4073 <B>``.*''</B>
4074
4075 one of the patterns in
4076 <FONT SIZE=-1><B>GLOBIGNORE</B>.
4077
4078 </FONT>
4079 The
4080 <B>dotglob</B>
4081
4082 option is disabled when
4083 <FONT SIZE=-1><B>GLOBIGNORE</B>
4084
4085 </FONT>
4086 is unset.
4087 <P>
4088
4089 <B>Pattern Matching</B>
4090 <P>
4091
4092 Any character that appears in a pattern, other than the special pattern
4093 characters described below, matches itself.  The NUL character may not
4094 occur in a pattern.  A backslash escapes the following character; the
4095 escaping backslash is discarded when matching.
4096 The special pattern characters must be quoted if
4097 they are to be matched literally.
4098 <P>
4099
4100 The special pattern characters have the following meanings:
4101 <P>
4102
4103
4104 <DL COMPACT><DT><DD>
4105 <DL COMPACT>
4106 <DT><B>*</B>
4107
4108 <DD>
4109 Matches any string, including the null string.
4110 When the <B>globstar</B> shell option is enabled, and <B>*</B> is used in
4111 a pathname expansion context, two adjacent <B>*</B>s used as a single
4112 pattern will match all files and zero or more directories and
4113 subdirectories.
4114 If followed by a <B>/</B>, two adjacent <B>*</B>s will match only directories
4115 and subdirectories.
4116 <DT><B>?</B>
4117
4118 <DD>
4119 Matches any single character.
4120 <DT><B>[...]</B>
4121
4122 <DD>
4123 Matches any one of the enclosed characters.  A pair of characters
4124 separated by a hyphen denotes a
4125 <I>range expression</I>;
4126 any character that sorts between those two characters, inclusive,
4127 using the current locale's collating sequence and character set,
4128 is matched.  If the first character following the
4129 <B>[</B>
4130
4131 is a
4132 <B>!</B>
4133
4134 or a
4135 <B>^</B>
4136
4137 then any character not enclosed is matched.
4138 The sorting order of characters in range expressions is determined by
4139 the current locale and the value of the
4140 <FONT SIZE=-1><B>LC_COLLATE</B>
4141
4142 </FONT>
4143 shell variable,
4144 if set.
4145
4146 <B>-</B>
4147
4148 may be matched by including it as the first or last character
4149 in the set.
4150 A
4151 <B>]</B>
4152
4153 may be matched by including it as the first character
4154 in the set.
4155 <BR>
4156
4157 <P>
4158
4159
4160 Within
4161 <B>[</B>
4162
4163 and
4164 <B>]</B>,
4165
4166 <I>character classes</I> can be specified using the syntax
4167 <B>[:</B><I>class</I><B>:]</B>, where <I>class</I> is one of the
4168 following classes defined in the POSIX standard:
4169 </DL>
4170 <P>
4171
4172 <DL COMPACT><DT><DD>
4173 <B>
4174 </B>
4175
4176 alnum   alpha   ascii   blank   cntrl   digit   graph   lower   print   punct   space   upper   word   xdigit
4177 <BR>
4178
4179 A character class matches any character belonging to that class.
4180 The <B>word</B> character class matches letters, digits, and the character _.
4181 <BR>
4182
4183 <P>
4184
4185
4186 Within
4187 <B>[</B>
4188
4189 and 
4190 <B>]</B>,
4191
4192 an <I>equivalence class</I> can be specified using the syntax
4193 <B>[=</B><I>c</I><B>=]</B>, which matches all characters with the
4194 same collation weight (as defined by the current locale) as
4195 the character <I>c</I>.
4196 <BR>
4197
4198 <P>
4199
4200
4201 Within
4202 <B>[</B>
4203
4204 and 
4205 <B>]</B>,
4206
4207 the syntax <B>[.</B><I>symbol</I><B>.]</B> matches the collating symbol
4208 <I>symbol</I>.
4209 </DL>
4210
4211 </DL>
4212
4213
4214 <P>
4215
4216 If the <B>extglob</B> shell option is enabled using the <B>shopt</B>
4217 builtin, several extended pattern matching operators are recognized.
4218 In the following description, a <I>pattern-list</I> is a list of one
4219 or more patterns separated by a <B>|</B>.
4220 Composite patterns may be formed using one or more of the following
4221 sub-patterns:
4222 <P>
4223
4224 <DL COMPACT><DT><DD>
4225 <DL COMPACT>
4226 <DT><B>?(</B><I>pattern-list</I><B>)</B><DD>
4227 Matches zero or one occurrence of the given patterns
4228 <DT><B>*(</B><I>pattern-list</I><B>)</B><DD>
4229 Matches zero or more occurrences of the given patterns
4230 <DT><B>+(</B><I>pattern-list</I><B>)</B><DD>
4231 Matches one or more occurrences of the given patterns
4232 <DT><B>@(</B><I>pattern-list</I><B>)</B><DD>
4233 Matches one of the given patterns
4234 <DT><B>!(</B><I>pattern-list</I><B>)</B><DD>
4235 Matches anything except one of the given patterns
4236 </DL></DL>
4237
4238
4239 <A NAME="lbBH">&nbsp;</A>
4240 <H4>Quote Removal</H4>
4241
4242 <P>
4243
4244 After the preceding expansions, all unquoted occurrences of the
4245 characters
4246 <B>\</B>,
4247
4248 <B>aq</B>,
4249
4250 and <B>&quot;</B> that did not result from one of the above
4251 expansions are removed.
4252 <A NAME="lbBI">&nbsp;</A>
4253 <H3>REDIRECTION</H3>
4254
4255 Before a command is executed, its input and output
4256 may be
4257 <I>redirected</I>
4258
4259 using a special notation interpreted by the shell.
4260 Redirection may also be used to open and close files for the
4261 current shell execution environment.  The following redirection
4262 operators may precede or appear anywhere within a
4263 <I>simple command</I>
4264
4265 or may follow a
4266 <I>command</I>.
4267
4268 Redirections are processed in the order they appear, from
4269 left to right.
4270 <P>
4271
4272 Each redirection that may be preceded by a file descriptor number
4273 may instead be preceded by a word of the form {<I>varname</I>}.
4274 In this case, for each redirection operator except
4275 &gt;&amp;- and &lt;&amp;-, the shell will allocate a file descriptor greater
4276 than 10 and assign it to <I>varname</I>.  If &gt;&amp;- or &lt;&amp;- is preceded
4277 by {<I>varname</I>}, the value of <I>varname</I> defines the file
4278 descriptor to close.
4279 <P>
4280
4281 In the following descriptions, if the file descriptor number is
4282 omitted, and the first character of the redirection operator is
4283 <B>&lt;</B>,
4284
4285 the redirection refers to the standard input (file descriptor
4286 0).  If the first character of the redirection operator is
4287 <B>&gt;</B>,
4288
4289 the redirection refers to the standard output (file descriptor
4290 1).
4291 <P>
4292
4293 The word following the redirection operator in the following
4294 descriptions, unless otherwise noted, is subjected to brace expansion,
4295 tilde expansion, parameter expansion, command substitution, arithmetic
4296 expansion, quote removal, pathname expansion, and word splitting.
4297 If it expands to more than one word,
4298 <B>bash</B>
4299
4300 reports an error.
4301 <P>
4302
4303 Note that the order of redirections is significant.  For example, 
4304 the command
4305 <DL COMPACT><DT><DD>
4306 <P>
4307
4308 ls <B>&gt;</B> dirlist 2<B>&gt;&amp;</B>1
4309 </DL>
4310
4311 <P>
4312
4313 directs both standard output and standard error to the file 
4314 <I>dirlist</I>,
4315
4316 while the command
4317 <DL COMPACT><DT><DD>
4318 <P>
4319
4320 ls 2<B>&gt;&amp;</B>1 <B>&gt;</B> dirlist
4321 </DL>
4322
4323 <P>
4324
4325 directs only the standard output to file
4326 <I>dirlist</I>,
4327
4328 because the standard error was duplicated from the standard output
4329 before the standard output was redirected to
4330 <I>dirlist</I>.
4331
4332 <P>
4333
4334 <B>Bash</B> handles several filenames specially when they are used in
4335 redirections, as described in the following table:
4336 <DL COMPACT><DT><DD>
4337 <P>
4338
4339
4340 <DL COMPACT>
4341 <DT><B>/dev/fd/</B><I>fd</I>
4342
4343 <DD>
4344 If <I>fd</I> is a valid integer, file descriptor <I>fd</I> is duplicated.
4345 <DT><B>/dev/stdin</B>
4346
4347 <DD>
4348 File descriptor 0 is duplicated.
4349 <DT><B>/dev/stdout</B>
4350
4351 <DD>
4352 File descriptor 1 is duplicated.
4353 <DT><B>/dev/stderr</B>
4354
4355 <DD>
4356 File descriptor 2 is duplicated.
4357 <DT><B>/dev/tcp/</B><I>host</I>/<I>port</I>
4358
4359 <DD>
4360 If <I>host</I> is a valid hostname or Internet address, and <I>port</I>
4361 is an integer port number or service name, <B>bash</B> attempts to open
4362 a TCP connection to the corresponding socket.
4363 <DT><B>/dev/udp/</B><I>host</I>/<I>port</I>
4364
4365 <DD>
4366 If <I>host</I> is a valid hostname or Internet address, and <I>port</I>
4367 is an integer port number or service name, <B>bash</B> attempts to open
4368 a UDP connection to the corresponding socket.
4369
4370 </DL></DL>
4371
4372 <P>
4373
4374 A failure to open or create a file causes the redirection to fail.
4375 <P>
4376
4377 Redirections using file descriptors greater than 9 should be used with
4378 care, as they may conflict with file descriptors the shell uses
4379 internally.
4380 <A NAME="lbBJ">&nbsp;</A>
4381 <H4>Redirecting Input</H4>
4382
4383 <P>
4384
4385 Redirection of input causes the file whose name results from
4386 the expansion of
4387 <I>word</I>
4388
4389 to be opened for reading on file descriptor
4390 <I>n</I>,
4391
4392 or the standard input (file descriptor 0) if
4393 <I>n</I>
4394
4395 is not specified.
4396 <P>
4397
4398 The general format for redirecting input is:
4399 <DL COMPACT><DT><DD>
4400 <P>
4401
4402 [<I>n</I>]<B>&lt;</B><I>word</I>
4403 </DL>
4404
4405 <A NAME="lbBK">&nbsp;</A>
4406 <H4>Redirecting Output</H4>
4407
4408 <P>
4409
4410 Redirection of output causes the file whose name results from
4411 the expansion of
4412 <I>word</I>
4413
4414 to be opened for writing on file descriptor
4415 <I>n</I>,
4416
4417 or the standard output (file descriptor 1) if
4418 <I>n</I>
4419
4420 is not specified.  If the file does not exist it is created;
4421 if it does exist it is truncated to zero size.
4422 <P>
4423
4424 The general format for redirecting output is:
4425 <DL COMPACT><DT><DD>
4426 <P>
4427
4428 [<I>n</I>]<B>&gt;</B><I>word</I>
4429 </DL>
4430
4431 <P>
4432
4433 If the redirection operator is
4434 <B>&gt;</B>,
4435
4436 and the
4437 <B>noclobber</B>
4438
4439 option to the
4440 <B>set</B>
4441
4442 builtin has been enabled, the redirection will fail if the file
4443 whose name results from the expansion of <I>word</I> exists and is
4444 a regular file.
4445 If the redirection operator is
4446 <B>&gt;|</B>,
4447
4448 or the redirection operator is
4449 <B>&gt;</B>
4450
4451 and the
4452 <B>noclobber</B>
4453
4454 option to the
4455 <B>set</B>
4456
4457 builtin command is not enabled, the redirection is attempted even
4458 if the file named by <I>word</I> exists.
4459 <A NAME="lbBL">&nbsp;</A>
4460 <H4>Appending Redirected Output</H4>
4461
4462 <P>
4463
4464 Redirection of output in this fashion
4465 causes the file whose name results from
4466 the expansion of
4467 <I>word</I>
4468
4469 to be opened for appending on file descriptor
4470 <I>n</I>,
4471
4472 or the standard output (file descriptor 1) if
4473 <I>n</I>
4474
4475 is not specified.  If the file does not exist it is created.
4476 <P>
4477
4478 The general format for appending output is:
4479 <DL COMPACT><DT><DD>
4480 <P>
4481
4482 [<I>n</I>]<B>&gt;&gt;</B><I>word</I>
4483 </DL>
4484
4485 <P>
4486
4487 <A NAME="lbBM">&nbsp;</A>
4488 <H4>Redirecting Standard Output and Standard Error</H4>
4489
4490 <P>
4491
4492 This construct allows both the
4493 standard output (file descriptor 1) and
4494 the standard error output (file descriptor 2)
4495 to be redirected to the file whose name is the
4496 expansion of
4497 <I>word</I>.
4498
4499 <P>
4500
4501 There are two formats for redirecting standard output and
4502 standard error:
4503 <DL COMPACT><DT><DD>
4504 <P>
4505
4506 <B>&amp;&gt;</B><I>word</I>
4507 </DL>
4508
4509 and
4510 <DL COMPACT><DT><DD>
4511 <B>&gt;&amp;</B><I>word</I>
4512 </DL>
4513
4514 <P>
4515
4516 Of the two forms, the first is preferred.
4517 This is semantically equivalent to
4518 <DL COMPACT><DT><DD>
4519 <P>
4520
4521 <B>&gt;</B><I>word</I> 2<B>&gt;&amp;</B>1
4522 </DL>
4523
4524 <P>
4525
4526 <A NAME="lbBN">&nbsp;</A>
4527 <H4>Appending Standard Output and Standard Error</H4>
4528
4529 <P>
4530
4531 This construct allows both the
4532 standard output (file descriptor 1) and
4533 the standard error output (file descriptor 2)
4534 to be appended to the file whose name is the
4535 expansion of
4536 <I>word</I>.
4537
4538 <P>
4539
4540 The format for appending standard output and standard error is:
4541 <DL COMPACT><DT><DD>
4542 <P>
4543
4544 <B>&amp;&gt;&gt;</B><I>word</I>
4545 </DL>
4546
4547 <P>
4548
4549 This is semantically equivalent to
4550 <DL COMPACT><DT><DD>
4551 <P>
4552
4553 <B>&gt;&gt;</B><I>word</I> 2<B>&gt;&amp;</B>1
4554 </DL>
4555
4556 <A NAME="lbBO">&nbsp;</A>
4557 <H4>Here Documents</H4>
4558
4559 <P>
4560
4561 This type of redirection instructs the shell to read input from the
4562 current source until a line containing only
4563 <I>delimiter</I>
4564
4565 (with no trailing blanks)
4566 is seen.  All of
4567 the lines read up to that point are then used as the standard
4568 input for a command.
4569 <P>
4570
4571 The format of here-documents is:
4572 <DL COMPACT><DT><DD>
4573 <P>
4574
4575 <PRE>
4576 <B>&lt;&lt;</B>[<B>-</B>]<I>word</I>
4577         <I>here-document</I>
4578 <I>delimiter</I>
4579 </PRE>
4580
4581 </DL>
4582
4583 <P>
4584
4585 No parameter expansion, command substitution, arithmetic expansion,
4586 or pathname expansion is performed on
4587 <I>word</I>.
4588
4589 If any characters in
4590 <I>word</I>
4591
4592 are quoted, the
4593 <I>delimiter</I>
4594
4595 is the result of quote removal on
4596 <I>word</I>,
4597
4598 and the lines in the here-document are not expanded.
4599 If <I>word</I> is unquoted,
4600 all lines of the here-document are subjected to parameter expansion,
4601 command substitution, and arithmetic expansion.  In the latter
4602 case, the character sequence
4603 <B>\&lt;newline&gt;</B>
4604
4605 is ignored, and
4606 <B>\</B>
4607
4608 must be used to quote the characters
4609 <B>\</B>,
4610
4611 <B>$</B>,
4612
4613 and
4614 <B>`</B>.
4615
4616 <P>
4617
4618 If the redirection operator is
4619 <B>&lt;&lt;-</B>,
4620
4621 then all leading tab characters are stripped from input lines and the
4622 line containing
4623 <I>delimiter</I>.
4624
4625 This allows
4626 here-documents within shell scripts to be indented in a
4627 natural fashion.
4628 <A NAME="lbBP">&nbsp;</A>
4629 <H4>Here Strings</H4>
4630
4631 A variant of here documents, the format is:
4632 <DL COMPACT><DT><DD>
4633 <P>
4634
4635 <PRE>
4636 <B>&lt;&lt;&lt;</B><I>word</I>
4637 </PRE>
4638
4639 </DL>
4640
4641 <P>
4642
4643 The <I>word</I> is expanded and supplied to the command on its standard
4644 input.
4645 <A NAME="lbBQ">&nbsp;</A>
4646 <H4>Duplicating File Descriptors</H4>
4647
4648 <P>
4649
4650 The redirection operator
4651 <DL COMPACT><DT><DD>
4652 <P>
4653
4654 [<I>n</I>]<B>&lt;&amp;</B><I>word</I>
4655 </DL>
4656
4657 <P>
4658
4659 is used to duplicate input file descriptors.
4660 If
4661 <I>word</I>
4662
4663 expands to one or more digits, the file descriptor denoted by
4664 <I>n</I>
4665
4666 is made to be a copy of that file descriptor.
4667 If the digits in
4668 <I>word</I>
4669
4670 do not specify a file descriptor open for input, a redirection error occurs.
4671 If
4672 <I>word</I>
4673
4674 evaluates to
4675 <B>-</B>,
4676
4677 file descriptor
4678 <I>n</I>
4679
4680 is closed.  If
4681 <I>n</I>
4682
4683 is not specified, the standard input (file descriptor 0) is used.
4684 <P>
4685
4686 The operator
4687 <DL COMPACT><DT><DD>
4688 <P>
4689
4690 [<I>n</I>]<B>&gt;&amp;</B><I>word</I>
4691 </DL>
4692
4693 <P>
4694
4695 is used similarly to duplicate output file descriptors.  If
4696 <I>n</I>
4697
4698 is not specified, the standard output (file descriptor 1) is used.
4699 If the digits in
4700 <I>word</I>
4701
4702 do not specify a file descriptor open for output, a redirection error occurs.
4703 As a special case, if <I>n</I> is omitted, and <I>word</I> does not
4704 expand to one or more digits, the standard output and standard
4705 error are redirected as described previously.
4706 <A NAME="lbBR">&nbsp;</A>
4707 <H4>Moving File Descriptors</H4>
4708
4709 <P>
4710
4711 The redirection operator
4712 <DL COMPACT><DT><DD>
4713 <P>
4714
4715 [<I>n</I>]<B>&lt;&amp;</B><I>digit</I><B>-</B>
4716 </DL>
4717
4718 <P>
4719
4720 moves the file descriptor <I>digit</I> to file descriptor
4721 <I>n</I>,
4722
4723 or the standard input (file descriptor 0) if <I>n</I> is not specified.
4724 <I>digit</I> is closed after being duplicated to <I>n</I>.
4725 <P>
4726
4727 Similarly, the redirection operator
4728 <DL COMPACT><DT><DD>
4729 <P>
4730
4731 [<I>n</I>]<B>&gt;&amp;</B><I>digit</I><B>-</B>
4732 </DL>
4733
4734 <P>
4735
4736 moves the file descriptor <I>digit</I> to file descriptor
4737 <I>n</I>,
4738
4739 or the standard output (file descriptor 1) if <I>n</I> is not specified.
4740 <A NAME="lbBS">&nbsp;</A>
4741 <H4>Opening File Descriptors for Reading and Writing</H4>
4742
4743 <P>
4744
4745 The redirection operator
4746 <DL COMPACT><DT><DD>
4747 <P>
4748
4749 [<I>n</I>]<B>&lt;&gt;</B><I>word</I>
4750 </DL>
4751
4752 <P>
4753
4754 causes the file whose name is the expansion of
4755 <I>word</I>
4756
4757 to be opened for both reading and writing on file descriptor
4758 <I>n</I>,
4759
4760 or on file descriptor 0 if
4761 <I>n</I>
4762
4763 is not specified.  If the file does not exist, it is created.
4764 <A NAME="lbBT">&nbsp;</A>
4765 <H3>ALIASES</H3>
4766
4767 <I>Aliases</I> allow a string to be substituted for a word when it is used
4768 as the first word of a simple command.
4769 The shell maintains a list of aliases that may be set and unset with the
4770 <B>alias</B>
4771
4772 and
4773 <B>unalias</B>
4774
4775 builtin commands (see
4776 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
4777
4778 </FONT>
4779 below).
4780 The first word of each simple command, if unquoted,
4781 is checked to see if it has an
4782 alias.  If so, that word is replaced by the text of the alias.
4783 The characters <B>/</B>, <B>$</B>, <B>`</B>, and <B>=</B> and
4784 any of the shell <I>metacharacters</I> or quoting characters
4785 listed above may not appear in an alias name.
4786 The replacement text may contain any valid shell input,
4787 including shell metacharacters.
4788 The first word of the replacement text is tested
4789 for aliases, but a word that is identical to an alias being expanded
4790 is not expanded a second time.
4791 This means that one may alias
4792 <B>ls</B>
4793
4794 to
4795 <B>ls -F</B>,
4796
4797 for instance, and
4798 <B>bash</B>
4799
4800 does not try to recursively expand the replacement text.
4801 If the last character of the alias value is a
4802 <I>blank</I>,
4803
4804 then the next command
4805 word following the alias is also checked for alias expansion.
4806 <P>
4807
4808 Aliases are created and listed with the
4809 <B>alias</B>
4810
4811 command, and removed with the
4812 <B>unalias</B>
4813
4814 command.
4815 <P>
4816
4817 There is no mechanism for using arguments in the replacement text.
4818 If arguments are needed, a shell function should be used (see
4819 <FONT SIZE=-1><B>FUNCTIONS</B>
4820
4821 </FONT>
4822 below).
4823 <P>
4824
4825 Aliases are not expanded when the shell is not interactive, unless
4826 the
4827 <B>expand_aliases</B>
4828
4829 shell option is set using
4830 <B>shopt</B>
4831
4832 (see the description of
4833 <B>shopt</B>
4834
4835 under
4836 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B></FONT>
4837 below).
4838 <P>
4839
4840 The rules concerning the definition and use of aliases are
4841 somewhat confusing.
4842 <B>Bash</B>
4843
4844 always reads at least one complete line
4845 of input before executing any
4846 of the commands on that line.  Aliases are expanded when a
4847 command is read, not when it is executed.  Therefore, an
4848 alias definition appearing on the same line as another
4849 command does not take effect until the next line of input is read.
4850 The commands following the alias definition
4851 on that line are not affected by the new alias.
4852 This behavior is also an issue when functions are executed.
4853 Aliases are expanded when a function definition is read,
4854 not when the function is executed, because a function definition
4855 is itself a compound command.  As a consequence, aliases
4856 defined in a function are not available until after that
4857 function is executed.  To be safe, always put
4858 alias definitions on a separate line, and do not use
4859 <B>alias</B>
4860
4861 in compound commands.
4862 <P>
4863
4864 For almost every purpose, aliases are superseded by
4865 shell functions.
4866 <A NAME="lbBU">&nbsp;</A>
4867 <H3>FUNCTIONS</H3>
4868
4869 A shell function, defined as described above under
4870 <FONT SIZE=-1><B>SHELL GRAMMAR</B>,
4871
4872 </FONT>
4873 stores a series of commands for later execution.
4874 When the name of a shell function is used as a simple command name,
4875 the list of commands associated with that function name is executed.
4876 Functions are executed in the context of the
4877 current shell; no new process is created to interpret
4878 them (contrast this with the execution of a shell script).
4879 When a function is executed, the arguments to the
4880 function become the positional parameters
4881 during its execution.
4882 The special parameter
4883 <B>#</B>
4884
4885 is updated to reflect the change.  Special parameter <B>0</B>
4886 is unchanged.
4887 The first element of the
4888 <FONT SIZE=-1><B>FUNCNAME</B>
4889
4890 </FONT>
4891 variable is set to the name of the function while the function
4892 is executing.
4893 <P>
4894
4895 All other aspects of the shell execution
4896 environment are identical between a function and its caller
4897 with these exceptions:  the
4898 <FONT SIZE=-1><B>DEBUG</B>
4899
4900 </FONT>
4901 and
4902 <B>RETURN</B>
4903
4904 traps (see the description of the
4905 <B>trap</B>
4906
4907 builtin under
4908 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
4909
4910 </FONT>
4911 below) are not inherited unless the function has been given the
4912 <B>trace</B> attribute (see the description of the
4913 <FONT SIZE=-1><B>declare</B>
4914
4915 </FONT>
4916 builtin below) or the
4917 <B>-o functrace</B> shell option has been enabled with
4918 the <B>set</B> builtin
4919 (in which case all functions inherit the <B>DEBUG</B> and <B>RETURN</B> traps),
4920 and the
4921 <FONT SIZE=-1><B>ERR</B>
4922
4923 </FONT>
4924 trap is not inherited unless the <B>-o errtrace</B> shell option has
4925 been enabled.
4926 <P>
4927
4928 Variables local to the function may be declared with the
4929 <B>local</B>
4930
4931 builtin command.  Ordinarily, variables and their values
4932 are shared between the function and its caller.
4933 <P>
4934
4935 The <B>FUNCNEST</B> variable, if set to a numeric value greater
4936 than 0, defines a maximum function nesting level.  Function
4937 invocations that exceed the limit cause the entire command to
4938 abort.
4939 <P>
4940
4941 If the builtin command
4942 <B>return</B>
4943
4944 is executed in a function, the function completes and
4945 execution resumes with the next command after the function
4946 call.
4947 Any command associated with the <B>RETURN</B> trap is executed
4948 before execution resumes.
4949 When a function completes, the values of the
4950 positional parameters and the special parameter
4951 <B>#</B>
4952
4953 are restored to the values they had prior to the function's
4954 execution.
4955 <P>
4956
4957 Function names and definitions may be listed with the
4958 <B>-f</B>
4959
4960 option to the
4961 <B>declare</B>
4962
4963 or
4964 <B>typeset</B>
4965
4966 builtin commands.  The
4967 <B>-F</B>
4968
4969 option to
4970 <B>declare</B>
4971
4972 or
4973 <B>typeset</B>
4974
4975 will list the function names only
4976 (and optionally the source file and line number, if the <B>extdebug</B>
4977 shell option is enabled).
4978 Functions may be exported so that subshells
4979 automatically have them defined with the
4980 <B>-f</B>
4981
4982 option to the 
4983 <B>export</B>
4984
4985 builtin.
4986 A function definition may be deleted using the <B>-f</B> option to
4987 the
4988 <B>unset</B>
4989
4990 builtin.
4991 Note that shell functions and variables with the same name may result
4992 in multiple identically-named entries in the environment passed to the
4993 shell's children.
4994 Care should be taken in cases where this may cause a problem.
4995 <P>
4996
4997 Functions may be recursive.
4998 The <B>FUNCNEST</B> variable may be used to limit the depth of the
4999 function call stack and restrict the number of function invocations.
5000 By default, no limit is imposed on the number of recursive calls.
5001 <A NAME="lbBV">&nbsp;</A>
5002 <H3>ARITHMETIC EVALUATION</H3>
5003
5004 The shell allows arithmetic expressions to be evaluated, under
5005 certain circumstances (see the <B>let</B> and <B>declare</B> builtin
5006 commands and <B>Arithmetic Expansion</B>).
5007 Evaluation is done in fixed-width integers with no check for overflow,
5008 though division by 0 is trapped and flagged as an error.
5009 The operators and their precedence, associativity, and values
5010 are the same as in the C language.
5011 The following list of operators is grouped into levels of
5012 equal-precedence operators.
5013 The levels are listed in order of decreasing precedence.
5014 <P>
5015
5016
5017 <DL COMPACT>
5018 <DT><B></B><I>id</I>++ <I>id</I>--
5019
5020 <DD>
5021 variable post-increment and post-decrement
5022 <DT><B>++</B><I>id</I> --<I>id</I>
5023
5024 <DD>
5025 variable pre-increment and pre-decrement
5026 <DT><B>- +</B>
5027
5028 <DD>
5029 unary minus and plus
5030 <DT><B>! ~</B>
5031
5032 <DD>
5033 logical and bitwise negation
5034 <DT><B>**</B>
5035
5036 <DD>
5037 exponentiation
5038 <DT><B>* / %</B>
5039
5040 <DD>
5041 multiplication, division, remainder
5042 <DT><B>+ -</B>
5043
5044 <DD>
5045 addition, subtraction
5046 <DT><B>&lt;&lt; &gt;&gt;</B>
5047
5048 <DD>
5049 left and right bitwise shifts
5050 <DT><B>&lt;= &gt;= &lt; &gt;</B>
5051
5052 <DD>
5053 comparison
5054 <DT><B>== !=</B>
5055
5056 <DD>
5057 equality and inequality
5058 <DT><B>&amp;</B>
5059
5060 <DD>
5061 bitwise AND
5062 <DT><B>^</B>
5063
5064 <DD>
5065 bitwise exclusive OR
5066 <DT><B>|</B>
5067
5068 <DD>
5069 bitwise OR
5070 <DT><B>&amp;&amp;</B>
5071
5072 <DD>
5073 logical AND
5074 <DT><B>||</B>
5075
5076 <DD>
5077 logical OR
5078 <DT><B></B><I>expr</I>?<I>expr</I>:<I>expr</I>
5079
5080 <DD>
5081 conditional operator
5082 <DT><B>= *= /= %= += -= &lt;&lt;= &gt;&gt;= &amp;= ^= |=</B>
5083
5084 <DD>
5085 assignment
5086 <DT><B></B><I>expr1</I> , <I>expr2</I>
5087
5088 <DD>
5089 comma
5090
5091 </DL>
5092 <P>
5093
5094 Shell variables are allowed as operands; parameter expansion is
5095 performed before the expression is evaluated.
5096 Within an expression, shell variables may also be referenced by name
5097 without using the parameter expansion syntax.
5098 A shell variable that is null or unset evaluates to 0 when referenced
5099 by name without using the parameter expansion syntax.
5100 The value of a variable is evaluated as an arithmetic expression
5101 when it is referenced, or when a variable which has been given the
5102 <I>integer</I> attribute using <B>declare -i</B> is assigned a value.
5103 A null value evaluates to 0.
5104 A shell variable need not have its <I>integer</I> attribute
5105 turned on to be used in an expression.
5106 <P>
5107
5108 Constants with a leading 0 are interpreted as octal numbers.
5109 A leading 0x or 0X denotes hexadecimal.
5110 Otherwise, numbers take the form [<I>base#</I>]n, where the optional <I>base</I>
5111 is a decimal number between 2 and 64 representing the arithmetic
5112 base, and <I>n</I> is a number in that base.
5113 If <I>base#</I> is omitted, then base 10 is used.
5114 The digits greater than 9 are represented by the lowercase letters,
5115 the uppercase letters, @, and _, in that order.
5116 If <I>base</I> is less than or equal to 36, lowercase and uppercase
5117 letters may be used interchangeably to represent numbers between 10
5118 and 35.
5119 <P>
5120
5121 Operators are evaluated in order of precedence.  Sub-expressions in
5122 parentheses are evaluated first and may override the precedence
5123 rules above.
5124 <A NAME="lbBW">&nbsp;</A>
5125 <H3>CONDITIONAL EXPRESSIONS</H3>
5126
5127 Conditional expressions are used by the <B>[[</B> compound command and
5128 the <B>test</B> and <B>[</B> builtin commands to test file attributes
5129 and perform string and arithmetic comparisons.
5130 Expressions are formed from the following unary or binary primaries.
5131 If any <I>file</I> argument to one of the primaries is of the form
5132 <I>/dev/fd/n</I>, then file descriptor <I>n</I> is checked.
5133 If the <I>file</I> argument to one of the primaries is one of
5134 <I>/dev/stdin</I>, <I>/dev/stdout</I>, or <I>/dev/stderr</I>, file
5135 descriptor 0, 1, or 2, respectively, is checked.
5136 <P>
5137
5138 Unless otherwise specified, primaries that operate on files follow symbolic
5139 links and operate on the target of the link, rather than the link itself.
5140 <P>
5141
5142
5143 When used with <B>[[</B>, the <B>&lt;</B> and <B>&gt;</B> operators sort
5144 lexicographically using the current locale.
5145 The <B>test</B> command sorts using ASCII ordering.
5146 <P>
5147
5148 <DL COMPACT>
5149 <DT><B>-a </B><I>file</I>
5150
5151 <DD>
5152 True if <I>file</I> exists.
5153 <DT><B>-b </B><I>file</I>
5154
5155 <DD>
5156 True if <I>file</I> exists and is a block special file.
5157 <DT><B>-c </B><I>file</I>
5158
5159 <DD>
5160 True if <I>file</I> exists and is a character special file.
5161 <DT><B>-d </B><I>file</I>
5162
5163 <DD>
5164 True if <I>file</I> exists and is a directory.
5165 <DT><B>-e </B><I>file</I>
5166
5167 <DD>
5168 True if <I>file</I> exists.
5169 <DT><B>-f </B><I>file</I>
5170
5171 <DD>
5172 True if <I>file</I> exists and is a regular file.
5173 <DT><B>-g </B><I>file</I>
5174
5175 <DD>
5176 True if <I>file</I> exists and is set-group-id.
5177 <DT><B>-h </B><I>file</I>
5178
5179 <DD>
5180 True if <I>file</I> exists and is a symbolic link.
5181 <DT><B>-k </B><I>file</I>
5182
5183 <DD>
5184 True if <I>file</I> exists and its ``sticky'' bit is set.
5185 <DT><B>-p </B><I>file</I>
5186
5187 <DD>
5188 True if <I>file</I> exists and is a named pipe (FIFO).
5189 <DT><B>-r </B><I>file</I>
5190
5191 <DD>
5192 True if <I>file</I> exists and is readable.
5193 <DT><B>-s </B><I>file</I>
5194
5195 <DD>
5196 True if <I>file</I> exists and has a size greater than zero.
5197 <DT><B>-t </B><I>fd</I>
5198
5199 <DD>
5200 True if file descriptor
5201 <I>fd</I>
5202
5203 is open and refers to a terminal.
5204 <DT><B>-u </B><I>file</I>
5205
5206 <DD>
5207 True if <I>file</I> exists and its set-user-id bit is set.
5208 <DT><B>-w </B><I>file</I>
5209
5210 <DD>
5211 True if <I>file</I> exists and is writable.
5212 <DT><B>-x </B><I>file</I>
5213
5214 <DD>
5215 True if <I>file</I> exists and is executable.
5216 <DT><B>-G </B><I>file</I>
5217
5218 <DD>
5219 True if <I>file</I> exists and is owned by the effective group id.
5220 <DT><B>-L </B><I>file</I>
5221
5222 <DD>
5223 True if <I>file</I> exists and is a symbolic link.
5224 <DT><B>-N </B><I>file</I>
5225
5226 <DD>
5227 True if <I>file</I> exists and has been modified since it was last read.
5228 <DT><B>-O </B><I>file</I>
5229
5230 <DD>
5231 True if <I>file</I> exists and is owned by the effective user id.
5232 <DT><B>-S </B><I>file</I>
5233
5234 <DD>
5235 True if <I>file</I> exists and is a socket.
5236 <DT><I>file1</I> <B>-ef</B> <I>file2</I><DD>
5237 True if <I>file1</I> and <I>file2</I> refer to the same device and
5238 inode numbers.
5239 <DT><I>file1</I> -<B>nt</B> <I>file2</I><DD>
5240 True if <I>file1</I> is newer (according to modification date) than <I>file2</I>,
5241 or if <I>file1</I> exists and file2 does not.
5242 <DT><I>file1</I> -<B>ot</B> <I>file2</I><DD>
5243 True if <I>file1</I> is older than <I>file2</I>, or if <I>file2</I> exists
5244 and <I>file1</I> does not.
5245 <DT><B>-o </B><I>optname</I>
5246
5247 <DD>
5248 True if the shell option
5249 <I>optname</I>
5250
5251 is enabled.
5252 See the list of options under the description of the
5253 <B>-o</B>
5254
5255 option to the
5256 <B>set</B>
5257
5258 builtin below.
5259 <DT><B>-v </B><I>varname</I>
5260
5261 <DD>
5262 True if the shell variable
5263 <I>varname</I>
5264
5265 is set (has been assigned a value).
5266 <DT><B>-z </B><I>string</I>
5267
5268 <DD>
5269 True if the length of <I>string</I> is zero.
5270 <DT><I>string</I><DD>
5271
5272 <DT><B>-n </B><I>string</I>
5273
5274 <DD>
5275
5276 True if the length of
5277 <I>string</I>
5278
5279 is non-zero.
5280 <DT><I>string1</I> <B>==</B> <I>string2</I><DD>
5281
5282 <DT><I>string1</I> <B>=</B> <I>string2</I><DD>
5283
5284 True if the strings are equal.  <B>=</B> should be used
5285 with the <B>test</B> command for POSIX conformance.
5286 <DT><I>string1</I> <B>!=</B> <I>string2</I><DD>
5287 True if the strings are not equal.
5288 <DT><I>string1</I> <B>&lt;</B> <I>string2</I><DD>
5289 True if <I>string1</I> sorts before <I>string2</I> lexicographically.
5290 <DT><I>string1</I> <B>&gt;</B> <I>string2</I><DD>
5291 True if <I>string1</I> sorts after <I>string2</I> lexicographically.
5292 <DT><I>arg1</I> <B>OP</B> <I>arg2</I>
5293
5294 <DD>
5295 <FONT SIZE=-1><B>OP</B>
5296
5297 </FONT>
5298 is one of
5299 <B>-eq</B>,
5300
5301 <B>-ne</B>,
5302
5303 <B>-lt</B>,
5304
5305 <B>-le</B>,
5306
5307 <B>-gt</B>,
5308
5309 or
5310 <B>-ge</B>.
5311
5312 These arithmetic binary operators return true if <I>arg1</I>
5313 is equal to, not equal to, less than, less than or equal to,
5314 greater than, or greater than or equal to <I>arg2</I>, respectively.
5315 <I>Arg1</I>
5316
5317 and
5318 <I>arg2</I>
5319
5320 may be positive or negative integers.
5321
5322 </DL>
5323 <A NAME="lbBX">&nbsp;</A>
5324 <H3>SIMPLE COMMAND EXPANSION</H3>
5325
5326 When a simple command is executed, the shell performs the following
5327 expansions, assignments, and redirections, from left to right.
5328 <DL COMPACT>
5329 <DT>1.<DD>
5330 The words that the parser has marked as variable assignments (those
5331 preceding the command name) and redirections are saved for later
5332 processing.
5333 <DT>2.<DD>
5334 The words that are not variable assignments or redirections are
5335 expanded.  If any words remain after expansion, the first word
5336 is taken to be the name of the command and the remaining words are
5337 the arguments.
5338 <DT>3.<DD>
5339 Redirections are performed as described above under
5340 <FONT SIZE=-1><B>REDIRECTION</B>.
5341
5342 </FONT>
5343 <DT>4.<DD>
5344 The text after the <B>=</B> in each variable assignment undergoes tilde
5345 expansion, parameter expansion, command substitution, arithmetic expansion,
5346 and quote removal before being assigned to the variable.
5347 </DL>
5348 <P>
5349
5350 If no command name results, the variable assignments affect the current
5351 shell environment.  Otherwise, the variables are added to the environment
5352 of the executed command and do not affect the current shell environment.
5353 If any of the assignments attempts to assign a value to a readonly variable,
5354 an error occurs, and the command exits with a non-zero status.
5355 <P>
5356
5357 If no command name results, redirections are performed, but do not
5358 affect the current shell environment.  A redirection error causes the
5359 command to exit with a non-zero status.
5360 <P>
5361
5362 If there is a command name left after expansion, execution proceeds as
5363 described below.  Otherwise, the command exits.  If one of the expansions
5364 contained a command substitution, the exit status of the command is
5365 the exit status of the last command substitution performed.  If there
5366 were no command substitutions, the command exits with a status of zero.
5367 <A NAME="lbBY">&nbsp;</A>
5368 <H3>COMMAND EXECUTION</H3>
5369
5370 After a command has been split into words, if it results in a
5371 simple command and an optional list of arguments, the following
5372 actions are taken.
5373 <P>
5374
5375 If the command name contains no slashes, the shell attempts to
5376 locate it.  If there exists a shell function by that name, that
5377 function is invoked as described above in
5378 <FONT SIZE=-1><B>FUNCTIONS</B>.
5379
5380 </FONT>
5381 If the name does not match a function, the shell searches for
5382 it in the list of shell builtins.  If a match is found, that
5383 builtin is invoked.
5384 <P>
5385
5386 If the name is neither a shell function nor a builtin,
5387 and contains no slashes,
5388 <B>bash</B>
5389
5390 searches each element of the
5391 <FONT SIZE=-1><B>PATH</B>
5392
5393 </FONT>
5394 for a directory containing an executable file by that name.
5395 <B>Bash</B>
5396
5397 uses a hash table to remember the full pathnames of executable
5398 files (see
5399 <B>hash</B>
5400
5401 under
5402 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
5403
5404 </FONT>
5405 below).
5406 A full search of the directories in
5407 <FONT SIZE=-1><B>PATH</B>
5408
5409 </FONT>
5410 is performed only if the command is not found in the hash table.
5411 If the search is unsuccessful, the shell searches for a defined shell
5412 function named <B>command_not_found_handle</B>.
5413 If that function exists, it is invoked with the original command and
5414 the original command's arguments as its arguments, and the function's
5415 exit status becomes the exit status of the shell.
5416 If that function is not defined, the shell prints an error
5417 message and returns an exit status of 127.
5418 <P>
5419
5420 If the search is successful, or if the command name contains
5421 one or more slashes, the shell executes the named program in a
5422 separate execution environment.
5423 Argument 0 is set to the name given, and the remaining arguments
5424 to the command are set to the arguments given, if any.
5425 <P>
5426
5427 If this execution fails because the file is not in executable
5428 format, and the file is not a directory, it is assumed to be
5429 a <I>shell script</I>, a file
5430 containing shell commands.  A subshell is spawned to execute
5431 it.  This subshell reinitializes itself, so
5432 that the effect is as if a new shell had been invoked
5433 to handle the script, with the exception that the locations of
5434 commands remembered by the parent (see
5435 <B>hash</B>
5436
5437 below under
5438 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>)</FONT>
5439 are retained by the child.
5440 <P>
5441
5442 If the program is a file beginning with
5443 <B>#!</B>,
5444
5445 the remainder of the first line specifies an interpreter
5446 for the program.  The shell executes the
5447 specified interpreter on operating systems that do not
5448 handle this executable format themselves.  The arguments to the 
5449 interpreter consist of a single optional argument following the
5450 interpreter name on the first line of the program, followed
5451 by the name of the program, followed by the command
5452 arguments, if any.
5453 <A NAME="lbBZ">&nbsp;</A>
5454 <H3>COMMAND EXECUTION ENVIRONMENT</H3>
5455
5456 The shell has an <I>execution environment</I>, which consists of the
5457 following:
5458
5459 <DL COMPACT>
5460 <DT>*<DD>
5461 open files inherited by the shell at invocation, as modified by
5462 redirections supplied to the <B>exec</B> builtin
5463 <DT>*<DD>
5464 the current working directory as set by <B>cd</B>, <B>pushd</B>, or
5465 <B>popd</B>, or inherited by the shell at invocation
5466 <DT>*<DD>
5467 the file creation mode mask as set by <B>umask</B> or inherited from
5468 the shell's parent
5469 <DT>*<DD>
5470 current traps set by <B>trap</B>
5471 <DT>*<DD>
5472 shell parameters that are set by variable assignment or with <B>set</B>
5473 or inherited from the shell's parent in the environment
5474 <DT>*<DD>
5475 shell functions defined during execution or inherited from the shell's
5476 parent in the environment
5477 <DT>*<DD>
5478 options enabled at invocation (either by default or with command-line
5479 arguments) or by <B>set</B>
5480 <DT>*<DD>
5481 options enabled by <B>shopt</B>
5482 <DT>*<DD>
5483 shell aliases defined with <B>alias</B>
5484 <DT>*<DD>
5485 various process IDs, including those of background jobs, the value
5486 of <B>$$</B>, and the value of
5487 <FONT SIZE=-1><B>PPID</B>
5488
5489 </FONT>
5490 </DL>
5491 <P>
5492
5493 When a simple command other than a builtin or shell function
5494 is to be executed, it
5495 is invoked in a separate execution environment that consists of
5496 the following.  Unless otherwise noted, the values are inherited
5497 from the shell.
5498
5499 <DL COMPACT>
5500 <DT>*<DD>
5501 the shell's open files, plus any modifications and additions specified
5502 by redirections to the command
5503 <DT>*<DD>
5504 the current working directory
5505 <DT>*<DD>
5506 the file creation mode mask
5507 <DT>*<DD>
5508 shell variables and functions marked for export, along with variables
5509 exported for the command, passed in the environment
5510 <DT>*<DD>
5511 traps caught by the shell are reset to the values inherited from the
5512 shell's parent, and traps ignored by the shell are ignored
5513 </DL>
5514 <P>
5515
5516 A command invoked in this separate environment cannot affect the
5517 shell's execution environment. 
5518 <P>
5519
5520 Command substitution, commands grouped with parentheses,
5521 and asynchronous commands are invoked in a
5522 subshell environment that is a duplicate of the shell environment,
5523 except that traps caught by the shell are reset to the values
5524 that the shell inherited from its parent at invocation.  Builtin
5525 commands that are invoked as part of a pipeline are also executed in a
5526 subshell environment.  Changes made to the subshell environment
5527 cannot affect the shell's execution environment.
5528 <P>
5529
5530 Subshells spawned to execute command substitutions inherit the value of
5531 the <B>-e</B> option from the parent shell.  When not in <I>posix</I> mode,
5532 <B>bash</B> clears the <B>-e</B> option in such subshells.
5533 <P>
5534
5535 If a command is followed by a <B>&amp;</B> and job control is not active, the
5536 default standard input for the command is the empty file <I>/dev/null</I>.
5537 Otherwise, the invoked command inherits the file descriptors of the calling
5538 shell as modified by redirections.
5539 <A NAME="lbCA">&nbsp;</A>
5540 <H3>ENVIRONMENT</H3>
5541
5542 When a program is invoked it is given an array of strings
5543 called the
5544 <I>environment</I>.
5545
5546 This is a list of 
5547 <I>name</I>-<I>value</I> pairs, of the form
5548 <I>name</I>=value.
5549
5550 <P>
5551
5552 The shell provides several ways to manipulate the environment.
5553 On invocation, the shell scans its own environment and
5554 creates a parameter for each name found, automatically marking
5555 it for
5556 <I>export</I>
5557
5558 to child processes.  Executed commands inherit the environment.
5559 The
5560 <B>export</B>
5561
5562 and
5563 <B>declare -x</B>
5564
5565 commands allow parameters and functions to be added to and
5566 deleted from the environment.  If the value of a parameter
5567 in the environment is modified, the new value becomes part
5568 of the environment, replacing the old.  The environment
5569 inherited by any executed command consists of the shell's
5570 initial environment, whose values may be modified in the shell,
5571 less any pairs removed by the
5572 <B>unset</B>
5573
5574 command, plus any additions via the
5575 <B>export</B>
5576
5577 and
5578 <B>declare -x</B>
5579
5580 commands.
5581 <P>
5582
5583 The environment for any
5584 <I>simple command</I>
5585
5586 or function may be augmented temporarily by prefixing it with
5587 parameter assignments, as described above in
5588 <FONT SIZE=-1><B>PARAMETERS</B>.
5589
5590 </FONT>
5591 These assignment statements affect only the environment seen
5592 by that command.
5593 <P>
5594
5595 If the 
5596 <B>-k</B>
5597
5598 option is set (see the
5599 <B>set</B>
5600
5601 builtin command below), then
5602 <I>all</I>
5603
5604 parameter assignments are placed in the environment for a command,
5605 not just those that precede the command name.
5606 <P>
5607
5608 When
5609 <B>bash</B>
5610
5611 invokes an external command, the variable
5612 <B>_</B>
5613
5614 is set to the full file name of the command and passed to that
5615 command in its environment.
5616 <A NAME="lbCB">&nbsp;</A>
5617 <H3>EXIT STATUS</H3>
5618
5619 <P>
5620
5621 The exit status of an executed command is the value returned by the
5622 <I>waitpid</I> system call or equivalent function.  Exit statuses
5623 fall between 0 and 255, though, as explained below, the shell may
5624 use values above 125 specially.  Exit statuses from shell builtins and
5625 compound commands are also limited to this range. Under certain
5626 circumstances, the shell will use special values to indicate specific
5627 failure modes.
5628 <P>
5629
5630 For the shell's purposes, a command which exits with a 
5631 zero exit status has succeeded.  An exit status of zero
5632 indicates success.  A non-zero exit status indicates failure.
5633 When a command terminates on a fatal signal <I>N</I>, <B>bash</B> uses
5634 the value of 128+<I>N</I> as the exit status.
5635 <P>
5636
5637 If a command is not found, the child process created to
5638 execute it returns a status of 127.  If a command is found
5639 but is not executable, the return status is 126.
5640 <P>
5641
5642 If a command fails because of an error during expansion or redirection,
5643 the exit status is greater than zero.
5644 <P>
5645
5646 Shell builtin commands return a status of 0 (<I>true</I>) if
5647 successful, and non-zero (<I>false</I>) if an error occurs
5648 while they execute. 
5649 All builtins return an exit status of 2 to indicate incorrect usage.
5650 <P>
5651
5652 <B>Bash</B> itself returns the exit status of the last command
5653 executed, unless a syntax error occurs, in which case it exits
5654 with a non-zero value.  See also the <B>exit</B> builtin
5655 command below.
5656 <A NAME="lbCC">&nbsp;</A>
5657 <H3>SIGNALS</H3>
5658
5659 When <B>bash</B> is interactive, in the absence of any traps, it ignores
5660 <FONT SIZE=-1><B>SIGTERM</B>
5661
5662 </FONT>
5663 (so that <B>kill 0</B> does not kill an interactive shell),
5664 and
5665 <FONT SIZE=-1><B>SIGINT</B>
5666
5667 </FONT>
5668 is caught and handled (so that the <B>wait</B> builtin is interruptible).
5669 In all cases, <B>bash</B> ignores
5670 <FONT SIZE=-1><B>SIGQUIT</B>.
5671
5672 </FONT>
5673 If job control is in effect,
5674 <B>bash</B>
5675
5676 ignores
5677 <FONT SIZE=-1><B>SIGTTIN</B>,
5678
5679 </FONT>
5680 <FONT SIZE=-1><B>SIGTTOU</B>,
5681
5682 </FONT>
5683 and
5684 <FONT SIZE=-1><B>SIGTSTP</B>.
5685
5686 </FONT>
5687 <P>
5688
5689 Non-builtin commands run by <B>bash</B> have signal handlers
5690 set to the values inherited by the shell from its parent.
5691 When job control is not in effect, asynchronous commands
5692 ignore
5693 <FONT SIZE=-1><B>SIGINT</B>
5694
5695 </FONT>
5696 and
5697 <FONT SIZE=-1><B>SIGQUIT</B>
5698
5699 </FONT>
5700 in addition to these inherited handlers.
5701 Commands run as a result of command substitution ignore the
5702 keyboard-generated job control signals
5703 <FONT SIZE=-1><B>SIGTTIN</B>,
5704
5705 </FONT>
5706 <FONT SIZE=-1><B>SIGTTOU</B>,
5707
5708 </FONT>
5709 and
5710 <FONT SIZE=-1><B>SIGTSTP</B>.
5711
5712 </FONT>
5713 <P>
5714
5715 The shell exits by default upon receipt of a
5716 <FONT SIZE=-1><B>SIGHUP</B>.
5717
5718 </FONT>
5719 Before exiting, an interactive shell resends the
5720 <FONT SIZE=-1><B>SIGHUP</B>
5721
5722 </FONT>
5723 to all jobs, running or stopped.
5724 Stopped jobs are sent
5725 <FONT SIZE=-1><B>SIGCONT</B>
5726
5727 </FONT>
5728 to ensure that they receive the
5729 <FONT SIZE=-1><B>SIGHUP</B>.
5730
5731 </FONT>
5732 To prevent the shell from
5733 sending the signal to a particular job, it should be removed from the
5734 jobs table with the 
5735 <B>disown</B>
5736
5737 builtin (see
5738 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
5739
5740 </FONT>
5741 below) or marked 
5742 to not receive
5743 <FONT SIZE=-1><B>SIGHUP</B>
5744
5745 </FONT>
5746 using
5747 <B>disown -h</B>.
5748
5749 <P>
5750
5751 If the
5752 <B>huponexit</B>
5753
5754 shell option has been set with
5755 <B>shopt</B>,
5756
5757 <B>bash</B>
5758
5759 sends a 
5760 <FONT SIZE=-1><B>SIGHUP</B>
5761
5762 </FONT>
5763 to all jobs when an interactive login shell exits.
5764 <P>
5765
5766 If <B>bash</B> is waiting for a command to complete and receives a signal
5767 for which a trap has been set, the trap will not be executed until
5768 the command completes. 
5769 When <B>bash</B> is waiting for an asynchronous command via the <B>wait</B>
5770 builtin, the reception of a signal for which a trap has been set will
5771 cause the <B>wait</B> builtin to return immediately with an exit status
5772 greater than 128, immediately after which the trap is executed.
5773 <A NAME="lbCD">&nbsp;</A>
5774 <H3>JOB CONTROL</H3>
5775
5776 <I>Job control</I>
5777
5778 refers to the ability to selectively stop (<I>suspend</I>)
5779 the execution of processes and continue (<I>resume</I>)
5780 their execution at a later point.  A user typically employs
5781 this facility via an interactive interface supplied jointly
5782 by the operating system kernel's terminal driver and
5783 <B>bash</B>.
5784
5785 <P>
5786
5787 The shell associates a
5788 <I>job</I>
5789
5790 with each pipeline.  It keeps a table of currently executing
5791 jobs, which may be listed with the
5792 <B>jobs</B>
5793
5794 command.  When
5795 <B>bash</B>
5796
5797 starts a job asynchronously (in the
5798 <I>background</I>),
5799
5800 it prints a line that looks like:
5801 <DL COMPACT><DT><DD>
5802 <P>
5803
5804 [1] 25647
5805 </DL>
5806
5807 <P>
5808
5809 indicating that this job is job number 1 and that the process ID
5810 of the last process in the pipeline associated with this job is 25647.
5811 All of the processes in a single pipeline are members of the same job.
5812 <B>Bash</B>
5813
5814 uses the
5815 <I>job</I>
5816
5817 abstraction as the basis for job control.
5818 <P>
5819
5820 To facilitate the implementation of the user interface to job
5821 control, the operating system maintains the notion of a <I>current terminal
5822 process group ID</I>.  Members of this process group (processes whose
5823 process group ID is equal to the current terminal process group ID)
5824 receive keyboard-generated signals such as
5825 <FONT SIZE=-1><B>SIGINT</B>.
5826
5827 </FONT>
5828 These processes are said to be in the
5829 <I>foreground</I>.
5830
5831 <I>Background</I>
5832
5833 processes are those whose process group ID differs from the terminal's;
5834 such processes are immune to keyboard-generated signals.
5835 Only foreground processes are allowed to read from or, if the
5836 user so specifies with <TT>stty tostop</TT>, write to the
5837 terminal.
5838 Background processes which attempt to read from (write to when
5839 <TT>stty tostop</TT> is in effect) the
5840 terminal are sent a 
5841 <FONT SIZE=-1><B>SIGTTIN (SIGTTOU)</B>
5842
5843 </FONT>
5844 signal by the kernel's terminal driver, 
5845 which, unless caught, suspends the process.
5846 <P>
5847
5848 If the operating system on which
5849 <B>bash</B>
5850
5851 is running supports
5852 job control,
5853 <B>bash</B>
5854
5855 contains facilities to use it.
5856 Typing the
5857 <I>suspend</I>
5858
5859 character (typically
5860 <B>^Z</B>,
5861
5862 Control-Z) while a process is running
5863 causes that process to be stopped and returns control to 
5864 <B>bash</B>.
5865
5866 Typing the
5867 <I>delayed suspend</I>
5868
5869 character (typically
5870 <B>^Y</B>,
5871
5872 Control-Y) causes the process to be stopped when it
5873 attempts to read input from the terminal, and control to
5874 be returned to
5875 <B>bash</B>.
5876
5877 The user may then manipulate the state of this job, using the
5878 <B>bg</B>
5879
5880 command to continue it in the background, the
5881 <B>fg</B>
5882
5883 command to continue it in the foreground, or
5884 the
5885 <B>kill</B>
5886
5887 command to kill it.  A <B>^Z</B> takes effect immediately,
5888 and has the additional side effect of causing pending output
5889 and typeahead to be discarded.
5890 <P>
5891
5892 There are a number of ways to refer to a job in the shell.
5893 The character
5894 <B>%</B>
5895
5896 introduces a job specification (<I>jobspec</I>).  Job number
5897 <I>n</I>
5898
5899 may be referred to as
5900 <B>%n</B>.
5901
5902 A job may also be referred to using a prefix of the name used to
5903 start it, or using a substring that appears in its command line.
5904 For example,
5905 <B>%ce</B>
5906
5907 refers to a stopped
5908 <B>ce</B>
5909
5910 job.  If a prefix matches more than one job,
5911 <B>bash</B>
5912
5913 reports an error.  Using
5914 <B>%?ce</B>,
5915
5916 on the other hand, refers to any job containing the string
5917 <B>ce</B>
5918
5919 in its command line.  If the substring matches more than one job,
5920 <B>bash</B>
5921
5922 reports an error.  The symbols
5923 <B>%%</B>
5924
5925 and
5926 <B>%+</B>
5927
5928 refer to the shell's notion of the
5929 <I>current job</I>,
5930
5931 which is the last job stopped while it was in
5932 the foreground or started in the background.
5933 The 
5934 <I>previous job</I>
5935
5936 may be referenced using
5937 <B>%-</B>.
5938
5939 If there is only a single job, <B>%+</B> and <B>%-</B> can both be used
5940 to refer to that job.
5941 In output pertaining to jobs (e.g., the output of the
5942 <B>jobs</B>
5943
5944 command), the current job is always flagged with a
5945 <B>+</B>,
5946
5947 and the previous job with a
5948 <B>-</B>.
5949
5950 A single % (with no accompanying job specification) also refers to the
5951 current job.
5952 <P>
5953
5954 Simply naming a job can be used to bring it into the
5955 foreground:
5956 <B>%1</B>
5957
5958 is a synonym for
5959 <B>``fg %1''</B>,
5960 bringing job 1 from the background into the foreground.
5961 Similarly,
5962 <B>``%1 &amp;''</B>
5963
5964 resumes job 1 in the background, equivalent to
5965 <B>``bg %1''</B>.
5966 <P>
5967
5968 The shell learns immediately whenever a job changes state.
5969 Normally,
5970 <B>bash</B>
5971
5972 waits until it is about to print a prompt before reporting
5973 changes in a job's status so as to not interrupt
5974 any other output.  If the 
5975 <B>-b</B>
5976
5977 option to the
5978 <B>set</B>
5979
5980 builtin command
5981 is enabled,
5982 <B>bash</B>
5983
5984 reports such changes immediately.
5985 Any trap on
5986 <FONT SIZE=-1><B>SIGCHLD</B>
5987
5988 </FONT>
5989 is executed for each child that exits.
5990 <P>
5991
5992 If an attempt to exit
5993 <B>bash</B>
5994
5995 is made while jobs are stopped (or, if the <B>checkjobs</B> shell option has
5996 been enabled using the <B>shopt</B> builtin, running), the shell prints a
5997 warning message, and, if the <B>checkjobs</B> option is enabled, lists the
5998 jobs and their statuses.
5999 The
6000 <B>jobs</B>
6001
6002 command may then be used to inspect their status. 
6003 If a second attempt to exit is made without an intervening command,
6004 the shell does not print another warning, and any stopped
6005 jobs are terminated.
6006 <A NAME="lbCE">&nbsp;</A>
6007 <H3>PROMPTING</H3>
6008
6009 When executing interactively, 
6010 <B>bash</B>
6011
6012 displays the primary prompt
6013 <FONT SIZE=-1><B>PS1</B>
6014
6015 </FONT>
6016 when it is ready to read a command, and the secondary prompt
6017 <FONT SIZE=-1><B>PS2</B>
6018
6019 </FONT>
6020 when it needs more input to complete a command.
6021 <B>Bash</B>
6022
6023 allows these prompt strings to be customized by inserting a number of
6024 backslash-escaped special characters that are decoded as follows:
6025 <DL COMPACT><DT><DD>
6026
6027 <DL COMPACT>
6028 <DT><B>\a</B>
6029
6030 <DD>
6031 an ASCII bell character (07)
6032 <DT><B>\d</B>
6033
6034 <DD>
6035 the date in &quot;Weekday Month Date&quot; format (e.g., &quot;Tue May 26&quot;)
6036 <DT><B>\D{</B><I>format</I>}
6037
6038 <DD>
6039 the <I>format</I> is passed to <I>strftime</I>(3) and the result is inserted
6040 into the prompt string; an empty <I>format</I> results in a locale-specific
6041 time representation.  The braces are required
6042 <DT><B>\e</B>
6043
6044 <DD>
6045 an ASCII escape character (033)
6046 <DT><B>\h</B>
6047
6048 <DD>
6049 the hostname up to the first `.'
6050 <DT><B>\H</B>
6051
6052 <DD>
6053 the hostname
6054 <DT><B>\j</B>
6055
6056 <DD>
6057 the number of jobs currently managed by the shell
6058 <DT><B>\l</B>
6059
6060 <DD>
6061 the basename of the shell's terminal device name
6062 <DT><B>\n</B>
6063
6064 <DD>
6065 newline
6066 <DT><B>\r</B>
6067
6068 <DD>
6069 carriage return
6070 <DT><B>\s</B>
6071
6072 <DD>
6073 the name of the shell, the basename of
6074 <B>$0</B>
6075
6076 (the portion following the final slash)
6077 <DT><B>\t</B>
6078
6079 <DD>
6080 the current time in 24-hour HH:MM:SS format
6081 <DT><B>\T</B>
6082
6083 <DD>
6084 the current time in 12-hour HH:MM:SS format
6085 <DT><B>\@</B>
6086
6087 <DD>
6088 the current time in 12-hour am/pm format
6089 <DT><B>\A</B>
6090
6091 <DD>
6092 the current time in 24-hour HH:MM format
6093 <DT><B>\u</B>
6094
6095 <DD>
6096 the username of the current user
6097 <DT><B>\v</B>
6098
6099 <DD>
6100 the version of <B>bash</B> (e.g., 2.00)
6101 <DT><B>\V</B>
6102
6103 <DD>
6104 the release of <B>bash</B>, version + patch level (e.g., 2.00.0)
6105 <DT><B>\w</B>
6106
6107 <DD>
6108 the current working directory, with
6109 <FONT SIZE=-1><B>$HOME</B>
6110
6111 </FONT>
6112 abbreviated with a tilde
6113 (uses the value of the
6114 <FONT SIZE=-1><B>PROMPT_DIRTRIM</B>
6115
6116 </FONT>
6117 variable)
6118 <DT><B>\W</B>
6119
6120 <DD>
6121 the basename of the current working directory, with
6122 <FONT SIZE=-1><B>$HOME</B>
6123
6124 </FONT>
6125 abbreviated with a tilde
6126 <DT><B>\!</B>
6127
6128 <DD>
6129 the history number of this command
6130 <DT><B>\#</B>
6131
6132 <DD>
6133 the command number of this command
6134 <DT><B>\$</B>
6135
6136 <DD>
6137 if the effective UID is 0, a
6138 <B>#</B>,
6139
6140 otherwise a
6141 <B>$</B>
6142
6143 <DT><B>\</B><I>nnn</I>
6144
6145 <DD>
6146 the character corresponding to the octal number <I>nnn</I>
6147 <DT><B>\\</B>
6148
6149 <DD>
6150 a backslash
6151 <DT><B>\[</B>
6152
6153 <DD>
6154 begin a sequence of non-printing characters, which could be used to
6155 embed a terminal control sequence into the prompt
6156 <DT><B>\]</B>
6157
6158 <DD>
6159 end a sequence of non-printing characters
6160
6161 </DL></DL>
6162
6163 <P>
6164
6165 The command number and the history number are usually different:
6166 the history number of a command is its position in the history
6167 list, which may include commands restored from the history file
6168 (see
6169 <FONT SIZE=-1><B>HISTORY</B>
6170
6171 </FONT>
6172 below), while the command number is the position in the sequence
6173 of commands executed during the current shell session.
6174 After the string is decoded, it is expanded via
6175 parameter expansion, command substitution, arithmetic
6176 expansion, and quote removal, subject to the value of the
6177 <B>promptvars</B>
6178
6179 shell option (see the description of the
6180 <B>shopt</B>
6181
6182 command under
6183 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
6184
6185 </FONT>
6186 below).
6187 <A NAME="lbCF">&nbsp;</A>
6188 <H3>READLINE</H3>
6189
6190 This is the library that handles reading input when using an interactive
6191 shell, unless the
6192 <B>--noediting</B>
6193
6194 option is given at shell invocation.
6195 Line editing is also used when using the <B>-e</B> option to the
6196 <B>read</B> builtin.
6197 By default, the line editing commands are similar to those of Emacs.
6198 A vi-style line editing interface is also available.
6199 Line editing can be enabled at any time using the
6200 <B>-o emacs</B>
6201
6202 or
6203 <B>-o vi</B>
6204
6205 options to the
6206 <B>set</B>
6207
6208 builtin (see
6209 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
6210
6211 </FONT>
6212 below).
6213 To turn off line editing after the shell is running, use the
6214 <B>+o emacs</B>
6215
6216 or
6217 <B>+o vi</B>
6218
6219 options to the
6220 <B>set</B>
6221
6222 builtin.
6223 <A NAME="lbCG">&nbsp;</A>
6224 <H4>Readline Notation</H4>
6225
6226 <P>
6227
6228 In this section, the Emacs-style notation is used to denote
6229 keystrokes.  Control keys are denoted by C-<I>key</I>, e.g., C-n
6230 means Control-N.  Similarly, 
6231 <I>meta</I>
6232
6233 keys are denoted by M-<I>key</I>, so M-x means Meta-X.  (On keyboards
6234 without a 
6235 <I>meta</I>
6236
6237 key, M-<I>x</I> means ESC <I>x</I>, i.e., press the Escape key
6238 then the
6239 <I>x</I>
6240
6241 key.  This makes ESC the <I>meta prefix</I>.
6242 The combination M-C-<I>x</I> means ESC-Control-<I>x</I>,
6243 or press the Escape key
6244 then hold the Control key while pressing the
6245 <I>x</I>
6246
6247 key.)
6248 <P>
6249
6250 Readline commands may be given numeric
6251 <I>arguments</I>,
6252
6253 which normally act as a repeat count.
6254 Sometimes, however, it is the sign of the argument that is significant.
6255 Passing a negative argument to a command that acts in the forward
6256 direction (e.g., <B>kill-line</B>) causes that command to act in a
6257 backward direction. 
6258 Commands whose behavior with arguments deviates from this are noted
6259 below.
6260 <P>
6261
6262 When a command is described as <I>killing</I> text, the text
6263 deleted is saved for possible future retrieval
6264 (<I>yanking</I>).  The killed text is saved in a
6265 <I>kill ring</I>.  Consecutive kills cause the text to be
6266 accumulated into one unit, which can be yanked all at once. 
6267 Commands which do not kill text separate the chunks of text
6268 on the kill ring.
6269 <A NAME="lbCH">&nbsp;</A>
6270 <H4>Readline Initialization</H4>
6271
6272 <P>
6273
6274 Readline is customized by putting commands in an initialization
6275 file (the <I>inputrc</I> file).
6276 The name of this file is taken from the value of the
6277 <FONT SIZE=-1><B>INPUTRC</B>
6278
6279 </FONT>
6280 variable.  If that variable is unset, the default is
6281 <A HREF="file:~/.inputrc"><I>~/.inputrc</I></A>.
6282
6283 When a program which uses the readline library starts up, the
6284 initialization file is read, and the key bindings and variables
6285 are set.
6286 There are only a few basic constructs allowed in the
6287 readline initialization file.
6288 Blank lines are ignored.
6289 Lines beginning with a <B>#</B> are comments.
6290 Lines beginning with a <B>$</B> indicate conditional constructs.
6291 Other lines denote key bindings and variable settings.
6292 <P>
6293
6294 The default key-bindings may be changed with an
6295 <I>inputrc </I>
6296
6297 file.
6298 Other programs that use this library may add their own commands
6299 and bindings.
6300 <P>
6301
6302 For example, placing
6303 <DL COMPACT><DT><DD>
6304 <P>
6305
6306 M-Control-u: universal-argument
6307 </DL>
6308
6309 or
6310 <DL COMPACT><DT><DD>
6311 C-Meta-u: universal-argument
6312 </DL>
6313
6314 into the 
6315 <I>inputrc</I>
6316
6317 would make M-C-u execute the readline command
6318 <I>universal-argument</I>.
6319
6320 <P>
6321
6322 The following symbolic character names are recognized:
6323 <I>RUBOUT</I>,
6324
6325 <I>DEL</I>,
6326
6327 <I>ESC</I>,
6328
6329 <I>LFD</I>,
6330
6331 <I>NEWLINE</I>,
6332
6333 <I>RET</I>,
6334
6335 <I>RETURN</I>,
6336
6337 <I>SPC</I>,
6338
6339 <I>SPACE</I>,
6340
6341 and
6342 <I>TAB</I>.
6343
6344 <P>
6345
6346 In addition to command names, readline allows keys to be bound
6347 to a string that is inserted when the key is pressed (a <I>macro</I>).
6348 <A NAME="lbCI">&nbsp;</A>
6349 <H4>Readline Key Bindings</H4>
6350
6351 <P>
6352
6353 The syntax for controlling key bindings in the
6354 <I>inputrc</I>
6355
6356 file is simple.  All that is required is the name of the
6357 command or the text of a macro and a key sequence to which
6358 it should be bound. The name may be specified in one of two ways:
6359 as a symbolic key name, possibly with <I>Meta-</I> or <I>Control-</I>
6360 prefixes, or as a key sequence.
6361 <P>
6362
6363 When using the form <B>keyname</B>:<I>function-name</I> or <I>macro</I>,
6364 <I>keyname</I>
6365
6366 is the name of a key spelled out in English.  For example:
6367 <P>
6368 <DL COMPACT><DT><DD>
6369 Control-u: universal-argument
6370 <BR>
6371
6372 Meta-Rubout: backward-kill-word
6373 <BR>
6374
6375 Control-o: &quot;&gt; output&quot;
6376 </DL>
6377
6378 <P>
6379
6380 In the above example,
6381 <I>C-u</I>
6382
6383 is bound to the function
6384 <B>universal-argument</B>,
6385
6386 <I>M-DEL</I>
6387
6388 is bound to the function
6389 <B>backward-kill-word</B>,
6390
6391 and
6392 <I>C-o</I>
6393
6394 is bound to run the macro
6395 expressed on the right hand side (that is, to insert the text
6396 <TT>&gt; output</TT>
6397
6398 into the line).
6399 <P>
6400
6401 In the second form, <B>&quot;keyseq&quot;</B>:<I>function-name</I> or <I>macro</I>,
6402 <B>keyseq</B>
6403
6404 differs from
6405 <B>keyname</B>
6406
6407 above in that strings denoting
6408 an entire key sequence may be specified by placing the sequence
6409 within double quotes.  Some GNU Emacs style key escapes can be
6410 used, as in the following example, but the symbolic character names
6411 are not recognized.
6412 <P>
6413 <DL COMPACT><DT><DD>
6414 &quot;\C-u&quot;: universal-argument
6415 <BR>
6416
6417 &quot;\C-x\C-r&quot;: re-read-init-file
6418 <BR>
6419
6420 &quot;\e[11~&quot;: &quot;Function Key 1&quot;
6421 </DL>
6422
6423 <P>
6424
6425 In this example,
6426 <I>C-u</I>
6427
6428 is again bound to the function
6429 <B>universal-argument</B>.
6430
6431 <I>C-x C-r</I>
6432
6433 is bound to the function
6434 <B>re-read-init-file</B>,
6435
6436 and 
6437 <I>ESC [ 1 1 ~</I>
6438
6439 is bound to insert the text
6440 <TT>Function Key 1</TT>.
6441
6442 <P>
6443
6444 The full set of GNU Emacs style escape sequences is
6445 <DL COMPACT><DT><DD>
6446
6447 <DL COMPACT>
6448 <DT><B>\C-</B>
6449
6450 <DD>
6451 control prefix
6452 <DT><B>\M-</B>
6453
6454 <DD>
6455 meta prefix
6456 <DT><B>\e</B>
6457
6458 <DD>
6459 an escape character
6460 <DT><B>\\</B>
6461
6462 <DD>
6463 backslash
6464 <DT><B>\</B>
6465
6466 <DD>
6467 literal &quot;
6468 <DT><B>\aq</B>
6469
6470 <DD>
6471 literal aq
6472 </DL></DL>
6473
6474
6475 <P>
6476
6477 In addition to the GNU Emacs style escape sequences, a second
6478 set of backslash escapes is available:
6479 <DL COMPACT><DT><DD>
6480
6481 <DL COMPACT>
6482 <DT><B>\a</B>
6483
6484 <DD>
6485 alert (bell)
6486 <DT><B>\b</B>
6487
6488 <DD>
6489 backspace
6490 <DT><B>\d</B>
6491
6492 <DD>
6493 delete
6494 <DT><B>\f</B>
6495
6496 <DD>
6497 form feed
6498 <DT><B>\n</B>
6499
6500 <DD>
6501 newline
6502 <DT><B>\r</B>
6503
6504 <DD>
6505 carriage return
6506 <DT><B>\t</B>
6507
6508 <DD>
6509 horizontal tab
6510 <DT><B>\v</B>
6511
6512 <DD>
6513 vertical tab
6514 <DT><B>\</B><I>nnn</I>
6515
6516 <DD>
6517 the eight-bit character whose value is the octal value <I>nnn</I>
6518 (one to three digits)
6519 <DT><B>\x</B><I>HH</I>
6520
6521 <DD>
6522 the eight-bit character whose value is the hexadecimal value <I>HH</I>
6523 (one or two hex digits)
6524 </DL></DL>
6525
6526
6527 <P>
6528
6529 When entering the text of a macro, single or double quotes must
6530 be used to indicate a macro definition.
6531 Unquoted text is assumed to be a function name.
6532 In the macro body, the backslash escapes described above are expanded.
6533 Backslash will quote any other character in the macro text,
6534 including &quot; and aq.
6535 <P>
6536
6537 <B>Bash</B>
6538
6539 allows the current readline key bindings to be displayed or modified
6540 with the
6541 <B>bind</B>
6542
6543 builtin command.  The editing mode may be switched during interactive
6544 use by using the
6545 <B>-o</B>
6546
6547 option to the
6548 <B>set</B>
6549
6550 builtin command (see
6551 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
6552
6553 </FONT>
6554 below).
6555 <A NAME="lbCJ">&nbsp;</A>
6556 <H4>Readline Variables</H4>
6557
6558 <P>
6559
6560 Readline has variables that can be used to further customize its
6561 behavior.  A variable may be set in the
6562 <I>inputrc</I>
6563
6564 file with a statement of the form
6565 <DL COMPACT><DT><DD>
6566 <P>
6567
6568 <B>set</B> <I>variable-name</I> <I>value</I>
6569 </DL>
6570
6571 <P>
6572
6573 Except where noted, readline variables can take the values
6574 <B>On</B>
6575
6576 or
6577 <B>Off</B>
6578
6579 (without regard to case).
6580 Unrecognized variable names are ignored.
6581 When a variable value is read, empty or null values, &quot;on&quot; (case-insensitive),
6582 and &quot;1&quot; are equivalent to <B>On</B>.  All other values are equivalent to
6583 <B>Off</B>.
6584 The variables and their default values are:
6585 <P>
6586
6587
6588 <DL COMPACT>
6589 <DT><B>bell-style (audible)</B>
6590
6591 <DD>
6592 Controls what happens when readline wants to ring the terminal bell.
6593 If set to <B>none</B>, readline never rings the bell.  If set to
6594 <B>visible</B>, readline uses a visible bell if one is available.
6595 If set to <B>audible</B>, readline attempts to ring the terminal's bell.
6596 <DT><B>bind-tty-special-chars (On)</B>
6597
6598 <DD>
6599 If set to <B>On</B>, readline attempts to bind the control characters
6600 treated specially by the kernel's terminal driver to their readline
6601 equivalents.
6602 <DT><B>comment-begin (``#'')</B>
6603
6604 <DD>
6605 The string that is inserted when the readline
6606 <B>insert-comment</B>
6607
6608 command is executed.
6609 This command is bound to
6610 <B>M-#</B>
6611
6612 in emacs mode and to
6613 <B>#</B>
6614
6615 in vi command mode.
6616 <DT><B>completion-ignore-case (Off)</B>
6617
6618 <DD>
6619 If set to <B>On</B>, readline performs filename matching and completion
6620 in a case-insensitive fashion.
6621 <DT><B>completion-prefix-display-length (0)</B>
6622
6623 <DD>
6624 The length in characters of the common prefix of a list of possible
6625 completions that is displayed without modification.  When set to a
6626 value greater than zero, common prefixes longer than this value are
6627 replaced with an ellipsis when displaying possible completions.
6628 <DT><B>completion-query-items (100)</B>
6629
6630 <DD>
6631 This determines when the user is queried about viewing
6632 the number of possible completions
6633 generated by the <B>possible-completions</B> command.
6634 It may be set to any integer value greater than or equal to
6635 zero.  If the number of possible completions is greater than
6636 or equal to the value of this variable, the user is asked whether
6637 or not he wishes to view them; otherwise they are simply listed
6638 on the terminal.
6639 <DT><B>convert-meta (On)</B>
6640
6641 <DD>
6642 If set to <B>On</B>, readline will convert characters with the
6643 eighth bit set to an ASCII key sequence
6644 by stripping the eighth bit and prefixing an
6645 escape character (in effect, using escape as the <I>meta prefix</I>).
6646 <DT><B>disable-completion (Off)</B>
6647
6648 <DD>
6649 If set to <B>On</B>, readline will inhibit word completion.  Completion
6650 characters will be inserted into the line as if they had been
6651 mapped to <B>self-insert</B>.
6652 <DT><B>editing-mode (emacs)</B>
6653
6654 <DD>
6655 Controls whether readline begins with a set of key bindings similar
6656 to <I>Emacs</I> or <I>vi</I>.
6657 <B>editing-mode</B>
6658
6659 can be set to either
6660 <B>emacs</B>
6661
6662 or
6663 <B>vi</B>.
6664
6665 <DT><B>echo-control-characters (On)</B>
6666
6667 <DD>
6668 When set to <B>On</B>, on operating systems that indicate they support it,
6669 readline echoes a character corresponding to a signal generated from the
6670 keyboard.
6671 <DT><B>enable-keypad (Off)</B>
6672
6673 <DD>
6674 When set to <B>On</B>, readline will try to enable the application
6675 keypad when it is called.  Some systems need this to enable the
6676 arrow keys.
6677 <DT><B>enable-meta-key (On)</B>
6678
6679 <DD>
6680 When set to <B>On</B>, readline will try to enable any meta modifier
6681 key the terminal claims to support when it is called.  On many terminals,
6682 the meta key is used to send eight-bit characters.
6683 <DT><B>expand-tilde (Off)</B>
6684
6685 <DD>
6686 If set to <B>On</B>, tilde expansion is performed when readline
6687 attempts word completion.
6688 <DT><B>history-preserve-point (Off)</B>
6689
6690 <DD>
6691 If set to <B>On</B>, the history code attempts to place point at the
6692 same location on each history line retrieved with <B>previous-history</B>
6693 or <B>next-history</B>.
6694 <DT><B>history-size (0)</B>
6695
6696 <DD>
6697 Set the maximum number of history entries saved in the history list.  If
6698 set to zero, the number of entries in the history list is not limited.
6699 <DT><B>horizontal-scroll-mode (Off)</B>
6700
6701 <DD>
6702 When set to <B>On</B>, makes readline use a single line for display,
6703 scrolling the input horizontally on a single screen line when it
6704 becomes longer than the screen width rather than wrapping to a new line.
6705 <DT><B>input-meta (Off)</B>
6706
6707 <DD>
6708 If set to <B>On</B>, readline will enable eight-bit input (that is,
6709 it will not strip the high bit from the characters it reads),
6710 regardless of what the terminal claims it can support.  The name
6711 <B>meta-flag</B>
6712
6713 is a synonym for this variable.
6714 <DT><B>isearch-terminators (``C-[C-J'')</B>
6715
6716 <DD>
6717 The string of characters that should terminate an incremental
6718 search without subsequently executing the character as a command.
6719 If this variable has not been given a value, the characters
6720 <I>ESC</I> and <I>C-J</I> will terminate an incremental search.
6721 <DT><B>keymap (emacs)</B>
6722
6723 <DD>
6724 Set the current readline keymap.  The set of valid keymap names is
6725 <I>emacs, emacs-standard, emacs-meta, emacs-ctlx, vi,
6726 vi-command</I>, and
6727 <I>vi-insert</I>.
6728
6729 <I>vi</I> is equivalent to <I>vi-command</I>; <I>emacs</I> is
6730 equivalent to <I>emacs-standard</I>.  The default value is
6731 <I>emacs</I>;
6732
6733 the value of
6734 <B>editing-mode</B>
6735
6736 also affects the default keymap.
6737 <DT><B>mark-directories (On)</B>
6738
6739 <DD>
6740 If set to <B>On</B>, completed directory names have a slash
6741 appended.
6742 <DT><B>mark-modified-lines (Off)</B>
6743
6744 <DD>
6745 If set to <B>On</B>, history lines that have been modified are displayed
6746 with a preceding asterisk (<B>*</B>).
6747 <DT><B>mark-symlinked-directories (Off)</B>
6748
6749 <DD>
6750 If set to <B>On</B>, completed names which are symbolic links to directories
6751 have a slash appended (subject to the value of
6752 <B>mark-directories</B>).
6753 <DT><B>match-hidden-files (On)</B>
6754
6755 <DD>
6756 This variable, when set to <B>On</B>, causes readline to match files whose
6757 names begin with a `.' (hidden files) when performing filename 
6758 completion.
6759 If set to <B>Off</B>, the leading `.' must be
6760 supplied by the user in the filename to be completed.
6761 <DT><B>menu-complete-display-prefix (Off)</B>
6762
6763 <DD>
6764 If set to <B>On</B>, menu completion displays the common prefix of the
6765 list of possible completions (which may be empty) before cycling through
6766 the list.
6767 <DT><B>output-meta (Off)</B>
6768
6769 <DD>
6770 If set to <B>On</B>, readline will display characters with the
6771 eighth bit set directly rather than as a meta-prefixed escape
6772 sequence.
6773 <DT><B>page-completions (On)</B>
6774
6775 <DD>
6776 If set to <B>On</B>, readline uses an internal <I>more</I>-like pager
6777 to display a screenful of possible completions at a time.
6778 <DT><B>print-completions-horizontally (Off)</B>
6779
6780 <DD>
6781 If set to <B>On</B>, readline will display completions with matches
6782 sorted horizontally in alphabetical order, rather than down the screen.
6783 <DT><B>revert-all-at-newline (Off)</B>
6784
6785 <DD>
6786 If set to <B>On</B>, readline will undo all changes to history lines 
6787 before returning when <B>accept-line</B> is executed.  By default,
6788 history lines may be modified and retain individual undo lists across
6789 calls to <B>readline</B>.
6790 <DT><B>show-all-if-ambiguous (Off)</B>
6791
6792 <DD>
6793 This alters the default behavior of the completion functions.  If
6794 set to
6795 <B>On</B>,
6796
6797 words which have more than one possible completion cause the
6798 matches to be listed immediately instead of ringing the bell.
6799 <DT><B>show-all-if-unmodified (Off)</B>
6800
6801 <DD>
6802 This alters the default behavior of the completion functions in
6803 a fashion similar to <B>show-all-if-ambiguous</B>.
6804 If set to
6805 <B>On</B>,
6806
6807 words which have more than one possible completion without any
6808 possible partial completion (the possible completions don't share
6809 a common prefix) cause the matches to be listed immediately instead
6810 of ringing the bell.
6811 <DT><B>skip-completed-text (Off)</B>
6812
6813 <DD>
6814 If set to <B>On</B>, this alters the default completion behavior when
6815 inserting a single match into the line.  It's only active when
6816 performing completion in the middle of a word.  If enabled, readline
6817 does not insert characters from the completion that match characters
6818 after point in the word being completed, so portions of the word
6819 following the cursor are not duplicated.
6820 <DT><B>visible-stats (Off)</B>
6821
6822 <DD>
6823 If set to <B>On</B>, a character denoting a file's type as reported
6824 by <I>stat</I>(2) is appended to the filename when listing possible
6825 completions.
6826
6827 </DL>
6828 <A NAME="lbCK">&nbsp;</A>
6829 <H4>Readline Conditional Constructs</H4>
6830
6831 <P>
6832
6833 Readline implements a facility similar in spirit to the conditional
6834 compilation features of the C preprocessor which allows key
6835 bindings and variable settings to be performed as the result
6836 of tests.  There are four parser directives used.
6837 <DL COMPACT>
6838 <DT><B>$if</B><DD>
6839 The 
6840 <B>$if</B>
6841
6842 construct allows bindings to be made based on the
6843 editing mode, the terminal being used, or the application using
6844 readline.  The text of the test extends to the end of the line;
6845 no characters are required to isolate it.
6846 <DL COMPACT><DT><DD>
6847 <DL COMPACT>
6848 <DT><B>mode</B><DD>
6849 The <B>mode=</B> form of the <B>$if</B> directive is used to test
6850 whether readline is in emacs or vi mode.
6851 This may be used in conjunction
6852 with the <B>set keymap</B> command, for instance, to set bindings in
6853 the <I>emacs-standard</I> and <I>emacs-ctlx</I> keymaps only if
6854 readline is starting out in emacs mode.
6855 <DT><B>term</B><DD>
6856 The <B>term=</B> form may be used to include terminal-specific
6857 key bindings, perhaps to bind the key sequences output by the
6858 terminal's function keys.  The word on the right side of the
6859 <B>=</B>
6860
6861 is tested against the both full name of the terminal and the portion
6862 of the terminal name before the first <B>-</B>.  This allows
6863 <I>sun</I>
6864
6865 to match both
6866 <I>sun</I>
6867
6868 and
6869 <I>sun-cmd</I>,
6870
6871 for instance.
6872 <DT><B>application</B><DD>
6873 The <B>application</B> construct is used to include
6874 application-specific settings.  Each program using the readline
6875 library sets the <I>application name</I>, and an initialization
6876 file can test for a particular value.
6877 This could be used to bind key sequences to functions useful for
6878 a specific program.  For instance, the following command adds a
6879 key sequence that quotes the current or previous word in <B>bash</B>:
6880 <P>
6881 <DL COMPACT><DT><DD>
6882 <PRE>
6883 <B>$if</B> Bash
6884 # Quote the current or previous word
6885 &quot;\C-xq&quot;: &quot;\eb\&quot;\ef\&quot;&quot;
6886 <B>$endif</B>
6887 </PRE>
6888
6889 </DL>
6890
6891 </DL></DL>
6892
6893 <DT><B>$endif</B><DD>
6894 This command, as seen in the previous example, terminates an
6895 <B>$if</B> command.
6896 <DT><B>$else</B><DD>
6897 Commands in this branch of the <B>$if</B> directive are executed if
6898 the test fails.
6899 <DT><B>$include</B><DD>
6900 This directive takes a single filename as an argument and reads commands
6901 and bindings from that file.  For example, the following directive
6902 would read <A HREF="file:/etc/inputrc"><I>/etc/inputrc</I></A>:
6903 <P>
6904 <DL COMPACT><DT><DD>
6905 <PRE>
6906 <B>$include</B>  <A HREF="file:/etc/inputrc"><I>/etc/inputrc</I></A>
6907 </PRE>
6908
6909 </DL>
6910
6911 </DL>
6912 <A NAME="lbCL">&nbsp;</A>
6913 <H4>Searching</H4>
6914
6915 <P>
6916
6917 Readline provides commands for searching through the command history
6918 (see
6919 <FONT SIZE=-1><B>HISTORY</B>
6920
6921 </FONT>
6922 below) for lines containing a specified string.
6923 There are two search modes:
6924 <I>incremental</I>
6925
6926 and
6927 <I>non-incremental</I>.
6928
6929 <P>
6930
6931 Incremental searches begin before the user has finished typing the
6932 search string.
6933 As each character of the search string is typed, readline displays
6934 the next entry from the history matching the string typed so far.
6935 An incremental search requires only as many characters as needed to
6936 find the desired history entry.
6937 The characters present in the value of the <B>isearch-terminators</B>
6938 variable are used to terminate an incremental search.
6939 If that variable has not been assigned a value the Escape and
6940 Control-J characters will terminate an incremental search.
6941 Control-G will abort an incremental search and restore the original
6942 line.
6943 When the search is terminated, the history entry containing the
6944 search string becomes the current line.
6945 <P>
6946
6947 To find other matching entries in the history list, type Control-S or
6948 Control-R as appropriate.
6949 This will search backward or forward in the history for the next
6950 entry matching the search string typed so far.
6951 Any other key sequence bound to a readline command will terminate
6952 the search and execute that command.
6953 For instance, a <I>newline</I> will terminate the search and accept
6954 the line, thereby executing the command from the history list.
6955 <P>
6956
6957 Readline remembers the last incremental search string.  If two
6958 Control-Rs are typed without any intervening characters defining a
6959 new search string, any remembered search string is used.
6960 <P>
6961
6962 Non-incremental searches read the entire search string before starting
6963 to search for matching history lines.  The search string may be
6964 typed by the user or be part of the contents of the current line.
6965 <A NAME="lbCM">&nbsp;</A>
6966 <H4>Readline Command Names</H4>
6967
6968 <P>
6969
6970 The following is a list of the names of the commands and the default
6971 key sequences to which they are bound.
6972 Command names without an accompanying key sequence are unbound by default.
6973 In the following descriptions, <I>point</I> refers to the current cursor
6974 position, and <I>mark</I> refers to a cursor position saved by the
6975 <B>set-mark</B> command.
6976 The text between the point and mark is referred to as the <I>region</I>.
6977 <A NAME="lbCN">&nbsp;</A>
6978 <H4>Commands for Moving</H4>
6979
6980 <P>
6981
6982
6983 <DL COMPACT>
6984 <DT><B>beginning-of-line (C-a)</B>
6985
6986 <DD>
6987 Move to the start of the current line.
6988 <DT><B>end-of-line (C-e)</B>
6989
6990 <DD>
6991 Move to the end of the line.
6992 <DT><B>forward-char (C-f)</B>
6993
6994 <DD>
6995 Move forward a character.
6996 <DT><B>backward-char (C-b)</B>
6997
6998 <DD>
6999 Move back a character.
7000 <DT><B>forward-word (M-f)</B>
7001
7002 <DD>
7003 Move forward to the end of the next word.  Words are composed of
7004 alphanumeric characters (letters and digits).
7005 <DT><B>backward-word (M-b)</B>
7006
7007 <DD>
7008 Move back to the start of the current or previous word.
7009 Words are composed of alphanumeric characters (letters and digits).
7010 <DT><B>shell-forward-word</B>
7011
7012 <DD>
7013 Move forward to the end of the next word.
7014 Words are delimited by non-quoted shell metacharacters.
7015 <DT><B>shell-backward-word</B>
7016
7017 <DD>
7018 Move back to the start of the current or previous word.
7019 Words are delimited by non-quoted shell metacharacters.
7020 <DT><B>clear-screen (C-l)</B>
7021
7022 <DD>
7023 Clear the screen leaving the current line at the top of the screen.
7024 With an argument, refresh the current line without clearing the
7025 screen.
7026 <DT><B>redraw-current-line</B>
7027
7028 <DD>
7029 Refresh the current line.
7030
7031 </DL>
7032 <A NAME="lbCO">&nbsp;</A>
7033 <H4>Commands for Manipulating the History</H4>
7034
7035 <P>
7036
7037
7038 <DL COMPACT>
7039 <DT><B>accept-line (Newline, Return)</B>
7040
7041 <DD>
7042 Accept the line regardless of where the cursor is.  If this line is
7043 non-empty, add it to the history list according to the state of the
7044 <FONT SIZE=-1><B>HISTCONTROL</B>
7045
7046 </FONT>
7047 variable.  If the line is a modified history
7048 line, then restore the history line to its original state.
7049 <DT><B>previous-history (C-p)</B>
7050
7051 <DD>
7052 Fetch the previous command from the history list, moving back in
7053 the list.
7054 <DT><B>next-history (C-n)</B>
7055
7056 <DD>
7057 Fetch the next command from the history list, moving forward in the
7058 list.
7059 <DT><B>beginning-of-history (M-&lt;)</B>
7060
7061 <DD>
7062 Move to the first line in the history.
7063 <DT><B>end-of-history (M-&gt;)</B>
7064
7065 <DD>
7066 Move to the end of the input history, i.e., the line currently being
7067 entered.
7068 <DT><B>reverse-search-history (C-r)</B>
7069
7070 <DD>
7071 Search backward starting at the current line and moving `up' through
7072 the history as necessary.  This is an incremental search.
7073 <DT><B>forward-search-history (C-s)</B>
7074
7075 <DD>
7076 Search forward starting at the current line and moving `down' through
7077 the history as necessary.  This is an incremental search.
7078 <DT><B>non-incremental-reverse-search-history (M-p)</B>
7079
7080 <DD>
7081 Search backward through the history starting at the current line
7082 using a non-incremental search for a string supplied by the user.
7083 <DT><B>non-incremental-forward-search-history (M-n)</B>
7084
7085 <DD>
7086 Search forward through the history using a non-incremental search for
7087 a string supplied by the user.
7088 <DT><B>history-search-forward</B>
7089
7090 <DD>
7091 Search forward through the history for the string of characters
7092 between the start of the current line and the point.
7093 This is a non-incremental search.
7094 <DT><B>history-search-backward</B>
7095
7096 <DD>
7097 Search backward through the history for the string of characters
7098 between the start of the current line and the point.
7099 This is a non-incremental search.
7100 <DT><B>yank-nth-arg (M-C-y)</B>
7101
7102 <DD>
7103 Insert the first argument to the previous command (usually
7104 the second word on the previous line) at point.
7105 With an argument
7106 <I>n</I>,
7107
7108 insert the <I>n</I>th word from the previous command (the words
7109 in the previous command begin with word 0).  A negative argument
7110 inserts the <I>n</I>th word from the end of the previous command.
7111 Once the argument <I>n</I> is computed, the argument is extracted
7112 as if the &quot;!<I>n</I>&quot; history expansion had been specified.
7113 <DT><B>yank-last-arg (M-., M-_)</B>
7114
7115 <DD>
7116 Insert the last argument to the previous command (the last word of
7117 the previous history entry).
7118 With a numeric argument, behave exactly like <B>yank-nth-arg</B>.
7119 Successive calls to <B>yank-last-arg</B> move back through the history
7120 list, inserting the last word (or the word specified by the argument to
7121 the first call) of each line in turn.
7122 Any numeric argument supplied to these successive calls determines
7123 the direction to move through the history.  A negative argument switches
7124 the direction through the history (back or forward).
7125 The history expansion facilities are used to extract the last argument,
7126 as if the &quot;!$&quot; history expansion had been specified.
7127 <DT><B>shell-expand-line (M-C-e)</B>
7128
7129 <DD>
7130 Expand the line as the shell does.  This
7131 performs alias and history expansion as well as all of the shell
7132 word expansions.  See
7133 <FONT SIZE=-1><B>HISTORY EXPANSION</B>
7134
7135 </FONT>
7136 below for a description of history expansion.
7137 <DT><B>history-expand-line (M-^)</B>
7138
7139 <DD>
7140 Perform history expansion on the current line.
7141 See
7142 <FONT SIZE=-1><B>HISTORY EXPANSION</B>
7143
7144 </FONT>
7145 below for a description of history expansion.
7146 <DT><B>magic-space</B>
7147
7148 <DD>
7149 Perform history expansion on the current line and insert a space.
7150 See
7151 <FONT SIZE=-1><B>HISTORY EXPANSION</B>
7152
7153 </FONT>
7154 below for a description of history expansion.
7155 <DT><B>alias-expand-line</B>
7156
7157 <DD>
7158 Perform alias expansion on the current line.
7159 See
7160 <FONT SIZE=-1><B>ALIASES</B>
7161
7162 </FONT>
7163 above for a description of alias expansion.
7164 <DT><B>history-and-alias-expand-line</B>
7165
7166 <DD>
7167 Perform history and alias expansion on the current line.
7168 <DT><B>insert-last-argument (M-., M-_)</B>
7169
7170 <DD>
7171 A synonym for <B>yank-last-arg</B>.
7172 <DT><B>operate-and-get-next (C-o)</B>
7173
7174 <DD>
7175 Accept the current line for execution and fetch the next line
7176 relative to the current line from the history for editing.  Any
7177 argument is ignored.
7178 <DT><B>edit-and-execute-command (C-xC-e)</B>
7179
7180 <DD>
7181 Invoke an editor on the current command line, and execute the result as shell
7182 commands.
7183 <B>Bash</B> attempts to invoke
7184 <FONT SIZE=-1><B>$VISUAL</B>,
7185
7186 </FONT>
7187 <FONT SIZE=-1><B>$EDITOR</B>,
7188
7189 </FONT>
7190 and <I>emacs</I> as the editor, in that order.
7191
7192 </DL>
7193 <A NAME="lbCP">&nbsp;</A>
7194 <H4>Commands for Changing Text</H4>
7195
7196 <P>
7197
7198
7199 <DL COMPACT>
7200 <DT><B>delete-char (C-d)</B>
7201
7202 <DD>
7203 Delete the character at point.  If point is at the
7204 beginning of the line, there are no characters in the line, and
7205 the last character typed was not bound to <B>delete-char</B>,
7206 then return
7207 <FONT SIZE=-1><B>EOF</B>.
7208
7209 </FONT>
7210 <DT><B>backward-delete-char (Rubout)</B>
7211
7212 <DD>
7213 Delete the character behind the cursor.  When given a numeric argument,
7214 save the deleted text on the kill ring.
7215 <DT><B>forward-backward-delete-char</B>
7216
7217 <DD>
7218 Delete the character under the cursor, unless the cursor is at the
7219 end of the line, in which case the character behind the cursor is
7220 deleted.
7221 <DT><B>quoted-insert (C-q, C-v)</B>
7222
7223 <DD>
7224 Add the next character typed to the line verbatim.  This is
7225 how to insert characters like <B>C-q</B>, for example.
7226 <DT><B>tab-insert (C-v TAB)</B>
7227
7228 <DD>
7229 Insert a tab character.
7230 <DT><B>self-insert (a,&nbsp;b,&nbsp;A,&nbsp;1,&nbsp;!,&nbsp;...)</B>
7231
7232 <DD>
7233 Insert the character typed.
7234 <DT><B>transpose-chars (C-t)</B>
7235
7236 <DD>
7237 Drag the character before point forward over the character at point,
7238 moving point forward as well.
7239 If point is at the end of the line, then this transposes
7240 the two characters before point.
7241 Negative arguments have no effect.
7242 <DT><B>transpose-words (M-t)</B>
7243
7244 <DD>
7245 Drag the word before point past the word after point,
7246 moving point over that word as well.
7247 If point is at the end of the line, this transposes
7248 the last two words on the line.   
7249 <DT><B>upcase-word (M-u)</B>
7250
7251 <DD>
7252 Uppercase the current (or following) word.  With a negative argument,
7253 uppercase the previous word, but do not move point.
7254 <DT><B>downcase-word (M-l)</B>
7255
7256 <DD>
7257 Lowercase the current (or following) word.  With a negative argument,
7258 lowercase the previous word, but do not move point.
7259 <DT><B>capitalize-word (M-c)</B>
7260
7261 <DD>
7262 Capitalize the current (or following) word.  With a negative argument,
7263 capitalize the previous word, but do not move point.
7264 <DT><B>overwrite-mode</B>
7265
7266 <DD>
7267 Toggle overwrite mode.  With an explicit positive numeric argument,
7268 switches to overwrite mode.  With an explicit non-positive numeric
7269 argument, switches to insert mode.  This command affects only
7270 <B>emacs</B> mode; <B>vi</B> mode does overwrite differently.
7271 Each call to <I>readline()</I> starts in insert mode.
7272 In overwrite mode, characters bound to <B>self-insert</B> replace   
7273 the text at point rather than pushing the text to the right.
7274 Characters bound to <B>backward-delete-char</B> replace the character
7275 before point with a space.  By default, this command is unbound.
7276
7277 </DL>
7278 <A NAME="lbCQ">&nbsp;</A>
7279 <H4>Killing and Yanking</H4>
7280
7281 <P>
7282
7283
7284 <DL COMPACT>
7285 <DT><B>kill-line (C-k)</B>
7286
7287 <DD>
7288 Kill the text from point to the end of the line.
7289 <DT><B>backward-kill-line (C-x Rubout)</B>
7290
7291 <DD>
7292 Kill backward to the beginning of the line.
7293 <DT><B>unix-line-discard (C-u)</B>
7294
7295 <DD>
7296 Kill backward from point to the beginning of the line.
7297 The killed text is saved on the kill-ring.
7298
7299 <DT><B>kill-whole-line</B>
7300
7301 <DD>
7302 Kill all characters on the current line, no matter where point is.
7303 <DT><B>kill-word  (M-d)</B>
7304
7305 <DD>
7306 Kill from point to the end of the current word, or if between
7307 words, to the end of the next word.
7308 Word boundaries are the same as those used by <B>forward-word</B>.
7309 <DT><B>backward-kill-word (M-Rubout)</B>
7310
7311 <DD>
7312 Kill the word behind point.
7313 Word boundaries are the same as those used by <B>backward-word</B>.
7314 <DT><B>shell-kill-word  (M-d)</B>
7315
7316 <DD>
7317 Kill from point to the end of the current word, or if between
7318 words, to the end of the next word.
7319 Word boundaries are the same as those used by <B>shell-forward-word</B>.
7320 <DT><B>shell-backward-kill-word (M-Rubout)</B>
7321
7322 <DD>
7323 Kill the word behind point.
7324 Word boundaries are the same as those used by <B>shell-backward-word</B>.
7325 <DT><B>unix-word-rubout (C-w)</B>
7326
7327 <DD>
7328 Kill the word behind point, using white space as a word boundary.
7329 The killed text is saved on the kill-ring.
7330 <DT><B>unix-filename-rubout</B>
7331
7332 <DD>
7333 Kill the word behind point, using white space and the slash character
7334 as the word boundaries.
7335 The killed text is saved on the kill-ring.
7336 <DT><B>delete-horizontal-space (M-\)</B>
7337
7338 <DD>
7339 Delete all spaces and tabs around point.
7340 <DT><B>kill-region</B>
7341
7342 <DD>
7343 Kill the text in the current region.
7344 <DT><B>copy-region-as-kill</B>
7345
7346 <DD>
7347 Copy the text in the region to the kill buffer.
7348 <DT><B>copy-backward-word</B>
7349
7350 <DD>
7351 Copy the word before point to the kill buffer.
7352 The word boundaries are the same as <B>backward-word</B>.
7353 <DT><B>copy-forward-word</B>
7354
7355 <DD>
7356 Copy the word following point to the kill buffer.
7357 The word boundaries are the same as <B>forward-word</B>.
7358 <DT><B>yank (C-y)</B>
7359
7360 <DD>
7361 Yank the top of the kill ring into the buffer at point.
7362 <DT><B>yank-pop (M-y)</B>
7363
7364 <DD>
7365 Rotate the kill ring, and yank the new top.  Only works following
7366 <B>yank</B>
7367
7368 or
7369 <B>yank-pop</B>.
7370
7371
7372 </DL>
7373 <A NAME="lbCR">&nbsp;</A>
7374 <H4>Numeric Arguments</H4>
7375
7376 <P>
7377
7378
7379 <DL COMPACT>
7380 <DT><B>digit-argument (M-0, M-1, ..., M--)</B>
7381
7382 <DD>
7383 Add this digit to the argument already accumulating, or start a new
7384 argument.  M-- starts a negative argument.
7385 <DT><B>universal-argument</B>
7386
7387 <DD>
7388 This is another way to specify an argument.
7389 If this command is followed by one or more digits, optionally with a
7390 leading minus sign, those digits define the argument.
7391 If the command is followed by digits, executing
7392 <B>universal-argument</B>
7393
7394 again ends the numeric argument, but is otherwise ignored.
7395 As a special case, if this command is immediately followed by a
7396 character that is neither a digit or minus sign, the argument count
7397 for the next command is multiplied by four.
7398 The argument count is initially one, so executing this function the
7399 first time makes the argument count four, a second time makes the
7400 argument count sixteen, and so on.
7401
7402 </DL>
7403 <A NAME="lbCS">&nbsp;</A>
7404 <H4>Completing</H4>
7405
7406 <P>
7407
7408
7409 <DL COMPACT>
7410 <DT><B>complete (TAB)</B>
7411
7412 <DD>
7413 Attempt to perform completion on the text before point.
7414 <B>Bash</B>
7415
7416 attempts completion treating the text as a variable (if the
7417 text begins with <B>$</B>), username (if the text begins with
7418 <B>~</B>), hostname (if the text begins with <B>@</B>), or
7419 command (including aliases and functions) in turn.  If none
7420 of these produces a match, filename completion is attempted.
7421 <DT><B>possible-completions (M-?)</B>
7422
7423 <DD>
7424 List the possible completions of the text before point.
7425 <DT><B>insert-completions (M-*)</B>
7426
7427 <DD>
7428 Insert all completions of the text before point
7429 that would have been generated by
7430 <B>possible-completions</B>.
7431 <DT><B>menu-complete</B>
7432
7433 <DD>
7434 Similar to <B>complete</B>, but replaces the word to be completed
7435 with a single match from the list of possible completions.
7436 Repeated execution of <B>menu-complete</B> steps through the list
7437 of possible completions, inserting each match in turn.
7438 At the end of the list of completions, the bell is rung
7439 (subject to the setting of <B>bell-style</B>)
7440 and the original text is restored.
7441 An argument of <I>n</I> moves <I>n</I> positions forward in the list
7442 of matches; a negative argument may be used to move backward
7443 through the list.
7444 This command is intended to be bound to <B>TAB</B>, but is unbound
7445 by default.
7446 <DT><B>menu-complete-backward</B>
7447
7448 <DD>
7449 Identical to <B>menu-complete</B>, but moves backward through the list
7450 of possible completions, as if <B>menu-complete</B> had been given a
7451 negative argument.  This command is unbound by default.
7452 <DT><B>delete-char-or-list</B>
7453
7454 <DD>
7455 Deletes the character under the cursor if not at the beginning or
7456 end of the line (like <B>delete-char</B>).
7457 If at the end of the line, behaves identically to
7458 <B>possible-completions</B>.
7459 This command is unbound by default.
7460 <DT><B>complete-filename (M-/)</B>
7461
7462 <DD>
7463 Attempt filename completion on the text before point.
7464 <DT><B>possible-filename-completions (C-x /)</B>
7465
7466 <DD>
7467 List the possible completions of the text before point,
7468 treating it as a filename.
7469 <DT><B>complete-username (M-~)</B>
7470
7471 <DD>
7472 Attempt completion on the text before point, treating
7473 it as a username.
7474 <DT><B>possible-username-completions (C-x ~)</B>
7475
7476 <DD>
7477 List the possible completions of the text before point,
7478 treating it as a username.
7479 <DT><B>complete-variable (M-$)</B>
7480
7481 <DD>
7482 Attempt completion on the text before point, treating
7483 it as a shell variable.
7484 <DT><B>possible-variable-completions (C-x $)</B>
7485
7486 <DD>
7487 List the possible completions of the text before point,
7488 treating it as a shell variable.
7489 <DT><B>complete-hostname (M-@)</B>
7490
7491 <DD>
7492 Attempt completion on the text before point, treating
7493 it as a hostname.
7494 <DT><B>possible-hostname-completions (C-x @)</B>
7495
7496 <DD>
7497 List the possible completions of the text before point,
7498 treating it as a hostname.
7499 <DT><B>complete-command (M-!)</B>
7500
7501 <DD>
7502 Attempt completion on the text before point, treating
7503 it as a command name.  Command completion attempts to
7504 match the text against aliases, reserved words, shell
7505 functions, shell builtins, and finally executable filenames,
7506 in that order.
7507 <DT><B>possible-command-completions (C-x !)</B>
7508
7509 <DD>
7510 List the possible completions of the text before point,
7511 treating it as a command name.
7512 <DT><B>dynamic-complete-history (M-TAB)</B>
7513
7514 <DD>
7515 Attempt completion on the text before point, comparing
7516 the text against lines from the history list for possible
7517 completion matches.
7518 <DT><B>dabbrev-expand</B>
7519
7520 <DD>
7521 Attempt menu completion on the text before point, comparing
7522 the text against lines from the history list for possible
7523 completion matches.
7524 <DT><B>complete-into-braces (M-{)</B>
7525
7526 <DD>
7527 Perform filename completion and insert the list of possible completions
7528 enclosed within braces so the list is available to the shell (see
7529 <B>Brace Expansion</B>
7530
7531 above).
7532
7533 </DL>
7534 <A NAME="lbCT">&nbsp;</A>
7535 <H4>Keyboard Macros</H4>
7536
7537 <P>
7538
7539
7540 <DL COMPACT>
7541 <DT><B>start-kbd-macro (C-x ()</B>
7542
7543 <DD>
7544 Begin saving the characters typed into the current keyboard macro.
7545 <DT><B>end-kbd-macro (C-x ))</B>
7546
7547 <DD>
7548 Stop saving the characters typed into the current keyboard macro
7549 and store the definition.
7550 <DT><B>call-last-kbd-macro (C-x e)</B>
7551
7552 <DD>
7553 Re-execute the last keyboard macro defined, by making the characters
7554 in the macro appear as if typed at the keyboard.
7555
7556 </DL>
7557 <A NAME="lbCU">&nbsp;</A>
7558 <H4>Miscellaneous</H4>
7559
7560 <P>
7561
7562
7563 <DL COMPACT>
7564 <DT><B>re-read-init-file (C-x C-r)</B>
7565
7566 <DD>
7567 Read in the contents of the <I>inputrc</I> file, and incorporate
7568 any bindings or variable assignments found there.
7569 <DT><B>abort (C-g)</B>
7570
7571 <DD>
7572 Abort the current editing command and
7573 ring the terminal's bell (subject to the setting of
7574 <B>bell-style</B>).
7575
7576 <DT><B>do-uppercase-version (M-a, M-b, M-</B><I>x</I>, ...)
7577
7578 <DD>
7579 If the metafied character <I>x</I> is lowercase, run the command
7580 that is bound to the corresponding uppercase character.
7581 <DT><B>prefix-meta (ESC)</B>
7582
7583 <DD>
7584 Metafy the next character typed.
7585 <FONT SIZE=-1><B>ESC</B>
7586
7587 </FONT>
7588 <B>f</B>
7589
7590 is equivalent to
7591 <B>Meta-f</B>.
7592
7593 <DT><B>undo (C-_, C-x C-u)</B>
7594
7595 <DD>
7596 Incremental undo, separately remembered for each line.
7597 <DT><B>revert-line (M-r)</B>
7598
7599 <DD>
7600 Undo all changes made to this line.  This is like executing the
7601 <B>undo</B>
7602
7603 command enough times to return the line to its initial state.
7604 <DT><B>tilde-expand (M-&amp;)</B>
7605
7606 <DD>
7607 Perform tilde expansion on the current word.
7608 <DT><B>set-mark (C-@, M-&lt;space&gt;)</B>
7609
7610 <DD>
7611 Set the mark to the point.  If a
7612 numeric argument is supplied, the mark is set to that position.
7613 <DT><B>exchange-point-and-mark (C-x C-x)</B>
7614
7615 <DD>
7616 Swap the point with the mark.  The current cursor position is set to
7617 the saved position, and the old cursor position is saved as the mark.
7618 <DT><B>character-search (C-])</B>
7619
7620 <DD>
7621 A character is read and point is moved to the next occurrence of that
7622 character.  A negative count searches for previous occurrences.
7623 <DT><B>character-search-backward (M-C-])</B>
7624
7625 <DD>
7626 A character is read and point is moved to the previous occurrence of that
7627 character.  A negative count searches for subsequent occurrences.
7628 <DT><B>skip-csi-sequence</B>
7629
7630 <DD>
7631 Read enough characters to consume a multi-key sequence such as those
7632 defined for keys like Home and End.  Such sequences begin with a
7633 Control Sequence Indicator (CSI), usually ESC-[.  If this sequence is
7634 bound to &quot;\[&quot;, keys producing such sequences will have no effect
7635 unless explicitly bound to a readline command, instead of inserting
7636 stray characters into the editing buffer.  This is unbound by default,
7637 but usually bound to ESC-[.
7638 <DT><B>insert-comment (M-#)</B>
7639
7640 <DD>
7641 Without a numeric argument, the value of the readline
7642 <B>comment-begin</B>
7643
7644 variable is inserted at the beginning of the current line.
7645 If a numeric argument is supplied, this command acts as a toggle:  if
7646 the characters at the beginning of the line do not match the value
7647 of <B>comment-begin</B>, the value is inserted, otherwise
7648 the characters in <B>comment-begin</B> are deleted from the beginning of 
7649 the line.
7650 In either case, the line is accepted as if a newline had been typed.
7651 The default value of
7652 <B>comment-begin</B> causes this command to make the current line
7653 a shell comment.
7654 If a numeric argument causes the comment character to be removed, the line
7655 will be executed by the shell.
7656 <DT><B>glob-complete-word (M-g)</B>
7657
7658 <DD>
7659 The word before point is treated as a pattern for pathname expansion,
7660 with an asterisk implicitly appended.  This pattern is used to
7661 generate a list of matching file names for possible completions.
7662 <DT><B>glob-expand-word (C-x *)</B>
7663
7664 <DD>
7665 The word before point is treated as a pattern for pathname expansion,
7666 and the list of matching file names is inserted, replacing the word.
7667 If a numeric argument is supplied, an asterisk is appended before
7668 pathname expansion.
7669 <DT><B>glob-list-expansions (C-x g)</B>
7670
7671 <DD>
7672 The list of expansions that would have been generated by
7673 <B>glob-expand-word</B>
7674
7675 is displayed, and the line is redrawn.
7676 If a numeric argument is supplied, an asterisk is appended before
7677 pathname expansion.
7678 <DT><B>dump-functions</B>
7679
7680 <DD>
7681 Print all of the functions and their key bindings to the
7682 readline output stream.  If a numeric argument is supplied,
7683 the output is formatted in such a way that it can be made part
7684 of an <I>inputrc</I> file.
7685 <DT><B>dump-variables</B>
7686
7687 <DD>
7688 Print all of the settable readline variables and their values to the
7689 readline output stream.  If a numeric argument is supplied,
7690 the output is formatted in such a way that it can be made part
7691 of an <I>inputrc</I> file.
7692 <DT><B>dump-macros</B>
7693
7694 <DD>
7695 Print all of the readline key sequences bound to macros and the
7696 strings they output.  If a numeric argument is supplied,
7697 the output is formatted in such a way that it can be made part
7698 of an <I>inputrc</I> file.
7699 <DT><B>display-shell-version (C-x C-v)</B>
7700
7701 <DD>
7702 Display version information about the current instance of
7703 <B>bash</B>.
7704
7705
7706 </DL>
7707 <A NAME="lbCV">&nbsp;</A>
7708 <H4>Programmable Completion</H4>
7709
7710 <P>
7711
7712 When word completion is attempted for an argument to a command for
7713 which a completion specification (a <I>compspec</I>) has been defined
7714 using the <B>complete</B> builtin (see
7715 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
7716
7717 </FONT>
7718 below), the programmable completion facilities are invoked.
7719 <P>
7720
7721 First, the command name is identified.
7722 If the command word is the empty string (completion attempted at the
7723 beginning of an empty line), any compspec defined with
7724 the <B>-E</B> option to <B>complete</B> is used.
7725 If a compspec has been defined for that command, the
7726 compspec is used to generate the list of possible completions for the word.
7727 If the command word is a full pathname, a compspec for the full
7728 pathname is searched for first.
7729 If no compspec is found for the full pathname, an attempt is made to
7730 find a compspec for the portion following the final slash.
7731 If those searches do not result in a compspec, any compspec defined with
7732 the <B>-D</B> option to <B>complete</B> is used as the default.
7733 <P>
7734
7735 Once a compspec has been found, it is used to generate the list of
7736 matching words.
7737 If a compspec is not found, the default <B>bash</B> completion as
7738 described above under <B>Completing</B> is performed.
7739 <P>
7740
7741 First, the actions specified by the compspec are used.
7742 Only matches which are prefixed by the word being completed are
7743 returned.
7744 When the
7745 <B>-f</B>
7746
7747 or
7748 <B>-d</B>
7749
7750 option is used for filename or directory name completion, the shell
7751 variable
7752 <FONT SIZE=-1><B>FIGNORE</B>
7753
7754 </FONT>
7755 is used to filter the matches.
7756 <P>
7757
7758 Any completions specified by a pathname expansion pattern to the
7759 <B>-G</B> option are generated next.
7760 The words generated by the pattern need not match the word
7761 being completed.
7762 The
7763 <FONT SIZE=-1><B>GLOBIGNORE</B>
7764
7765 </FONT>
7766 shell variable is not used to filter the matches, but the
7767 <FONT SIZE=-1><B>FIGNORE</B>
7768
7769 </FONT>
7770 variable is used.
7771 <P>
7772
7773 Next, the string specified as the argument to the <B>-W</B> option
7774 is considered.
7775 The string is first split using the characters in the
7776 <FONT SIZE=-1><B>IFS</B>
7777
7778 </FONT>
7779 special variable as delimiters.
7780 Shell quoting is honored.
7781 Each word is then expanded using
7782 brace expansion, tilde expansion, parameter and variable expansion,
7783 command substitution, and arithmetic expansion,
7784 as described above under 
7785 <FONT SIZE=-1><B>EXPANSION</B>.
7786
7787 </FONT>
7788 The results are split using the rules described above under
7789 <B>Word Splitting</B>.
7790 The results of the expansion are prefix-matched against the word being
7791 completed, and the matching words become the possible completions.
7792 <P>
7793
7794 After these matches have been generated, any shell function or command
7795 specified with the <B>-F</B> and <B>-C</B> options is invoked.
7796 When the command or function is invoked, the
7797 <FONT SIZE=-1><B>COMP_LINE</B>,
7798
7799 </FONT>
7800 <FONT SIZE=-1><B>COMP_POINT</B>,
7801
7802 </FONT>
7803 <FONT SIZE=-1><B>COMP_KEY</B>,
7804
7805 </FONT>
7806 and
7807 <FONT SIZE=-1><B>COMP_TYPE</B>
7808
7809 </FONT>
7810 variables are assigned values as described above under
7811 <B>Shell Variables</B>.
7812 If a shell function is being invoked, the 
7813 <FONT SIZE=-1><B>COMP_WORDS</B>
7814
7815 </FONT>
7816 and
7817 <FONT SIZE=-1><B>COMP_CWORD</B>
7818
7819 </FONT>
7820 variables are also set.
7821 When the function or command is invoked, the first argument is the
7822 name of the command whose arguments are being completed, the
7823 second argument is the word being completed, and the third argument
7824 is the word preceding the word being completed on the current command line.
7825 No filtering of the generated completions against the word being completed
7826 is performed; the function or command has complete freedom in generating
7827 the matches.
7828 <P>
7829
7830 Any function specified with <B>-F</B> is invoked first.
7831 The function may use any of the shell facilities, including the
7832 <B>compgen</B> builtin described below, to generate the matches.
7833 It must put the possible completions in the
7834 <FONT SIZE=-1><B>COMPREPLY</B>
7835
7836 </FONT>
7837 array variable.
7838 <P>
7839
7840 Next, any command specified with the <B>-C</B> option is invoked
7841 in an environment equivalent to command substitution.
7842 It should print a list of completions, one per line, to the
7843 standard output.
7844 Backslash may be used to escape a newline, if necessary.
7845 <P>
7846
7847 After all of the possible completions are generated, any filter
7848 specified with the <B>-X</B> option is applied to the list.
7849 The filter is a pattern as used for pathname expansion; a <B>&amp;</B>
7850 in the pattern is replaced with the text of the word being completed.
7851 A literal <B>&amp;</B> may be escaped with a backslash; the backslash
7852 is removed before attempting a match.
7853 Any completion that matches the pattern will be removed from the list.
7854 A leading <B>!</B> negates the pattern; in this case any completion
7855 not matching the pattern will be removed.
7856 <P>
7857
7858 Finally, any prefix and suffix specified with the <B>-P</B> and <B>-S</B>
7859 options are added to each member of the completion list, and the result is
7860 returned to the readline completion code as the list of possible
7861 completions.
7862 <P>
7863
7864 If the previously-applied actions do not generate any matches, and the
7865 <B>-o dirnames</B> option was supplied to <B>complete</B> when the
7866 compspec was defined, directory name completion is attempted.
7867 <P>
7868
7869 If the <B>-o plusdirs</B> option was supplied to <B>complete</B> when the
7870 compspec was defined, directory name completion is attempted and any
7871 matches are added to the results of the other actions.
7872 <P>
7873
7874 By default, if a compspec is found, whatever it generates is returned
7875 to the completion code as the full set of possible completions.
7876 The default <B>bash</B> completions are not attempted, and the readline
7877 default of filename completion is disabled.
7878 If the <B>-o bashdefault</B> option was supplied to <B>complete</B> when
7879 the compspec was defined, the <B>bash</B> default completions are attempted
7880 if the compspec generates no matches.
7881 If the <B>-o default</B> option was supplied to <B>complete</B> when the
7882 compspec was defined, readline's default completion will be performed
7883 if the compspec (and, if attempted, the default <B>bash</B> completions)
7884 generate no matches.
7885 <P>
7886
7887 When a compspec indicates that directory name completion is desired,
7888 the programmable completion functions force readline to append a slash
7889 to completed names which are symbolic links to directories, subject to  
7890 the value of the <B>mark-directories</B> readline variable, regardless
7891 of the setting of the <B>mark-symlinked-directories</B> readline variable.
7892 <P>
7893
7894 There is some support for dynamically modifying completions.  This is
7895 most useful when used in combination with a default completion specified
7896 with <B>complete -D</B>.
7897 It's possible for shell functions executed as completion
7898 handlers to indicate that completion should be retried by returning an
7899 exit status of 124.  If a shell function returns 124, and changes
7900 the compspec associated with the command on which completion is being
7901 attempted (supplied as the first argument when the function is executed),
7902 programmable completion restarts from the beginning, with an
7903 attempt to find a new compspec for that command.  This allows a set of
7904 completions to be built dynamically as completion is attempted, rather than
7905 being loaded all at once.
7906 <P>
7907
7908 For instance, assuming that there is a library of compspecs, each kept in a
7909 file corresponding to the name of the command, the following default
7910 completion function would load completions dynamically:
7911 <P>
7912
7913 <TT>_completion_loader()
7914 <BR>
7915
7916 {
7917 <BR>
7918
7919 <TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT>. &quot;/etc/bash_completion.d/$1.sh&quot; &gt;/dev/null 2&gt;&amp;1 &amp;&amp; return 124<BR>
7920 <BR>
7921
7922 }
7923 <BR>
7924
7925 complete -D -F _completion_loader
7926 <BR>
7927
7928 </TT>
7929 <A NAME="lbCW">&nbsp;</A>
7930 <H3>HISTORY</H3>
7931
7932 When the
7933 <B>-o history</B>
7934
7935 option to the
7936 <B>set</B>
7937
7938 builtin is enabled, the shell provides access to the
7939 <I>command history</I>,
7940 the list of commands previously typed.
7941 The value of the
7942 <FONT SIZE=-1><B>HISTSIZE</B>
7943
7944 </FONT>
7945 variable is used as the
7946 number of commands to save in a history list.
7947 The text of the last
7948 <FONT SIZE=-1><B>HISTSIZE</B>
7949
7950 </FONT>
7951 commands (default 500) is saved.  The shell
7952 stores each command in the history list prior to parameter and
7953 variable expansion (see
7954 <FONT SIZE=-1><B>EXPANSION</B>
7955
7956 </FONT>
7957 above) but after history expansion is performed, subject to the
7958 values of the shell variables
7959 <FONT SIZE=-1><B>HISTIGNORE</B>
7960
7961 </FONT>
7962 and
7963 <FONT SIZE=-1><B>HISTCONTROL</B>.
7964
7965 </FONT>
7966 <P>
7967
7968 On startup, the history is initialized from the file named by
7969 the variable
7970 <FONT SIZE=-1><B>HISTFILE</B>
7971
7972 </FONT>
7973 (default <A HREF="file:~/.bash_history"><I>~/.bash_history</I></A>).
7974 The file named by the value of
7975 <FONT SIZE=-1><B>HISTFILE</B>
7976
7977 </FONT>
7978 is truncated, if necessary, to contain no more than
7979 the number of lines specified by the value of
7980 <FONT SIZE=-1><B>HISTFILESIZE</B>.
7981
7982 </FONT>
7983 When the history file is read,
7984 lines beginning with the history comment character followed immediately
7985 by a digit are interpreted as timestamps for the preceding history line.
7986 These timestamps are optionally displayed depending on the value of the
7987 <FONT SIZE=-1><B>HISTTIMEFORMAT</B>
7988
7989 </FONT>
7990 variable.
7991 When an interactive shell exits, the last
7992 <FONT SIZE=-1><B>$HISTSIZE</B>
7993
7994 </FONT>
7995 lines are copied from the history list to
7996 <FONT SIZE=-1><B>$HISTFILE</B>.
7997
7998 </FONT>
7999 If the
8000 <B>histappend</B>
8001
8002 shell option is enabled
8003 (see the description of
8004 <B>shopt</B>
8005
8006 under
8007 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
8008
8009 </FONT>
8010 below), the lines are appended to the history file,
8011 otherwise the history file is overwritten.
8012 If
8013 <FONT SIZE=-1><B>HISTFILE</B>
8014
8015 </FONT>
8016 is unset, or if the history file is unwritable, the history is
8017 not saved.
8018 If the
8019 <FONT SIZE=-1><B>HISTTIMEFORMAT</B>
8020
8021 </FONT>
8022 variable is set, time stamps are written to the history file, marked
8023 with the history comment character, so
8024 they may be preserved across shell sessions.
8025 This uses the history comment character to distinguish timestamps from
8026 other history lines.
8027 After saving the history, the history file is truncated
8028 to contain no more than
8029 <FONT SIZE=-1><B>HISTFILESIZE</B>
8030
8031 </FONT>
8032 lines.  If
8033 <FONT SIZE=-1><B>HISTFILESIZE</B>
8034
8035 </FONT>
8036 is not set, no truncation is performed.
8037 <P>
8038
8039 The builtin command
8040 <B>fc</B>
8041
8042 (see
8043 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
8044
8045 </FONT>
8046 below) may be used to list or edit and re-execute a portion of
8047 the history list.
8048 The
8049 <B>history</B>
8050
8051 builtin may be used to display or modify the history list and
8052 manipulate the history file.
8053 When using command-line editing, search commands
8054 are available in each editing mode that provide access to the
8055 history list.
8056 <P>
8057
8058 The shell allows control over which commands are saved on the history
8059 list.  The
8060 <FONT SIZE=-1><B>HISTCONTROL</B>
8061
8062 </FONT>
8063 and
8064 <FONT SIZE=-1><B>HISTIGNORE</B>
8065
8066 </FONT>
8067 variables may be set to cause the shell to save only a subset of the
8068 commands entered.
8069 The
8070 <B>cmdhist</B>
8071
8072 shell option, if enabled, causes the shell to attempt to save each
8073 line of a multi-line command in the same history entry, adding
8074 semicolons where necessary to preserve syntactic correctness.
8075 The
8076 <B>lithist</B>
8077
8078 shell option causes the shell to save the command with embedded newlines
8079 instead of semicolons.  See the description of the
8080 <B>shopt</B>
8081
8082 builtin below under
8083 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
8084
8085 </FONT>
8086 for information on setting and unsetting shell options.
8087 <A NAME="lbCX">&nbsp;</A>
8088 <H3>HISTORY EXPANSION</H3>
8089
8090 <P>
8091
8092 The shell supports a history expansion feature that
8093 is similar to the history expansion in
8094 <B>csh.</B>
8095
8096 This section describes what syntax features are available.  This
8097 feature is enabled by default for interactive shells, and can be
8098 disabled using the
8099 <B>+H</B>
8100
8101 option to the
8102 <B>set</B>
8103
8104 builtin command (see
8105 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
8106
8107 </FONT>
8108 below).  Non-interactive shells do not perform history expansion
8109 by default.
8110 <P>
8111
8112 History expansions introduce words from the history list into
8113 the input stream, making it easy to repeat commands, insert the
8114 arguments to a previous command into the current input line, or
8115 fix errors in previous commands quickly.
8116 <P>
8117
8118 History expansion is performed immediately after a complete line
8119 is read, before the shell breaks it into words.
8120 It takes place in two parts.
8121 The first is to determine which line from the history list
8122 to use during substitution.
8123 The second is to select portions of that line for inclusion into
8124 the current one.
8125 The line selected from the history is the <I>event</I>,
8126 and the portions of that line that are acted upon are <I>words</I>.
8127 Various <I>modifiers</I> are available to manipulate the selected words.
8128 The line is broken into words in the same fashion as when reading input,
8129 so that several <I>metacharacter</I>-separated words surrounded by
8130 quotes are considered one word.
8131 History expansions are introduced by the appearance of the
8132 history expansion character, which is <B>!</B> by default.
8133 Only backslash (<B>\</B>) and single quotes can quote
8134 the history expansion character.
8135 <P>
8136
8137 Several characters inhibit history expansion if found immediately
8138 following the history expansion character, even if it is unquoted:
8139 space, tab, newline, carriage return, and <B>=</B>.
8140 If the <B>extglob</B> shell option is enabled, <B>(</B> will also
8141 inhibit expansion.
8142 <P>
8143
8144 Several shell options settable with the
8145 <B>shopt</B>
8146
8147 builtin may be used to tailor the behavior of history expansion.
8148 If the
8149 <B>histverify</B>
8150
8151 shell option is enabled (see the description of the
8152 <B>shopt</B>
8153
8154 builtin below), and
8155 <B>readline</B>
8156
8157 is being used, history substitutions are not immediately passed to
8158 the shell parser.
8159 Instead, the expanded line is reloaded into the
8160 <B>readline</B>
8161
8162 editing buffer for further modification.
8163 If
8164 <B>readline</B>
8165
8166 is being used, and the
8167 <B>histreedit</B>
8168
8169 shell option is enabled, a failed history substitution will be reloaded
8170 into the
8171 <B>readline</B>
8172
8173 editing buffer for correction.
8174 The
8175 <B>-p</B>
8176
8177 option to the
8178 <B>history</B>
8179
8180 builtin command may be used to see what a history expansion will
8181 do before using it.
8182 The
8183 <B>-s</B>
8184
8185 option to the
8186 <B>history</B>
8187
8188 builtin may be used to add commands to the end of the history list
8189 without actually executing them, so that they are available for
8190 subsequent recall.
8191 <P>
8192
8193 The shell allows control of the various characters used by the
8194 history expansion mechanism (see the description of
8195 <B>histchars</B>
8196
8197 above under
8198 <B>Shell Variables</B>).
8199
8200 The shell uses
8201 the history comment character to mark history timestamps when
8202 writing the history file.
8203 <A NAME="lbCY">&nbsp;</A>
8204 <H4>Event Designators</H4>
8205
8206 <P>
8207
8208 An event designator is a reference to a command line entry in the
8209 history list.
8210 Unless the reference is absolute, events are relative to the current
8211 position in the history list.
8212 <P>
8213
8214
8215 <DL COMPACT>
8216 <DT><B>!</B>
8217
8218 <DD>
8219 Start a history substitution, except when followed by a
8220 <B>blank</B>,
8221
8222 newline, carriage return, =
8223 or ( (when the <B>extglob</B> shell option is enabled using
8224 the <B>shopt</B> builtin).
8225 <DT><B>!</B><I>n</I>
8226
8227 <DD>
8228 Refer to command line
8229 <I>n</I>.
8230
8231 <DT><B>!-</B><I>n</I>
8232
8233 <DD>
8234 Refer to the current command minus
8235 <I>n</I>.
8236
8237 <DT><B>!!</B>
8238
8239 <DD>
8240 Refer to the previous command.  This is a synonym for `!-1'.
8241 <DT><B>!</B><I>string</I>
8242
8243 <DD>
8244 Refer to the most recent command preceding the current position in the
8245 history list starting with
8246 <I>string</I>.
8247
8248 <DT><B>!?</B><I>string</I><B>[?]</B>
8249
8250 <DD>
8251 Refer to the most recent command preceding the current postition in the
8252 history list containing
8253 <I>string</I>.
8254
8255 The trailing <B>?</B> may be omitted if
8256 <I>string</I>
8257
8258 is followed immediately by a newline.
8259 <DT><B></B><FONT SIZE=+2><B>^</B></FONT><B></B><I>string1</I><FONT SIZE=+2>^</FONT><I>string2</I><FONT SIZE=+2>^</FONT>
8260
8261 <DD>
8262 Quick substitution.  Repeat the previous command, replacing
8263 <I>string1</I>
8264
8265 with
8266 <I>string2</I>.
8267
8268 Equivalent to
8269 ``!!:s/<I>string1</I>/<I>string2</I>/''
8270 (see <B>Modifiers</B> below).
8271 <DT><B>!#</B>
8272
8273 <DD>
8274 The entire command line typed so far.
8275
8276 </DL>
8277 <A NAME="lbCZ">&nbsp;</A>
8278 <H4>Word Designators</H4>
8279
8280 <P>
8281
8282 Word designators are used to select desired words from the event.
8283
8284 <B>:</B>
8285
8286 separates the event specification from the word designator.
8287 It may be omitted if the word designator begins with a
8288 <B>^</B>,
8289
8290 <B>$</B>,
8291
8292 <B>*</B>,
8293
8294 <B>-</B>,
8295
8296 or
8297 <B>%</B>.
8298
8299 Words are numbered from the beginning of the line,
8300 with the first word being denoted by 0 (zero).
8301 Words are inserted into the current line separated by single spaces.
8302 <P>
8303
8304
8305 <DL COMPACT>
8306 <DT><B>0 (zero)</B>
8307
8308 <DD>
8309 The zeroth word.  For the shell, this is the command
8310 word.
8311 <DT><I>n</I>
8312
8313 <DD>
8314 The <I>n</I>th word.
8315 <DT><B>^</B>
8316
8317 <DD>
8318 The first argument.  That is, word 1.
8319 <DT><B>$</B>
8320
8321 <DD>
8322 The last argument.
8323 <DT><B>%</B>
8324
8325 <DD>
8326 The word matched by the most recent `?<I>string</I>?' search.
8327 <DT><I>x</I><B>-</B>y
8328
8329 <DD>
8330 A range of words; `-<I>y</I>' abbreviates `0-<I>y</I>'.
8331 <DT><B>*</B>
8332
8333 <DD>
8334 All of the words but the zeroth.  This is a synonym
8335 for `<I>1-$</I>'.  It is not an error to use
8336 <B>*</B>
8337
8338 if there is just one
8339 word in the event; the empty string is returned in that case.
8340 <DT><B>x*</B>
8341
8342 <DD>
8343 Abbreviates <I>x-$</I>.
8344 <DT><B>x-</B>
8345
8346 <DD>
8347 Abbreviates <I>x-$</I> like <B>x*</B>, but omits the last word.
8348
8349 </DL>
8350 <P>
8351
8352 If a word designator is supplied without an event specification, the
8353 previous command is used as the event.
8354 <A NAME="lbDA">&nbsp;</A>
8355 <H4>Modifiers</H4>
8356
8357 <P>
8358
8359 After the optional word designator, there may appear a sequence of
8360 one or more of the following modifiers, each preceded by a `:'.
8361 <P>
8362
8363
8364 <P>
8365
8366 <DL COMPACT>
8367 <DT><B>h</B>
8368
8369 <DD>
8370 Remove a trailing file name component, leaving only the head.
8371 <DT><B>t</B>
8372
8373 <DD>
8374 Remove all leading file name components, leaving the tail.
8375 <DT><B>r</B>
8376
8377 <DD>
8378 Remove a trailing suffix of the form <I>.xxx</I>, leaving the
8379 basename.
8380 <DT><B>e</B>
8381
8382 <DD>
8383 Remove all but the trailing suffix.
8384 <DT><B>p</B>
8385
8386 <DD>
8387 Print the new command but do not execute it.
8388 <DT><B>q</B>
8389
8390 <DD>
8391 Quote the substituted words, escaping further substitutions.
8392 <DT><B>x</B>
8393
8394 <DD>
8395 Quote the substituted words as with
8396 <B>q</B>,
8397
8398 but break into words at
8399 <B>blanks</B>
8400
8401 and newlines.
8402 <DT><B>s/</B><I>old</I>/<I>new</I>/
8403
8404 <DD>
8405 Substitute
8406 <I>new</I>
8407
8408 for the first occurrence of
8409 <I>old</I>
8410
8411 in the event line.  Any delimiter can be used in place of /.  The
8412 final delimiter is optional if it is the last character of the
8413 event line.  The delimiter may be quoted in
8414 <I>old</I>
8415
8416 and
8417 <I>new</I>
8418
8419 with a single backslash.  If &amp; appears in
8420 <I>new</I>,
8421
8422 it is replaced by
8423 <I>old</I>.
8424
8425 A single backslash will quote the &amp;.  If
8426 <I>old</I>
8427
8428 is null, it is set to the last
8429 <I>old</I>
8430
8431 substituted, or, if no previous history substitutions took place,
8432 the last
8433 <I>string</I>
8434
8435 in a
8436 <B>!?</B><I>string</I><B>[?]</B>
8437
8438 search.
8439 <DT><B>&amp;</B>
8440
8441 <DD>
8442 Repeat the previous substitution.
8443 <DT><B>g</B>
8444
8445 <DD>
8446 Cause changes to be applied over the entire event line.  This is
8447 used in conjunction with `<B>:s</B>' (e.g., `<B>:gs/</B><I>old</I>/<I>new</I>/')
8448 or `<B>:&amp;</B>'.  If used with
8449 `<B>:s</B>', any delimiter can be used
8450 in place of /, and the final delimiter is optional
8451 if it is the last character of the event line.
8452 An <B>a</B> may be used as a synonym for <B>g</B>.
8453 <DT><B>G</B>
8454
8455 <DD>
8456 Apply the following `<B>s</B>' modifier once to each word in the event line.
8457
8458 </DL>
8459 <A NAME="lbDB">&nbsp;</A>
8460 <H3>SHELL BUILTIN COMMANDS</H3>
8461
8462
8463
8464 <P>
8465
8466 Unless otherwise noted, each builtin command documented in this
8467 section as accepting options preceded by
8468 <B>-</B>
8469
8470 accepts
8471 <B>--</B>
8472
8473 to signify the end of the options.
8474 The <B>:</B>, <B>true</B>, <B>false</B>, and <B>test</B> builtins
8475 do not accept options and do not treat <B>--</B> specially.
8476 The <B>exit</B>, <B>logout</B>, <B>break</B>, <B>continue</B>, <B>let</B>,
8477 and <B>shift</B> builtins accept and process arguments beginning with
8478 <B>-</B> without requiring <B>--</B>.
8479 Other builtins that accept arguments but are not specified as accepting
8480 options interpret arguments beginning with <B>-</B> as invalid options and
8481 require <B>--</B> to prevent this interpretation.
8482 <P>
8483
8484 <DL COMPACT>
8485 <DT><B>:</B> [<I>arguments</I>]<DD>
8486
8487 No effect; the command does nothing beyond expanding
8488 <I>arguments</I>
8489
8490 and performing any specified
8491 redirections.  A zero exit code is returned.
8492 <DT><B> . </B> <I>filename</I> [<I>arguments</I>]<DD>
8493
8494 <DT><B>source</B> <I>filename</I> [<I>arguments</I>]<DD>
8495
8496 Read and execute commands from
8497 <I>filename</I>
8498
8499 in the current
8500 shell environment and return the exit status of the last command
8501 executed from
8502 <I>filename</I>.
8503
8504 If
8505 <I>filename</I>
8506
8507 does not contain a slash, file names in
8508 <FONT SIZE=-1><B>PATH</B>
8509
8510 </FONT>
8511 are used to find the directory containing
8512 <I>filename</I>.
8513
8514 The file searched for in
8515 <FONT SIZE=-1><B>PATH</B>
8516
8517 </FONT>
8518 need not be executable.
8519 When <B>bash</B> is not in <I>posix mode</I>, the current directory is
8520 searched if no file is found in
8521 <FONT SIZE=-1><B>PATH</B>.
8522
8523 </FONT>
8524 If the
8525 <B>sourcepath</B>
8526
8527 option to the
8528 <B>shopt</B>
8529
8530 builtin command is turned off, the
8531 <FONT SIZE=-1><B>PATH</B>
8532
8533 </FONT>
8534 is not searched.
8535 If any <I>arguments</I> are supplied, they become the positional
8536 parameters when <I>filename</I> is executed.  Otherwise the positional
8537 parameters are unchanged.
8538 The return status is the status of the last command exited within
8539 the script (0 if no commands are executed), and false if
8540 <I>filename</I>
8541
8542 is not found or cannot be read.
8543 <DT><B>alias</B> [<B>-p</B>] [<I>name</I>[=<I>value</I>] ...]<DD>
8544 <B>Alias</B> with no arguments or with the
8545 <B>-p</B>
8546
8547 option prints the list of aliases in the form
8548 <B>alias</B> <I>name</I>=<I>value</I> on standard output.
8549 When arguments are supplied, an alias is defined for
8550 each <I>name</I> whose <I>value</I> is given.
8551 A trailing space in  <I>value</I> causes the next word to be
8552 checked for alias substitution when the alias is expanded.
8553 For each <I>name</I> in the argument list for which no <I>value</I>
8554 is supplied, the name and value of the alias is printed.
8555 <B>Alias</B> returns true unless a <I>name</I> is given for which
8556 no alias has been defined.
8557 <DT><B>bg</B> [<I>jobspec</I> ...]<DD>
8558 Resume each suspended job <I>jobspec</I> in the background, as if it
8559 had been started with
8560 <B>&amp;</B>.
8561
8562 If
8563 <I>jobspec</I>
8564
8565 is not present, the shell's notion of the <I>current job</I> is used.
8566 <B>bg</B>
8567
8568 <I>jobspec</I>
8569
8570 returns 0 unless run when job control is disabled or, when run with
8571 job control enabled, any specified <I>jobspec</I> was not found
8572 or was started without job control.
8573 <DT><B>bind</B> [<B>-m</B> <I>keymap</I>] [<B>-lpsvPSV</B>]<DD>
8574
8575 <DT><B>bind</B> [<B>-m</B> <I>keymap</I>] [<B>-q</B> <I>function</I>] [<B>-u</B> <I>function</I>] [<B>-r</B> <I>keyseq</I>]<DD>
8576 <DT><B>bind</B> [<B>-m</B> <I>keymap</I>] <B>-f</B> <I>filename</I><DD>
8577 <DT><B>bind</B> [<B>-m</B> <I>keymap</I>] <B>-x</B> <I>keyseq</I>:<I>shell-command</I><DD>
8578 <DT><B>bind</B> [<B>-m</B> <I>keymap</I>] <I>keyseq</I>:<I>function-name</I><DD>
8579 <DT><B>bind</B> <I>readline-command</I><DD>
8580
8581 Display current
8582 <B>readline</B>
8583
8584 key and function bindings, bind a key sequence to a
8585 <B>readline</B>
8586
8587 function or macro, or set a
8588 <B>readline</B>
8589
8590 variable.
8591 Each non-option argument is a command as it would appear in
8592 <I>.inputrc</I>,
8593
8594 but each binding or command must be passed as a separate argument;
8595 e.g., '&quot;\C-x\C-r&quot;: re-read-init-file'.
8596 Options, if supplied, have the following meanings:
8597 <DL COMPACT><DT><DD>
8598
8599 <DL COMPACT>
8600 <DT><B>-m </B><I>keymap</I>
8601
8602 <DD>
8603 Use
8604 <I>keymap</I>
8605
8606 as the keymap to be affected by the subsequent bindings.
8607 Acceptable
8608 <I>keymap</I>
8609
8610 names are
8611 <I>emacs, emacs-standard, emacs-meta, emacs-ctlx, vi,
8612 vi-move, vi-command</I>, and
8613 <I>vi-insert</I>.
8614
8615 <I>vi</I> is equivalent to <I>vi-command</I>; <I>emacs</I> is
8616 equivalent to <I>emacs-standard</I>.
8617 <DT><B>-l</B>
8618
8619 <DD>
8620 List the names of all <B>readline</B> functions.
8621 <DT><B>-p</B>
8622
8623 <DD>
8624 Display <B>readline</B> function names and bindings in such a way
8625 that they can be re-read.
8626 <DT><B>-P</B>
8627
8628 <DD>
8629 List current <B>readline</B> function names and bindings.
8630 <DT><B>-s</B>
8631
8632 <DD>
8633 Display <B>readline</B> key sequences bound to macros and the strings
8634 they output in such a way that they can be re-read.
8635 <DT><B>-S</B>
8636
8637 <DD>
8638 Display <B>readline</B> key sequences bound to macros and the strings
8639 they output.
8640 <DT><B>-v</B>
8641
8642 <DD>
8643 Display <B>readline</B> variable names and values in such a way that they
8644 can be re-read.
8645 <DT><B>-V</B>
8646
8647 <DD>
8648 List current <B>readline</B> variable names and values.
8649 <DT><B>-f </B><I>filename</I>
8650
8651 <DD>
8652 Read key bindings from <I>filename</I>.
8653 <DT><B>-q </B><I>function</I>
8654
8655 <DD>
8656 Query about which keys invoke the named <I>function</I>.
8657 <DT><B>-u </B><I>function</I>
8658
8659 <DD>
8660 Unbind all keys bound to the named <I>function</I>.
8661 <DT><B>-r </B><I>keyseq</I>
8662
8663 <DD>
8664 Remove any current binding for <I>keyseq</I>.
8665 <DT><B>-x </B><I>keyseq</I>:<I>shell-command</I>
8666
8667 <DD>
8668 Cause <I>shell-command</I> to be executed whenever <I>keyseq</I> is
8669 entered.
8670 When <I>shell-command</I> is executed, the shell sets the
8671 <FONT SIZE=-1><B>READLINE_LINE</B>
8672
8673 </FONT>
8674 variable to the contents of the <B>readline</B> line buffer and the
8675 <FONT SIZE=-1><B>READLINE_POINT</B>
8676
8677 </FONT>
8678 variable to the current location of the insertion point.
8679 If the executed command changes the value of
8680 <FONT SIZE=-1><B>READLINE_LINE</B>
8681
8682 </FONT>
8683 or
8684 <FONT SIZE=-1><B>READLINE_POINT</B>,
8685
8686 </FONT>
8687 those new values will be reflected in the editing state.
8688
8689 </DL>
8690 <P>
8691
8692 The return value is 0 unless an unrecognized option is given or an
8693 error occurred.
8694 </DL>
8695
8696 <DT><B>break</B> [<I>n</I>]<DD>
8697 Exit from within a
8698 <B>for</B>,
8699
8700 <B>while</B>,
8701
8702 <B>until</B>,
8703
8704 or
8705 <B>select</B>
8706
8707 loop.  If <I>n</I> is specified, break <I>n</I> levels.
8708 <I>n</I>
8709
8710 must be >= 1.  If
8711 <I>n</I>
8712
8713 is greater than the number of enclosing loops, all enclosing loops
8714 are exited.
8715 The return value is 0 unless <I>n</I> is not greater than or equal to 1.
8716 <DT><B>builtin</B> <I>shell-builtin</I> [<I>arguments</I>]<DD>
8717 Execute the specified shell builtin, passing it
8718 <I>arguments</I>,
8719
8720 and return its exit status.
8721 This is useful when defining a
8722 function whose name is the same as a shell builtin,
8723 retaining the functionality of the builtin within the function.
8724 The <B>cd</B> builtin is commonly redefined this way.
8725 The return status is false if
8726 <I>shell-builtin</I>
8727
8728 is not a shell builtin command.
8729 <DT><B>caller</B> [<I>expr</I>]<DD>
8730 Returns the context of any active subroutine call (a shell function or
8731 a script executed with the <B>.</B> or <B>source</B> builtins).
8732 Without <I>expr</I>, <B>caller</B> displays the line number and source
8733 filename of the current subroutine call.
8734 If a non-negative integer is supplied as <I>expr</I>, <B>caller</B> 
8735 displays the line number, subroutine name, and source file corresponding
8736 to that position in the current execution call stack.  This extra
8737 information may be used, for example, to print a stack trace.  The
8738 current frame is frame 0.
8739 The return value is 0 unless the shell is not executing a subroutine
8740 call or <I>expr</I> does not correspond to a valid position in the
8741 call stack.
8742 <DT><B>cd</B> [<B>-L</B>|[<B>-P</B> [<B>-e</B>]]] [<I>dir</I>]<DD>
8743 Change the current directory to <I>dir</I>.  The variable
8744 <FONT SIZE=-1><B>HOME</B>
8745
8746 </FONT>
8747 is the
8748 default
8749 <I>dir</I>.
8750
8751 The variable
8752 <FONT SIZE=-1><B>CDPATH</B>
8753
8754 </FONT>
8755 defines the search path for the directory containing
8756 <I>dir</I>.
8757
8758 Alternative directory names in
8759 <FONT SIZE=-1><B>CDPATH</B>
8760
8761 </FONT>
8762 are separated by a colon (:).  A null directory name in
8763 <FONT SIZE=-1><B>CDPATH</B>
8764
8765 </FONT>
8766 is the same as the current directory, i.e., ``<B>.</B>''.  If
8767 <I>dir</I>
8768
8769 begins with a slash (/),
8770 then
8771 <FONT SIZE=-1><B>CDPATH</B>
8772
8773 </FONT>
8774 is not used. The
8775 <B>-P</B>
8776
8777 option says to use the physical directory structure instead of
8778 following symbolic links (see also the
8779 <B>-P</B>
8780
8781 option to the
8782 <B>set</B>
8783
8784 builtin command); the
8785 <B>-L</B>
8786
8787 option forces symbolic links to be followed.
8788 If the
8789 <B>-e</B>
8790
8791 option is supplied with
8792 <B>-P</B>,
8793
8794 and the current working directory cannot be successfully determined
8795 after a successful directory change, <B>cd</B> will return an unsuccessful
8796 status.
8797 An argument of
8798 <B>-</B>
8799
8800 is equivalent to
8801 <FONT SIZE=-1><B>$OLDPWD</B>.
8802
8803 </FONT>
8804 If a non-empty directory name from
8805 <FONT SIZE=-1><B>CDPATH</B>
8806
8807 </FONT>
8808 is used, or if
8809 <B>-</B> is the first argument, and the directory change is
8810 successful, the absolute pathname of the new working directory is
8811 written to the standard output.
8812 The return value is true if the directory was successfully changed;
8813 false otherwise.
8814 <DT><B>command</B> [<B>-pVv</B>] <I>command</I> [<I>arg</I> ...]<DD>
8815 Run
8816 <I>command</I>
8817
8818 with
8819 <I>args</I>
8820
8821 suppressing the normal shell function lookup. Only builtin
8822 commands or commands found in the
8823 <FONT SIZE=-1><B>PATH</B>
8824
8825 </FONT>
8826 are executed.  If the
8827 <B>-p</B>
8828
8829 option is given, the search for
8830 <I>command</I>
8831
8832 is performed using a default value for
8833 <FONT SIZE=-1><B>PATH</B>
8834
8835 </FONT>
8836 that is guaranteed to find all of the standard utilities.
8837 If either the
8838 <B>-V</B>
8839
8840 or
8841 <B>-v</B>
8842
8843 option is supplied, a description of
8844 <I>command</I>
8845
8846 is printed.  The
8847 <B>-v</B>
8848
8849 option causes a single word indicating the command or file name
8850 used to invoke
8851 <I>command</I>
8852
8853 to be displayed; the
8854 <B>-V</B>
8855
8856 option produces a more verbose description.
8857 If the
8858 <B>-V</B>
8859
8860 or
8861 <B>-v</B>
8862
8863 option is supplied, the exit status is 0 if
8864 <I>command</I>
8865
8866 was found, and 1 if not.  If neither option is supplied and
8867 an error occurred or
8868 <I>command</I>
8869
8870 cannot be found, the exit status is 127.  Otherwise, the exit status of the
8871 <B>command</B>
8872
8873 builtin is the exit status of
8874 <I>command</I>.
8875
8876 <DT><B>compgen</B> [<I>option</I>] [<I>word</I>]<DD>
8877 Generate possible completion matches for <I>word</I> according to
8878 the <I>option</I>s, which may be any option accepted by the
8879 <B>complete</B>
8880
8881 builtin with the exception of <B>-p</B> and <B>-r</B>, and write
8882 the matches to the standard output.
8883 When using the <B>-F</B> or <B>-C</B> options, the various shell variables
8884 set by the programmable completion facilities, while available, will not
8885 have useful values.
8886 <P>
8887 The matches will be generated in the same way as if the programmable
8888 completion code had generated them directly from a completion specification
8889 with the same flags.
8890 If <I>word</I> is specified, only those completions matching <I>word</I>
8891 will be displayed.
8892 <P>
8893 The return value is true unless an invalid option is supplied, or no
8894 matches were generated.
8895 <DT><B>complete</B> [<B>-abcdefgjksuv</B>] [<B>-o</B> <I>comp-option</I>] [<B>-DE</B>] [<B>-A</B> <I>action</I>] [<B>-G</B> <I>globpat</I>] [<B>-W</B> <I>wordlist</I>] [<B>-F</B> <I>function</I>] [<B>-C</B> <I>command</I>]<DD>
8896 <BR>
8897
8898 [<B>-X</B> <I>filterpat</I>] [<B>-P</B> <I>prefix</I>] [<B>-S</B> <I>suffix</I>] <I>name</I> [<I>name ...</I>]
8899
8900 <DT><B>complete</B> <B>-pr</B> [<B>-DE</B>] [<I>name</I> ...]<DD>
8901
8902 Specify how arguments to each <I>name</I> should be completed.
8903 If the <B>-p</B> option is supplied, or if no options are supplied,
8904 existing completion specifications are printed in a way that allows
8905 them to be reused as input.
8906 The <B>-r</B> option removes a completion specification for
8907 each <I>name</I>, or, if no <I>name</I>s are supplied, all
8908 completion specifications.
8909 The <B>-D</B> option indicates that the remaining options and actions should
8910 apply to the ``default'' command completion; that is, completion attempted
8911 on a command for which no completion has previously been defined.
8912 The <B>-E</B> option indicates that the remaining options and actions should
8913 apply to ``empty'' command completion; that is, completion attempted on a
8914 blank line.
8915 <P>
8916 The process of applying these completion specifications when word completion
8917 is attempted is described above under <B>Programmable Completion</B>.
8918 <P>
8919 Other options, if specified, have the following meanings.
8920 The arguments to the <B>-G</B>, <B>-W</B>, and <B>-X</B> options
8921 (and, if necessary, the <B>-P</B> and <B>-S</B> options)
8922 should be quoted to protect them from expansion before the
8923 <B>complete</B>
8924
8925 builtin is invoked.
8926 <DL COMPACT><DT><DD>
8927
8928 <DL COMPACT>
8929 <DT><B>-o</B> <I>comp-option</I><DD>
8930 The <I>comp-option</I> controls several aspects of the compspec's behavior
8931 beyond the simple generation of completions.
8932 <I>comp-option</I> may be one of:
8933 <DL COMPACT><DT><DD>
8934 <DL COMPACT>
8935 <DT><B>bashdefault</B>
8936
8937 <DD>
8938 Perform the rest of the default <B>bash</B> completions if the compspec
8939 generates no matches.
8940 <DT><B>default</B>
8941
8942 <DD>
8943 Use readline's default filename completion if the compspec generates
8944 no matches.
8945 <DT><B>dirnames</B>
8946
8947 <DD>
8948 Perform directory name completion if the compspec generates no matches.
8949 <DT><B>filenames</B>
8950
8951 <DD>
8952 Tell readline that the compspec generates filenames, so it can perform any
8953 filename-specific processing (like adding a slash to directory names,
8954 quoting special characters, or suppressing trailing spaces).
8955 Intended to be used with shell functions.
8956 <DT><B>nospace</B>
8957
8958 <DD>
8959 Tell readline not to append a space (the default) to words completed at
8960 the end of the line.
8961 <DT><B>plusdirs</B>
8962
8963 <DD>
8964 After any matches defined by the compspec are generated, 
8965 directory name completion is attempted and any
8966 matches are added to the results of the other actions.
8967 </DL></DL>
8968
8969 <DT><B>-A</B> <I>action</I><DD>
8970 The <I>action</I> may be one of the following to generate a list of possible
8971 completions:
8972 <DL COMPACT><DT><DD>
8973 <DL COMPACT>
8974 <DT><B>alias</B>
8975
8976 <DD>
8977 Alias names.  May also be specified as <B>-a</B>.
8978 <DT><B>arrayvar</B>
8979
8980 <DD>
8981 Array variable names.
8982 <DT><B>binding</B>
8983
8984 <DD>
8985 <B>Readline</B> key binding names.
8986 <DT><B>builtin</B>
8987
8988 <DD>
8989 Names of shell builtin commands.  May also be specified as <B>-b</B>.
8990 <DT><B>command</B>
8991
8992 <DD>
8993 Command names.  May also be specified as <B>-c</B>.
8994 <DT><B>directory</B>
8995
8996 <DD>
8997 Directory names.  May also be specified as <B>-d</B>.
8998 <DT><B>disabled</B>
8999
9000 <DD>
9001 Names of disabled shell builtins.
9002 <DT><B>enabled</B>
9003
9004 <DD>
9005 Names of enabled shell builtins.
9006 <DT><B>export</B>
9007
9008 <DD>
9009 Names of exported shell variables.  May also be specified as <B>-e</B>.
9010 <DT><B>file</B>
9011
9012 <DD>
9013 File names.  May also be specified as <B>-f</B>.
9014 <DT><B>function</B>
9015
9016 <DD>
9017 Names of shell functions.
9018 <DT><B>group</B>
9019
9020 <DD>
9021 Group names.  May also be specified as <B>-g</B>.
9022 <DT><B>helptopic</B>
9023
9024 <DD>
9025 Help topics as accepted by the <B>help</B> builtin.
9026 <DT><B>hostname</B>
9027
9028 <DD>
9029 Hostnames, as taken from the file specified by the
9030 <FONT SIZE=-1><B>HOSTFILE</B>
9031
9032 </FONT>
9033 shell variable.
9034 <DT><B>job</B>
9035
9036 <DD>
9037 Job names, if job control is active.  May also be specified as <B>-j</B>.
9038 <DT><B>keyword</B>
9039
9040 <DD>
9041 Shell reserved words.  May also be specified as <B>-k</B>.
9042 <DT><B>running</B>
9043
9044 <DD>
9045 Names of running jobs, if job control is active.
9046 <DT><B>service</B>
9047
9048 <DD>
9049 Service names.  May also be specified as <B>-s</B>.
9050 <DT><B>setopt</B>
9051
9052 <DD>
9053 Valid arguments for the <B>-o</B> option to the <B>set</B> builtin.
9054 <DT><B>shopt</B>
9055
9056 <DD>
9057 Shell option names as accepted by the <B>shopt</B> builtin.
9058 <DT><B>signal</B>
9059
9060 <DD>
9061 Signal names.
9062 <DT><B>stopped</B>
9063
9064 <DD>
9065 Names of stopped jobs, if job control is active.
9066 <DT><B>user</B>
9067
9068 <DD>
9069 User names.  May also be specified as <B>-u</B>.
9070 <DT><B>variable</B>
9071
9072 <DD>
9073 Names of all shell variables.  May also be specified as <B>-v</B>.
9074 </DL></DL>
9075
9076 <DT><B>-C</B> <I>command</I><DD>
9077 <I>command</I> is executed in a subshell environment, and its output is
9078 used as the possible completions.
9079 <DT><B>-F</B> <I>function</I><DD>
9080 The shell function <I>function</I> is executed in the current shell
9081 environment.
9082 When it finishes, the possible completions are retrieved from the value
9083 of the
9084 <FONT SIZE=-1><B>COMPREPLY</B>
9085
9086 </FONT>
9087 array variable.
9088 <DT><B>-G</B> <I>globpat</I><DD>
9089 The pathname expansion pattern <I>globpat</I> is expanded to generate
9090 the possible completions.
9091 <DT><B>-P</B> <I>prefix</I><DD>
9092 <I>prefix</I> is added at the beginning of each possible completion
9093 after all other options have been applied.
9094 <DT><B>-S</B> <I>suffix</I><DD>
9095 <I>suffix</I> is appended to each possible completion
9096 after all other options have been applied.
9097 <DT><B>-W</B> <I>wordlist</I><DD>
9098 The <I>wordlist</I> is split using the characters in the
9099 <FONT SIZE=-1><B>IFS</B>
9100
9101 </FONT>
9102 special variable as delimiters, and each resultant word is expanded.
9103 The possible completions are the members of the resultant list which
9104 match the word being completed.
9105 <DT><B>-X</B> <I>filterpat</I><DD>
9106 <I>filterpat</I> is a pattern as used for pathname expansion.
9107 It is applied to the list of possible completions generated by the
9108 preceding options and arguments, and each completion matching
9109 <I>filterpat</I> is removed from the list.
9110 A leading <B>!</B> in <I>filterpat</I> negates the pattern; in this
9111 case, any completion not matching <I>filterpat</I> is removed.
9112
9113 </DL>
9114 <P>
9115
9116 The return value is true unless an invalid option is supplied, an option
9117 other than <B>-p</B> or <B>-r</B> is supplied without a <I>name</I>
9118 argument, an attempt is made to remove a completion specification for
9119 a <I>name</I> for which no specification exists, or
9120 an error occurs adding a completion specification.
9121 </DL>
9122
9123 <DT><B>compopt</B> [<B>-o</B> <I>option</I>] [<B>-DE</B>] [<B>+o</B> <I>option</I>] [<I>name</I>]<DD>
9124 Modify completion options for each <I>name</I> according to the
9125 <I>option</I>s, or for the
9126 currently-executing completion if no <I>name</I>s are supplied.
9127 If no <I>option</I>s are given, display the completion options for each
9128 <I>name</I> or the current completion.
9129 The possible values of <I>option</I> are those valid for the <B>complete</B>
9130 builtin described above.
9131 The <B>-D</B> option indicates that the remaining options should
9132 apply to the ``default'' command completion; that is, completion attempted
9133 on a command for which no completion has previously been defined.
9134 The <B>-E</B> option indicates that the remaining options should
9135 apply to ``empty'' command completion; that is, completion attempted on a
9136 blank line.
9137 <P>
9138 The return value is true unless an invalid option is supplied, an attempt
9139 is made to modify the options for a <I>name</I> for which no completion
9140 specification exists, or an output error occurs.
9141 <DT><B>continue</B> [<I>n</I>]<DD>
9142 Resume the next iteration of the enclosing
9143 <B>for</B>,
9144
9145 <B>while</B>,
9146
9147 <B>until</B>,
9148
9149 or
9150 <B>select</B>
9151
9152 loop.
9153 If
9154 <I>n</I>
9155
9156 is specified, resume at the <I>n</I>th enclosing loop.
9157 <I>n</I>
9158
9159 must be >= 1.  If
9160 <I>n</I>
9161
9162 is greater than the number of enclosing loops, the last enclosing loop
9163 (the ``top-level'' loop) is resumed.
9164 The return value is 0 unless <I>n</I> is not greater than or equal to 1.
9165 <DT><B>declare</B> [<B>-aAfFgilrtux</B>] [<B>-p</B>] [<I>name</I>[=<I>value</I>] ...]<DD>
9166
9167 <DT><B>typeset</B> [<B>-aAfFgilrtux</B>] [<B>-p</B>] [<I>name</I>[=<I>value</I>] ...]<DD>
9168
9169 Declare variables and/or give them attributes.
9170 If no <I>name</I>s are given then display the values of variables.
9171 The
9172 <B>-p</B>
9173
9174 option will display the attributes and values of each
9175 <I>name</I>.
9176
9177 When
9178 <B>-p</B>
9179
9180 is used with <I>name</I> arguments, additional options are ignored.
9181 When
9182 <B>-p</B>
9183
9184 is supplied without <I>name</I> arguments, it will display the attributes
9185 and values of all variables having the attributes specified by the
9186 additional options.
9187 If no other options are supplied with <B>-p</B>, <B>declare</B> will display
9188 the attributes and values of all shell variables.  The <B>-f</B> option
9189 will restrict the display to shell functions.
9190 The
9191 <B>-F</B>
9192
9193 option inhibits the display of function definitions; only the
9194 function name and attributes are printed.
9195 If the <B>extdebug</B> shell option is enabled using <B>shopt</B>,
9196 the source file name and line number where the function is defined
9197 are displayed as well.  The
9198 <B>-F</B>
9199
9200 option implies
9201 <B>-f</B>.
9202
9203 The
9204 <B>-g</B>
9205
9206 option forces variables to be created or modified at the global scope,
9207 even when <B>declare</B> is executed in a shell function.
9208 It is ignored in all other cases.
9209 The following options can
9210 be used to restrict output to variables with the specified attribute or
9211 to give variables attributes:
9212 <DL COMPACT><DT><DD>
9213
9214 <DL COMPACT>
9215 <DT><B>-a</B>
9216
9217 <DD>
9218 Each <I>name</I> is an indexed array variable (see
9219 <B>Arrays</B>
9220
9221 above).
9222 <DT><B>-A</B>
9223
9224 <DD>
9225 Each <I>name</I> is an associative array variable (see
9226 <B>Arrays</B>
9227
9228 above).
9229 <DT><B>-f</B>
9230
9231 <DD>
9232 Use function names only.
9233 <DT><B>-i</B>
9234
9235 <DD>
9236 The variable is treated as an integer; arithmetic evaluation (see
9237 <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>
9238
9239 </FONT>
9240 above) is performed when the variable is assigned a value.
9241 <DT><B>-l</B>
9242
9243 <DD>
9244 When the variable is assigned a value, all upper-case characters are
9245 converted to lower-case.
9246 The upper-case attribute is disabled.
9247 <DT><B>-r</B>
9248
9249 <DD>
9250 Make <I>name</I>s readonly.  These names cannot then be assigned values
9251 by subsequent assignment statements or unset.
9252 <DT><B>-t</B>
9253
9254 <DD>
9255 Give each <I>name</I> the <I>trace</I> attribute.
9256 Traced functions inherit the <B>DEBUG</B> and <B>RETURN</B> traps from
9257 the calling shell.
9258 The trace attribute has no special meaning for variables.
9259 <DT><B>-u</B>
9260
9261 <DD>
9262 When the variable is assigned a value, all lower-case characters are
9263 converted to upper-case.
9264 The lower-case attribute is disabled.
9265 <DT><B>-x</B>
9266
9267 <DD>
9268 Mark <I>name</I>s for export to subsequent commands via the environment.
9269
9270 </DL>
9271 <P>
9272
9273 Using `+' instead of `-'
9274 turns off the attribute instead,
9275 with the exceptions that <B>+a</B>
9276 may not be used to destroy an array variable and <B>+r</B> will not
9277 remove the readonly attribute.
9278 When used in a function, makes each
9279 <I>name</I> local, as with the 
9280 <B>local</B>
9281
9282 command,
9283 unless the <B>-gP option is supplied,
9284 If a variable name is followed by =</B><I>value</I>, the value of
9285 the variable is set to <I>value</I>.
9286 The return value is 0 unless an invalid option is encountered,
9287 an attempt is made to define a function using
9288
9289 <TT>-f foo=bar</TT>,
9290 an attempt is made to assign a value to a readonly variable,
9291 an attempt is made to assign a value to an array variable without
9292 using the compound assignment syntax (see
9293 <B>Arrays</B>
9294
9295 above), one of the <I>names</I> is not a valid shell variable name,
9296 an attempt is made to turn off readonly status for a readonly variable,
9297 an attempt is made to turn off array status for an array variable,
9298 or an attempt is made to display a non-existent function with <B>-f</B>.
9299 </DL>
9300
9301 <DT><B>dirs [+</B><I>n</I>] [-<I>n</I>] [<B>-clpv</B>]
9302
9303 <DD>
9304 Without options, displays the list of currently remembered directories.
9305 The default display is on a single line with directory names separated
9306 by spaces.
9307 Directories are added to the list with the 
9308 <B>pushd</B>
9309
9310 command; the
9311 <B>popd</B>
9312
9313 command removes entries from the list.
9314 <DL COMPACT><DT><DD>
9315
9316 <DL COMPACT>
9317 <DT><B>+</B><I>n</I><DD>
9318 Displays the <I>n</I>th entry counting from the left of the list
9319 shown by
9320 <B>dirs</B>
9321
9322 when invoked without options, starting with zero.
9323 <DT><B>-</B><I>n</I><DD>
9324 Displays the <I>n</I>th entry counting from the right of the list
9325 shown by
9326 <B>dirs</B>
9327
9328 when invoked without options, starting with zero.
9329 <DT><B>-c</B>
9330
9331 <DD>
9332 Clears the directory stack by deleting all of the entries.
9333 <DT><B>-l</B>
9334
9335 <DD>
9336 Produces a longer listing; the default listing format uses a 
9337 tilde to denote the home directory.
9338 <DT><B>-p</B>
9339
9340 <DD>
9341 Print the directory stack with one entry per line.
9342 <DT><B>-v</B>
9343
9344 <DD>
9345 Print the directory stack with one entry per line,
9346 prefixing each entry with its index in the stack.
9347
9348 </DL>
9349 <P>
9350
9351 The return value is 0 unless an
9352 invalid option is supplied or <I>n</I> indexes beyond the end
9353 of the directory stack.
9354 </DL>
9355
9356 <DT><B>disown</B> [<B>-ar</B>] [<B>-h</B>] [<I>jobspec</I> ...]<DD>
9357 Without options, each
9358 <I>jobspec</I>
9359
9360 is removed from the table of active jobs.
9361 If
9362 <I>jobspec</I>
9363
9364 is not present, and neither <B>-a</B> nor <B>-r</B> is supplied,
9365 the shell's notion of the <I>current job</I> is used.
9366 If the <B>-h</B> option is given, each
9367 <I>jobspec</I>
9368
9369 is not removed from the table, but is marked so that
9370 <FONT SIZE=-1><B>SIGHUP</B>
9371
9372 </FONT>
9373 is not sent to the job if the shell receives a
9374 <FONT SIZE=-1><B>SIGHUP</B>.
9375
9376 </FONT>
9377 If no
9378 <I>jobspec</I>
9379
9380 is present, and neither the
9381 <B>-a</B>
9382
9383 nor the
9384 <B>-r</B>
9385
9386 option is supplied, the <I>current job</I> is used.
9387 If no
9388 <I>jobspec</I>
9389
9390 is supplied, the
9391 <B>-a</B>
9392
9393 option means to remove or mark all jobs; the
9394 <B>-r</B>
9395
9396 option without a
9397 <I>jobspec</I>
9398
9399 argument restricts operation to running jobs.
9400 The return value is 0 unless a
9401 <I>jobspec</I>
9402
9403 does not specify a valid job.
9404 <DT><B>echo</B> [<B>-neE</B>] [<I>arg</I> ...]<DD>
9405 Output the <I>arg</I>s, separated by spaces, followed by a newline.
9406 The return status is always 0.
9407 If <B>-n</B> is specified, the trailing newline is
9408 suppressed.  If the <B>-e</B> option is given, interpretation of
9409 the following backslash-escaped characters is enabled.  The
9410 <B>-E</B>
9411
9412 option disables the interpretation of these escape characters,
9413 even on systems where they are interpreted by default.
9414 The <B>xpg_echo</B> shell option may be used to
9415 dynamically determine whether or not <B>echo</B> expands these
9416 escape characters by default.
9417 <B>echo</B>
9418
9419 does not interpret <B>--</B> to mean the end of options.
9420 <B>echo</B>
9421
9422 interprets the following escape sequences:
9423 <DL COMPACT><DT><DD>
9424
9425 <DL COMPACT>
9426 <DT><B>\a</B>
9427
9428 <DD>
9429 alert (bell)
9430 <DT><B>\b</B>
9431
9432 <DD>
9433 backspace
9434 <DT><B>\c</B>
9435
9436 <DD>
9437 suppress further output
9438 <DT><B>\e</B>
9439
9440 <DD>
9441 <DT><B>\E</B>
9442
9443 <DD>
9444 an escape character
9445 <DT><B>\f</B>
9446
9447 <DD>
9448 form feed
9449 <DT><B>\n</B>
9450
9451 <DD>
9452 new line
9453 <DT><B>\r</B>
9454
9455 <DD>
9456 carriage return
9457 <DT><B>\t</B>
9458
9459 <DD>
9460 horizontal tab
9461 <DT><B>\v</B>
9462
9463 <DD>
9464 vertical tab
9465 <DT><B>\\</B>
9466
9467 <DD>
9468 backslash
9469 <DT><B>\0</B><I>nnn</I>
9470
9471 <DD>
9472 the eight-bit character whose value is the octal value <I>nnn</I>
9473 (zero to three octal digits)
9474 <DT><B>\x</B><I>HH</I>
9475
9476 <DD>
9477 the eight-bit character whose value is the hexadecimal value <I>HH</I>
9478 (one or two hex digits)
9479 <DT><B>\u</B><I>HHHH</I>
9480
9481 <DD>
9482 the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value
9483 <I>HHHH</I> (one to four hex digits)
9484 <DT><B>\U</B><I>HHHHHHHH</I>
9485
9486 <DD>
9487 the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value
9488 <I>HHHHHHHH</I> (one to eight hex digits)
9489
9490 </DL></DL>
9491
9492 <DT><B>enable</B> [<B>-a</B>] [<B>-dnps</B>] [<B>-f</B> <I>filename</I>] [<I>name</I> ...]<DD>
9493 Enable and disable builtin shell commands.
9494 Disabling a builtin allows a disk command which has the same name
9495 as a shell builtin to be executed without specifying a full pathname,
9496 even though the shell normally searches for builtins before disk commands.
9497 If <B>-n</B> is used, each <I>name</I>
9498 is disabled; otherwise,
9499 <I>names</I> are enabled.  For example, to use the
9500 <B>test</B>
9501
9502 binary found via the
9503 <FONT SIZE=-1><B>PATH</B>
9504
9505 </FONT>
9506 instead of the shell builtin version, run
9507 <TT>enable -n test</TT>.
9508
9509 The
9510 <B>-f</B>
9511
9512 option means to load the new builtin command
9513 <I>name</I>
9514
9515 from shared object
9516 <I>filename</I>,
9517
9518 on systems that support dynamic loading.  The
9519 <B>-d</B>
9520
9521 option will delete a builtin previously loaded with
9522 <B>-f</B>.
9523
9524 If no <I>name</I> arguments are given, or if the
9525 <B>-p</B>
9526
9527 option is supplied, a list of shell builtins is printed.
9528 With no other option arguments, the list consists of all enabled
9529 shell builtins.
9530 If <B>-n</B> is supplied, only disabled builtins are printed.
9531 If <B>-a</B> is supplied, the list printed includes all builtins, with an
9532 indication of whether or not each is enabled.
9533 If <B>-s</B> is supplied, the output is restricted to the POSIX
9534 <I>special</I> builtins.
9535 The return value is 0 unless a
9536 <I>name</I>
9537
9538 is not a shell builtin or there is an error loading a new builtin
9539 from a shared object.
9540 <DT><B>eval</B> [<I>arg</I> ...]<DD>
9541 The <I>arg</I>s are read and concatenated together into a single
9542 command.  This command is then read and executed by the shell, and
9543 its exit status is returned as the value of
9544 <B>eval</B>.
9545
9546 If there are no
9547 <I>args</I>,
9548
9549 or only null arguments,
9550 <B>eval</B>
9551
9552 returns 0.
9553 <DT><B>exec</B> [<B>-cl</B>] [<B>-a</B> <I>name</I>] [<I>command</I> [<I>arguments</I>]]<DD>
9554 If
9555 <I>command</I>
9556
9557 is specified, it replaces the shell.
9558 No new process is created.  The
9559 <I>arguments</I>
9560
9561 become the arguments to <I>command</I>.
9562 If the
9563 <B>-l</B>
9564
9565 option is supplied,
9566 the shell places a dash at the beginning of the zeroth argument passed to 
9567 <I>command</I>.
9568
9569 This is what
9570 <I>login</I>(1)
9571
9572 does.  The
9573 <B>-c</B>
9574
9575 option causes
9576 <I>command</I>
9577
9578 to be executed with an empty environment.  If
9579 <B>-a</B>
9580
9581 is supplied, the shell passes
9582 <I>name</I>
9583
9584 as the zeroth argument to the executed command.  If
9585 <I>command</I>
9586
9587 cannot be executed for some reason, a non-interactive shell exits,
9588 unless the shell option
9589 <B>execfail</B>
9590
9591 is enabled, in which case it returns failure.
9592 An interactive shell returns failure if the file cannot be executed.
9593 If
9594 <I>command</I>
9595
9596 is not specified, any redirections take effect in the current shell,
9597 and the return status is 0.  If there is a redirection error, the
9598 return status is 1.
9599 <DT><B>exit</B> [<I>n</I>]<DD>
9600 Cause the shell to exit
9601 with a status of <I>n</I>.  If
9602 <I>n</I>
9603
9604 is omitted, the exit status
9605 is that of the last command executed.
9606 A trap on
9607 <FONT SIZE=-1><B>EXIT</B>
9608
9609 </FONT>
9610 is executed before the shell terminates.
9611 <DT><B>export</B> [<B>-fn</B>] [<I>name</I>[=<I>word</I>]] ...<DD>
9612
9613 <DT><B>export -p</B>
9614
9615 <DD>
9616
9617 The supplied
9618 <I>names</I>
9619
9620 are marked for automatic export to the environment of
9621 subsequently executed commands.  If the 
9622 <B>-f</B>
9623
9624 option is given,
9625 the 
9626 <I>names</I>
9627
9628 refer to functions.
9629 If no
9630 <I>names</I>
9631
9632 are given, or if the
9633 <B>-p</B>
9634
9635 option is supplied, a list
9636 of all names that are exported in this shell is printed.
9637 The
9638 <B>-n</B>
9639
9640 option causes the export property to be removed from each
9641 <I>name</I>.
9642 If a variable name is followed by =<I>word</I>, the value of
9643 the variable is set to <I>word</I>.
9644 <B>export</B>
9645
9646 returns an exit status of 0 unless an invalid option is
9647 encountered,
9648 one of the <I>names</I> is not a valid shell variable name, or
9649 <B>-f</B>
9650
9651 is supplied with a
9652 <I>name</I>
9653
9654 that is not a function.
9655 <DT><B>fc</B> [<B>-e</B> <I>ename</I>] [<B>-lnr</B>] [<I>first</I>] [<I>last</I>]<DD>
9656
9657 <DT><B>fc</B> <B>-s</B> [<I>pat</I>=<I>rep</I>] [<I>cmd</I>]<DD>
9658
9659 Fix Command.  In the first form, a range of commands from
9660 <I>first</I>
9661
9662 to
9663 <I>last</I>
9664
9665 is selected from the history list.
9666 <I>First</I>
9667
9668 and
9669 <I>last</I>
9670
9671 may be specified as a string (to locate the last command beginning
9672 with that string) or as a number (an index into the history list,
9673 where a negative number is used as an offset from the current
9674 command number).  If 
9675 <I>last</I>
9676
9677 is not specified it is set to
9678 the current command for listing (so that
9679
9680 <TT>fc -l -10</TT>
9681 prints the last 10 commands) and to
9682 <I>first</I>
9683
9684 otherwise.
9685 If
9686 <I>first</I>
9687
9688 is not specified it is set to the previous
9689 command for editing and -16 for listing.
9690 <P>
9691 The
9692 <B>-n</B>
9693
9694 option suppresses
9695 the command numbers when listing.  The
9696 <B>-r</B>
9697
9698 option reverses the order of
9699 the commands.  If the
9700 <B>-l</B>
9701
9702 option is given,
9703 the commands are listed on
9704 standard output.  Otherwise, the editor given by
9705 <I>ename</I>
9706
9707 is invoked
9708 on a file containing those commands.  If
9709 <I>ename</I>
9710
9711 is not given, the
9712 value of the
9713 <FONT SIZE=-1><B>FCEDIT</B>
9714
9715 </FONT>
9716 variable is used, and
9717 the value of
9718 <FONT SIZE=-1><B>EDITOR</B>
9719
9720 </FONT>
9721 if
9722 <FONT SIZE=-1><B>FCEDIT</B>
9723
9724 </FONT>
9725 is not set.  If neither variable is set,
9726
9727 <I>vi</I>
9728
9729 is used.  When editing is complete, the edited commands are
9730 echoed and executed.
9731 <P>
9732 In the second form, <I>command</I> is re-executed after each instance
9733 of <I>pat</I> is replaced by <I>rep</I>.
9734 A useful alias to use with this is
9735
9736 <TT>r='fc -s'</TT>,
9737 so that typing
9738
9739 <TT>r cc</TT>
9740 runs the last command beginning with
9741
9742 <TT>cc</TT>
9743 and typing
9744
9745 <TT>r</TT>
9746 re-executes the last command.
9747 <P>
9748 If the first form is used, the return value is 0 unless an invalid
9749 option is encountered or
9750 <I>first</I>
9751
9752 or
9753 <I>last</I>
9754
9755 specify history lines out of range.
9756 If the
9757 <B>-e</B>
9758
9759 option is supplied, the return value is the value of the last
9760 command executed or failure if an error occurs with the temporary
9761 file of commands.  If the second form is used, the return status
9762 is that of the command re-executed, unless
9763 <I>cmd</I>
9764
9765 does not specify a valid history line, in which case
9766 <B>fc</B>
9767
9768 returns failure.
9769 <DT><B>fg</B> [<I>jobspec</I>]<DD>
9770 Resume
9771 <I>jobspec</I>
9772
9773 in the foreground, and make it the current job.
9774 If
9775 <I>jobspec</I>
9776
9777 is not present, the shell's notion of the <I>current job</I> is used.
9778 The return value is that of the command placed into the foreground,
9779 or failure if run when job control is disabled or, when run with
9780 job control enabled, if
9781 <I>jobspec</I>
9782
9783 does not specify a valid job or
9784 <I>jobspec</I>
9785
9786 specifies a job that was started without job control.
9787 <DT><B>getopts</B> <I>optstring</I> <I>name</I> [<I>args</I>]<DD>
9788 <B>getopts</B>
9789
9790 is used by shell procedures to parse positional parameters.
9791 <I>optstring</I>
9792
9793 contains the option characters to be recognized; if a character
9794 is followed by a colon, the option is expected to have an
9795 argument, which should be separated from it by white space.
9796 The colon and question mark characters may not be used as
9797 option characters.
9798 Each time it is invoked,
9799 <B>getopts</B>
9800
9801 places the next option in the shell variable
9802 <I>name</I>,
9803
9804 initializing
9805 <I>name</I>
9806
9807 if it does not exist,
9808 and the index of the next argument to be processed into the
9809 variable
9810 <FONT SIZE=-1><B>OPTIND</B>.
9811
9812 </FONT>
9813 <FONT SIZE=-1><B>OPTIND</B>
9814
9815 </FONT>
9816 is initialized to 1 each time the shell or a shell script
9817 is invoked.  When an option requires an argument,
9818 <B>getopts</B>
9819
9820 places that argument into the variable
9821 <FONT SIZE=-1><B>OPTARG</B>.
9822
9823 </FONT>
9824 The shell does not reset
9825 <FONT SIZE=-1><B>OPTIND</B>
9826
9827 </FONT>
9828 automatically; it must be manually reset between multiple
9829 calls to
9830 <B>getopts</B>
9831
9832 within the same shell invocation if a new set of parameters
9833 is to be used.
9834 <P>
9835 When the end of options is encountered, <B>getopts</B> exits with a
9836 return value greater than zero.
9837 <FONT SIZE=-1><B>OPTIND</B>
9838
9839 </FONT>
9840 is set to the index of the first non-option argument,
9841 and <I>name</I> is set to ?.
9842 <P>
9843 <B>getopts</B>
9844
9845 normally parses the positional parameters, but if more arguments are
9846 given in
9847 <I>args</I>,
9848
9849 <B>getopts</B>
9850
9851 parses those instead.
9852 <P>
9853 <B>getopts</B>
9854
9855 can report errors in two ways.  If the first character of
9856 <I>optstring</I>
9857
9858 is a colon,
9859 <I>silent</I>
9860
9861 error reporting is used.  In normal operation diagnostic messages
9862 are printed when invalid options or missing option arguments are
9863 encountered.
9864 If the variable
9865 <FONT SIZE=-1><B>OPTERR</B>
9866
9867 </FONT>
9868 is set to 0, no error messages will be displayed, even if the first
9869 character of 
9870 <I>optstring</I>
9871
9872 is not a colon.
9873 <P>
9874 If an invalid option is seen,
9875 <B>getopts</B>
9876
9877 places ? into
9878 <I>name</I>
9879
9880 and, if not silent,
9881 prints an error message and unsets
9882 <FONT SIZE=-1><B>OPTARG</B>.
9883
9884 </FONT>
9885 If
9886 <B>getopts</B>
9887
9888 is silent,
9889 the option character found is placed in
9890 <FONT SIZE=-1><B>OPTARG</B>
9891
9892 </FONT>
9893 and no diagnostic message is printed.
9894 <P>
9895 If a required argument is not found, and
9896 <B>getopts</B>
9897
9898 is not silent,
9899 a question mark (<B>?</B>) is placed in
9900 <I>name</I>,
9901
9902 <FONT SIZE=-1><B>OPTARG</B>
9903
9904 </FONT>
9905 is unset, and a diagnostic message is printed.
9906 If
9907 <B>getopts</B>
9908
9909 is silent, then a colon (<B>:</B>) is placed in
9910 <I>name</I>
9911
9912 and
9913 <FONT SIZE=-1><B>OPTARG</B>
9914
9915 </FONT>
9916 is set to the option character found.
9917 <P>
9918 <B>getopts</B>
9919
9920 returns true if an option, specified or unspecified, is found.
9921 It returns false if the end of options is encountered or an
9922 error occurs.
9923 <DT><B>hash</B> [<B>-lr</B>] [<B>-p</B> <I>filename</I>] [<B>-dt</B>] [<I>name</I>]<DD>
9924 Each time <B>hash</B> is invoked,
9925 the full pathname of the command 
9926 <I>name</I>
9927
9928 is determined by searching
9929 the directories in
9930 <B>$PATH</B>
9931
9932 and remembered.  Any previously-remembered pathname is discarded.
9933 If the
9934 <B>-p</B>
9935
9936 option is supplied, no path search is performed, and
9937 <I>filename</I>
9938
9939 is used as the full file name of the command.
9940 The
9941 <B>-r</B>
9942
9943 option causes the shell to forget all
9944 remembered locations.
9945 The
9946 <B>-d</B>
9947
9948 option causes the shell to forget the remembered location of each <I>name</I>.
9949 If the
9950 <B>-t</B>
9951
9952 option is supplied, the full pathname to which each <I>name</I> corresponds
9953 is printed.  If multiple <I>name</I> arguments are supplied with <B>-t</B>,
9954 the <I>name</I> is printed before the hashed full pathname.
9955 The
9956 <B>-l</B>
9957
9958 option causes output to be displayed in a format that may be reused as input.
9959 If no arguments are given, or if only <B>-l</B> is supplied,
9960 information about remembered commands is printed.
9961 The return status is true unless a
9962 <I>name</I>
9963
9964 is not found or an invalid option is supplied.
9965 <DT><B>help</B> [<B>-dms</B>] [<I>pattern</I>]<DD>
9966 Display helpful information about builtin commands.  If
9967 <I>pattern</I>
9968
9969 is specified,
9970 <B>help</B>
9971
9972 gives detailed help on all commands matching
9973 <I>pattern</I>;
9974
9975 otherwise help for all the builtins and shell control structures
9976 is printed.
9977 <DL COMPACT><DT><DD>
9978
9979 <DL COMPACT>
9980 <DT><B>-d</B>
9981
9982 <DD>
9983 Display a short description of each <I>pattern</I>
9984 <DT><B>-m</B>
9985
9986 <DD>
9987 Display the description of each <I>pattern</I> in a manpage-like format
9988 <DT><B>-s</B>
9989
9990 <DD>
9991 Display only a short usage synopsis for each <I>pattern</I>
9992
9993 </DL></DL>
9994
9995 The return status is 0 unless no command matches
9996 <I>pattern</I>.
9997
9998 <DT><B>history [</B><I>n</I>]<DD>
9999
10000 <DT><B>history</B> <B>-c</B><DD>
10001 <DT><B>history -d</B> <I>offset</I><DD>
10002 <DT><B>history</B> <B>-anrw</B> [<I>filename</I>]<DD>
10003 <DT><B>history</B> <B>-p</B> <I>arg</I> [<I>arg ...</I>]<DD>
10004 <DT><B>history</B> <B>-s</B> <I>arg</I> [<I>arg ...</I>]<DD>
10005
10006 With no options, display the command
10007 history list with line numbers.  Lines listed
10008 with a 
10009 <B>*</B>
10010
10011 have been modified.  An argument of
10012 <I>n</I>
10013
10014 lists only the last
10015 <I>n</I>
10016
10017 lines.
10018 If the shell variable
10019 <FONT SIZE=-1><B>HISTTIMEFORMAT</B>
10020
10021 </FONT>
10022 is set and not null,
10023 it is used as a format string for <I>strftime</I>(3) to display
10024 the time stamp associated with each displayed history entry.
10025 No intervening blank is printed between the formatted time stamp
10026 and the history line.
10027 If <I>filename</I> is supplied, it is used as the
10028 name of the history file; if not, the value of
10029 <FONT SIZE=-1><B>HISTFILE</B>
10030
10031 </FONT>
10032 is used.  Options, if supplied, have the following meanings:
10033 <DL COMPACT><DT><DD>
10034
10035 <DL COMPACT>
10036 <DT><B>-c</B>
10037
10038 <DD>
10039 Clear the history list by deleting all the entries.
10040 <DT><B>-d</B> <I>offset</I><DD>
10041 Delete the history entry at position <I>offset</I>.
10042 <DT><B>-a</B>
10043
10044 <DD>
10045 Append the ``new'' history lines (history lines entered since the
10046 beginning of the current <B>bash</B> session) to the history file.
10047 <DT><B>-n</B>
10048
10049 <DD>
10050 Read the history lines not already read from the history
10051 file into the current history list.  These are lines
10052 appended to the history file since the beginning of the
10053 current <B>bash</B> session.
10054 <DT><B>-r</B>
10055
10056 <DD>
10057 Read the contents of the history file
10058 and use them as the current history.
10059 <DT><B>-w</B>
10060
10061 <DD>
10062 Write the current history to the history file, overwriting the
10063 history file's contents.
10064 <DT><B>-p</B>
10065
10066 <DD>
10067 Perform history substitution on the following <I>args</I> and display
10068 the result on the standard output.
10069 Does not store the results in the history list.
10070 Each <I>arg</I> must be quoted to disable normal history expansion.
10071 <DT><B>-s</B>
10072
10073 <DD>
10074 Store the
10075 <I>args</I>
10076
10077 in the history list as a single entry.  The last command in the
10078 history list is removed before the
10079 <I>args</I>
10080
10081 are added.
10082
10083 </DL>
10084 <P>
10085
10086 If the
10087 <FONT SIZE=-1><B>HISTTIMEFORMAT</B>
10088
10089 </FONT>
10090 variable is set, the time stamp information
10091 associated with each history entry is written to the history file,
10092 marked with the history comment character.
10093 When the history file is read, lines beginning with the history
10094 comment character followed immediately by a digit are interpreted
10095 as timestamps for the previous history line.
10096 The return value is 0 unless an invalid option is encountered, an
10097 error occurs while reading or writing the history file, an invalid
10098 <I>offset</I> is supplied as an argument to <B>-d</B>, or the
10099 history expansion supplied as an argument to <B>-p</B> fails.
10100 </DL>
10101
10102 <DT><B>jobs</B> [<B>-lnprs</B>] [ <I>jobspec</I> ... ]<DD>
10103
10104 <DT><B>jobs</B> <B>-x</B> <I>command</I> [ <I>args</I> ... ]<DD>
10105
10106 The first form lists the active jobs.  The options have the following
10107 meanings:
10108 <DL COMPACT><DT><DD>
10109
10110 <DL COMPACT>
10111 <DT><B>-l</B>
10112
10113 <DD>
10114 List process IDs
10115 in addition to the normal information.
10116 <DT><B>-n</B>
10117
10118 <DD>
10119 Display information only about jobs that have changed status since
10120 the user was last notified of their status.
10121 <DT><B>-p</B>
10122
10123 <DD>
10124 List only the process ID of the job's process group
10125 leader.
10126 <DT><B>-r</B>
10127
10128 <DD>
10129 Restrict output to running jobs.
10130 <DT><B>-s</B>
10131
10132 <DD>
10133 Restrict output to stopped jobs.
10134
10135 </DL>
10136 <P>
10137
10138 If
10139 <I>jobspec</I>
10140
10141 is given, output is restricted to information about that job.
10142 The return status is 0 unless an invalid option is encountered
10143 or an invalid
10144 <I>jobspec</I>
10145
10146 is supplied.
10147 <P>
10148
10149 If the
10150 <B>-x</B>
10151
10152 option is supplied,
10153 <B>jobs</B>
10154
10155 replaces any
10156 <I>jobspec</I>
10157
10158 found in
10159 <I>command</I>
10160
10161 or
10162 <I>args</I>
10163
10164 with the corresponding process group ID, and executes
10165 <I>command</I>
10166
10167 passing it
10168 <I>args</I>,
10169
10170 returning its exit status.
10171 </DL>
10172
10173 <DT><B>kill</B> [<B>-s</B> <I>sigspec</I> | <B>-n</B> <I>signum</I> | <B>-</B><I>sigspec</I>] [<I>pid</I> | <I>jobspec</I>] ...<DD>
10174
10175 <DT><B>kill</B> <B>-l</B> [<I>sigspec</I> | <I>exit_status</I>]<DD>
10176
10177 Send the signal named by
10178 <I>sigspec</I>
10179
10180 or
10181 <I>signum</I>
10182
10183 to the processes named by
10184 <I>pid</I>
10185
10186 or
10187 <I>jobspec</I>.
10188
10189 <I>sigspec</I>
10190
10191 is either a case-insensitive signal name such as
10192 <FONT SIZE=-1><B>SIGKILL</B>
10193
10194 </FONT>
10195 (with or without the
10196 <FONT SIZE=-1><B>SIG</B>
10197
10198 </FONT>
10199 prefix) or a signal number;
10200 <I>signum</I>
10201
10202 is a signal number.
10203 If
10204 <I>sigspec</I>
10205
10206 is not present, then
10207 <FONT SIZE=-1><B>SIGTERM</B>
10208
10209 </FONT>
10210 is assumed.
10211 An argument of
10212 <B>-l</B>
10213
10214 lists the signal names.
10215 If any arguments are supplied when
10216 <B>-l</B>
10217
10218 is given, the names of the signals corresponding to the arguments are
10219 listed, and the return status is 0.
10220 The <I>exit_status</I> argument to
10221 <B>-l</B>
10222
10223 is a number specifying either a signal number or the exit status of
10224 a process terminated by a signal.
10225 <B>kill</B>
10226
10227 returns true if at least one signal was successfully sent, or false
10228 if an error occurs or an invalid option is encountered.
10229 <DT><B>let</B> <I>arg</I> [<I>arg</I> ...]<DD>
10230 Each
10231 <I>arg</I>
10232
10233 is an arithmetic expression to be evaluated (see
10234 <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>
10235
10236 </FONT>
10237 above).
10238 If the last
10239 <I>arg</I>
10240
10241 evaluates to 0,
10242 <B>let</B>
10243
10244 returns 1; 0 is returned otherwise.
10245 <DT><B>local</B> [<I>option</I>] [<I>name</I>[=<I>value</I>] ...]<DD>
10246 For each argument, a local variable named
10247 <I>name </I>
10248
10249 is created, and assigned
10250 <I>value</I>.
10251
10252 The <I>option</I> can be any of the options accepted by <B>declare</B>.
10253 When
10254 <B>local</B>
10255
10256 is used within a function, it causes the variable
10257 <I>name</I>
10258
10259 to have a visible scope restricted to that function and its children.
10260 With no operands,
10261 <B>local</B>
10262
10263 writes a list of local variables to the standard output.  It is
10264 an error to use
10265 <B>local</B>
10266
10267 when not within a function.  The return status is 0 unless
10268 <B>local</B>
10269
10270 is used outside a function, an invalid
10271 <I>name</I>
10272
10273 is supplied, or
10274 <I>name</I> is a readonly variable.
10275 <DT><B>logout</B>
10276
10277 <DD>
10278 Exit a login shell.
10279 <DT><B>mapfile</B> [<B>-n</B> <I>count</I>] [<B>-O</B> <I>origin</I>] [<B>-s</B> <I>count</I>] [<B>-t</B>] [<B>-u</B> <I>fd</I>] [<B>-C</B> <I>callback</I>] [<B>-c</B> <I>quantum</I>] [<I>array</I>]<DD>
10280
10281 <DT><B>readarray</B> [<B>-n</B> <I>count</I>] [<B>-O</B> <I>origin</I>] [<B>-s</B> <I>count</I>] [<B>-t</B>] [<B>-u</B> <I>fd</I>] [<B>-C</B> <I>callback</I>] [<B>-c</B> <I>quantum</I>] [<I>array</I>]<DD>
10282
10283 Read lines from the standard input into the indexed array variable
10284 <I>array</I>,
10285
10286 or from file descriptor 
10287 <I>fd</I>
10288
10289 if the 
10290 <B>-u</B>
10291
10292 option is supplied.
10293 The variable
10294 <FONT SIZE=-1><B>MAPFILE</B>
10295
10296 </FONT>
10297 is the default <I>array</I>.
10298 Options, if supplied, have the following meanings:
10299 <DL COMPACT><DT><DD>
10300
10301 <DL COMPACT>
10302 <DT><B>-n</B>
10303
10304 <DD>
10305 Copy at most
10306 <I>count</I>
10307
10308 lines.  If <I>count</I> is 0, all lines are copied.
10309 <DT><B>-O</B>
10310
10311 <DD>
10312 Begin assigning to
10313 <I>array</I>
10314
10315 at index
10316 <I>origin</I>.
10317
10318 The default index is 0.
10319 <DT><B>-s</B>
10320
10321 <DD>
10322 Discard the first <I>count</I> lines read.
10323 <DT><B>-t</B>
10324
10325 <DD>
10326 Remove a trailing newline from each line read.
10327 <DT><B>-u</B>
10328
10329 <DD>
10330 Read lines from file descriptor <I>fd</I> instead of the standard input.
10331 <DT><B>-C</B>
10332
10333 <DD>
10334 Evaluate
10335 <I>callback</I>
10336
10337 each time <I>quantum</I> lines are read.  The <B>-c</B> option specifies
10338 <I>quantum</I>.
10339
10340 <DT><B>-c</B>
10341
10342 <DD>
10343 Specify the number of lines read between each call to
10344 <I>callback</I>.
10345
10346
10347 </DL>
10348 <P>
10349
10350 If
10351 <B>-C</B>
10352
10353 is specified without 
10354 <B>-c</B>,
10355
10356 the default quantum is 5000.
10357 When <I>callback</I> is evaluated, it is supplied the index of the next
10358 array element to be assigned and the line to be assigned to that element
10359 as additional arguments.
10360 <I>callback</I> is evaluated after the line is read but before the 
10361 array element is assigned.
10362 <P>
10363
10364 If not supplied with an explicit origin, <B>mapfile</B> will clear <I>array</I>
10365 before assigning to it.
10366 <P>
10367
10368 <B>mapfile</B> returns successfully unless an invalid option or option
10369 argument is supplied, <I>array</I> is invalid or unassignable, or if
10370 <I>array</I> is not an indexed array.
10371 </DL>
10372
10373 <DT><B>popd</B> [-<B>n</B>] [+<I>n</I>] [-<I>n</I>]<DD>
10374 Removes entries from the directory stack.  With no arguments,
10375 removes the top directory from the stack, and performs a
10376 <B>cd</B>
10377
10378 to the new top directory.
10379 Arguments, if supplied, have the following meanings:
10380 <DL COMPACT><DT><DD>
10381
10382 <DL COMPACT>
10383 <DT><B>-n</B>
10384
10385 <DD>
10386 Suppresses the normal change of directory when removing directories
10387 from the stack, so that only the stack is manipulated.
10388 <DT><B>+</B><I>n</I><DD>
10389 Removes the <I>n</I>th entry counting from the left of the list
10390 shown by
10391 <B>dirs</B>,
10392
10393 starting with zero.  For example:
10394
10395 <TT>popd +0</TT>
10396 removes the first directory,
10397
10398 <TT>popd +1</TT>
10399 the second.
10400 <DT><B>-</B><I>n</I><DD>
10401 Removes the <I>n</I>th entry counting from the right of the list
10402 shown by
10403 <B>dirs</B>,
10404
10405 starting with zero.  For example:
10406
10407 <TT>popd -0</TT>
10408 removes the last directory,
10409
10410 <TT>popd -1</TT>
10411 the next to last.
10412
10413 </DL>
10414 <P>
10415
10416 If the
10417 <B>popd</B>
10418
10419 command is successful, a 
10420 <B>dirs</B>
10421
10422 is performed as well, and the return status is 0.
10423 <B>popd</B>
10424
10425 returns false if an invalid option is encountered, the directory stack
10426 is empty, a non-existent directory stack entry is specified, or the
10427 directory change fails.
10428 </DL>
10429
10430 <DT><B>printf</B> [<B>-v</B> <I>var</I>] <I>format</I> [<I>arguments</I>]<DD>
10431 Write the formatted <I>arguments</I> to the standard output under the
10432 control of the <I>format</I>.
10433 The <B>-v</B> option causes the output to be assigned to the variable
10434 <I>var</I> rather than being printed to the standard output.
10435 <P>
10436 The <I>format</I> is a character string which contains three types of objects:
10437 plain characters, which are simply copied to standard output, character
10438 escape sequences, which are converted and copied to the standard output, and
10439 format specifications, each of which causes printing of the next successive
10440 <I>argument</I>.
10441 In addition to the standard <I>printf</I>(1) format specifications,
10442 <B>printf</B> interprets the following extensions:
10443 <DL COMPACT><DT><DD>
10444
10445 <DL COMPACT>
10446 <DT><B>%b</B>
10447
10448 <DD>
10449 causes
10450 <B>printf</B> to expand backslash escape sequences in the corresponding
10451 <I>argument</I> (except that <B>\c</B> terminates output, backslashes in
10452 <B>\aq</B>, <B>\&quot;</B>, and <B>\?</B> are not removed, and octal escapes
10453 beginning with <B>\0</B> may contain up to four digits).
10454 <DT><B>%q</B>
10455
10456 <DD>
10457 causes <B>printf</B> to output the corresponding
10458 <I>argument</I> in a format that can be reused as shell input.
10459 <DT><B>%(</B><I>datefmt</I>)T
10460
10461 <DD>
10462 causes <B>printf</B> to output the date-time string resulting from using
10463 <I>datefmt</I> as a format string for <I>strftime</I>(3).  The corresponding
10464 <I>argument</I> is an integer representing the number of seconds since the
10465 epoch.  Two special argument values may be used: -1 represents the current
10466 time, and -2 represents the time the shell was invoked.
10467
10468 </DL>
10469 <P>
10470
10471 Arguments to non-string format specifiers are treated as C constants,
10472 except that a leading plus or minus sign is allowed, and if the leading
10473 character is a single or double quote, the value is the ASCII value of
10474 the following character.
10475 <P>
10476
10477 The <I>format</I> is reused as necessary to consume all of the <I>arguments</I>.
10478 If the <I>format</I> requires more <I>arguments</I> than are supplied, the
10479 extra format specifications behave as if a zero value or null string, as
10480 appropriate, had been supplied.
10481 The return value is zero on success, non-zero on failure.
10482 </DL>
10483
10484 <DT><B>pushd</B> [<B>-n</B>] [+<I>n</I>] [-<I>n</I>]<DD>
10485
10486 <DT><B>pushd</B> [<B>-n</B>] [<I>dir</I>]<DD>
10487
10488 Adds a directory to the top of the directory stack, or rotates
10489 the stack, making the new top of the stack the current working
10490 directory.  With no arguments, exchanges the top two directories
10491 and returns 0, unless the directory stack is empty.
10492 Arguments, if supplied, have the following meanings:
10493 <DL COMPACT><DT><DD>
10494
10495 <DL COMPACT>
10496 <DT><B>-n</B>
10497
10498 <DD>
10499 Suppresses the normal change of directory when adding directories
10500 to the stack, so that only the stack is manipulated.
10501 <DT><B>+</B><I>n</I><DD>
10502 Rotates the stack so that the <I>n</I>th directory
10503 (counting from the left of the list shown by
10504 <B>dirs</B>,
10505
10506 starting with zero)
10507 is at the top.
10508 <DT><B>-</B><I>n</I><DD>
10509 Rotates the stack so that the <I>n</I>th directory
10510 (counting from the right of the list shown by
10511 <B>dirs</B>,
10512
10513 starting with zero) is at the top.
10514 <DT><I>dir</I>
10515
10516 <DD>
10517 Adds
10518 <I>dir</I>
10519
10520 to the directory stack at the top, making it the
10521 new current working directory.
10522
10523 </DL>
10524 <P>
10525
10526 If the
10527 <B>pushd</B>
10528
10529 command is successful, a 
10530 <B>dirs</B>
10531
10532 is performed as well.
10533 If the first form is used,
10534 <B>pushd</B>
10535
10536 returns 0 unless the cd to
10537 <I>dir</I>
10538
10539 fails.  With the second form,
10540 <B>pushd</B>
10541
10542 returns 0 unless the directory stack is empty,
10543 a non-existent directory stack element is specified,
10544 or the directory change to the specified new current directory
10545 fails.
10546 </DL>
10547
10548 <DT><B>pwd</B> [<B>-LP</B>]<DD>
10549 Print the absolute pathname of the current working directory.
10550 The pathname printed contains no symbolic links if the
10551 <B>-P</B>
10552
10553 option is supplied or the 
10554 <B>-o physical</B>
10555
10556 option to the
10557 <B>set</B>
10558
10559 builtin command is enabled.
10560 If the
10561 <B>-L</B>
10562
10563 option is used, the pathname printed may contain symbolic links.
10564 The return status is 0 unless an error occurs while
10565 reading the name of the current directory or an
10566 invalid option is supplied.
10567 <DT><B>read</B> [<B>-ers</B>] [<B>-a</B> <I>aname</I>] [<B>-d</B> <I>delim</I>] [<B>-i</B> <I>text</I>] [<B>-n</B> <I>nchars</I>] [<B>-N</B> <I>nchars</I>] [<B>-p</B> <I>prompt</I>] [<B>-t</B> <I>timeout</I>] [<B>-u</B> <I>fd</I>] [<I>name</I> ...]<DD>
10568 One line is read from the standard input, or from the file descriptor
10569 <I>fd</I> supplied as an argument to the <B>-u</B> option, and the first word
10570 is assigned to the first
10571 <I>name</I>,
10572
10573 the second word to the second
10574 <I>name</I>,
10575
10576 and so on, with leftover words and their intervening separators assigned
10577 to the last
10578 <I>name</I>.
10579
10580 If there are fewer words read from the input stream than names,
10581 the remaining names are assigned empty values.
10582 The characters in 
10583 <FONT SIZE=-1><B>IFS</B>
10584
10585 </FONT>
10586 are used to split the line into words.
10587 The backslash character (<B>\</B>) may be used to remove any special
10588 meaning for the next character read and for line continuation.
10589 Options, if supplied, have the following meanings:
10590 <DL COMPACT><DT><DD>
10591
10592 <DL COMPACT>
10593 <DT><B>-a </B><I>aname</I>
10594
10595 <DD>
10596 The words are assigned to sequential indices
10597 of the array variable
10598 <I>aname</I>,
10599
10600 starting at 0.
10601 <I>aname</I>
10602
10603 is unset before any new values are assigned.
10604 Other <I>name</I> arguments are ignored.
10605 <DT><B>-d </B><I>delim</I>
10606
10607 <DD>
10608 The first character of <I>delim</I> is used to terminate the input line,
10609 rather than newline.
10610 <DT><B>-e</B>
10611
10612 <DD>
10613 If the standard input
10614 is coming from a terminal,
10615 <B>readline</B>
10616
10617 (see
10618 <FONT SIZE=-1><B>READLINE</B>
10619
10620 </FONT>
10621 above) is used to obtain the line.
10622 Readline uses the current (or default, if line editing was not previously
10623 active) editing settings.
10624 <DT><B>-i </B><I>text</I>
10625
10626 <DD>
10627 If
10628 <B>readline</B>
10629
10630 is being used to read the line, <I>text</I> is placed into the editing
10631 buffer before editing begins.
10632 <DT><B>-n </B><I>nchars</I>
10633
10634 <DD>
10635 <B>read</B> returns after reading <I>nchars</I> characters rather than
10636 waiting for a complete line of input, but honor a delimiter if fewer
10637 than <I>nchars</I> characters are read before the delimiter.
10638 <DT><B>-N </B><I>nchars</I>
10639
10640 <DD>
10641 <B>read</B> returns after reading exactly <I>nchars</I> characters rather
10642 than waiting for a complete line of input, unless EOF is encountered or
10643 <B>read</B> times out.
10644 Delimiter characters encountered in the input are
10645 not treated specially and do not cause <B>read</B> to return until
10646 <I>nchars</I> characters are read.
10647 <DT><B>-p </B><I>prompt</I>
10648
10649 <DD>
10650 Display <I>prompt</I> on standard error, without a
10651 trailing newline, before attempting to read any input.  The prompt
10652 is displayed only if input is coming from a terminal.
10653 <DT><B>-r</B>
10654
10655 <DD>
10656 Backslash does not act as an escape character.
10657 The backslash is considered to be part of the line.
10658 In particular, a backslash-newline pair may not be used as a line
10659 continuation.
10660 <DT><B>-s</B>
10661
10662 <DD>
10663 Silent mode.  If input is coming from a terminal, characters are
10664 not echoed.
10665 <DT><B>-t </B><I>timeout</I>
10666
10667 <DD>
10668 Cause <B>read</B> to time out and return failure if a complete line of
10669 input is not read within <I>timeout</I> seconds.
10670 <I>timeout</I> may be a decimal number with a fractional portion following
10671 the decimal point.
10672 This option is only effective if <B>read</B> is reading input from a
10673 terminal, pipe, or other special file; it has no effect when reading
10674 from regular files.
10675 If <I>timeout</I> is 0, <B>read</B> returns success if input is available on
10676 the specified file descriptor, failure otherwise.
10677 The exit status is greater than 128 if the timeout is exceeded.
10678 <DT><B>-u </B><I>fd</I>
10679
10680 <DD>
10681 Read input from file descriptor <I>fd</I>.
10682
10683 </DL>
10684 <P>
10685
10686 If no
10687 <I>names</I>
10688
10689 are supplied, the line read is assigned to the variable
10690 <FONT SIZE=-1><B>REPLY</B>.
10691
10692 </FONT>
10693 The return code is zero, unless end-of-file is encountered, <B>read</B>
10694 times out (in which case the return code is greater than 128), or an
10695 invalid file descriptor is supplied as the argument to <B>-u</B>.
10696 </DL>
10697
10698 <DT><B>readonly</B> [<B>-aApf</B>] [<I>name</I>[=<I>word</I>] ...]<DD>
10699
10700 The given
10701 <I>names</I> are marked readonly; the values of these
10702 <I>names</I>
10703
10704 may not be changed by subsequent assignment.
10705 If the
10706 <B>-f</B>
10707
10708 option is supplied, the functions corresponding to the
10709 <I>names</I> are so
10710 marked.
10711 The
10712 <B>-a</B>
10713
10714 option restricts the variables to indexed arrays; the
10715 <B>-A</B>
10716
10717 option restricts the variables to associative arrays.
10718 If no
10719 <I>name</I>
10720
10721 arguments are given, or if the
10722 <B>-p</B>
10723
10724 option is supplied, a list of all readonly names is printed.
10725 The
10726 <B>-p</B>
10727
10728 option causes output to be displayed in a format that
10729 may be reused as input.
10730 If a variable name is followed by =<I>word</I>, the value of
10731 the variable is set to <I>word</I>.
10732 The return status is 0 unless an invalid option is encountered,
10733 one of the
10734 <I>names</I>
10735
10736 is not a valid shell variable name, or
10737 <B>-f</B>
10738
10739 is supplied with a
10740 <I>name</I>
10741
10742 that is not a function.
10743 <DT><B>return</B> [<I>n</I>]<DD>
10744 Causes a function to exit with the return value specified by
10745 <I>n</I>.
10746
10747 If 
10748 <I>n</I>
10749
10750 is omitted, the return status is that of the last command
10751 executed in the function body.  If used outside a function,
10752 but during execution of a script by the 
10753 <B>.</B>
10754
10755 (<B>source</B>) command, it causes the shell to stop executing
10756 that script and return either
10757 <I>n</I>
10758
10759 or the exit status of the last command executed within the
10760 script as the exit status of the script.  If used outside a
10761 function and not during execution of a script by <B>.</B>,
10762 the return status is false.
10763 Any command associated with the <B>RETURN</B> trap is executed
10764 before execution resumes after the function or script.
10765 <DT><B>set</B> [<B>--abefhkmnptuvxBCEHPT</B>] [<B>-o</B> <I>option-name</I>] [<I>arg</I> ...]<DD>
10766
10767 <DT><B>set</B> [<B>+abefhkmnptuvxBCEHPT</B>] [<B>+o</B> <I>option-name</I>] [<I>arg</I> ...]<DD>
10768
10769 Without options, the name and value of each shell variable are displayed
10770 in a format that can be reused as input
10771 for setting or resetting the currently-set variables.
10772 Read-only variables cannot be reset.
10773 In <I>posix mode</I>, only shell variables are listed.
10774 The output is sorted according to the current locale.
10775 When options are specified, they set or unset shell attributes.
10776 Any arguments remaining after option processing are treated
10777 as values for the positional parameters and are assigned, in order, to 
10778 <B>$1</B>,
10779
10780 <B>$2</B>,
10781
10782 <B>...</B>
10783
10784 <B>$</B><I>n</I>.
10785
10786 Options, if specified, have the following meanings:
10787 <DL COMPACT><DT><DD>
10788
10789 <DL COMPACT>
10790 <DT><B>-a</B>
10791
10792 <DD>
10793 Automatically mark variables and functions which are modified or
10794 created for export to the environment of subsequent commands.
10795 <DT><B>-b</B>
10796
10797 <DD>
10798 Report the status of terminated background jobs
10799 immediately, rather than before the next primary prompt.  This is
10800 effective only when job control is enabled.
10801 <DT><B>-e</B>
10802
10803 <DD>
10804 Exit immediately if a <I>pipeline</I> (which may consist of a single
10805 <I>simple command</I>),  a <I>subshell</I> command enclosed in parentheses,
10806 or one of the commands executed as part of a command list enclosed
10807 by braces (see
10808 <FONT SIZE=-1><B>SHELL GRAMMAR</B>
10809
10810 </FONT>
10811 above) exits with a non-zero status.
10812 The shell does not exit if the
10813 command that fails is part of the command list immediately following a
10814 <B>while</B>
10815
10816 or
10817 <B>until</B>
10818
10819 keyword, 
10820 part of the test following the
10821 <B>if</B>
10822
10823 or
10824 <B>elif</B>
10825
10826 reserved words, part of any command executed in a
10827 <B>&amp;&amp;</B>
10828
10829 or
10830 <B>||</B>
10831
10832 list except the command following the final <B>&amp;&amp;</B> or <B>||</B>,
10833 any command in a pipeline but the last,
10834 or if the command's return value is
10835 being inverted with
10836 <B>!</B>.
10837
10838 A trap on <B>ERR</B>, if set, is executed before the shell exits.
10839 This option applies to the shell environment and each subshell environment
10840 separately (see
10841 <FONT SIZE=-1><B>COMMAND EXECUTION ENVIRONMENT</B>
10842
10843 </FONT>
10844 above), and may cause
10845 subshells to exit before executing all the commands in the subshell.
10846 <DT><B>-f</B>
10847
10848 <DD>
10849 Disable pathname expansion.
10850 <DT><B>-h</B>
10851
10852 <DD>
10853 Remember the location of commands as they are looked up for execution.
10854 This is enabled by default.
10855 <DT><B>-k</B>
10856
10857 <DD>
10858 All arguments in the form of assignment statements
10859 are placed in the environment for a command, not just
10860 those that precede the command name.
10861 <DT><B>-m</B>
10862
10863 <DD>
10864 Monitor mode.  Job control is enabled.  This option is on
10865 by default for interactive shells on systems that support
10866 it (see
10867 <FONT SIZE=-1><B>JOB CONTROL</B>
10868
10869 </FONT>
10870 above).  Background processes run in a separate process
10871 group and a line containing their exit status is printed
10872 upon their completion.
10873 <DT><B>-n</B>
10874
10875 <DD>
10876 Read commands but do not execute them.  This may be used to 
10877 check a shell script for syntax errors.  This is ignored by
10878 interactive shells.
10879 <DT><B>-o </B><I>option-name</I>
10880
10881 <DD>
10882 The <I>option-name</I> can be one of the following:
10883 <DL COMPACT><DT><DD>
10884 <DL COMPACT>
10885 <DT><B>allexport</B>
10886
10887 <DD>
10888 Same as
10889 <B>-a</B>.
10890
10891 <DT><B>braceexpand</B>
10892
10893 <DD>
10894 Same as
10895 <B>-B</B>.
10896
10897 <DT><B>emacs</B>
10898
10899 <DD>
10900 Use an emacs-style command line editing interface.  This is enabled
10901 by default when the shell is interactive, unless the shell is started
10902 with the
10903 <B>--noediting</B>
10904
10905 option.
10906 This also affects the editing interface used for <B>read -e</B>.
10907 <DT><B>errexit</B>
10908
10909 <DD>
10910 Same as
10911 <B>-e</B>.
10912
10913 <DT><B>errtrace</B>
10914
10915 <DD>
10916 Same as
10917 <B>-E</B>.
10918
10919 <DT><B>functrace</B>
10920
10921 <DD>
10922 Same as
10923 <B>-T</B>.
10924
10925 <DT><B>hashall</B>
10926
10927 <DD>
10928 Same as
10929 <B>-h</B>.
10930
10931 <DT><B>histexpand</B>
10932
10933 <DD>
10934 Same as
10935 <B>-H</B>.
10936
10937 <DT><B>history</B>
10938
10939 <DD>
10940 Enable command history, as described above under
10941 <FONT SIZE=-1><B>HISTORY</B>.
10942
10943 </FONT>
10944 This option is on by default in interactive shells.
10945 <DT><B>ignoreeof</B>
10946
10947 <DD>
10948 The effect is as if the shell command
10949 <TT>IGNOREEOF=10</TT>
10950
10951 had been executed
10952 (see
10953 <B>Shell Variables</B>
10954
10955 above).
10956 <DT><B>keyword</B>
10957
10958 <DD>
10959 Same as
10960 <B>-k</B>.
10961
10962 <DT><B>monitor</B>
10963
10964 <DD>
10965 Same as
10966 <B>-m</B>.
10967
10968 <DT><B>noclobber</B>
10969
10970 <DD>
10971 Same as
10972 <B>-C</B>.
10973
10974 <DT><B>noexec</B>
10975
10976 <DD>
10977 Same as
10978 <B>-n</B>.
10979
10980 <DT><B>noglob</B>
10981
10982 <DD>
10983 Same as
10984 <B>-f</B>.
10985
10986 <DT><B>nolog</B>
10987
10988 <DD>
10989 Currently ignored.
10990 <DT><B>notify</B>
10991
10992 <DD>
10993 Same as
10994 <B>-b</B>.
10995
10996 <DT><B>nounset</B>
10997
10998 <DD>
10999 Same as
11000 <B>-u</B>.
11001
11002 <DT><B>onecmd</B>
11003
11004 <DD>
11005 Same as
11006 <B>-t</B>.
11007
11008 <DT><B>physical</B>
11009
11010 <DD>
11011 Same as
11012 <B>-P</B>.
11013
11014 <DT><B>pipefail</B>
11015
11016 <DD>
11017 If set, the return value of a pipeline is the value of the last
11018 (rightmost) command to exit with a non-zero status, or zero if all
11019 commands in the pipeline exit successfully.
11020 This option is disabled by default.
11021 <DT><B>posix</B>
11022
11023 <DD>
11024 Change the behavior of
11025 <B>bash</B>
11026
11027 where the default operation differs
11028 from the POSIX standard to match the standard (<I>posix mode</I>).
11029 <DT><B>privileged</B>
11030
11031 <DD>
11032 Same as
11033 <B>-p</B>.
11034
11035 <DT><B>verbose</B>
11036
11037 <DD>
11038 Same as
11039 <B>-v</B>.
11040
11041 <DT><B>vi</B>
11042
11043 <DD>
11044 Use a vi-style command line editing interface.
11045 This also affects the editing interface used for <B>read -e</B>.
11046 <DT><B>xtrace</B>
11047
11048 <DD>
11049 Same as
11050 <B>-x</B>.
11051
11052 <P>
11053 </DL>
11054 <P>
11055
11056 If
11057 <B>-o</B>
11058
11059 is supplied with no <I>option-name</I>, the values of the current options are
11060 printed.
11061 If
11062 <B>+o</B>
11063
11064 is supplied with no <I>option-name</I>, a series of
11065 <B>set</B>
11066
11067 commands to recreate the current option settings is displayed on
11068 the standard output.
11069 </DL>
11070
11071 <DT><B>-p</B>
11072
11073 <DD>
11074 Turn on
11075 <I>privileged</I>
11076
11077 mode.  In this mode, the
11078 <FONT SIZE=-1><B>$ENV</B>
11079
11080 </FONT>
11081 and
11082 <FONT SIZE=-1><B>$BASH_ENV</B>
11083
11084 </FONT>
11085 files are not processed, shell functions are not inherited from the
11086 environment, and the
11087 <FONT SIZE=-1><B>SHELLOPTS</B>,
11088
11089 </FONT>
11090 <FONT SIZE=-1><B>BASHOPTS</B>,
11091
11092 </FONT>
11093 <FONT SIZE=-1><B>CDPATH</B>,
11094
11095 </FONT>
11096 and
11097 <FONT SIZE=-1><B>GLOBIGNORE</B>
11098
11099 </FONT>
11100 variables, if they appear in the environment, are ignored.
11101 If the shell is started with the effective user (group) id not equal to the
11102 real user (group) id, and the <B>-p</B> option is not supplied, these actions
11103 are taken and the effective user id is set to the real user id.
11104 If the <B>-p</B> option is supplied at startup, the effective user id is
11105 not reset.
11106 Turning this option off causes the effective user
11107 and group ids to be set to the real user and group ids.
11108 <DT><B>-t</B>
11109
11110 <DD>
11111 Exit after reading and executing one command.
11112 <DT><B>-u</B>
11113
11114 <DD>
11115 Treat unset variables and parameters other than the special
11116 parameters &quot;@&quot; and &quot;*&quot; as an error when performing
11117 parameter expansion.  If expansion is attempted on an
11118 unset variable or parameter, the shell prints an error message, and,
11119 if not interactive, exits with a non-zero status.
11120 <DT><B>-v</B>
11121
11122 <DD>
11123 Print shell input lines as they are read.
11124 <DT><B>-x</B>
11125
11126 <DD>
11127 After expanding each <I>simple command</I>,
11128 <B>for</B> command, <B>case</B> command, <B>select</B> command, or
11129 arithmetic <B>for</B> command, display the expanded value of
11130 <FONT SIZE=-1><B>PS4</B>,
11131
11132 </FONT>
11133 followed by the command and its expanded arguments
11134 or associated word list.
11135 <DT><B>-B</B>
11136
11137 <DD>
11138 The shell performs brace expansion (see
11139 <B>Brace Expansion</B>
11140
11141 above).  This is on by default.
11142 <DT><B>-C</B>
11143
11144 <DD>
11145 If set,
11146 <B>bash</B>
11147
11148 does not overwrite an existing file with the
11149 <B>&gt;</B>,
11150
11151 <B>&gt;&amp;</B>,
11152
11153 and
11154 <B>&lt;&gt;</B>
11155
11156 redirection operators.  This may be overridden when 
11157 creating output files by using the redirection operator
11158 <B>&gt;|</B>
11159
11160 instead of
11161 <B>&gt;</B>.
11162
11163 <DT><B>-E</B>
11164
11165 <DD>
11166 If set, any trap on <B>ERR</B> is inherited by shell functions, command
11167 substitutions, and commands executed in a subshell environment.
11168 The <B>ERR</B> trap is normally not inherited in such cases.
11169 <DT><B>-H</B>
11170
11171 <DD>
11172 Enable
11173 <B>!</B>
11174
11175 style history substitution.  This option is on by
11176 default when the shell is interactive.
11177 <DT><B>-P</B>
11178
11179 <DD>
11180 If set, the shell does not follow symbolic links when executing
11181 commands such as
11182 <B>cd</B>
11183
11184 that change the current working directory.  It uses the
11185 physical directory structure instead.  By default,
11186 <B>bash</B>
11187
11188 follows the logical chain of directories when performing commands
11189 which change the current directory.
11190 <DT><B>-T</B>
11191
11192 <DD>
11193 If set, any traps on <B>DEBUG</B> and <B>RETURN</B> are inherited by shell
11194 functions, command substitutions, and commands executed in a
11195 subshell environment.
11196 The <B>DEBUG</B> and <B>RETURN</B> traps are normally not inherited
11197 in such cases.
11198 <DT><B>--</B>
11199
11200 <DD>
11201 If no arguments follow this option, then the positional parameters are
11202 unset.  Otherwise, the positional parameters are set to the
11203 <I>arg</I>s, even if some of them begin with a
11204 <B>-</B>.
11205
11206 <DT><B>-</B>
11207
11208 <DD>
11209 Signal the end of options, cause all remaining <I>arg</I>s to be
11210 assigned to the positional parameters.  The
11211 <B>-x</B>
11212
11213 and
11214 <B>-v</B>
11215
11216 options are turned off.
11217 If there are no <I>arg</I>s,
11218 the positional parameters remain unchanged.
11219
11220 </DL>
11221 <P>
11222
11223 The options are off by default unless otherwise noted.
11224 Using + rather than - causes these options to be turned off.
11225 The options can also be specified as arguments to an invocation of
11226 the shell.
11227 The current set of options may be found in
11228 <B>$-</B>.
11229
11230 The return status is always true unless an invalid option is encountered.
11231 </DL>
11232
11233 <DT><B>shift</B> [<I>n</I>]<DD>
11234 The positional parameters from <I>n</I>+1 ... are renamed to
11235 <B>$1</B>
11236
11237 <B>....</B>
11238
11239 Parameters represented by the numbers <B>$#</B>
11240 down to <B>$#</B>-<I>n</I>+1 are unset.
11241 <I>n</I>
11242
11243 must be a non-negative number less than or equal to <B>$#</B>.
11244 If
11245 <I>n</I>
11246
11247 is 0, no parameters are changed.
11248 If
11249 <I>n </I>
11250
11251 is not given, it is assumed to be 1.
11252 If
11253 <I>n</I>
11254
11255 is greater than <B>$#</B>, the positional parameters are not changed.
11256 The return status is greater than zero if
11257 <I>n</I>
11258
11259 is greater than
11260 <B>$#</B>
11261
11262 or less than zero; otherwise 0.
11263 <DT><B>shopt</B> [<B>-pqsu</B>] [<B>-o</B>] [<I>optname</I> ...]<DD>
11264 Toggle the values of variables controlling optional shell behavior.
11265 With no options, or with the
11266 <B>-p</B>
11267
11268 option, a list of all settable options is displayed, with
11269 an indication of whether or not each is set.
11270 The <B>-p</B> option causes output to be displayed in a form that
11271 may be reused as input.
11272 Other options have the following meanings:
11273 <DL COMPACT><DT><DD>
11274
11275 <DL COMPACT>
11276 <DT><B>-s</B>
11277
11278 <DD>
11279 Enable (set) each <I>optname</I>.
11280 <DT><B>-u</B>
11281
11282 <DD>
11283 Disable (unset) each <I>optname</I>.
11284 <DT><B>-q</B>
11285
11286 <DD>
11287 Suppresses normal output (quiet mode); the return status indicates
11288 whether the <I>optname</I> is set or unset.
11289 If multiple <I>optname</I> arguments are given with
11290 <B>-q</B>,
11291
11292 the return status is zero if all <I>optnames</I> are enabled; non-zero
11293 otherwise.
11294 <DT><B>-o</B>
11295
11296 <DD>
11297 Restricts the values of <I>optname</I> to be those defined for the
11298 <B>-o</B>
11299
11300 option to the
11301 <B>set</B>
11302
11303 builtin.
11304
11305 </DL>
11306 <P>
11307
11308 If either
11309 <B>-s</B>
11310
11311 or
11312 <B>-u</B>
11313
11314 is used with no <I>optname</I> arguments, the display is limited to
11315 those options which are set or unset, respectively.
11316 Unless otherwise noted, the <B>shopt</B> options are disabled (unset)
11317 by default.
11318 <P>
11319
11320 The return status when listing options is zero if all <I>optnames</I>
11321 are enabled, non-zero otherwise.  When setting or unsetting options,
11322 the return status is zero unless an <I>optname</I> is not a valid shell
11323 option.
11324 <P>
11325
11326 The list of <B>shopt</B> options is:
11327 <P>
11328
11329
11330
11331 <DL COMPACT>
11332 <DT><B>autocd</B>
11333
11334 <DD>
11335 If set, a command name that is the name of a directory is executed as if
11336 it were the argument to the <B>cd</B> command.
11337 This option is only used by interactive shells.
11338 <DT><B>cdable_vars</B>
11339
11340 <DD>
11341 If set, an argument to the
11342 <B>cd</B>
11343
11344 builtin command that
11345 is not a directory is assumed to be the name of a variable whose
11346 value is the directory to change to.
11347 <DT><B>cdspell</B>
11348
11349 <DD>
11350 If set, minor errors in the spelling of a directory component in a
11351 <B>cd</B>
11352
11353 command will be corrected.
11354 The errors checked for are transposed characters,
11355 a missing character, and one character too many.
11356 If a correction is found, the corrected file name is printed,
11357 and the command proceeds.
11358 This option is only used by interactive shells.
11359 <DT><B>checkhash</B>
11360
11361 <DD>
11362 If set, <B>bash</B> checks that a command found in the hash
11363 table exists before trying to execute it.  If a hashed command no
11364 longer exists, a normal path search is performed.
11365 <DT><B>checkjobs</B>
11366
11367 <DD>
11368 If set, <B>bash</B> lists the status of any stopped and running jobs before
11369 exiting an interactive shell.  If any jobs are running, this causes
11370 the exit to be deferred until a second exit is attempted without an
11371 intervening command (see
11372 <FONT SIZE=-1><B>JOB CONTROL</B>
11373
11374 </FONT>
11375 above).  The shell always
11376 postpones exiting if any jobs are stopped.
11377 <DT><B>checkwinsize</B>
11378
11379 <DD>
11380 If set, <B>bash</B> checks the window size after each command
11381 and, if necessary, updates the values of
11382 <FONT SIZE=-1><B>LINES</B>
11383
11384 </FONT>
11385 and
11386 <FONT SIZE=-1><B>COLUMNS</B>.
11387
11388 </FONT>
11389 <DT><B>cmdhist</B>
11390
11391 <DD>
11392 If set,
11393 <B>bash</B>
11394
11395 attempts to save all lines of a multiple-line
11396 command in the same history entry.  This allows
11397 easy re-editing of multi-line commands.
11398 <DT><B>compat31</B>
11399
11400 <DD>
11401 If set,
11402 <B>bash</B>
11403
11404 changes its behavior to that of version 3.1 with respect to quoted
11405 arguments to the <B>[[</B> conditional command's <B>=~</B> operator.
11406 <DT><B>compat32</B>
11407
11408 <DD>
11409 If set,
11410 <B>bash</B>
11411
11412 changes its behavior to that of version 3.2 with respect to locale-specific
11413 string comparison when using the <B>[[</B>
11414 conditional command's <B>&lt;</B> and <B>&gt;</B> operators.
11415 Bash versions prior to bash-4.1 use ASCII collation and
11416 <I>strcmp</I>(3);
11417
11418 bash-4.1 and later
11419 use the current locale's collation sequence and
11420 <I>strcoll</I>(3).
11421
11422 <DT><B>compat40</B>
11423
11424 <DD>
11425 If set,
11426 <B>bash</B>
11427
11428 changes its behavior to that of version 4.0 with respect to locale-specific
11429 string comparison when using the <B>[[</B>
11430 conditional command's <B>&lt;</B> and <B>&gt;</B> operators (see previous item)
11431 and the effect of interrupting a command list.
11432 <DT><B>compat41</B>
11433
11434 <DD>
11435 @item compat41
11436 If set,
11437 <B>bash</B>,
11438
11439 when in posix mode, treats a single quote in a double-quoted
11440 parameter expansion as a special character.  The single quotes must match
11441 (an even number) and the characters between the single quotes are considered
11442 quoted.  This is the behavior of posix mode through version 4.1.
11443 The default bash behavior remains as in previous versions.
11444 <DT><B>dirspell</B>
11445
11446 <DD>
11447 If set,
11448 <B>bash</B>
11449
11450 attempts spelling correction on directory names during word completion
11451 if the directory name initially supplied does not exist.
11452 <DT><B>dotglob</B>
11453
11454 <DD>
11455 If set, 
11456 <B>bash</B>
11457
11458 includes filenames beginning with a `.' in the results of pathname
11459 expansion.
11460 <DT><B>execfail</B>
11461
11462 <DD>
11463 If set, a non-interactive shell will not exit if
11464 it cannot execute the file specified as an argument to the
11465 <B>exec</B>
11466
11467 builtin command.  An interactive shell does not exit if
11468 <B>exec</B>
11469
11470 fails.
11471 <DT><B>expand_aliases</B>
11472
11473 <DD>
11474 If set, aliases are expanded as described above under
11475 <FONT SIZE=-1><B>ALIASES</B>.
11476
11477 </FONT>
11478 This option is enabled by default for interactive shells.
11479 <DT><B>extdebug</B>
11480
11481 <DD>
11482 If set, behavior intended for use by debuggers is enabled:
11483 <DL COMPACT><DT><DD>
11484 <DL COMPACT>
11485 <DT><B>1.</B>
11486
11487 <DD>
11488 The <B>-F</B> option to the <B>declare</B> builtin displays the source
11489 file name and line number corresponding to each function name supplied
11490 as an argument.
11491 <DT><B>2.</B>
11492
11493 <DD>
11494 If the command run by the <B>DEBUG</B> trap returns a non-zero value, the
11495 next command is skipped and not executed.
11496 <DT><B>3.</B>
11497
11498 <DD>
11499 If the command run by the <B>DEBUG</B> trap returns a value of 2, and the
11500 shell is executing in a subroutine (a shell function or a shell script
11501 executed by the <B>.</B> or <B>source</B> builtins), a call to
11502 <B>return</B> is simulated.
11503 <DT><B>4.</B>
11504
11505 <DD>
11506 <FONT SIZE=-1><B>BASH_ARGC</B>
11507
11508 </FONT>
11509 and
11510 <FONT SIZE=-1><B>BASH_ARGV</B>
11511
11512 </FONT>
11513 are updated as described in their descriptions above.
11514 <DT><B>5.</B>
11515
11516 <DD>
11517 Function tracing is enabled:  command substitution, shell functions, and
11518 subshells invoked with <B>(</B> <I>command</I> <B>)</B> inherit the
11519 <B>DEBUG</B> and <B>RETURN</B> traps.
11520 <DT><B>6.</B>
11521
11522 <DD>
11523 Error tracing is enabled:  command substitution, shell functions, and
11524 subshells invoked with <B>(</B> <I>command</I> <B>)</B> inherit the
11525 <B>ERR</B> trap.
11526 </DL></DL>
11527
11528 <DT><B>extglob</B>
11529
11530 <DD>
11531 If set, the extended pattern matching features described above under
11532 <B>Pathname Expansion</B> are enabled.
11533 <DT><B>extquote</B>
11534
11535 <DD>
11536 If set, <B>$</B>aq<I>string</I>aq and <B>$</B>&quot;<I>string</I>&quot; quoting is
11537 performed within <B>${</B><I>parameter</I><B>}</B> expansions
11538 enclosed in double quotes.  This option is enabled by default.
11539 <DT><B>failglob</B>
11540
11541 <DD>
11542 If set, patterns which fail to match filenames during pathname expansion
11543 result in an expansion error.
11544 <DT><B>force_fignore</B>
11545
11546 <DD>
11547 If set, the suffixes specified by the
11548 <FONT SIZE=-1><B>FIGNORE</B>
11549
11550 </FONT>
11551 shell variable
11552 cause words to be ignored when performing word completion even if
11553 the ignored words are the only possible completions.
11554 See
11555 <FONT SIZE=-1><B>SHELL VARIABLES</B></FONT>
11556 above for a description of
11557 <FONT SIZE=-1><B>FIGNORE</B>.
11558
11559 </FONT>
11560 This option is enabled by default.
11561 <DT><B>globstar</B>
11562
11563 <DD>
11564 If set, the pattern <B>**</B> used in a pathname expansion context will
11565 match a files and zero or more directories and subdirectories.
11566 If the pattern is followed by a <B>/</B>, only directories and
11567 subdirectories match.
11568 <DT><B>gnu_errfmt</B>
11569
11570 <DD>
11571 If set, shell error messages are written in the standard GNU error
11572 message format.
11573 <DT><B>histappend</B>
11574
11575 <DD>
11576 If set, the history list is appended to the file named by the value
11577 of the
11578 <FONT SIZE=-1><B>HISTFILE</B>
11579
11580 </FONT>
11581 variable when the shell exits, rather than overwriting the file.
11582 <DT><B>histreedit</B>
11583
11584 <DD>
11585 If set, and
11586 <B>readline</B>
11587
11588 is being used, a user is given the opportunity to re-edit a
11589 failed history substitution.
11590 <DT><B>histverify</B>
11591
11592 <DD>
11593 If set, and 
11594 <B>readline</B>
11595
11596 is being used, the results of history substitution are not immediately
11597 passed to the shell parser.  Instead, the resulting line is loaded into
11598 the <B>readline</B> editing buffer, allowing further modification.
11599 <DT><B>hostcomplete</B>
11600
11601 <DD>
11602 If set, and
11603 <B>readline</B>
11604
11605 is being used, <B>bash</B> will attempt to perform hostname completion when a
11606 word containing a <B>@</B> is being completed (see
11607 <B>Completing</B>
11608
11609 under
11610 <FONT SIZE=-1><B>READLINE</B>
11611
11612 </FONT>
11613 above).
11614 This is enabled by default.
11615 <DT><B>huponexit</B>
11616
11617 <DD>
11618 If set, <B>bash</B> will send
11619 <FONT SIZE=-1><B>SIGHUP</B>
11620
11621 </FONT>
11622 to all jobs when an interactive login shell exits.
11623 <DT><B>interactive_comments</B>
11624
11625 <DD>
11626 If set, allow a word beginning with
11627 <B>#</B>
11628
11629 to cause that word and all remaining characters on that
11630 line to be ignored in an interactive shell (see
11631 <FONT SIZE=-1><B>COMMENTS</B>
11632
11633 </FONT>
11634 above).  This option is enabled by default.
11635 <DT><B>lastpipe</B>
11636
11637 <DD>
11638 If set, and job control is not active, the shell runs the last command of
11639 a pipeline not executed in the background in the current shell environment.
11640 <DT><B>lithist</B>
11641
11642 <DD>
11643 If set, and the
11644 <B>cmdhist</B>
11645
11646 option is enabled, multi-line commands are saved to the history with
11647 embedded newlines rather than using semicolon separators where possible.
11648 <DT><B>login_shell</B>
11649
11650 <DD>
11651 The shell sets this option if it is started as a login shell (see
11652 <FONT SIZE=-1><B>INVOCATION</B>
11653
11654 </FONT>
11655 above).
11656 The value may not be changed.
11657 <DT><B>mailwarn</B>
11658
11659 <DD>
11660 If set, and a file that <B>bash</B> is checking for mail has been  
11661 accessed since the last time it was checked, the message ``The mail in
11662 <I>mailfile</I> has been read'' is displayed.
11663 <DT><B>no_empty_cmd_completion</B>
11664
11665 <DD>
11666 If set, and
11667 <B>readline</B>
11668
11669 is being used,
11670 <B>bash</B>
11671
11672 will not attempt to search the
11673 <FONT SIZE=-1><B>PATH</B>
11674
11675 </FONT>
11676 for possible completions when
11677 completion is attempted on an empty line.
11678 <DT><B>nocaseglob</B>
11679
11680 <DD>
11681 If set,
11682 <B>bash</B>
11683
11684 matches filenames in a case-insensitive fashion when performing pathname
11685 expansion (see
11686 <B>Pathname Expansion</B>
11687
11688 above).
11689 <DT><B>nocasematch</B>
11690
11691 <DD>
11692 If set,
11693 <B>bash</B>
11694
11695 matches patterns in a case-insensitive fashion when performing matching
11696 while executing <B>case</B> or <B>[[</B> conditional commands.
11697 <DT><B>nullglob</B>
11698
11699 <DD>
11700 If set,
11701 <B>bash</B>
11702
11703 allows patterns which match no
11704 files (see
11705 <B>Pathname Expansion</B>
11706
11707 above)
11708 to expand to a null string, rather than themselves.
11709 <DT><B>progcomp</B>
11710
11711 <DD>
11712 If set, the programmable completion facilities (see
11713 <B>Programmable Completion</B> above) are enabled.
11714 This option is enabled by default.
11715 <DT><B>promptvars</B>
11716
11717 <DD>
11718 If set, prompt strings undergo
11719 parameter expansion, command substitution, arithmetic
11720 expansion, and quote removal after being expanded as described in
11721 <FONT SIZE=-1><B>PROMPTING</B>
11722
11723 </FONT>
11724 above.  This option is enabled by default.
11725 <DT><B>restricted_shell</B>
11726
11727 <DD>
11728 The shell sets this option if it is started in restricted mode (see
11729 <FONT SIZE=-1><B>RESTRICTED SHELL</B>
11730
11731 </FONT>
11732 below).
11733 The value may not be changed.
11734 This is not reset when the startup files are executed, allowing
11735 the startup files to discover whether or not a shell is restricted.
11736 <DT><B>shift_verbose</B>
11737
11738 <DD>
11739 If set, the
11740 <B>shift</B>
11741
11742 builtin prints an error message when the shift count exceeds the
11743 number of positional parameters.
11744 <DT><B>sourcepath</B>
11745
11746 <DD>
11747 If set, the
11748 <B>source</B> (<B>.</B>) builtin uses the value of
11749 <FONT SIZE=-1><B>PATH</B>
11750
11751 </FONT>
11752 to find the directory containing the file supplied as an argument.
11753 This option is enabled by default.
11754 <DT><B>xpg_echo</B>
11755
11756 <DD>
11757 If set, the <B>echo</B> builtin expands backslash-escape sequences
11758 by default.
11759 </DL></DL>
11760
11761 <DT><B>suspend</B> [<B>-f</B>]<DD>
11762 Suspend the execution of this shell until it receives a
11763 <FONT SIZE=-1><B>SIGCONT</B>
11764
11765 </FONT>
11766 signal.  A login shell cannot be suspended; the
11767 <B>-f</B>
11768
11769 option can be used to override this and force the suspension.
11770 The return status is 0 unless the shell is a login shell and
11771 <B>-f</B>
11772
11773 is not supplied, or if job control is not enabled.
11774 <DT><B>test</B> <I>expr</I><DD>
11775
11776 <DT><B>[</B> <I>expr</I> <B>]</B><DD>
11777 Return a status of 0 or 1 depending on
11778 the evaluation of the conditional expression
11779 <I>expr</I>.
11780
11781 Each operator and operand must be a separate argument.
11782 Expressions are composed of the primaries described above under
11783 <FONT SIZE=-1><B>CONDITIONAL EXPRESSIONS</B>.
11784
11785 </FONT>
11786 <B>test</B> does not accept any options, nor does it accept and ignore
11787 an argument of <B>--</B> as signifying the end of options.
11788 <P>
11789
11790
11791 Expressions may be combined using the following operators, listed
11792 in decreasing order of precedence.
11793 The evaluation depends on the number of arguments; see below.
11794 Operator precedence is used when there are five or more arguments.
11795 <DL COMPACT><DT><DD>
11796
11797 <DL COMPACT>
11798 <DT><B>! </B><I>expr</I>
11799
11800 <DD>
11801 True if
11802 <I>expr</I>
11803
11804 is false.
11805 <DT><B>( </B><I>expr</I> )
11806
11807 <DD>
11808 Returns the value of <I>expr</I>.
11809 This may be used to override the normal precedence of operators.
11810 <DT><I>expr1</I> -<B>a</B> <I>expr2</I><DD>
11811 True if both
11812 <I>expr1</I>
11813
11814 and
11815 <I>expr2</I>
11816
11817 are true.
11818 <DT><I>expr1</I> -<B>o</B> <I>expr2</I><DD>
11819 True if either
11820 <I>expr1</I>
11821
11822 or
11823 <I>expr2</I>
11824
11825 is true.
11826
11827 </DL>
11828 <P>
11829
11830 <B>test</B> and <B>[</B> evaluate conditional
11831 expressions using a set of rules based on the number of arguments.
11832 <P>
11833
11834
11835
11836 <DL COMPACT>
11837 <DT>0 arguments<DD>
11838 The expression is false.
11839 <DT>1 argument<DD>
11840 The expression is true if and only if the argument is not null.
11841 <DT>2 arguments<DD>
11842 If the first argument is <B>!</B>, the expression is true if and
11843 only if the second argument is null.
11844 If the first argument is one of the unary conditional operators listed above
11845 under
11846 <FONT SIZE=-1><B>CONDITIONAL EXPRESSIONS</B>,
11847
11848 </FONT>
11849 the expression is true if the unary test is true.
11850 If the first argument is not a valid unary conditional operator, the expression
11851 is false.
11852 <DT>3 arguments<DD>
11853 The following conditions are applied in the order listed.
11854 If the second argument is one of the binary conditional operators listed above
11855 under
11856 <FONT SIZE=-1><B>CONDITIONAL EXPRESSIONS</B>,
11857
11858 </FONT>
11859 the result of the expression is the result of the binary test using
11860 the first and third arguments as operands.
11861 The <B>-a</B> and <B>-o</B> operators are considered binary operators
11862 when there are three arguments.  
11863 If the first argument is <B>!</B>, the value is the negation of
11864 the two-argument test using the second and third arguments.
11865 If the first argument is exactly <B>(</B> and the third argument is
11866 exactly <B>)</B>, the result is the one-argument test of the second
11867 argument.
11868 Otherwise, the expression is false.
11869 <DT>4 arguments<DD>
11870 If the first argument is <B>!</B>, the result is the negation of
11871 the three-argument expression composed of the remaining arguments.
11872 Otherwise, the expression is parsed and evaluated according to 
11873 precedence using the rules listed above.
11874 <DT>5 or more arguments<DD>
11875 The expression is parsed and evaluated according to precedence
11876 using the rules listed above.
11877 <P>
11878
11879
11880 </DL>
11881 <P>
11882
11883 When used with <B>test</B> or <B>[</B>, the <B>&lt;</B> and <B>&gt;</B> operators
11884 sort lexicographically using ASCII ordering.
11885 </DL>
11886
11887
11888 <DT><B>times</B>
11889
11890 <DD>
11891 Print the accumulated user and system times for the shell and
11892 for processes run from the shell.  The return status is 0.
11893 <DT><B>trap</B> [<B>-lp</B>] [[<I>arg</I>] <I>sigspec</I> ...]<DD>
11894 The command
11895 <I>arg</I>
11896
11897 is to be read and executed when the shell receives
11898 signal(s)
11899 <I>sigspec</I>.
11900
11901 If
11902 <I>arg</I>
11903
11904 is absent (and there is a single <I>sigspec</I>) or
11905 <B>-</B>,
11906
11907 each specified signal is
11908 reset to its original disposition (the value it had
11909 upon entrance to the shell).
11910 If 
11911 <I>arg</I>
11912
11913 is the null string the signal specified by each
11914 <I>sigspec</I>
11915
11916 is ignored by the shell and by the commands it invokes.
11917 If
11918 <I>arg</I>
11919
11920 is not present and
11921 <B>-p</B>
11922
11923 has been supplied, then the trap commands associated with each
11924 <I>sigspec</I>
11925
11926 are displayed.
11927 If no arguments are supplied or if only
11928 <B>-p</B>
11929
11930 is given,
11931 <B>trap</B>
11932
11933 prints the list of commands associated with each signal.
11934 The
11935 <B>-l</B>
11936
11937 option causes the shell to print a list of signal names and
11938 their corresponding numbers.
11939 Each
11940 <I>sigspec</I>
11941
11942 is either
11943 a signal name defined in &lt;<I>signal.h</I>&gt;, or a signal number.
11944 Signal names are case insensitive and the
11945 <FONT SIZE=-1><B>SIG</B>
11946
11947 </FONT>
11948 prefix is optional.
11949 <P>
11950
11951
11952 If a
11953 <I>sigspec</I>
11954
11955 is
11956 <FONT SIZE=-1><B>EXIT</B>
11957
11958 </FONT>
11959 (0) the command
11960 <I>arg</I>
11961
11962 is executed on exit from the shell.
11963 If a
11964 <I>sigspec</I>
11965
11966 is
11967 <FONT SIZE=-1><B>DEBUG</B>,
11968
11969 </FONT>
11970 the command
11971 <I>arg</I>
11972
11973 is executed before every <I>simple command</I>, <I>for</I> command,
11974 <I>case</I> command, <I>select</I> command, every arithmetic <I>for</I>
11975 command, and before the first command executes in a shell function (see
11976 <FONT SIZE=-1><B>SHELL GRAMMAR</B>
11977
11978 </FONT>
11979 above).
11980 Refer to the description of the <B>extdebug</B> option to the
11981 <B>shopt</B> builtin for details of its effect on the <B>DEBUG</B> trap.
11982 If a
11983 <I>sigspec</I>
11984
11985 is
11986 <FONT SIZE=-1><B>RETURN</B>,
11987
11988 </FONT>
11989 the command
11990 <I>arg</I>
11991
11992 is executed each time a shell function or a script executed with
11993 the <B>.</B> or <B>source</B> builtins finishes executing.
11994 <P>
11995
11996
11997 If a
11998 <I>sigspec</I>
11999
12000 is
12001 <FONT SIZE=-1><B>ERR</B>,
12002
12003 </FONT>
12004 the command
12005 <I>arg</I>
12006
12007 is executed whenever a simple command has a non-zero exit status,
12008 subject to the following conditions.
12009 The
12010 <FONT SIZE=-1><B>ERR</B>
12011
12012 </FONT>
12013 trap is not executed if the failed
12014 command is part of the command list immediately following a
12015 <B>while</B>
12016
12017 or
12018 <B>until</B>
12019
12020 keyword, 
12021 part of the test in an
12022 <I>if</I>
12023
12024 statement, part of a command executed in a
12025 <B>&amp;&amp;</B>
12026
12027 or
12028 <B>||</B>
12029
12030 list, or if the command's return value is
12031 being inverted via
12032 <B>!</B>.
12033
12034 These are the same conditions obeyed by the <B>errexit</B> option.
12035 <P>
12036
12037
12038 Signals ignored upon entry to the shell cannot be trapped or reset.
12039 Trapped signals that are not being ignored are reset to their original
12040 values in a subshell or subshell environment when one is created.
12041 The return status is false if any
12042 <I>sigspec</I>
12043
12044 is invalid; otherwise
12045 <B>trap</B>
12046
12047 returns true.
12048 <DT><B>type</B> [<B>-aftpP</B>] <I>name</I> [<I>name</I> ...]<DD>
12049 With no options, 
12050 indicate how each
12051 <I>name</I>
12052
12053 would be interpreted if used as a command name.
12054 If the
12055 <B>-t</B>
12056
12057 option is used,
12058 <B>type</B>
12059
12060 prints a string which is one of
12061 <I>alias</I>,
12062
12063 <I>keyword</I>,
12064
12065 <I>function</I>,
12066
12067 <I>builtin</I>,
12068
12069 or
12070 <I>file </I>
12071
12072 if
12073 <I>name</I>
12074
12075 is an alias, shell reserved word, function, builtin, or disk file,
12076 respectively.
12077 If the
12078 <I>name</I>
12079
12080 is not found, then nothing is printed, and an exit status of false
12081 is returned.
12082 If the
12083 <B>-p</B>
12084
12085 option is used,
12086 <B>type</B>
12087
12088 either returns the name of the disk file
12089 that would be executed if
12090 <I>name</I>
12091
12092 were specified as a command name,
12093 or nothing if
12094 <TT>type -t name</TT>
12095
12096 would not return
12097 <I>file</I>.
12098
12099 The
12100 <B>-P</B>
12101
12102 option forces a
12103 <FONT SIZE=-1><B>PATH</B>
12104
12105 </FONT>
12106 search for each <I>name</I>, even if
12107 <TT>type -t name</TT>
12108
12109 would not return
12110 <I>file</I>.
12111
12112 If a command is hashed,
12113 <B>-p</B>
12114
12115 and
12116 <B>-P</B>
12117
12118 print the hashed value, not necessarily the file that appears
12119 first in 
12120 <FONT SIZE=-1><B>PATH</B>.
12121
12122 </FONT>
12123 If the
12124 <B>-a</B>
12125
12126 option is used, 
12127 <B>type</B>
12128
12129 prints all of the places that contain
12130 an executable named 
12131 <I>name</I>.
12132
12133 This includes aliases and functions,
12134 if and only if the 
12135 <B>-p</B>
12136
12137 option is not also used.
12138 The table of hashed commands is not consulted
12139 when using
12140 <B>-a</B>.
12141
12142 The
12143 <B>-f</B>
12144
12145 option suppresses shell function lookup, as with the <B>command</B> builtin.
12146 <B>type</B>
12147
12148 returns true if all of the arguments are found, false if
12149 any are not found.
12150 <DT><B>ulimit</B> [<B>-HSTabcdefilmnpqrstuvx</B> [<I>limit</I>]]<DD>
12151 Provides control over the resources available to the shell and to
12152 processes started by it, on systems that allow such control.
12153 The <B>-H</B> and <B>-S</B> options specify that the hard or soft limit is
12154 set for the given resource.
12155 A hard limit cannot be increased by a non-root user once it is set;
12156 a soft limit may be increased up to the value of the hard limit.
12157 If neither <B>-H</B> nor <B>-S</B> is specified, both the soft and hard
12158 limits are set.
12159 The value of
12160 <I>limit</I>
12161
12162 can be a number in the unit specified for the resource
12163 or one of the special values
12164 <B>hard</B>,
12165
12166 <B>soft</B>,
12167
12168 or
12169 <B>unlimited</B>,
12170
12171 which stand for the current hard limit, the current soft limit, and
12172 no limit, respectively.
12173 If
12174 <I>limit</I>
12175
12176 is omitted, the current value of the soft limit of the resource is
12177 printed, unless the <B>-H</B> option is given.  When more than one
12178 resource is specified, the limit name and unit are printed before the value.
12179 Other options are interpreted as follows:
12180 <DL COMPACT><DT><DD>
12181
12182 <DL COMPACT>
12183 <DT><B>-a</B>
12184
12185 <DD>
12186 All current limits are reported
12187 <DT><B>-b</B>
12188
12189 <DD>
12190 The maximum socket buffer size
12191 <DT><B>-c</B>
12192
12193 <DD>
12194 The maximum size of core files created
12195 <DT><B>-d</B>
12196
12197 <DD>
12198 The maximum size of a process's data segment
12199 <DT><B>-e</B>
12200
12201 <DD>
12202 The maximum scheduling priority (&quot;nice&quot;)
12203 <DT><B>-f</B>
12204
12205 <DD>
12206 The maximum size of files written by the shell and its children
12207 <DT><B>-i</B>
12208
12209 <DD>
12210 The maximum number of pending signals
12211 <DT><B>-l</B>
12212
12213 <DD>
12214 The maximum size that may be locked into memory
12215 <DT><B>-m</B>
12216
12217 <DD>
12218 The maximum resident set size (many systems do not honor this limit)
12219 <DT><B>-n</B>
12220
12221 <DD>
12222 The maximum number of open file descriptors (most systems do not
12223 allow this value to be set)
12224 <DT><B>-p</B>
12225
12226 <DD>
12227 The pipe size in 512-byte blocks (this may not be set)
12228 <DT><B>-q</B>
12229
12230 <DD>
12231 The maximum number of bytes in POSIX message queues
12232 <DT><B>-r</B>
12233
12234 <DD>
12235 The maximum real-time scheduling priority
12236 <DT><B>-s</B>
12237
12238 <DD>
12239 The maximum stack size
12240 <DT><B>-t</B>
12241
12242 <DD>
12243 The maximum amount of cpu time in seconds
12244 <DT><B>-u</B>
12245
12246 <DD>
12247 The maximum number of processes available to a single user
12248 <DT><B>-v</B>
12249
12250 <DD>
12251 The maximum amount of virtual memory available to the shell and, on
12252 some systems, to its children
12253 <DT><B>-x</B>
12254
12255 <DD>
12256 The maximum number of file locks
12257 <DT><B>-T</B>
12258
12259 <DD>
12260 The maximum number of threads
12261
12262 </DL>
12263 <P>
12264
12265 If
12266 <I>limit</I>
12267
12268 is given, it is the new value of the specified resource (the
12269 <B>-a</B>
12270
12271 option is display only).
12272 If no option is given, then
12273 <B>-f</B>
12274
12275 is assumed.  Values are in 1024-byte increments, except for
12276 <B>-t</B>,
12277
12278 which is in seconds,
12279 <B>-p</B>,
12280
12281 which is in units of 512-byte blocks,
12282 and
12283 <B>-T</B>,
12284
12285 <B>-b</B>,
12286
12287 <B>-n</B>,
12288
12289 and
12290 <B>-u</B>,
12291
12292 which are unscaled values.
12293 The return status is 0 unless an invalid option or argument is supplied,
12294 or an error occurs while setting a new limit.
12295 </DL>
12296
12297 <DT><B>umask</B> [<B>-p</B>] [<B>-S</B>] [<I>mode</I>]<DD>
12298 The user file-creation mask is set to 
12299 <I>mode</I>.
12300
12301 If
12302 <I>mode</I>
12303
12304 begins with a digit, it
12305 is interpreted as an octal number; otherwise
12306 it is interpreted as a symbolic mode mask similar
12307 to that accepted by
12308 <I>chmod</I>(1).
12309
12310 If
12311 <I>mode</I>
12312
12313 is omitted, the current value of the mask is printed.
12314 The
12315 <B>-S</B>
12316
12317 option causes the mask to be printed in symbolic form; the
12318 default output is an octal number.
12319 If the
12320 <B>-p</B>
12321
12322 option is supplied, and
12323 <I>mode</I>
12324
12325 is omitted, the output is in a form that may be reused as input.
12326 The return status is 0 if the mode was successfully changed or if
12327 no <I>mode</I> argument was supplied, and false otherwise.
12328 <DT><B>unalias</B> [-<B>a</B>] [<I>name</I> ...]<DD>
12329 Remove each <I>name</I> from the list of defined aliases.  If
12330 <B>-a</B>
12331
12332 is supplied, all alias definitions are removed.  The return
12333 value is true unless a supplied
12334 <I>name</I>
12335
12336 is not a defined alias.
12337 <DT><B>unset</B> [-<B>fv</B>] [<I>name</I> ...]<DD>
12338 For each
12339 <I>name</I>,
12340
12341 remove the corresponding variable or function.
12342 If no options are supplied, or the
12343 <B>-v</B>
12344
12345 option is given, each
12346 <I>name</I>
12347
12348 refers to a shell variable.
12349 Read-only variables may not be unset.
12350 If
12351 <B>-f</B>
12352
12353 is specified, each
12354 <I>name</I>
12355
12356 refers to a shell function, and the function definition
12357 is removed.
12358 Each unset variable or function is removed from the environment
12359 passed to subsequent commands.
12360 If any of
12361 <FONT SIZE=-1><B>COMP_WORDBREAKS</B>,
12362
12363 </FONT>
12364 <FONT SIZE=-1><B>RANDOM</B>,
12365
12366 </FONT>
12367 <FONT SIZE=-1><B>SECONDS</B>,
12368
12369 </FONT>
12370 <FONT SIZE=-1><B>LINENO</B>,
12371
12372 </FONT>
12373 <FONT SIZE=-1><B>HISTCMD</B>,
12374
12375 </FONT>
12376 <FONT SIZE=-1><B>FUNCNAME</B>,
12377
12378 </FONT>
12379 <FONT SIZE=-1><B>GROUPS</B>,
12380
12381 </FONT>
12382 or
12383 <FONT SIZE=-1><B>DIRSTACK</B>
12384
12385 </FONT>
12386 are unset, they lose their special properties, even if they are
12387 subsequently reset.  The exit status is true unless a
12388 <I>name</I>
12389
12390 is readonly.
12391 <DT><B>wait</B> [<I>n ...</I>]<DD>
12392 Wait for each specified process and return its termination status.
12393 Each
12394 <I>n</I>
12395
12396 may be a process
12397 ID or a job specification; if a job spec is given, all processes
12398 in that job's pipeline are waited for.  If
12399 <I>n</I>
12400
12401 is not given, all currently active child processes
12402 are waited for, and the return status is zero.  If
12403 <I>n</I>
12404
12405 specifies a non-existent process or job, the return status is
12406 127.  Otherwise, the return status is the exit status of the last
12407 process or job waited for.
12408
12409
12410 </DL>
12411 <A NAME="lbDC">&nbsp;</A>
12412 <H3>RESTRICTED SHELL</H3>
12413
12414
12415
12416 <P>
12417
12418 If
12419 <B>bash</B>
12420
12421 is started with the name
12422 <B>rbash</B>,
12423
12424 or the
12425 <B>-r</B>
12426
12427 option is supplied at invocation,
12428 the shell becomes restricted.
12429 A restricted shell is used to
12430 set up an environment more controlled than the standard shell.
12431 It behaves identically to
12432 <B>bash</B>
12433
12434 with the exception that the following are disallowed or not performed:
12435 <DL COMPACT>
12436 <DT>*<DD>
12437 changing directories with <B>cd</B>
12438 <DT>*<DD>
12439 setting or unsetting the values of
12440 <FONT SIZE=-1><B>SHELL</B>,
12441
12442 </FONT>
12443 <FONT SIZE=-1><B>PATH</B>,
12444
12445 </FONT>
12446 <FONT SIZE=-1><B>ENV</B>,
12447
12448 </FONT>
12449 or
12450 <FONT SIZE=-1><B>BASH_ENV</B>
12451
12452 </FONT>
12453 <DT>*<DD>
12454 specifying command names containing
12455 <B>/</B>
12456
12457 <DT>*<DD>
12458 specifying a file name containing a
12459 <B>/</B>
12460
12461 as an argument to the
12462 <B>.</B>
12463
12464 builtin command
12465 <DT>*<DD>
12466 specifying a filename containing a slash as an argument to the
12467 <B>-p</B>
12468
12469 option to the
12470 <B>hash</B>
12471
12472 builtin command
12473 <DT>*<DD>
12474 importing function definitions from the shell environment at startup
12475 <DT>*<DD>
12476 parsing the value of
12477 <FONT SIZE=-1><B>SHELLOPTS</B>
12478
12479 </FONT>
12480 from the shell environment at startup
12481 <DT>*<DD>
12482 redirecting output using the &gt;, &gt;|, &lt;&gt;, &gt;&amp;, &amp;&gt;, and &gt;&gt; redirection operators
12483 <DT>*<DD>
12484 using the
12485 <B>exec</B>
12486
12487 builtin command to replace the shell with another command
12488 <DT>*<DD>
12489 adding or deleting builtin commands with the
12490 <B>-f</B>
12491
12492 and
12493 <B>-d</B>
12494
12495 options to the
12496 <B>enable</B>
12497
12498 builtin command
12499 <DT>*<DD>
12500 using the <B>enable</B> builtin command to enable disabled shell builtins
12501 <DT>*<DD>
12502 specifying the
12503 <B>-p</B>
12504
12505 option to the
12506 <B>command</B>
12507
12508 builtin command
12509 <DT>*<DD>
12510 turning off restricted mode with
12511 <B>set +r</B> or <B>set +o restricted</B>.
12512 </DL>
12513 <P>
12514
12515 These restrictions are enforced after any startup files are read.
12516 <P>
12517
12518
12519  When a command that is found to be a shell script is executed
12520 (see
12521 <FONT SIZE=-1><B>COMMAND EXECUTION</B>
12522
12523 </FONT>
12524
12525 above),
12526
12527 <B>rbash</B>
12528
12529 turns off any restrictions in the shell spawned to execute the
12530 script.
12531
12532
12533 <A NAME="lbDD">&nbsp;</A>
12534 <H3>SEE ALSO</H3>
12535
12536
12537 <DL COMPACT>
12538 <DT><I>Bash Reference Manual</I>, Brian Fox and Chet Ramey<DD>
12539 <DT><I>The Gnu Readline Library</I>, Brian Fox and Chet Ramey<DD>
12540 <DT><I>The Gnu History Library</I>, Brian Fox and Chet Ramey<DD>
12541 <DT><I>Portable Operating System Interface (POSIX) Part 2: Shell and Utilities</I>, IEEE<DD>
12542 <DT><I>sh</I>(1), <I>ksh</I>(1), <I>csh</I>(1)<DD>
12543 <DT><I>emacs</I>(1), <I>vi</I>(1)<DD>
12544 <DT><I>readline</I>(3)<DD>
12545
12546 </DL>
12547 <A NAME="lbDE">&nbsp;</A>
12548 <H3>FILES</H3>
12549
12550
12551 <DL COMPACT>
12552 <DT>
12553 <A HREF="file:/bin/bash"><I>/bin/bash</I></A>
12554
12555 <DD>
12556 The <B>bash</B> executable
12557 <DT>
12558 <A HREF="file:/etc/profile"><I>/etc/profile</I></A>
12559
12560 <DD>
12561 The systemwide initialization file, executed for login shells
12562 <DT>
12563 <A HREF="file:~/.bash_profile"><I>~/.bash_profile</I></A>
12564
12565 <DD>
12566 The personal initialization file, executed for login shells
12567 <DT>
12568 <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>
12569
12570 <DD>
12571 The individual per-interactive-shell startup file
12572 <DT>
12573 <A HREF="file:~/.bash_logout"><I>~/.bash_logout</I></A>
12574
12575 <DD>
12576 The individual login shell cleanup file, executed when a login shell exits
12577 <DT>
12578 <A HREF="file:~/.inputrc"><I>~/.inputrc</I></A>
12579
12580 <DD>
12581 Individual <I>readline</I> initialization file
12582
12583 </DL>
12584 <A NAME="lbDF">&nbsp;</A>
12585 <H3>AUTHORS</H3>
12586
12587 Brian Fox, Free Software Foundation
12588 <BR>
12589
12590 <A HREF="mailto:bfox@gnu.org">bfox@gnu.org</A>
12591 <P>
12592
12593 Chet Ramey, Case Western Reserve University
12594 <BR>
12595
12596 <A HREF="mailto:chet.ramey@case.edu">chet.ramey@case.edu</A>
12597 <A NAME="lbDG">&nbsp;</A>
12598 <H3>BUG REPORTS</H3>
12599
12600 If you find a bug in
12601 <B>bash,</B>
12602
12603 you should report it.  But first, you should
12604 make sure that it really is a bug, and that it appears in the latest
12605 version of
12606 <B>bash</B>.
12607
12608 The latest version is always available from
12609 <I><A HREF="ftp://ftp.gnu.org/pub/gnu/bash/">ftp://ftp.gnu.org/pub/gnu/bash/</A></I>.
12610 <P>
12611
12612 Once you have determined that a bug actually exists, use the
12613 <I>bashbug</I>
12614
12615 command to submit a bug report.
12616 If you have a fix, you are encouraged to mail that as well!
12617 Suggestions and `philosophical' bug reports may be mailed
12618 to <I><A HREF="mailto:bug-bash@gnu.org">bug-bash@gnu.org</A></I> or posted to the Usenet
12619 newsgroup
12620 <A HREF="news:gnu.bash.bug">gnu.bash.bug</A>.
12621
12622 <P>
12623
12624 ALL bug reports should include:
12625 <P>
12626
12627
12628 <DL COMPACT>
12629 <DT>The version number of <B>bash</B><DD>
12630 <DT>The hardware and operating system<DD>
12631 <DT>The compiler used to compile<DD>
12632 <DT>A description of the bug behaviour<DD>
12633 <DT>A short script or `recipe' which exercises the bug<DD>
12634
12635 </DL>
12636 <P>
12637
12638 <I>bashbug</I>
12639
12640 inserts the first three items automatically into the template
12641 it provides for filing a bug report.
12642 <P>
12643
12644 Comments and bug reports concerning
12645 this manual page should be directed to
12646 <I><A HREF="mailto:chet@po.cwru.edu">chet@po.cwru.edu</A></I>.
12647
12648 <A NAME="lbDH">&nbsp;</A>
12649 <H3>BUGS</H3>
12650
12651 <P>
12652
12653 It's too big and too slow.
12654 <P>
12655
12656 There are some subtle differences between 
12657 <B>bash</B>
12658
12659 and traditional versions of
12660 <B>sh</B>,
12661
12662 mostly because of the
12663 <FONT SIZE=-1><B>POSIX</B>
12664
12665 </FONT>
12666 specification.
12667 <P>
12668
12669 Aliases are confusing in some uses.
12670 <P>
12671
12672 Shell builtin commands and functions are not stoppable/restartable.
12673 <P>
12674
12675 Compound commands and command sequences of the form `a ; b ; c'
12676 are not handled gracefully when process suspension is attempted.
12677 When a process is stopped, the shell immediately executes the next
12678 command in the sequence.
12679 It suffices to place the sequence of commands between
12680 parentheses to force it into a subshell, which may be stopped as
12681 a unit.
12682 <P>
12683
12684 Array variables may not (yet) be exported.
12685 <P>
12686
12687 There may be only one active coprocess at a time.
12688
12689
12690
12691 <HR>
12692 <TABLE WIDTH=100%>
12693 <TR>
12694 <TH ALIGN=LEFT width=33%>GNU Bash-4.2<TH ALIGN=CENTER width=33%>2010 December 28<TH ALIGN=RIGHT width=33%>BASH(1)
12695 </TR>
12696 </TABLE>
12697 <HR>
12698 <A NAME="index">&nbsp;</A><H2>Index</H2>
12699 <DL>
12700 <DT><A HREF="#lbAB">NAME</A><DD>
12701 <DT><A HREF="#lbAC">SYNOPSIS</A><DD>
12702 <DT><A HREF="#lbAD">COPYRIGHT</A><DD>
12703 <DT><A HREF="#lbAE">DESCRIPTION</A><DD>
12704 <DT><A HREF="#lbAF">OPTIONS</A><DD>
12705 <DT><A HREF="#lbAG">ARGUMENTS</A><DD>
12706 <DT><A HREF="#lbAH">INVOCATION</A><DD>
12707 <DT><A HREF="#lbAI">DEFINITIONS</A><DD>
12708 <DT><A HREF="#lbAJ">RESERVED WORDS</A><DD>
12709 <DT><A HREF="#lbAK">SHELL GRAMMAR</A><DD>
12710 <DL>
12711 <DT><A HREF="#lbAL">Simple Commands</A><DD>
12712 <DT><A HREF="#lbAM">Pipelines</A><DD>
12713 <DT><A HREF="#lbAN">Lists</A><DD>
12714 <DT><A HREF="#lbAO">Compound Commands</A><DD>
12715 <DT><A HREF="#lbAP">Coprocesses</A><DD>
12716 <DT><A HREF="#lbAQ">Shell Function Definitions</A><DD>
12717 </DL>
12718 <DT><A HREF="#lbAR">COMMENTS</A><DD>
12719 <DT><A HREF="#lbAS">QUOTING</A><DD>
12720 <DT><A HREF="#lbAT">PARAMETERS</A><DD>
12721 <DL>
12722 <DT><A HREF="#lbAU">Positional Parameters</A><DD>
12723 <DT><A HREF="#lbAV">Special Parameters</A><DD>
12724 <DT><A HREF="#lbAW">Shell Variables</A><DD>
12725 <DT><A HREF="#lbAX">Arrays</A><DD>
12726 </DL>
12727 <DT><A HREF="#lbAY">EXPANSION</A><DD>
12728 <DL>
12729 <DT><A HREF="#lbAZ">Brace Expansion</A><DD>
12730 <DT><A HREF="#lbBA">Tilde Expansion</A><DD>
12731 <DT><A HREF="#lbBB">Parameter Expansion</A><DD>
12732 <DT><A HREF="#lbBC">Command Substitution</A><DD>
12733 <DT><A HREF="#lbBD">Arithmetic Expansion</A><DD>
12734 <DT><A HREF="#lbBE">Process Substitution</A><DD>
12735 <DT><A HREF="#lbBF">Word Splitting</A><DD>
12736 <DT><A HREF="#lbBG">Pathname Expansion</A><DD>
12737 <DT><A HREF="#lbBH">Quote Removal</A><DD>
12738 </DL>
12739 <DT><A HREF="#lbBI">REDIRECTION</A><DD>
12740 <DL>
12741 <DT><A HREF="#lbBJ">Redirecting Input</A><DD>
12742 <DT><A HREF="#lbBK">Redirecting Output</A><DD>
12743 <DT><A HREF="#lbBL">Appending Redirected Output</A><DD>
12744 <DT><A HREF="#lbBM">Redirecting Standard Output and Standard Error</A><DD>
12745 <DT><A HREF="#lbBN">Appending Standard Output and Standard Error</A><DD>
12746 <DT><A HREF="#lbBO">Here Documents</A><DD>
12747 <DT><A HREF="#lbBP">Here Strings</A><DD>
12748 <DT><A HREF="#lbBQ">Duplicating File Descriptors</A><DD>
12749 <DT><A HREF="#lbBR">Moving File Descriptors</A><DD>
12750 <DT><A HREF="#lbBS">Opening File Descriptors for Reading and Writing</A><DD>
12751 </DL>
12752 <DT><A HREF="#lbBT">ALIASES</A><DD>
12753 <DT><A HREF="#lbBU">FUNCTIONS</A><DD>
12754 <DT><A HREF="#lbBV">ARITHMETIC EVALUATION</A><DD>
12755 <DT><A HREF="#lbBW">CONDITIONAL EXPRESSIONS</A><DD>
12756 <DT><A HREF="#lbBX">SIMPLE COMMAND EXPANSION</A><DD>
12757 <DT><A HREF="#lbBY">COMMAND EXECUTION</A><DD>
12758 <DT><A HREF="#lbBZ">COMMAND EXECUTION ENVIRONMENT</A><DD>
12759 <DT><A HREF="#lbCA">ENVIRONMENT</A><DD>
12760 <DT><A HREF="#lbCB">EXIT STATUS</A><DD>
12761 <DT><A HREF="#lbCC">SIGNALS</A><DD>
12762 <DT><A HREF="#lbCD">JOB CONTROL</A><DD>
12763 <DT><A HREF="#lbCE">PROMPTING</A><DD>
12764 <DT><A HREF="#lbCF">READLINE</A><DD>
12765 <DL>
12766 <DT><A HREF="#lbCG">Readline Notation</A><DD>
12767 <DT><A HREF="#lbCH">Readline Initialization</A><DD>
12768 <DT><A HREF="#lbCI">Readline Key Bindings</A><DD>
12769 <DT><A HREF="#lbCJ">Readline Variables</A><DD>
12770 <DT><A HREF="#lbCK">Readline Conditional Constructs</A><DD>
12771 <DT><A HREF="#lbCL">Searching</A><DD>
12772 <DT><A HREF="#lbCM">Readline Command Names</A><DD>
12773 <DT><A HREF="#lbCN">Commands for Moving</A><DD>
12774 <DT><A HREF="#lbCO">Commands for Manipulating the History</A><DD>
12775 <DT><A HREF="#lbCP">Commands for Changing Text</A><DD>
12776 <DT><A HREF="#lbCQ">Killing and Yanking</A><DD>
12777 <DT><A HREF="#lbCR">Numeric Arguments</A><DD>
12778 <DT><A HREF="#lbCS">Completing</A><DD>
12779 <DT><A HREF="#lbCT">Keyboard Macros</A><DD>
12780 <DT><A HREF="#lbCU">Miscellaneous</A><DD>
12781 <DT><A HREF="#lbCV">Programmable Completion</A><DD>
12782 </DL>
12783 <DT><A HREF="#lbCW">HISTORY</A><DD>
12784 <DT><A HREF="#lbCX">HISTORY EXPANSION</A><DD>
12785 <DL>
12786 <DT><A HREF="#lbCY">Event Designators</A><DD>
12787 <DT><A HREF="#lbCZ">Word Designators</A><DD>
12788 <DT><A HREF="#lbDA">Modifiers</A><DD>
12789 </DL>
12790 <DT><A HREF="#lbDB">SHELL BUILTIN COMMANDS</A><DD>
12791 <DT><A HREF="#lbDC">RESTRICTED SHELL</A><DD>
12792 <DT><A HREF="#lbDD">SEE ALSO</A><DD>
12793 <DT><A HREF="#lbDE">FILES</A><DD>
12794 <DT><A HREF="#lbDF">AUTHORS</A><DD>
12795 <DT><A HREF="#lbDG">BUG REPORTS</A><DD>
12796 <DT><A HREF="#lbDH">BUGS</A><DD>
12797 </DL>
12798 <HR>
12799 This document was created by man2html from bash.1.<BR>
12800 Time: 28 December 2010 14:30:29 EST
12801 </BODY>
12802 </HTML>