Imported from ../bash-4.0.tar.gz.
[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%>2008 December 29<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-2009 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 In addition to the single-character shell options documented in the
71 description of the <B>set</B> builtin command, <B>bash</B>
72 interprets the following options when it is invoked:
73 <P>
74
75
76 <DL COMPACT>
77 <DT><B>-c</B><I> string</I>
78
79 <DD>
80 If the
81 <B>-c</B>
82
83 option is present, then commands are read from
84 <I>string</I>.
85
86 If there are arguments after the
87 <I>string</I>,
88
89 they are assigned to the positional parameters, starting with
90 <B>$0</B>.
91
92 <DT><B>-i</B>
93
94 <DD>
95 If the
96 <B>-i</B>
97
98 option is present, the shell is
99 <I>interactive</I>.
100
101 <DT><B>-l</B>
102
103 <DD>
104 Make
105 <B>bash</B>
106
107 act as if it had been invoked as a login shell (see
108 <FONT SIZE=-1><B>INVOCATION</B>
109
110 </FONT>
111 below).
112 <DT><B>-r</B>
113
114 <DD>
115 If the
116 <B>-r</B>
117
118 option is present, the shell becomes
119 <I>restricted</I>
120
121 (see
122 <FONT SIZE=-1><B>RESTRICTED SHELL</B>
123
124 </FONT>
125 below).
126 <DT><B>-s</B>
127
128 <DD>
129 If the
130 <B>-s</B>
131
132 option is present, or if no arguments remain after option
133 processing, then commands are read from the standard input.
134 This option allows the positional parameters to be set
135 when invoking an interactive shell.
136 <DT><B>-D</B>
137
138 <DD>
139 A list of all double-quoted strings preceded by <B>$</B>
140 is printed on the standard output.
141 These are the strings that
142 are subject to language translation when the current locale
143 is not <B>C</B> or <B>POSIX</B>.
144 This implies the <B>-n</B> option; no commands will be executed.
145 <DT><B>[-+]O [</B><I>shopt_option</I>]
146
147 <DD>
148 <I>shopt_option</I> is one of the shell options accepted by the
149 <B>shopt</B> builtin (see
150 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
151
152 </FONT>
153 below).
154 If <I>shopt_option</I> is present, <B>-O</B> sets the value of that option;
155 <B>+O</B> unsets it.
156 If <I>shopt_option</I> is not supplied, the names and values of the shell
157 options accepted by <B>shopt</B> are printed on the standard output.
158 If the invocation option is <B>+O</B>, the output is displayed in a format
159 that may be reused as input.
160 <DT><B>--</B>
161
162 <DD>
163 A
164 <B>--</B>
165
166 signals the end of options and disables further option processing.
167 Any arguments after the
168 <B>--</B>
169
170 are treated as filenames and arguments.  An argument of
171 <B>-</B>
172
173 is equivalent to <B>--</B>.
174
175 </DL>
176 <P>
177
178 <B>Bash</B>
179
180 also interprets a number of multi-character options.
181 These options must appear on the command line before the
182 single-character options to be recognized.
183 <P>
184
185
186 <DL COMPACT>
187 <DT><B>--debugger</B>
188
189 <DD>
190 Arrange for the debugger profile to be executed before the shell
191 starts.
192 Turns on extended debugging mode (see the description of the
193 <B>extdebug</B>
194
195 option to the
196 <B>shopt</B>
197
198 builtin below)
199 and shell function tracing (see the description of the
200 <B>-o functrace</B> option to the
201 <B>set</B>
202
203 builtin below).
204 <DT><B>--dump-po-strings</B>
205
206 <DD>
207 Equivalent to <B>-D</B>, but the output is in the GNU <I>gettext</I>
208 <B>po</B> (portable object) file format.
209 <DT><B>--dump-strings</B>
210
211 <DD>
212 Equivalent to <B>-D</B>.
213 <DT><B>--help</B>
214
215 <DD>
216 Display a usage message on standard output and exit successfully.
217 <DT><B>--init-file</B> <I>file</I><DD>
218
219 <DT><B>--rcfile</B> <I>file</I><DD>
220
221 Execute commands from
222 <I>file</I>
223
224 instead of the standard personal initialization file
225 <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>
226
227 if the shell is interactive (see
228 <FONT SIZE=-1><B>INVOCATION</B>
229
230 </FONT>
231 below).
232 <DT><B>--login</B>
233
234 <DD>
235 Equivalent to <B>-l</B>.
236 <DT><B>--noediting</B>
237
238 <DD>
239 Do not use the GNU
240 <B>readline</B>
241
242 library to read command lines when the shell is interactive.
243 <DT><B>--noprofile</B>
244
245 <DD>
246 Do not read either the system-wide startup file
247
248 <A HREF="file:/etc/profile"><I>/etc/profile</I></A>
249
250 or any of the personal initialization files
251 <A HREF="file:~/.bash_profile"><I>~/.bash_profile</I></A>,
252
253 <A HREF="file:~/.bash_login"><I>~/.bash_login</I></A>,
254
255 or
256 <A HREF="file:~/.profile"><I>~/.profile</I></A>.
257
258 By default,
259 <B>bash</B>
260
261 reads these files when it is invoked as a login shell (see
262 <FONT SIZE=-1><B>INVOCATION</B>
263
264 </FONT>
265 below).
266 <DT><B>--norc</B>
267
268 <DD>
269 Do not read and execute the personal initialization file
270 <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>
271
272 if the shell is interactive.
273 This option is on by default if the shell is invoked as
274 <B>sh</B>.
275
276 <DT><B>--posix</B>
277
278 <DD>
279 Change the behavior of <B>bash</B> where the default operation differs
280 from the POSIX standard to match the standard (<I>posix mode</I>).
281 <DT><B>--restricted</B>
282
283 <DD>
284 The shell becomes restricted (see
285 <FONT SIZE=-1><B>RESTRICTED SHELL</B>
286
287 </FONT>
288 below).
289 <DT><B>--verbose</B>
290
291 <DD>
292 Equivalent to  <B>-v</B>.
293 <DT><B>--version</B>
294
295 <DD>
296 Show version information for this instance of
297 <B>bash</B>
298
299 on the standard output and exit successfully.
300
301 </DL>
302 <A NAME="lbAG">&nbsp;</A>
303 <H3>ARGUMENTS</H3>
304
305 If arguments remain after option processing, and neither the
306 <B>-c</B>
307
308 nor the
309 <B>-s</B>
310
311 option has been supplied, the first argument is assumed to
312 be the name of a file containing shell commands.
313 If
314 <B>bash</B>
315
316 is invoked in this fashion, 
317 <B>$0</B>
318
319 is set to the name of the file, and the positional parameters
320 are set to the remaining arguments.
321 <B>Bash</B>
322
323 reads and executes commands from this file, then exits.
324 <B>Bash</B>'s exit status is the exit status of the last command
325 executed in the script.
326 If no commands are executed, the exit status is 0.
327 An attempt is first made to open the file in the current directory, and,
328 if no file is found, then the shell searches the directories in
329 <FONT SIZE=-1><B>PATH</B>
330
331 </FONT>
332 for the script.
333 <A NAME="lbAH">&nbsp;</A>
334 <H3>INVOCATION</H3>
335
336 A <I>login shell</I> is one whose first character of argument zero is a
337 <B>-</B>,
338
339 or one started with the 
340 <B>--login</B>
341
342 option.
343 <P>
344
345 An <I>interactive</I> shell is one started without non-option arguments
346 and without the
347 <B>-c</B>
348
349 option
350 whose standard input and error are
351 both connected to terminals (as determined by
352 <I>isatty</I>(3)),
353
354 or one started with the
355 <B>-i</B>
356
357 option.
358 <FONT SIZE=-1><B>PS1</B>
359
360 </FONT>
361 is set and
362 <B>$-</B>
363
364 includes
365 <B>i</B>
366
367 if
368 <B>bash</B>
369
370 is interactive,
371 allowing a shell script or a startup file to test this state.
372 <P>
373
374 The following paragraphs describe how
375 <B>bash</B>
376
377 executes its startup files.
378 If any of the files exist but cannot be read,
379 <B>bash</B>
380
381 reports an error.
382 Tildes are expanded in file names as described below under
383 <B>Tilde Expansion</B>
384
385 in the
386 <FONT SIZE=-1><B>EXPANSION</B>
387
388 </FONT>
389 section.
390 <P>
391
392 When
393 <B>bash</B>
394
395 is invoked as an interactive login shell, or as a non-interactive shell
396 with the <B>--login</B> option, it first reads and
397 executes commands from the file <A HREF="file:/etc/profile"><I>/etc/profile</I></A>, if that
398 file exists.
399 After reading that file, it looks for <A HREF="file:~/.bash_profile"><I>~/.bash_profile</I></A>,
400 <A HREF="file:~/.bash_login"><I>~/.bash_login</I></A>, and <A HREF="file:~/.profile"><I>~/.profile</I></A>, in that order, and reads
401 and executes commands from the first one that exists and is readable.
402 The
403 <B>--noprofile</B>
404
405 option may be used when the shell is started to inhibit this behavior.
406 <P>
407
408 When a login shell exits,
409 <B>bash</B>
410
411 reads and executes commands from the file <A HREF="file:~/.bash_logout"><I>~/.bash_logout</I></A>, if it
412 exists.
413 <P>
414
415 When an interactive shell that is not a login shell is started,
416 <B>bash</B>
417
418 reads and executes commands from <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>, if that file exists.
419 This may be inhibited by using the
420 <B>--norc</B>
421
422 option.
423 The <B>--rcfile</B> <I>file</I> option will force
424 <B>bash</B>
425
426 to read and execute commands from <I>file</I> instead of <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>.
427 <P>
428
429 When
430 <B>bash</B>
431
432 is started non-interactively, to run a shell script, for example, it
433 looks for the variable
434 <FONT SIZE=-1><B>BASH_ENV</B>
435
436 </FONT>
437 in the environment, expands its value if it appears there, and uses the
438 expanded value as the name of a file to read and execute.
439 <B>Bash</B>
440
441 behaves as if the following command were executed:
442 <P>
443 <DL COMPACT><DT><DD>
444 <TT>if [ -n &quot;$BASH_ENV&quot; ]; then . &quot;$BASH_ENV&quot;; fi</TT>
445
446 </DL>
447
448 <P>
449 but the value of the
450 <FONT SIZE=-1><B>PATH</B>
451
452 </FONT>
453 variable is not used to search for the file name.
454 <P>
455
456 If
457 <B>bash</B>
458
459 is invoked with the name
460 <B>sh</B>,
461
462 it tries to mimic the startup behavior of historical versions of
463 <B>sh</B>
464
465 as closely as possible,
466 while conforming to the POSIX standard as well.
467 When invoked as an interactive login shell, or a non-interactive
468 shell with the <B>--login</B> option, it first attempts to
469 read and execute commands from
470 <A HREF="file:/etc/profile"><I>/etc/profile</I></A>
471
472 and
473 <A HREF="file:~/.profile"><I>~/.profile</I></A>,
474
475 in that order.
476 The
477 <B>--noprofile</B>
478
479 option may be used to inhibit this behavior.
480 When invoked as an interactive shell with the name
481 <B>sh</B>,
482
483 <B>bash</B>
484
485 looks for the variable
486 <FONT SIZE=-1><B>ENV</B>,
487
488 </FONT>
489 expands its value if it is defined, and uses the
490 expanded value as the name of a file to read and execute.
491 Since a shell invoked as
492 <B>sh</B>
493
494 does not attempt to read and execute commands from any other startup
495 files, the
496 <B>--rcfile</B>
497
498 option has no effect.
499 A non-interactive shell invoked with the name
500 <B>sh</B>
501
502 does not attempt to read any other startup files. 
503 When invoked as
504 <B>sh</B>,
505
506 <B>bash</B>
507
508 enters
509 <I>posix</I>
510
511 mode after the startup files are read.
512 <P>
513
514 When
515 <B>bash</B>
516
517 is started in
518 <I>posix</I>
519
520 mode, as with the
521 <B>--posix</B>
522
523 command line option, it follows the POSIX standard for startup files.
524 In this mode, interactive shells expand the
525 <FONT SIZE=-1><B>ENV</B>
526
527 </FONT>
528 variable and commands are read and executed from the file
529 whose name is the expanded value.
530 No other startup files are read.
531 <P>
532
533 <B>Bash</B>
534
535 attempts to determine when it is being run with its standard input
536 connected to a a network connection, as if by the remote shell
537 daemon, usually <I>rshd</I>, or the secure shell daemon <I>sshd</I>.
538 If
539 <B>bash</B>
540
541 determines it is being run in this fashion, it reads and executes
542 commands from <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>, if that file exists and is readable.
543 It will not do this if invoked as <B>sh</B>.
544 The
545 <B>--norc</B>
546
547 option may be used to inhibit this behavior, and the
548 <B>--rcfile</B>
549
550 option may be used to force another file to be read, but
551 <I>rshd</I> does not generally invoke the shell with those options
552 or allow them to be specified.
553 <P>
554
555 If the shell is started with the effective user (group) id not equal to the
556 real user (group) id, and the <B>-p</B> option is not supplied, no startup
557 files are read, shell functions are not inherited from the environment, the
558 <FONT SIZE=-1><B>SHELLOPTS</B>
559
560 </FONT>
561 variable, if it appears in the environment, is ignored,
562 and the effective user id is set to the real user id.
563 If the <B>-p</B> option is supplied at invocation, the startup behavior is
564 the same, but the effective user id is not reset.
565 <A NAME="lbAI">&nbsp;</A>
566 <H3>DEFINITIONS</H3>
567
568 <P>
569
570 The following definitions are used throughout the rest of this
571 document.
572
573 <DL COMPACT>
574 <DT><B>blank </B>
575
576 <DD>
577 A space or tab.
578 <DT><B>word</B>
579
580 <DD>
581 A sequence of characters considered as a single unit by the shell.
582 Also known as a
583 <B>token</B>.
584
585 <DT><B>name</B>
586
587 <DD>
588
589 <I>word</I>
590
591 consisting only of alphanumeric characters and underscores, and
592 beginning with an alphabetic character or an underscore.  Also
593 referred to as an
594 <B>identifier</B>.
595
596 <DT><B>metacharacter</B>
597
598 <DD>
599 A character that, when unquoted, separates words.  One of the following:
600 <BR>
601
602 <DL COMPACT><DT><DD>
603 <P>
604
605 <B>|  &amp;  ;  (  )  &lt;  &gt;  space  tab</B>
606
607 </DL>
608
609 </DL>
610 <P>
611
612 <DL COMPACT>
613 <DT><B>control operator</B>
614
615 <DD>
616 A <I>token</I> that performs a control function.  It is one of the following
617 symbols:
618 <DL COMPACT><DT><DD>
619 <P>
620
621 <B>||  &amp;  &amp;&amp;  ;  ;;  (  )  |  |&amp;    &lt;newline&gt;</B>
622
623 </DL>
624
625
626 </DL>
627 <A NAME="lbAJ">&nbsp;</A>
628 <H3>RESERVED WORDS</H3>
629
630 <I>Reserved words</I> are words that have a special meaning to the shell.
631 The following words are recognized as reserved when unquoted and either
632 the first word of a simple command (see
633 <FONT SIZE=-1><B>SHELL GRAMMAR</B>
634
635 </FONT>
636 below) or the third word of a 
637 <B>case </B>
638
639 or
640 <B>for</B>
641
642 command:
643 <DL COMPACT><DT><DD>
644
645 <P>
646
647 <B>
648 </B>
649
650 !    case    do    done    elif    else    esac    fi    for    function    if    in    select    then    until    while    {    }    time    [[    ]]
651 </DL>
652
653
654 <A NAME="lbAK">&nbsp;</A>
655 <H3>SHELL GRAMMAR</H3>
656
657 <A NAME="lbAL">&nbsp;</A>
658 <H4>Simple Commands</H4>
659
660 <P>
661
662 A <I>simple command</I> is a sequence of optional variable assignments
663 followed by <B>blank</B>-separated words and redirections, and
664 terminated by a <I>control operator</I>.  The first word
665 specifies the command to be executed, and is passed as argument zero.
666 The remaining words are passed as arguments to the invoked command.
667 <P>
668
669 The return value of a <I>simple command</I> is its exit status, or
670 128+<I>n</I> if the command is terminated by signal
671 <I>n</I>.
672
673 <A NAME="lbAM">&nbsp;</A>
674 <H4>Pipelines</H4>
675
676 <P>
677
678 A <I>pipeline</I> is a sequence of one or more commands separated by
679 one of the control operators
680 <B>|</B>
681
682 or <B>|&amp;</B>.
683 The format for a pipeline is:
684 <DL COMPACT><DT><DD>
685 <P>
686
687 [<B>time</B> [<B>-p</B>]] [ ! ] <I>command</I> [ [<B>|</B>|<B>|&amp;</B>] <I>command2</I> ... ]
688 </DL>
689
690 <P>
691
692 The standard output of
693 <I>command</I>
694
695 is connected via a pipe to the standard input of
696 <I>command2</I>.
697
698 This connection is performed before any redirections specified by the
699 command (see
700 <FONT SIZE=-1><B>REDIRECTION</B>
701
702 </FONT>
703 below).
704 If <B>|&amp;</B> is used, the standard error of <I>command</I> is connected to
705 <I>command2</I>'s standard input through the pipe; it is shorthand for
706 <B>2&gt;&amp;1 |</B>.
707 This implicit redirection of the standard error is performed after any
708 redirections specified by the command.
709 <P>
710
711 The return status of a pipeline is the exit status of the last
712 command, unless the <B>pipefail</B> option is enabled.
713 If <B>pipefail</B> is enabled, the pipeline's return status is the
714 value of the last (rightmost) command to exit with a non-zero status,
715 or zero if all commands exit successfully.
716 If the reserved word
717 <B>!</B>
718
719 precedes a pipeline, the exit status of that pipeline is the logical
720 negation of the exit status as described above.
721 The shell waits for all commands in the pipeline to
722 terminate before returning a value.
723 <P>
724
725 If the
726 <B>time</B>
727
728 reserved word precedes a pipeline, the elapsed as well as user and
729 system time consumed by its execution are reported when the pipeline
730 terminates.
731 The <B>-p</B> option changes the output format to that specified by POSIX.
732 The
733 <FONT SIZE=-1><B>TIMEFORMAT</B>
734
735 </FONT>
736 variable may be set to a format string that specifies how the timing
737 information should be displayed; see the description of
738 <FONT SIZE=-1><B>TIMEFORMAT</B>
739
740 </FONT>
741 under
742 <B>Shell Variables</B>
743
744 below.
745 <P>
746
747 Each command in a pipeline is executed as a separate process (i.e., in a
748 subshell).
749 <A NAME="lbAN">&nbsp;</A>
750 <H4>Lists</H4>
751
752 <P>
753
754 A <I>list</I> is a sequence of one or more pipelines separated by one
755 of the operators
756 <B>;</B>,
757
758 <B>&amp;</B>,
759
760 <B>&amp;&amp;</B>,
761
762 or
763 <B>||</B>,
764
765 and optionally terminated by one of
766 <B>;</B>,
767
768 <B>&amp;</B>,
769
770 or
771 <B>&lt;newline&gt;</B>.
772
773 <P>
774
775 Of these list operators,
776 <B>&amp;&amp;</B>
777
778 and
779 <B>||</B>
780
781 have equal precedence, followed by
782 <B>;</B>
783
784 and
785 <B>&amp;</B>,
786
787 which have equal precedence.
788 <P>
789
790 A sequence of one or more newlines may appear in a <I>list</I> instead
791 of a semicolon to delimit commands.
792 <P>
793
794 If a command is terminated by the control operator
795 <B>&amp;</B>,
796
797 the shell executes the command in the <I>background</I>
798 in a subshell.  The shell does not wait for the command to
799 finish, and the return status is 0.  Commands separated by a
800 <B>;</B>
801
802 are executed sequentially; the shell waits for each
803 command to terminate in turn.  The return status is the
804 exit status of the last command executed.
805 <P>
806
807 AND and OR lists are sequences of one of more pipelines separated by the
808 <B>&amp;&amp;</B> and <B>||</B> control operators, respectively.
809 AND and OR lists are executed with left associativity.
810 An AND list has the form
811 <DL COMPACT><DT><DD>
812 <P>
813
814 <I>command1</I> <B>&amp;&amp;</B> <I>command2</I>
815 </DL>
816
817 <P>
818
819 <I>command2</I>
820
821 is executed if, and only if,
822 <I>command1</I>
823
824 returns an exit status of zero.
825 <P>
826
827 An OR list has the form
828 <DL COMPACT><DT><DD>
829 <P>
830
831 <I>command1</I> <B>||</B> <I>command2</I>
832 <P>
833
834 </DL>
835
836 <P>
837
838 <I>command2</I>
839
840 is executed if and only if
841 <I>command1</I>
842
843 returns a non-zero exit status.
844 The return status of
845 AND and OR lists is the exit status of the last command
846 executed in the list.
847 <A NAME="lbAO">&nbsp;</A>
848 <H4>Compound Commands</H4>
849
850 <P>
851
852 A <I>compound command</I> is one of the following:
853 <DL COMPACT>
854 <DT>(<I>list</I>)<DD>
855 <I>list</I> is executed in a subshell environment (see
856 <FONT SIZE=-1><B>COMMAND EXECUTION ENVIRONMENT</B></FONT>
857 below).
858 Variable assignments and builtin
859 commands that affect the shell's environment do not remain in effect
860 after the command completes.  The return status is the exit status of
861 <I>list</I>.
862 <DT>{ <I>list</I>; }<DD>
863 <I>list</I> is simply executed in the current shell environment.
864 <I>list</I> must be terminated with a newline or semicolon.
865 This is known as a <I>group command</I>.
866 The return status is the exit status of
867 <I>list</I>.
868 Note that unlike the metacharacters <B>(</B> and <B>)</B>, <B>{</B> and
869 <B>}</B> are <I>reserved words</I> and must occur where a reserved
870 word is permitted to be recognized.  Since they do not cause a word
871 break, they must be separated from <I>list</I> by whitespace or another
872 shell metacharacter.
873 <DT>((<I>expression</I>))<DD>
874 The <I>expression</I> is evaluated according to the rules described
875 below under
876 <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>.
877
878 </FONT>
879 If the value of the expression is non-zero, the return status is 0;
880 otherwise the return status is 1.  This is exactly equivalent to
881 <B>let &quot;</B><I>expression</I>&quot;.
882 <DT><B>[[</B> <I>expression</I> <B>]]</B><DD>
883 Return a status of 0 or 1 depending on the evaluation of
884 the conditional expression <I>expression</I>.
885 Expressions are composed of the primaries described below under
886 <FONT SIZE=-1><B>CONDITIONAL EXPRESSIONS</B>.
887
888 </FONT>
889 Word splitting and pathname expansion are not performed on the words
890 between the <B>[[</B> and <B>]]</B>; tilde expansion, parameter and
891 variable expansion, arithmetic expansion, command substitution, process
892 substitution, and quote removal are performed.
893 Conditional operators such as <B>-f</B> must be unquoted to be recognized
894 as primaries.
895 <P>
896
897
898 When the <B>==</B> and <B>!=</B> operators are used, the string to the
899 right of the operator is considered a pattern and matched according
900 to the rules described below under <B>Pattern Matching</B>.
901 If the shell option
902 <B>nocasematch</B>
903
904 is enabled, the match is performed without regard to the case
905 of alphabetic characters.
906 The return value is 0 if the string matches (<B>==</B>) or does not match
907 (<B>!=</B>) the pattern, and 1 otherwise.
908 Any part of the pattern may be quoted to force it to be matched as a
909 string.
910 <P>
911
912
913 An additional binary operator, <B>=~</B>, is available, with the same
914 precedence as <B>==</B> and <B>!=</B>.
915 When it is used, the string to the right of the operator is considered
916 an extended regular expression and matched accordingly (as in <I>regex</I>(3)).  
917 The return value is 0 if the string matches
918 the pattern, and 1 otherwise.
919 If the regular expression is syntactically incorrect, the conditional
920 expression's return value is 2.
921 If the shell option
922 <B>nocasematch</B>
923
924 is enabled, the match is performed without regard to the case
925 of alphabetic characters.
926 Any part of the pattern may be quoted to force it to be matched as a
927 string.
928 Substrings matched by parenthesized subexpressions within the regular
929 expression are saved in the array variable <B>BASH_REMATCH</B>.
930 The element of <B>BASH_REMATCH</B> with index 0 is the portion of the string
931 matching the entire regular expression.
932 The element of <B>BASH_REMATCH</B> with index <I>n</I> is the portion of the
933 string matching the <I>n</I>th parenthesized subexpression.
934 <P>
935
936
937 Expressions may be combined using the following operators, listed
938 in decreasing order of precedence:
939 <P>
940
941
942 <DL COMPACT><DT><DD>
943
944 <DL COMPACT>
945 <DT><B>( </B><I>expression</I> )
946
947 <DD>
948 Returns the value of <I>expression</I>.
949 This may be used to override the normal precedence of operators.
950 <DT><B>! </B><I>expression</I>
951
952 <DD>
953 True if
954 <I>expression</I>
955
956 is false.
957 <DT><I>expression1</I> <B>&amp;&amp;</B> <I>expression2</I><DD>
958 True if both
959 <I>expression1</I>
960
961 and
962 <I>expression2</I>
963
964 are true.
965 <DT><I>expression1</I> <B>||</B> <I>expression2</I>
966 <DD>
967
968 True if either
969 <I>expression1</I>
970
971 or
972 <I>expression2</I>
973
974 is true.
975
976 </DL>
977 <P>
978
979 The <B>&amp;&amp;</B> and
980 <B>||</B>
981
982 operators do not evaluate <I>expression2</I> if the value of
983 <I>expression1</I> is sufficient to determine the return value of
984 the entire conditional expression.
985 </DL>
986
987 <DT><B>for</B> <I>name</I> [ <B>in</B> <I>word</I> ] ; <B>do</B> <I>list</I> ; <B>done</B><DD>
988 The list of words following <B>in</B> is expanded, generating a list
989 of items.
990 The variable <I>name</I> is set to each element of this list
991 in turn, and <I>list</I> is executed each time.
992 If the <B>in</B> <I>word</I> is omitted, the <B>for</B> command executes
993 <I>list</I> once for each positional parameter that is set (see
994 <FONT SIZE=-1><B>PARAMETERS</B>
995
996 </FONT>
997 below).
998 The return status is the exit status of the last command that executes.
999 If the expansion of the items following <B>in</B> results in an empty
1000 list, no commands are executed, and the return status is 0.
1001 <DT><B>for</B> (( <I>expr1</I> ; <I>expr2</I> ; <I>expr3</I> )) ; <B>do</B> <I>list</I> ; <B>done</B><DD>
1002 First, the arithmetic expression <I>expr1</I> is evaluated according
1003 to the rules described below under
1004 <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>.
1005
1006 </FONT>
1007 The arithmetic expression <I>expr2</I> is then evaluated repeatedly
1008 until it evaluates to zero.
1009 Each time <I>expr2</I> evaluates to a non-zero value, <I>list</I> is
1010 executed and the arithmetic expression <I>expr3</I> is evaluated.
1011 If any expression is omitted, it behaves as if it evaluates to 1.
1012 The return value is the exit status of the last command in <I>list</I>
1013 that is executed, or false if any of the expressions is invalid.
1014 <DT><B>select</B> <I>name</I> [ <B>in</B> <I>word</I> ] ; <B>do</B> <I>list</I> ; <B>done</B><DD>
1015 The list of words following <B>in</B> is expanded, generating a list
1016 of items.  The set of expanded words is printed on the standard
1017 error, each preceded by a number.  If the <B>in</B>
1018 <I>word</I> is omitted, the positional parameters are printed (see
1019 <FONT SIZE=-1><B>PARAMETERS</B>
1020
1021 </FONT>
1022 below).  The
1023 <B>PS3</B>
1024
1025 prompt is then displayed and a line read from the standard input.
1026 If the line consists of a number corresponding to one of
1027 the displayed words, then the value of
1028 <I>name</I>
1029
1030 is set to that word.  If the line is empty, the words and prompt
1031 are displayed again.  If EOF is read, the command completes.  Any
1032 other value read causes
1033 <I>name</I>
1034
1035 to be set to null.  The line read is saved in the variable
1036 <B>REPLY</B>.
1037
1038 The
1039 <I>list</I>
1040
1041 is executed after each selection until a
1042 <B>break</B>
1043
1044 command is executed.
1045 The exit status of
1046 <B>select</B>
1047
1048 is the exit status of the last command executed in
1049 <I>list</I>,
1050
1051 or zero if no commands were executed.
1052 <DT><B>case</B> <I>word</I> <B>in</B> [ [(] <I>pattern</I> [ <B>|</B> <I>pattern</I> ] 
1053 <DD>
1054 A <B>case</B> command first expands <I>word</I>, and tries to match
1055 it against each <I>pattern</I> in turn, using the same matching rules
1056 as for pathname expansion (see
1057 <B>Pathname Expansion</B>
1058
1059 below).
1060 The <I>word</I> is expanded using tilde
1061 expansion, parameter and variable expansion, arithmetic substitution,
1062 command substitution, process substitution and quote removal.
1063 Each <I>pattern</I> examined is expanded using tilde
1064 expansion, parameter and variable expansion, arithmetic substitution,
1065 command substitution, and process substitution.
1066 If the shell option
1067 <B>nocasematch</B>
1068
1069 is enabled, the match is performed without regard to the case
1070 of alphabetic characters.
1071 When a match is found, the corresponding <I>list</I> is executed.
1072 If the <B>;;</B> operator is used, no subsequent matches are attempted after
1073 the first pattern match.
1074 Using <B>;&amp;</B> in place of <B>;;</B> causes execution to continue with
1075 the <I>list</I> associated with the next set of patterns.
1076 Using <B>;;&amp;</B> in place of <B>;;</B> causes the shell to test the next
1077 pattern list in the statement, if any, and execute any associated <I>list</I>
1078 on a successful match.
1079 The exit status is zero if no
1080 pattern matches.  Otherwise, it is the exit status of the
1081 last command executed in <I>list</I>.
1082 <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>
1083 The
1084 <B>if </B>
1085
1086 <I>list</I>
1087
1088 is executed.  If its exit status is zero, the
1089 <B>then</B> <I>list</I> is executed.  Otherwise, each <B>elif</B>
1090 <I>list</I> is executed in turn, and if its exit status is zero,
1091 the corresponding <B>then</B> <I>list</I> is executed and the
1092 command completes.  Otherwise, the <B>else</B> <I>list</I> is
1093 executed, if present.  The exit status is the exit status of the
1094 last command executed, or zero if no condition tested true.
1095 <DT><B>while</B> <I>list</I>; <B>do</B> <I>list</I>; <B>done</B><DD>
1096
1097 <DT><B>until</B> <I>list</I>; <B>do</B> <I>list</I>; <B>done</B><DD>
1098
1099 The <B>while</B> command continuously executes the <B>do</B>
1100 <I>list</I> as long as the last command in <I>list</I> returns
1101 an exit status of zero.  The <B>until</B> command is identical
1102 to the <B>while</B> command, except that the test is negated;
1103 the
1104 <B>do</B>
1105
1106 <I>list</I>
1107
1108 is executed as long as the last command in
1109 <I>list</I>
1110
1111 returns a non-zero exit status.
1112 The exit status of the <B>while</B> and <B>until</B> commands
1113 is the exit status
1114 of the last <B>do</B> <I>list</I> command executed, or zero if
1115 none was executed.
1116 </DL>
1117 <A NAME="lbAP">&nbsp;</A>
1118 <H4>Coprocesses</H4>
1119
1120 <P>
1121
1122 A <I>coprocess</I> is a shell command preceded by the <B>coproc</B> reserved
1123 word.
1124 A coprocess is executed asynchronously in a subshell, as if the command
1125 had been terminated with the <B>&amp;</B> control operator, with a two-way pipe
1126 established between the executing shell and the coprocess.
1127 <P>
1128
1129 The format for a coprocess is:
1130 <DL COMPACT><DT><DD>
1131 <P>
1132
1133 <B>coproc</B> [<I>NAME</I>] <I>command</I> [<I>redirections</I>]
1134 </DL>
1135
1136 <P>
1137
1138 This creates a coprocess named <I>NAME</I>.
1139 If <I>NAME</I> is not supplied, the default name is <I>COPROC</I>.
1140 <I>NAME</I> must not be supplied if <I>command</I> is a <I>simple
1141 command</I> (see above); otherwise, it is interpreted as the first word
1142 of the simple command.
1143 When the coproc is executed, the shell creates an array variable (see
1144 <B>Arrays</B>
1145
1146 below) named <I>NAME</I> in the context of the executing shell.
1147 The standard output of
1148 <I>command</I>
1149
1150 is connected via a pipe to a file descriptor in the executing shell,
1151 and that file descriptor is assigned to <I>NAME</I>[0].
1152 The standard input of
1153 <I>command</I>
1154
1155 is connected via a pipe to a file descriptor in the executing shell,
1156 and that file descriptor is assigned to <I>NAME</I>[1].
1157 This pipe is established before any redirections specified by the
1158 command (see
1159 <FONT SIZE=-1><B>REDIRECTION</B>
1160
1161 </FONT>
1162 below).
1163 The file descriptors can be utilized as arguments to shell commands
1164 and redirections using standard word expansions.
1165 The process id of the shell spawned to execute the coprocess is
1166 available as the value of the variable <I>NAME</I>_PID.
1167 The <B>wait</B>
1168 builtin command may be used to wait for the coprocess to terminate.
1169 <P>
1170
1171 The return status of a coprocess is the exit status of <I>command</I>.
1172 <A NAME="lbAQ">&nbsp;</A>
1173 <H4>Shell Function Definitions</H4>
1174
1175 <P>
1176
1177 A shell function is an object that is called like a simple command and
1178 executes a compound command with a new set of positional parameters.
1179 Shell functions are declared as follows:
1180 <DL COMPACT>
1181 <DT>[ <B>function</B> ] <I>name</I> () <I>compound-command</I> [<I>redirection</I>]<DD>
1182 This defines a function named <I>name</I>.
1183 The reserved word <B>function</B> is optional.
1184 If the <B>function</B> reserved word is supplied, the parentheses are optional.
1185 The <I>body</I> of the function is the compound command
1186 <I>compound-command </I>
1187
1188 (see <B>Compound Commands</B> above).
1189 That command is usually a <I>list</I> of commands between { and }, but
1190 may be any command listed under <B>Compound Commands</B> above.
1191 <I>compound-command</I> is executed whenever <I>name</I> is specified as the
1192 name of a simple command.
1193 Any redirections (see
1194 <FONT SIZE=-1><B>REDIRECTION</B>
1195
1196 </FONT>
1197 below) specified when a function is defined are performed
1198 when the function is executed.
1199 The exit status of a function definition is zero unless a syntax error
1200 occurs or a readonly function with the same name already exists.
1201 When executed, the exit status of a function is the exit status of the
1202 last command executed in the body.  (See
1203 <FONT SIZE=-1><B>FUNCTIONS</B>
1204
1205 </FONT>
1206 below.)
1207 </DL>
1208 <A NAME="lbAR">&nbsp;</A>
1209 <H3>COMMENTS</H3>
1210
1211 In a non-interactive shell, or an interactive shell in which the
1212 <B>interactive_comments</B>
1213
1214 option to the
1215 <B>shopt</B>
1216
1217 builtin is enabled (see
1218 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
1219
1220 </FONT>
1221 below), a word beginning with
1222 <B>#</B>
1223
1224 causes that word and all remaining characters on that line to
1225 be ignored.  An interactive shell without the
1226 <B>interactive_comments</B>
1227
1228 option enabled does not allow comments.  The
1229 <B>interactive_comments</B>
1230
1231 option is on by default in interactive shells.
1232 <A NAME="lbAS">&nbsp;</A>
1233 <H3>QUOTING</H3>
1234
1235 <I>Quoting</I> is used to remove the special meaning of certain
1236 characters or words to the shell.  Quoting can be used to 
1237 disable special treatment for special characters, to prevent
1238 reserved words from being recognized as such, and to prevent
1239 parameter expansion.
1240 <P>
1241
1242 Each of the <I>metacharacters</I> listed above under
1243 <FONT SIZE=-1><B>DEFINITIONS</B>
1244
1245 </FONT>
1246 has special meaning to the shell and must be quoted if it is to
1247 represent itself.
1248 <P>
1249
1250 When the command history expansion facilities are being used
1251 (see
1252 <FONT SIZE=-1><B>HISTORY EXPANSION</B>
1253
1254 </FONT>
1255 below), the
1256 <I>history expansion</I> character, usually <B>!</B>, must be quoted
1257 to prevent history expansion.
1258 <P>
1259
1260 There are three quoting mechanisms: the
1261 <I>escape character</I>,
1262
1263 single quotes, and double quotes.
1264 <P>
1265
1266 A non-quoted backslash (<B>\</B>) is the
1267 <I>escape character</I>.
1268
1269 It preserves the literal value of the next character that follows,
1270 with the exception of &lt;newline&gt;.  If a <B>\</B>&lt;newline&gt; pair
1271 appears, and the backslash is not itself quoted, the <B>\</B>&lt;newline&gt;
1272 is treated as a line continuation (that is, it is removed from the
1273 input stream and effectively ignored).
1274 <P>
1275
1276 Enclosing characters in single quotes preserves the literal value
1277 of each character within the quotes.  A single quote may not occur
1278 between single quotes, even when preceded by a backslash.
1279 <P>
1280
1281 Enclosing characters in double quotes preserves the literal value
1282 of all characters within the quotes, with the exception of
1283 <B>$</B>,
1284
1285 <B>`</B>,
1286
1287 <B>\</B>,
1288
1289 and, when history expansion is enabled,
1290 <B>!</B>.
1291
1292 The characters
1293 <B>$</B>
1294
1295 and
1296 <B>`</B>
1297
1298 retain their special meaning within double quotes.  The backslash
1299 retains its special meaning only when followed by one of the following
1300 characters:
1301 <B>$</B>,
1302
1303 <B>`</B>,
1304
1305 <B>&quot;</B>,
1306 <B>\</B>,
1307
1308 or
1309 <B>&lt;newline&gt;</B>.
1310
1311 A double quote may be quoted within double quotes by preceding it with
1312 a backslash.
1313 If enabled, history expansion will be performed unless an
1314 <B>!</B>
1315
1316 appearing in double quotes is escaped using a backslash.
1317 The backslash preceding the
1318 <B>!</B>
1319
1320 is not removed.
1321 <P>
1322
1323 The special parameters
1324 <B>*</B>
1325
1326 and
1327 <B>@</B>
1328
1329 have special meaning when in double
1330 quotes (see
1331 <FONT SIZE=-1><B>PARAMETERS</B>
1332
1333 </FONT>
1334 below).
1335 <P>
1336
1337 Words of the form <B>$</B>aq<I>string</I>aq are treated specially.  The
1338 word expands to <I>string</I>, with backslash-escaped characters replaced
1339 as specified by the ANSI C standard.  Backslash escape sequences, if
1340 present, are decoded as follows:
1341 <DL COMPACT><DT><DD>
1342
1343 <DL COMPACT>
1344 <DT><B>\a</B>
1345
1346 <DD>
1347 alert (bell)
1348 <DT><B>\b</B>
1349
1350 <DD>
1351 backspace
1352 <DT><B>\e</B>
1353
1354 <DD>
1355 an escape character
1356 <DT><B>\f</B>
1357
1358 <DD>
1359 form feed
1360 <DT><B>\n</B>
1361
1362 <DD>
1363 new line
1364 <DT><B>\r</B>
1365
1366 <DD>
1367 carriage return
1368 <DT><B>\t</B>
1369
1370 <DD>
1371 horizontal tab
1372 <DT><B>\v</B>
1373
1374 <DD>
1375 vertical tab
1376 <DT><B>\\</B>
1377
1378 <DD>
1379 backslash
1380 <DT><B>\aq</B>
1381
1382 <DD>
1383 single quote
1384 <DT><B>\</B><I>nnn</I>
1385
1386 <DD>
1387 the eight-bit character whose value is the octal value <I>nnn</I>
1388 (one to three digits)
1389 <DT><B>\x</B><I>HH</I>
1390
1391 <DD>
1392 the eight-bit character whose value is the hexadecimal value <I>HH</I>
1393 (one or two hex digits)
1394 <DT><B>\c</B><I>x</I>
1395
1396 <DD>
1397 a control-<I>x</I> character
1398
1399 </DL></DL>
1400
1401 <P>
1402
1403 The expanded result is single-quoted, as if the dollar sign had
1404 not been present.
1405 <P>
1406
1407 A double-quoted string preceded by a dollar sign (<B>$</B>) will cause
1408 the string to be translated according to the current locale.
1409 If the current locale is <B>C</B> or <B>POSIX</B>, the dollar sign
1410 is ignored.
1411 If the string is translated and replaced, the replacement is
1412 double-quoted.
1413 <A NAME="lbAT">&nbsp;</A>
1414 <H3>PARAMETERS</H3>
1415
1416 A
1417 <I>parameter</I>
1418
1419 is an entity that stores values.
1420 It can be a
1421 <I>name</I>,
1422
1423 a number, or one of the special characters listed below under
1424 <B>Special Parameters</B>.
1425
1426 A
1427 <I>variable</I>
1428
1429 is a parameter denoted by a
1430 <I>name</I>.
1431
1432 A variable has a <I>value</I> and zero or more <I>attributes</I>.
1433 Attributes are assigned using the
1434 <B>declare</B>
1435
1436 builtin command (see
1437 <B>declare</B>
1438
1439 below in
1440 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>).
1441
1442 </FONT>
1443 <P>
1444
1445 A parameter is set if it has been assigned a value.  The null string is
1446 a valid value.  Once a variable is set, it may be unset only by using
1447 the
1448 <B>unset</B>
1449
1450 builtin command (see
1451 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
1452
1453 </FONT>
1454 below).
1455 <P>
1456
1457 A
1458 <I>variable</I>
1459
1460 may be assigned to by a statement of the form
1461 <DL COMPACT><DT><DD>
1462 <P>
1463
1464 <I>name</I>=[<I>value</I>]
1465 </DL>
1466
1467 <P>
1468
1469 If
1470 <I>value</I>
1471
1472 is not given, the variable is assigned the null string.  All
1473 <I>values</I>
1474
1475 undergo tilde expansion, parameter and variable expansion,
1476 command substitution, arithmetic expansion, and quote
1477 removal (see
1478 <FONT SIZE=-1><B>EXPANSION</B>
1479
1480 </FONT>
1481 below).  If the variable has its
1482 <B>integer</B>
1483
1484 attribute set, then
1485 <I>value</I>
1486
1487 is evaluated as an arithmetic expression even if the $((...)) expansion is
1488 not used (see
1489 <B>Arithmetic Expansion</B>
1490
1491 below).
1492 Word splitting is not performed, with the exception
1493 of <B>&quot;$@&quot;</B> as explained below under
1494 <B>Special Parameters</B>.
1495
1496 Pathname expansion is not performed.
1497 Assignment statements may also appear as arguments to the
1498 <B>alias</B>,
1499
1500 <B>declare</B>,
1501
1502 <B>typeset</B>,
1503
1504 <B>export</B>,
1505
1506 <B>readonly</B>,
1507
1508 and
1509 <B>local</B>
1510
1511 builtin commands.
1512 <P>
1513
1514 In the context where an assignment statement is assigning a value
1515 to a shell variable or array index, the += operator can be used to
1516 append to or add to the variable's previous value.
1517 When += is applied to a variable for which the integer attribute has been
1518 set, <I>value</I> is evaluated as an arithmetic expression and added to the
1519 variable's current value, which is also evaluated.
1520 When += is applied to an array variable using compound assignment (see
1521 <B>Arrays</B>
1522
1523 below), the
1524 variable's value is not unset (as it is when using =), and new values are
1525 appended to the array beginning at one greater than the array's maximum index
1526 (for indexed arrays) or added as additional key-value pairs in an
1527 associative array.
1528 When applied to a string-valued variable, <I>value</I> is expanded and
1529 appended to the variable's value.
1530 <A NAME="lbAU">&nbsp;</A>
1531 <H4>Positional Parameters</H4>
1532
1533 <P>
1534
1535 A
1536 <I>positional parameter</I>
1537
1538 is a parameter denoted by one or more
1539 digits, other than the single digit 0.  Positional parameters are
1540 assigned from the shell's arguments when it is invoked,
1541 and may be reassigned using the
1542 <B>set</B>
1543
1544 builtin command.  Positional parameters may not be assigned to
1545 with assignment statements.  The positional parameters are
1546 temporarily replaced when a shell function is executed (see
1547 <FONT SIZE=-1><B>FUNCTIONS</B>
1548
1549 </FONT>
1550 below).
1551 <P>
1552
1553 When a positional parameter consisting of more than a single
1554 digit is expanded, it must be enclosed in braces (see
1555 <FONT SIZE=-1><B>EXPANSION</B>
1556
1557 </FONT>
1558 below).
1559 <A NAME="lbAV">&nbsp;</A>
1560 <H4>Special Parameters</H4>
1561
1562 <P>
1563
1564 The shell treats several parameters specially.  These parameters may
1565 only be referenced; assignment to them is not allowed.
1566
1567 <DL COMPACT>
1568 <DT><B>*</B>
1569
1570 <DD>
1571 Expands to the positional parameters, starting from one.  When the
1572 expansion occurs within double quotes, it expands to a single word
1573 with the value of each parameter separated by the first character
1574 of the 
1575 <FONT SIZE=-1><B>IFS</B>
1576
1577 </FONT>
1578 special variable.  That is, &quot;<B>$*</B>&quot; is equivalent
1579 to &quot;<B>$1</B><I>c</I><B>$2</B><I>c</I><B>...</B>&quot;, where
1580 <I>c</I>
1581
1582 is the first character of the value of the
1583 <FONT SIZE=-1><B>IFS</B>
1584
1585 </FONT>
1586 variable.  If
1587 <FONT SIZE=-1><B>IFS</B>
1588
1589 </FONT>
1590 is unset, the parameters are separated by spaces.
1591 If
1592 <FONT SIZE=-1><B>IFS</B>
1593
1594 </FONT>
1595 is null, the parameters are joined without intervening separators.
1596 <DT><B>@</B>
1597
1598 <DD>
1599 Expands to the positional parameters, starting from one.  When the
1600 expansion occurs within double quotes, each parameter expands to a
1601 separate word.  That is, &quot;<B>$@</B>&quot; is equivalent to
1602 &quot;<B>$1</B>&quot; &quot;<B>$2</B>&quot; ...
1603 If the double-quoted expansion occurs within a word, the expansion of
1604 the first parameter is joined with the beginning part of the original
1605 word, and the expansion of the last parameter is joined with the last
1606 part of the original word.
1607 When there are no positional parameters, &quot;<B>$@</B>&quot; and 
1608 <B>$@</B>
1609
1610 expand to nothing (i.e., they are removed).
1611 <DT><B>#</B>
1612
1613 <DD>
1614 Expands to the number of positional parameters in decimal.
1615 <DT><B>?</B>
1616
1617 <DD>
1618 Expands to the exit status of the most recently executed foreground
1619 pipeline.
1620 <DT><B>-</B>
1621
1622 <DD>
1623 Expands to the current option flags as specified upon invocation, 
1624 by the
1625 <B>set</B>
1626
1627 builtin command, or those set by the shell itself
1628 (such as the
1629 <B>-i</B>
1630
1631 option).
1632 <DT><B>$</B>
1633
1634 <DD>
1635 Expands to the process ID of the shell.  In a () subshell, it
1636 expands to the process ID of the current shell, not the
1637 subshell.
1638 <DT><B>!</B>
1639
1640 <DD>
1641 Expands to the process ID of the most recently executed background
1642 (asynchronous) command.
1643 <DT><B>0</B>
1644
1645 <DD>
1646 Expands to the name of the shell or shell script.  This is set at
1647 shell initialization.  If
1648 <B>bash</B>
1649
1650 is invoked with a file of commands,
1651 <B>$0</B>
1652
1653 is set to the name of that file.  If
1654 <B>bash</B>
1655
1656 is started with the
1657 <B>-c</B>
1658
1659 option, then
1660 <B>$0</B>
1661
1662 is set to the first argument after the string to be
1663 executed, if one is present.  Otherwise, it is set
1664 to the file name used to invoke
1665 <B>bash</B>,
1666
1667 as given by argument zero.
1668 <DT><B>_</B>
1669
1670 <DD>
1671 At shell startup, set to the absolute pathname used to invoke the
1672 shell or shell script being executed as passed in the environment
1673 or argument list.
1674 Subsequently, expands to the last argument to the previous command,
1675 after expansion.
1676 Also set to the full pathname used to invoke each command executed
1677 and placed in the environment exported to that command.
1678 When checking mail, this parameter holds the name of the mail file
1679 currently being checked.
1680
1681 </DL>
1682 <A NAME="lbAW">&nbsp;</A>
1683 <H4>Shell Variables</H4>
1684
1685 <P>
1686
1687 The following variables are set by the shell:
1688 <P>
1689
1690
1691 <DL COMPACT>
1692 <DT><B>BASH</B>
1693
1694 <DD>
1695 Expands to the full file name used to invoke this instance of
1696 <B>bash</B>.
1697
1698 <DT><B>BASHPID</B>
1699
1700 <DD>
1701 Expands to the process id of the current <B>bash</B> process.
1702 This differs from <B>$$</B> under certain circumstances, such as subshells
1703 that do not require <B>bash</B> to be re-initialized.
1704 <DT><B>BASH_ALIASES</B>
1705
1706 <DD>
1707 An associative array variable whose members correspond to the internal
1708 list of aliases as maintained by the <B>alias</B> builtin
1709 Elements added to this array appear in the alias list; unsetting array
1710 elements cause aliases to be removed from the alias list.
1711 <DT><B>BASH_ARGC</B>
1712
1713 <DD>
1714 An array variable whose values are the number of parameters in each
1715 frame of the current <B>bash</B> execution call stack.
1716 The number of
1717 parameters to the current subroutine (shell function or script executed
1718 with <B>.</B> or <B>source</B>) is at the top of the stack.
1719 When a subroutine is executed, the number of parameters passed is pushed onto
1720 <B>BASH_ARGC</B>.
1721 The shell sets <B>BASH_ARGC</B> only when in extended debugging mode
1722 (see the description of the
1723 <B>extdebug</B>
1724
1725 option to the
1726 <B>shopt</B>
1727
1728 builtin below)
1729 <DT><B>BASH_ARGV</B>
1730
1731 <DD>
1732 An array variable containing all of the parameters in the current <B>bash</B>
1733 execution call stack.  The final parameter of the last subroutine call
1734 is at the top of the stack; the first parameter of the initial call is
1735 at the bottom.  When a subroutine is executed, the parameters supplied
1736 are pushed onto <B>BASH_ARGV</B>.
1737 The shell sets <B>BASH_ARGV</B> only when in extended debugging mode
1738 (see the description of the
1739 <B>extdebug</B>
1740
1741 option to the
1742 <B>shopt</B>
1743
1744 builtin below)
1745 <DT><B>BASH_CMDS</B>
1746
1747 <DD>
1748 An associative array variable whose members correspond to the internal
1749 hash table of commands as maintained by the <B>hash</B> builtin.
1750 Elements added to this array appear in the hash table; unsetting array
1751 elements cause commands to be removed from the hash table.
1752 <DT><B>BASH_COMMAND</B>
1753
1754 <DD>
1755 The command currently being executed or about to be executed, unless the
1756 shell is executing a command as the result of a trap,
1757 in which case it is the command executing at the time of the trap.
1758 <DT><B>BASH_EXECUTION_STRING</B>
1759
1760 <DD>
1761 The command argument to the <B>-c</B> invocation option.
1762 <DT><B>BASH_LINENO</B>
1763
1764 <DD>
1765 An array variable whose members are the line numbers in source files
1766 corresponding to each member of <B>FUNCNAME</B>.
1767 <B>${BASH_LINENO[</B><I>$i</I><B>]}</B> is the line number in the source
1768 file where <B>${FUNCNAME[</B><I>$i</I><B>]}</B> was called
1769 (or <B>${BASH_LINENO[</B><I>$i-1</I><B>]}</B> if referenced within another
1770 shell function).
1771 The corresponding source file name is <B>${BASH_SOURCE[</B><I>$i</I><B>]}.
1772 Use LINENO</B> to obtain the current line number.
1773 <DT><B>BASH_REMATCH</B>
1774
1775 <DD>
1776 An array variable whose members are assigned by the <B>=~</B> binary
1777 operator to the <B>[[</B> conditional command.
1778 The element with index 0 is the portion of the string
1779 matching the entire regular expression.
1780 The element with index <I>n</I> is the portion of the
1781 string matching the <I>n</I>th parenthesized subexpression.
1782 This variable is read-only.
1783 <DT><B>BASH_SOURCE</B>
1784
1785 <DD>
1786 An array variable whose members are the source filenames corresponding
1787 to the elements in the <B>FUNCNAME</B> array variable.
1788 <DT><B>BASH_SUBSHELL</B>
1789
1790 <DD>
1791 Incremented by one each time a subshell or subshell environment is spawned.
1792 The initial value is 0.
1793 <DT><B>BASH_VERSINFO</B>
1794
1795 <DD>
1796 A readonly array variable whose members hold version information for
1797 this instance of
1798 <B>bash</B>.
1799
1800 The values assigned to the array members are as follows:
1801 <P>
1802 <DL COMPACT><DT><DD>
1803
1804 <DL COMPACT>
1805 <DT><B>BASH_VERSINFO[</B>0]
1806
1807 <DD>
1808 The major version number (the <I>release</I>).
1809 <DT><B>BASH_VERSINFO[</B>1]
1810
1811 <DD>
1812 The minor version number (the <I>version</I>).
1813 <DT><B>BASH_VERSINFO[</B>2]
1814
1815 <DD>
1816 The patch level.
1817 <DT><B>BASH_VERSINFO[</B>3]
1818
1819 <DD>
1820 The build version.
1821 <DT><B>BASH_VERSINFO[</B>4]
1822
1823 <DD>
1824 The release status (e.g., <I>beta1</I>).
1825 <DT><B>BASH_VERSINFO[</B>5]
1826
1827 <DD>
1828 The value of <B>MACHTYPE</B>.
1829
1830 </DL></DL>
1831
1832 <DT><B>BASH_VERSION</B>
1833
1834 <DD>
1835 Expands to a string describing the version of this instance of
1836 <B>bash</B>.
1837
1838 <DT><B>COMP_CWORD</B>
1839
1840 <DD>
1841 An index into <B>${COMP_WORDS}</B> of the word containing the current
1842 cursor position.
1843 This variable is available only in shell functions invoked by the
1844 programmable completion facilities (see <B>Programmable Completion</B>
1845 below).
1846 <DT><B>COMP_KEY</B>
1847
1848 <DD>
1849 The key (or final key of a key sequence) used to invoke the current
1850 completion function.
1851 <DT><B>COMP_LINE</B>
1852
1853 <DD>
1854 The current command line.
1855 This variable is available only in shell functions and external
1856 commands invoked by the
1857 programmable completion facilities (see <B>Programmable Completion</B>
1858 below).
1859 <DT><B>COMP_POINT</B>
1860
1861 <DD>
1862 The index of the current cursor position relative to the beginning of
1863 the current command.
1864 If the current cursor position is at the end of the current command,
1865 the value of this variable is equal to <B>${#COMP_LINE}</B>.
1866 This variable is available only in shell functions and external
1867 commands invoked by the
1868 programmable completion facilities (see <B>Programmable Completion</B>
1869 below).
1870 <DT><B>COMP_TYPE</B>
1871
1872 <DD>
1873 Set to an integer value corresponding to the type of completion attempted
1874 that caused a completion function to be called:
1875 <I>TAB</I>, for normal completion,
1876 <I>?</I>, for listing completions after successive tabs,
1877 <I>!</I>, for listing alternatives on partial word completion,
1878 <I>@</I>, to list completions if the word is not unmodified,
1879 or
1880 <I>%</I>, for menu completion.
1881 This variable is available only in shell functions and external
1882 commands invoked by the
1883 programmable completion facilities (see <B>Programmable Completion</B>
1884 below).
1885 <DT><B>COMP_WORDBREAKS</B>
1886
1887 <DD>
1888 The set of characters that the Readline library treats as word
1889 separators when performing word completion.
1890 If
1891 <FONT SIZE=-1><B>COMP_WORDBREAKS</B>
1892
1893 </FONT>
1894 is unset, it loses its special properties, even if it is
1895 subsequently reset.
1896 <DT><B>COMP_WORDS</B>
1897
1898 <DD>
1899 An array variable (see <B>Arrays</B> below) consisting of the individual
1900 words in the current command line.
1901 The words are split on shell metacharacters as the shell parser would
1902 separate them.
1903 This variable is available only in shell functions invoked by the
1904 programmable completion facilities (see <B>Programmable Completion</B>
1905 below).
1906 <DT><B>DIRSTACK</B>
1907
1908 <DD>
1909 An array variable (see
1910 <B>Arrays</B>
1911
1912 below) containing the current contents of the directory stack.
1913 Directories appear in the stack in the order they are displayed by the
1914 <B>dirs</B>
1915
1916 builtin.
1917 Assigning to members of this array variable may be used to modify
1918 directories already in the stack, but the
1919 <B>pushd</B>
1920
1921 and
1922 <B>popd</B>
1923
1924 builtins must be used to add and remove directories.
1925 Assignment to this variable will not change the current directory.
1926 If
1927 <FONT SIZE=-1><B>DIRSTACK</B>
1928
1929 </FONT>
1930 is unset, it loses its special properties, even if it is
1931 subsequently reset.
1932 <DT><B>EUID</B>
1933
1934 <DD>
1935 Expands to the effective user ID of the current user, initialized at
1936 shell startup.  This variable is readonly.
1937 <DT><B>FUNCNAME</B>
1938
1939 <DD>
1940 An array variable containing the names of all shell functions
1941 currently in the execution call stack.
1942 The element with index 0 is the name of any currently-executing
1943 shell function.
1944 The bottom-most element is
1945 <TT>&quot;main&quot;</TT>.
1946
1947 This variable exists only when a shell function is executing.
1948 Assignments to
1949 <FONT SIZE=-1><B>FUNCNAME</B>
1950
1951 </FONT>
1952 have no effect and return an error status.
1953 If
1954 <FONT SIZE=-1><B>FUNCNAME</B>
1955
1956 </FONT>
1957 is unset, it loses its special properties, even if it is
1958 subsequently reset.
1959 <DT><B>GROUPS</B>
1960
1961 <DD>
1962 An array variable containing the list of groups of which the current
1963 user is a member.
1964 Assignments to    
1965 <FONT SIZE=-1><B>GROUPS</B>
1966
1967 </FONT>
1968 have no effect and return an error status.
1969 If
1970 <FONT SIZE=-1><B>GROUPS</B>
1971
1972 </FONT>
1973 is unset, it loses its special properties, even if it is
1974 subsequently reset.
1975 <DT><B>HISTCMD</B>
1976
1977 <DD>
1978 The history number, or index in the history list, of the current
1979 command.
1980 If
1981 <FONT SIZE=-1><B>HISTCMD</B>
1982
1983 </FONT>
1984 is unset, it loses its special properties, even if it is
1985 subsequently reset.
1986 <DT><B>HOSTNAME</B>
1987
1988 <DD>
1989 Automatically set to the name of the current host.
1990 <DT><B>HOSTTYPE</B>
1991
1992 <DD>
1993 Automatically set to a string that uniquely
1994 describes the type of machine on which
1995 <B>bash</B>
1996
1997 is executing.
1998 The default is system-dependent.
1999 <DT><B>LINENO</B>
2000
2001 <DD>
2002 Each time this parameter is referenced, the shell substitutes
2003 a decimal number representing the current sequential line number
2004 (starting with 1) within a script or function.  When not in a
2005 script or function, the value substituted is not guaranteed to
2006 be meaningful.
2007 If
2008 <FONT SIZE=-1><B>LINENO</B>
2009
2010 </FONT>
2011 is unset, it loses its special properties, even if it is
2012 subsequently reset.
2013 <DT><B>MACHTYPE</B>
2014
2015 <DD>
2016 Automatically set to a string that fully describes the system
2017 type on which
2018 <B>bash</B>
2019
2020 is executing, in the standard GNU <I>cpu-company-system</I> format.
2021 The default is system-dependent.
2022 <DT><B>OLDPWD</B>
2023
2024 <DD>
2025 The previous working directory as set by the
2026 <B>cd</B>
2027
2028 command.
2029 <DT><B>OPTARG</B>
2030
2031 <DD>
2032 The value of the last option argument processed by the
2033 <B>getopts</B>
2034
2035 builtin command (see
2036 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
2037
2038 </FONT>
2039 below).
2040 <DT><B>OPTIND</B>
2041
2042 <DD>
2043 The index of the next argument to be processed by the
2044 <B>getopts</B>
2045
2046 builtin command (see
2047 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
2048
2049 </FONT>
2050 below).
2051 <DT><B>OSTYPE</B>
2052
2053 <DD>
2054 Automatically set to a string that
2055 describes the operating system on which
2056 <B>bash</B>
2057
2058 is executing.
2059 The default is system-dependent.
2060 <DT><B>PIPESTATUS</B>
2061
2062 <DD>
2063 An array variable (see
2064 <B>Arrays</B>
2065
2066 below) containing a list of exit status values from the processes
2067 in the most-recently-executed foreground pipeline (which may
2068 contain only a single command).
2069 <DT><B>PPID</B>
2070
2071 <DD>
2072 The process ID of the shell's parent.  This variable is readonly.
2073 <DT><B>PWD</B>
2074
2075 <DD>
2076 The current working directory as set by the
2077 <B>cd</B>
2078
2079 command.
2080 <DT><B>RANDOM</B>
2081
2082 <DD>
2083 Each time this parameter is referenced, a random integer between
2084 0 and 32767 is
2085 generated.  The sequence of random numbers may be initialized by assigning
2086 a value to
2087 <FONT SIZE=-1><B>RANDOM</B>.
2088
2089 </FONT>
2090 If
2091 <FONT SIZE=-1><B>RANDOM</B>
2092
2093 </FONT>
2094 is unset, it loses its special properties, even if it is
2095 subsequently reset.
2096 <DT><B>REPLY</B>
2097
2098 <DD>
2099 Set to the line of input read by the
2100 <B>read</B>
2101
2102 builtin command when no arguments are supplied.
2103 <DT><B>SECONDS</B>
2104
2105 <DD>
2106 Each time this parameter is
2107 referenced, the number of seconds since shell invocation is returned.  If a
2108 value is assigned to 
2109 <FONT SIZE=-1><B>SECONDS</B>,
2110
2111 </FONT>
2112 the value returned upon subsequent
2113 references is
2114 the number of seconds since the assignment plus the value assigned.
2115 If
2116 <FONT SIZE=-1><B>SECONDS</B>
2117
2118 </FONT>
2119 is unset, it loses its special properties, even if it is
2120 subsequently reset.
2121 <DT><B>SHELLOPTS</B>
2122
2123 <DD>
2124 A colon-separated list of enabled shell options.  Each word in
2125 the list is a valid argument for the
2126 <B>-o</B>
2127
2128 option to the
2129 <B>set</B>
2130
2131 builtin command (see
2132 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
2133
2134 </FONT>
2135 below).  The options appearing in
2136 <FONT SIZE=-1><B>SHELLOPTS</B>
2137
2138 </FONT>
2139 are those reported as
2140 <I>on</I>
2141
2142 by <B>set -o</B>.
2143 If this variable is in the environment when
2144 <B>bash</B>
2145
2146 starts up, each shell option in the list will be enabled before
2147 reading any startup files.
2148 This variable is read-only.
2149 <DT><B>SHLVL</B>
2150
2151 <DD>
2152 Incremented by one each time an instance of
2153 <B>bash</B>
2154
2155 is started.
2156 <DT><B>UID</B>
2157
2158 <DD>
2159 Expands to the user ID of the current user, initialized at shell startup.
2160 This variable is readonly.
2161
2162 </DL>
2163 <P>
2164
2165 The following variables are used by the shell.  In some cases,
2166 <B>bash</B>
2167
2168 assigns a default value to a variable; these cases are noted
2169 below.
2170 <P>
2171
2172
2173 <DL COMPACT>
2174 <DT><B>BASH_ENV</B>
2175
2176 <DD>
2177 If this parameter is set when <B>bash</B> is executing a shell script,
2178 its value is interpreted as a filename containing commands to
2179 initialize the shell, as in
2180 <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>.
2181
2182 The value of
2183 <FONT SIZE=-1><B>BASH_ENV</B>
2184
2185 </FONT>
2186 is subjected to parameter expansion, command substitution, and arithmetic
2187 expansion before being interpreted as a file name.
2188 <FONT SIZE=-1><B>PATH</B>
2189
2190 </FONT>
2191 is not used to search for the resultant file name.
2192 <DT><B>CDPATH</B>
2193
2194 <DD>
2195 The search path for the
2196 <B>cd</B>
2197
2198 command.
2199 This is a colon-separated list of directories in which the shell looks
2200 for destination directories specified by the
2201 <B>cd</B>
2202
2203 command.
2204 A sample value is
2205 <TT>&quot;.:~:/usr&quot;</TT>.
2206
2207 <DT><B>COLUMNS</B>
2208
2209 <DD>
2210 Used by the <B>select</B> builtin command to determine the terminal width
2211 when printing selection lists.  Automatically set upon receipt of a SIGWINCH.
2212 <DT><B>COMPREPLY</B>
2213
2214 <DD>
2215 An array variable from which <B>bash</B> reads the possible completions
2216 generated by a shell function invoked by the programmable completion
2217 facility (see <B>Programmable Completion</B> below).
2218 <DT><B>EMACS</B>
2219
2220 <DD>
2221 If <B>bash</B> finds this variable in the environment when the shell starts
2222 with value
2223 <TT>t</TT>,
2224
2225 it assumes that the shell is running in an emacs shell buffer and disables
2226 line editing.
2227 <DT><B>FCEDIT</B>
2228
2229 <DD>
2230 The default editor for the
2231 <B>fc</B>
2232
2233 builtin command.
2234 <DT><B>FIGNORE</B>
2235
2236 <DD>
2237 A colon-separated list of suffixes to ignore when performing
2238 filename completion (see
2239 <FONT SIZE=-1><B>READLINE</B>
2240
2241 </FONT>
2242 below).
2243 A filename whose suffix matches one of the entries in 
2244 <FONT SIZE=-1><B>FIGNORE</B>
2245
2246 </FONT>
2247 is excluded from the list of matched filenames.
2248 A sample value is
2249 <TT>&quot;.o:~&quot;</TT>.
2250
2251 <DT><B>GLOBIGNORE</B>
2252
2253 <DD>
2254 A colon-separated list of patterns defining the set of filenames to
2255 be ignored by pathname expansion.
2256 If a filename matched by a pathname expansion pattern also matches one
2257 of the patterns in
2258 <FONT SIZE=-1><B>GLOBIGNORE</B>,
2259
2260 </FONT>
2261 it is removed from the list of matches.
2262 <DT><B>HISTCONTROL</B>
2263
2264 <DD>
2265 A colon-separated list of values controlling how commands are saved on
2266 the history list.
2267 If the list of values includes
2268 <I>ignorespace</I>,
2269
2270 lines which begin with a
2271 <B>space</B>
2272
2273 character are not saved in the history list.
2274 A value of 
2275 <I>ignoredups</I>
2276
2277 causes lines matching the previous history entry to not be saved.
2278 A value of
2279 <I>ignoreboth</I>
2280
2281 is shorthand for <I>ignorespace</I> and <I>ignoredups</I>.
2282 A value of
2283 <I>erasedups</I>
2284
2285 causes all previous lines matching the current line to be removed from
2286 the history list before that line is saved.
2287 Any value not in the above list is ignored.
2288 If <B>HISTCONTROL</B> is unset, or does not include a valid value,
2289 all lines read by the shell parser are saved on the history list,
2290 subject to the value of
2291 <B>HISTIGNORE</B>.
2292
2293 The second and subsequent lines of a multi-line compound command are
2294 not tested, and are added to the history regardless of the value of
2295 <B>HISTCONTROL</B>.
2296
2297 <DT><B>HISTFILE</B>
2298
2299 <DD>
2300 The name of the file in which command history is saved (see
2301 <FONT SIZE=-1><B>HISTORY</B>
2302
2303 </FONT>
2304 below).  The default value is <A HREF="file:~/.bash_history"><I>~/.bash_history</I></A>.  If unset, the
2305 command history is not saved when an interactive shell exits.
2306 <DT><B>HISTFILESIZE</B>
2307
2308 <DD>
2309 The maximum number of lines contained in the history file.  When this
2310 variable is assigned a value, the history file is truncated, if
2311 necessary, by removing the oldest entries,
2312 to contain no more than that number of lines.  The default
2313 value is 500.  The history file is also truncated to this size after
2314 writing it when an interactive shell exits.
2315 <DT><B>HISTIGNORE</B>
2316
2317 <DD>
2318 A colon-separated list of patterns used to decide which command lines
2319 should be saved on the history list.  Each pattern is anchored at the
2320 beginning of the line and must match the complete line (no implicit
2321 `<B>*</B>' is appended).  Each pattern is tested against the line
2322 after the checks specified by
2323 <B>HISTCONTROL</B>
2324
2325 are applied.
2326 In addition to the normal shell pattern matching characters, `<B>&amp;</B>'
2327 matches the previous history line.  `<B>&amp;</B>' may be escaped using a
2328 backslash; the backslash is removed before attempting a match.
2329 The second and subsequent lines of a multi-line compound command are
2330 not tested, and are added to the history regardless of the value of
2331 <B>HISTIGNORE</B>.
2332
2333 <DT><B>HISTSIZE</B>
2334
2335 <DD>
2336 The number of commands to remember in the command history (see
2337 <FONT SIZE=-1><B>HISTORY</B>
2338
2339 </FONT>
2340 below).  The default value is 500.
2341 <DT><B>HISTTIMEFORMAT</B>
2342
2343 <DD>
2344 If this variable is set and not null, its value is used as a format string
2345 for <I>strftime</I>(3) to print the time stamp associated with each history
2346 entry displayed by the <B>history</B> builtin.
2347 If this variable is set, time stamps are written to the history file so
2348 they may be preserved across shell sessions.
2349 This uses the history comment character to distinguish timestamps from
2350 other history lines.
2351 <DT><B>HOME</B>
2352
2353 <DD>
2354 The home directory of the current user; the default argument for the
2355 <B>cd</B> builtin command.
2356 The value of this variable is also used when performing tilde expansion.
2357 <DT><B>HOSTFILE</B>
2358
2359 <DD>
2360 Contains the name of a file in the same format as
2361
2362 <I>/etc/hosts</I>
2363
2364 that should be read when the shell needs to complete a
2365 hostname.
2366 The list of possible hostname completions may be changed while the
2367 shell is running;
2368 the next time hostname completion is attempted after the
2369 value is changed,
2370 <B>bash</B>
2371
2372 adds the contents of the new file to the existing list.
2373 If
2374 <FONT SIZE=-1><B>HOSTFILE</B>
2375
2376 </FONT>
2377 is set, but has no value, <B>bash</B> attempts to read
2378
2379 <I>/etc/hosts</I>
2380
2381 to obtain the list of possible hostname completions.
2382 When
2383 <FONT SIZE=-1><B>HOSTFILE</B>
2384
2385 </FONT>
2386 is unset, the hostname list is cleared.
2387 <DT><B>IFS</B>
2388
2389 <DD>
2390 The
2391 <I>Internal Field Separator</I>
2392
2393 that is used
2394 for word splitting after expansion and to
2395 split lines into words with the
2396 <B>read</B>
2397
2398 builtin command.  The default value is
2399 ``&lt;space&gt;&lt;tab&gt;&lt;newline&gt;''.
2400 <DT><B>IGNOREEOF</B>
2401
2402 <DD>
2403 Controls the
2404 action of an interactive shell on receipt of an
2405 <FONT SIZE=-1><B>EOF</B>
2406
2407 </FONT>
2408 character as the sole input.  If set, the value is the number of
2409 consecutive
2410 <FONT SIZE=-1><B>EOF</B>
2411
2412 </FONT>
2413 characters which must be
2414 typed as the first characters on an input line before
2415 <B>bash</B>
2416
2417 exits.  If the variable exists but does not have a numeric value, or
2418 has no value, the default value is 10.  If it does not exist,
2419 <FONT SIZE=-1><B>EOF</B>
2420
2421 </FONT>
2422 signifies the end of input to the shell.
2423 <DT><B>INPUTRC</B>
2424
2425 <DD>
2426 The filename for the
2427 <B>readline</B>
2428
2429 startup file, overriding the default of
2430
2431 <A HREF="file:~/.inputrc"><I>~/.inputrc</I></A>
2432
2433 (see
2434 <FONT SIZE=-1><B>READLINE</B>
2435
2436 </FONT>
2437 below).
2438 <DT><B>LANG</B>
2439
2440 <DD>
2441 Used to determine the locale category for any category not specifically
2442 selected with a variable starting with <B>LC_</B>.
2443 <DT><B>LC_ALL</B>
2444
2445 <DD>
2446 This variable overrides the value of <B>LANG</B> and any other
2447 <B>LC_</B> variable specifying a locale category.
2448 <DT><B>LC_COLLATE</B>
2449
2450 <DD>
2451 This variable determines the collation order used when sorting the
2452 results of pathname expansion, and determines the behavior of range
2453 expressions, equivalence classes, and collating sequences within
2454 pathname expansion and pattern matching.
2455 <DT><B>LC_CTYPE</B>
2456
2457 <DD>
2458 This variable determines the interpretation of characters and the
2459 behavior of character classes within pathname expansion and pattern
2460 matching.
2461 <DT><B>LC_MESSAGES</B>
2462
2463 <DD>
2464 This variable determines the locale used to translate double-quoted
2465 strings preceded by a <B>$</B>.
2466 <DT><B>LC_NUMERIC</B>
2467
2468 <DD>
2469 This variable determines the locale category used for number formatting.
2470 <DT><B>LINES</B>
2471
2472 <DD>
2473 Used by the <B>select</B> builtin command to determine the column length
2474 for printing selection lists.  Automatically set upon receipt of a SIGWINCH.
2475 <DT><B>MAIL</B>
2476
2477 <DD>
2478 If this parameter is set to a file name and the
2479 <FONT SIZE=-1><B>MAILPATH</B>
2480
2481 </FONT>
2482 variable is not set,
2483 <B>bash</B>
2484
2485 informs the user of the arrival of mail in the specified file.
2486 <DT><B>MAILCHECK</B>
2487
2488 <DD>
2489 Specifies how
2490 often (in seconds)
2491 <B>bash</B>
2492
2493 checks for mail.  The default is 60 seconds.  When it is time to check
2494 for mail, the shell does so before displaying the primary prompt.
2495 If this variable is unset, or set to a value that is not a number
2496 greater than or equal to zero, the shell disables mail checking.
2497 <DT><B>MAILPATH</B>
2498
2499 <DD>
2500 A colon-separated list of file names to be checked for mail. 
2501 The message to be printed when mail arrives in a particular file
2502 may be specified by separating the file name from the message with a `?'.
2503 When used in the text of the message, <B>$_</B> expands to the name of
2504 the current mailfile. 
2505 Example:
2506 <DL COMPACT><DT><DD>
2507 <P>
2508
2509 <B>MAILPATH</B>=aq/var/mail/bfox?&quot;You have mail&quot;:~/shell-mail?&quot;$_ has mail!&quot;aq
2510 <P>
2511
2512 <B>Bash</B>
2513
2514 supplies a default value for this variable, but the location of the user
2515 mail files that it uses is system dependent (e.g., /var/mail/<B>$USER</B>).
2516 </DL>
2517
2518 <DT><B>OPTERR</B>
2519
2520 <DD>
2521 If set to the value 1,
2522 <B>bash</B>
2523
2524 displays error messages generated by the
2525 <B>getopts</B>
2526
2527 builtin command (see
2528 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
2529
2530 </FONT>
2531 below).
2532 <FONT SIZE=-1><B>OPTERR</B>
2533
2534 </FONT>
2535 is initialized to 1 each time the shell is invoked or a shell
2536 script is executed.
2537 <DT><B>PATH</B>
2538
2539 <DD>
2540 The search path for commands.  It
2541 is a colon-separated list of directories in which
2542 the shell looks for commands (see
2543 <FONT SIZE=-1><B>COMMAND EXECUTION</B>
2544
2545 </FONT>
2546 below).
2547 A zero-length (null) directory name in the value of <B>PATH</B> indicates the
2548 current directory.
2549 A null directory name may appear as two adjacent colons, or as an initial
2550 or trailing colon.
2551 The default path is system-dependent,
2552 and is set by the administrator who installs
2553 <B>bash</B>.
2554
2555 A common value is
2556 <TT>/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin</TT>.
2557
2558 <DT><B>POSIXLY_CORRECT</B>
2559
2560 <DD>
2561 If this variable is in the environment when <B>bash</B> starts, the shell
2562 enters <I>posix mode</I> before reading the startup files, as if the
2563 <B>--posix</B>
2564
2565 invocation option had been supplied.  If it is set while the shell is
2566 running, <B>bash</B> enables <I>posix mode</I>, as if the command
2567 <TT>set -o posix</TT>
2568
2569 had been executed.
2570 <DT><B>PROMPT_COMMAND</B>
2571
2572 <DD>
2573 If set, the value is executed as a command prior to issuing each primary
2574 prompt.
2575 <DT><B>PROMPT_DIRTRIM</B>
2576
2577 <DD>
2578 If set to a number greater than zero, the value is used as the number of
2579 trailing directory components to retain when expanding the <B>\w and
2580 \W</B> prompt string escapes (see
2581 <FONT SIZE=-1><B>PROMPTING</B>
2582
2583 </FONT>
2584 below).  Characters removed are replaced with an ellipsis.
2585 <DT><B>PS1</B>
2586
2587 <DD>
2588 The value of this parameter is expanded (see
2589 <FONT SIZE=-1><B>PROMPTING</B>
2590
2591 </FONT>
2592 below) and used as the primary prompt string.  The default value is
2593 ``<B>\s-\v\$ </B>''.
2594 <DT><B>PS2</B>
2595
2596 <DD>
2597 The value of this parameter is expanded as with
2598 <B>PS1</B>
2599
2600 and used as the secondary prompt string.  The default is
2601 ``<B>&gt; </B>''.
2602 <DT><B>PS3</B>
2603
2604 <DD>
2605 The value of this parameter is used as the prompt for the
2606 <B>select</B>
2607
2608 command (see
2609 <FONT SIZE=-1><B>SHELL GRAMMAR</B>
2610
2611 </FONT>
2612 above).
2613 <DT><B>PS4</B>
2614
2615 <DD>
2616 The value of this parameter is expanded as with
2617 <B>PS1</B>
2618
2619 and the value is printed before each command
2620 <B>bash</B>
2621
2622 displays during an execution trace.  The first character of
2623 <FONT SIZE=-1><B>PS4</B>
2624
2625 </FONT>
2626 is replicated multiple times, as necessary, to indicate multiple
2627 levels of indirection.  The default is ``<B>+ </B>''.
2628 <DT><B>SHELL</B>
2629
2630 <DD>
2631 The full pathname to the shell is kept in this environment variable.
2632 If it is not set when the shell starts,
2633 <B>bash</B>
2634
2635 assigns to it the full pathname of the current user's login shell.
2636 <DT><B>TIMEFORMAT</B>
2637
2638 <DD>
2639 The value of this parameter is used as a format string specifying
2640 how the timing information for pipelines prefixed with the
2641 <B>time</B>
2642
2643 reserved word should be displayed.
2644 The <B>%</B> character introduces an escape sequence that is
2645 expanded to a time value or other information.
2646 The escape sequences and their meanings are as follows; the
2647 braces denote optional portions.
2648 <P>
2649 <DL COMPACT><DT><DD>
2650
2651 <DL COMPACT>
2652 <DT><B>%%</B>
2653
2654 <DD>
2655 A literal <B>%</B>.
2656 <DT><B>%[</B><I>p</I>][l]R
2657
2658 <DD>
2659 The elapsed time in seconds.
2660 <DT><B>%[</B><I>p</I>][l]U
2661
2662 <DD>
2663 The number of CPU seconds spent in user mode.
2664 <DT><B>%[</B><I>p</I>][l]S
2665
2666 <DD>
2667 The number of CPU seconds spent in system mode.
2668 <DT><B>%P</B>
2669
2670 <DD>
2671 The CPU percentage, computed as (%U + %S) / %R.
2672
2673 </DL></DL>
2674
2675 <DT><DD>
2676 The optional <I>p</I> is a digit specifying the <I>precision</I>,
2677 the number of fractional digits after a decimal point.
2678 A value of 0 causes no decimal point or fraction to be output.
2679 At most three places after the decimal point may be specified;
2680 values of <I>p</I> greater than 3 are changed to 3.
2681 If <I>p</I> is not specified, the value 3 is used.
2682 <DT><DD>
2683 The optional <B>l</B> specifies a longer format, including
2684 minutes, of the form <I>MM</I>m<I>SS</I>.<I>FF</I>s.
2685 The value of <I>p</I> determines whether or not the fraction is
2686 included.
2687 <DT><DD>
2688 If this variable is not set, <B>bash</B> acts as if it had the
2689 value <B>$aq\nreal\t%3lR\nuser\t%3lU\nsys       %3lSaq</B>.
2690 If the value is null, no timing information is displayed.
2691 A trailing newline is added when the format string is displayed.
2692 <DT><B>TMOUT</B>
2693
2694 <DD>
2695 If set to a value greater than zero, <B>TMOUT</B> is treated as the
2696 default timeout for the <B>read</B> builtin.
2697 The <B>select</B> command terminates if input does not arrive
2698 after <B>TMOUT</B> seconds when input is coming from a terminal.
2699 In an interactive shell, the value is interpreted as the
2700 number of seconds to wait for input after issuing the primary prompt.
2701 <B>Bash</B>
2702
2703 terminates after waiting for that number of seconds if input does
2704 not arrive.
2705 <DT><B>TMPDIR</B>
2706
2707 <DD>
2708 If set, <B>Bash</B> uses its value as the name of a directory in which
2709 <B>Bash</B> creates temporary files for the shell's use.
2710 <DT><B>auto_resume</B>
2711
2712 <DD>
2713 This variable controls how the shell interacts with the user and
2714 job control.  If this variable is set, single word simple
2715 commands without redirections are treated as candidates for resumption
2716 of an existing stopped job.  There is no ambiguity allowed; if there is
2717 more than one job beginning with the string typed, the job most recently
2718 accessed is selected.  The
2719 <I>name</I>
2720
2721 of a stopped job, in this context, is the command line used to
2722 start it.
2723 If set to the value
2724 <I>exact</I>,
2725
2726 the string supplied must match the name of a stopped job exactly;
2727 if set to
2728 <I>substring</I>,
2729
2730 the string supplied needs to match a substring of the name of a
2731 stopped job.  The
2732 <I>substring</I>
2733
2734 value provides functionality analogous to the
2735 <B>%?</B>
2736
2737 job identifier (see
2738 <FONT SIZE=-1><B>JOB CONTROL</B>
2739
2740 </FONT>
2741 below).  If set to any other value, the supplied string must
2742 be a prefix of a stopped job's name; this provides functionality
2743 analogous to the <B>%</B><I>string</I> job identifier.
2744 <DT><B>histchars</B>
2745
2746 <DD>
2747 The two or three characters which control history expansion
2748 and tokenization (see
2749 <FONT SIZE=-1><B>HISTORY EXPANSION</B>
2750
2751 </FONT>
2752 below).  The first character is the <I>history expansion</I> character,
2753 the character which signals the start of a history
2754 expansion, normally `<B>!</B>'.
2755 The second character is the <I>quick substitution</I>
2756 character, which is used as shorthand for re-running the previous
2757 command entered, substituting one string for another in the command.
2758 The default is `<B>^</B>'.
2759 The optional third character is the character
2760 which indicates that the remainder of the line is a comment when found
2761 as the first character of a word, normally `<B>#</B>'.  The history
2762 comment character causes history substitution to be skipped for the
2763 remaining words on the line.  It does not necessarily cause the shell
2764 parser to treat the rest of the line as a comment.
2765
2766 </DL>
2767 <A NAME="lbAX">&nbsp;</A>
2768 <H4>Arrays</H4>
2769
2770 <B>Bash</B>
2771
2772 provides one-dimensional indexed and associative array variables.
2773 Any variable may be used as an indexed array; the
2774 <B>declare</B>
2775
2776 builtin will explicitly declare an array.
2777 There is no maximum
2778 limit on the size of an array, nor any requirement that members
2779 be indexed or assigned contiguously.
2780 Indexed arrays are referenced using integers (including arithmetic
2781 expressions)  and are zero-based; associative arrays are referenced
2782 using arbitrary strings.
2783 <P>
2784
2785 An indexed array is created automatically if any variable is assigned to
2786 using the syntax <I>name</I>[<I>subscript</I>]=<I>value</I>.  The
2787 <I>subscript</I>
2788
2789 is treated as an arithmetic expression that must evaluate to a number
2790 greater than or equal to zero.  To explicitly declare an indexed array,
2791 use
2792 <B>declare -a </B><I>name</I>
2793
2794 (see
2795 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
2796
2797 </FONT>
2798 below).
2799 <B>declare -a </B><I>name</I>[<I>subscript</I>]
2800
2801 is also accepted; the <I>subscript</I> is ignored.
2802 <P>
2803
2804 Associative arrays are created using
2805 <B>declare -A </B><I>name</I>.
2806
2807 <P>
2808
2809 Attributes may be
2810 specified for an array variable using the
2811 <B>declare</B>
2812
2813 and
2814 <B>readonly</B>
2815
2816 builtins.  Each attribute applies to all members of an array.
2817 <P>
2818
2819 Arrays are assigned to using compound assignments of the form
2820 <I>name</I>=<B>(</B>value<I>1</I> ... value<I>n</I><B>)</B>, where each
2821 <I>value</I> is of the form [<I>subscript</I>]=<I>string</I>.
2822 Indexed array assignments do not require the bracket and subscript.
2823 When assigning to indexed arrays, if the optional brackets and subscript
2824 are supplied, that index is assigned to;
2825 otherwise the index of the element assigned is the last index assigned
2826 to by the statement plus one.  Indexing starts at zero.
2827 <P>
2828
2829 When assigning to an associative array, the subscript is required.
2830 <P>
2831
2832 This syntax is also accepted by the
2833 <B>declare</B>
2834
2835 builtin.  Individual array elements may be assigned to using the
2836 <I>name</I>[<I>subscript</I>]=<I>value</I> syntax introduced above.
2837 <P>
2838
2839 Any element of an array may be referenced using
2840 ${<I>name</I>[<I>subscript</I>]}.  The braces are required to avoid
2841 conflicts with pathname expansion.  If
2842 <I>subscript</I> is <B>@</B> or <B>*</B>, the word expands to
2843 all members of <I>name</I>.  These subscripts differ only when the
2844 word appears within double quotes.  If the word is double-quoted,
2845 ${<I>name</I>[*]} expands to a single
2846 word with the value of each array member separated by the first
2847 character of the
2848 <FONT SIZE=-1><B>IFS</B>
2849
2850 </FONT>
2851 special variable, and ${<I>name</I>[@]} expands each element of
2852 <I>name</I> to a separate word.  When there are no array members,
2853 ${<I>name</I>[@]} expands to nothing.
2854 If the double-quoted expansion occurs within a word, the expansion of
2855 the first parameter is joined with the beginning part of the original
2856 word, and the expansion of the last parameter is joined with the last
2857 part of the original word.
2858 This is analogous to the expansion
2859 of the special parameters <B>*</B> and <B>@</B> (see
2860 <B>Special Parameters</B>
2861
2862 above).  ${#<I>name</I>[<I>subscript</I>]} expands to the length of
2863 ${<I>name</I>[<I>subscript</I>]}.  If <I>subscript</I> is <B>*</B> or
2864 <B>@</B>, the expansion is the number of elements in the array.
2865 Referencing an array variable without a subscript is equivalent to
2866 referencing the array with a subscript of 0.
2867 <P>
2868
2869 The
2870 <B>unset</B>
2871
2872 builtin is used to destroy arrays.  <B>unset</B> <I>name</I>[<I>subscript</I>]
2873 destroys the array element at index <I>subscript</I>.
2874 Care must be taken to avoid unwanted side effects caused by filename
2875 generation.
2876 <B>unset</B> <I>name</I>, where <I>name</I> is an array, or
2877 <B>unset</B> <I>name</I>[<I>subscript</I>], where
2878 <I>subscript</I> is <B>*</B> or <B>@</B>, removes the entire array.
2879 <P>
2880
2881 The
2882 <B>declare</B>,
2883
2884 <B>local</B>,
2885
2886 and
2887 <B>readonly</B>
2888
2889 builtins each accept a
2890 <B>-a</B>
2891
2892 option to specify an indexed array and a
2893 <B>-A</B>
2894
2895 option to specify an associative array.
2896 The
2897 <B>read</B>
2898
2899 builtin accepts a
2900 <B>-a</B>
2901
2902 option to assign a list of words read from the standard input
2903 to an array.  The
2904 <B>set</B>
2905
2906 and
2907 <B>declare</B>
2908
2909 builtins display array values in a way that allows them to be
2910 reused as assignments.
2911 <A NAME="lbAY">&nbsp;</A>
2912 <H3>EXPANSION</H3>
2913
2914 Expansion is performed on the command line after it has been split into
2915 words.  There are seven kinds of expansion performed:
2916 <I>brace expansion</I>,
2917
2918 <I>tilde expansion</I>,
2919
2920 <I>parameter and variable expansion</I>,
2921
2922 <I>command substitution</I>,
2923
2924 <I>arithmetic expansion</I>,
2925
2926 <I>word splitting</I>,
2927
2928 and
2929 <I>pathname expansion</I>.
2930
2931 <P>
2932
2933 The order of expansions is: brace expansion, tilde expansion,
2934 parameter, variable and arithmetic expansion and
2935 command substitution
2936 (done in a left-to-right fashion), word splitting, and pathname
2937 expansion.
2938 <P>
2939
2940 On systems that can support it, there is an additional expansion
2941 available: <I>process substitution</I>.
2942 <P>
2943
2944 Only brace expansion, word splitting, and pathname expansion
2945 can change the number of words of the expansion; other expansions
2946 expand a single word to a single word.
2947 The only exceptions to this are the expansions of
2948 &quot;<B>$@</B>&quot; and &quot;<B>${</B><I>name</I><B>[@]}</B>&quot;
2949 as explained above (see
2950 <FONT SIZE=-1><B>PARAMETERS</B>).
2951
2952 </FONT>
2953 <A NAME="lbAZ">&nbsp;</A>
2954 <H4>Brace Expansion</H4>
2955
2956 <P>
2957
2958 <I>Brace expansion</I>
2959
2960 is a mechanism by which arbitrary strings
2961 may be generated.  This mechanism is similar to
2962 <I>pathname expansion</I>, but the filenames generated
2963 need not exist.  Patterns to be brace expanded take
2964 the form of an optional
2965 <I>preamble</I>,
2966
2967 followed by either a series of comma-separated strings or
2968 a sequence expression between a pair of braces, followed by
2969 an optional
2970 <I>postscript</I>.
2971
2972 The preamble is prefixed to each string contained
2973 within the braces, and the postscript is then appended
2974 to each resulting string, expanding left to right.
2975 <P>
2976
2977 Brace expansions may be nested.  The results of each expanded
2978 string are not sorted; left to right order is preserved.
2979 For example, a<B>{</B>d,c,b<B>}</B>e expands into `ade ace abe'.
2980 <P>
2981
2982 A sequence expression takes the form
2983 <B>{</B><I>x</I><B>..</B><I>y</I><B>[..</B><I>incr</I><B>]}</B>,
2984 where <I>x</I> and <I>y</I> are either integers or single characters,
2985 and <I>incr</I>, an optional increment, is an integer.
2986 When integers are supplied, the expression expands to each number between
2987 <I>x</I> and <I>y</I>, inclusive.
2988 Supplied integers may be prefixed with <I>0</I> to force each term to have the
2989 same width.  When either <I>x</I> or y begins with a zero, the shell
2990 attempts to force all generated terms to contain the same number of digits,
2991 zero-padding where necessary.
2992 When characters are supplied, the expression expands to each character
2993 lexicographically between <I>x</I> and <I>y</I>, inclusive.  Note that
2994 both <I>x</I> and <I>y</I> must be of the same type.
2995 When the increment is supplied, it is used as the difference between
2996 each term.  The default increment is 1 or -1 as appropriate.
2997 <P>
2998
2999 Brace expansion is performed before any other expansions,
3000 and any characters special to other expansions are preserved
3001 in the result.  It is strictly textual.
3002 <B>Bash</B>
3003
3004 does not apply any syntactic interpretation to the context of the
3005 expansion or the text between the braces.
3006 <P>
3007
3008 A correctly-formed brace expansion must contain unquoted opening
3009 and closing braces, and at least one unquoted comma or a valid
3010 sequence expression.
3011 Any incorrectly formed brace expansion is left unchanged.
3012 A <B>{</B> or <B>,</B> may be quoted with a backslash to prevent its
3013 being considered part of a brace expression.
3014 To avoid conflicts with parameter expansion, the string <B>${</B>
3015 is not considered eligible for brace expansion.
3016 <P>
3017
3018 This construct is typically used as shorthand when the common
3019 prefix of the strings to be generated is longer than in the
3020 above example:
3021 <DL COMPACT><DT><DD>
3022 <P>
3023
3024 mkdir /usr/local/src/bash/{old,new,dist,bugs}
3025 </DL>
3026
3027 or
3028 <DL COMPACT><DT><DD>
3029 chown root /usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}}
3030 </DL>
3031
3032 <P>
3033
3034 Brace expansion introduces a slight incompatibility with
3035 historical versions of
3036 <B>sh</B>.
3037
3038 <B>sh</B>
3039
3040 does not treat opening or closing braces specially when they
3041 appear as part of a word, and preserves them in the output.
3042 <B>Bash</B>
3043
3044 removes braces from words as a consequence of brace
3045 expansion.  For example, a word entered to
3046 <B>sh</B>
3047
3048 as <I>file{1,2}</I>
3049 appears identically in the output.  The same word is
3050 output as
3051 <I>file1 file2</I>
3052
3053 after expansion by
3054 <B>bash</B>.
3055
3056 If strict compatibility with
3057 <B>sh</B>
3058
3059 is desired, start
3060 <B>bash</B>
3061
3062 with the
3063 <B>+B </B>
3064
3065 option or disable brace expansion with the
3066 <B>+B</B>
3067
3068 option to the
3069 <B>set</B>
3070
3071 command (see
3072 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
3073
3074 </FONT>
3075 below).
3076 <A NAME="lbBA">&nbsp;</A>
3077 <H4>Tilde Expansion</H4>
3078
3079 <P>
3080
3081 If a word begins with an unquoted tilde character (`<B>~</B>'), all of
3082 the characters preceding the first unquoted slash (or all characters,
3083 if there is no unquoted slash) are considered a <I>tilde-prefix</I>.
3084 If none of the characters in the tilde-prefix are quoted, the
3085 characters in the tilde-prefix following the tilde are treated as a
3086 possible <I>login name</I>.
3087 If this login name is the null string, the tilde is replaced with the
3088 value of the shell parameter
3089 <FONT SIZE=-1><B>HOME</B>.
3090
3091 </FONT>
3092 If
3093 <FONT SIZE=-1><B>HOME</B>
3094
3095 </FONT>
3096 is unset, the home directory of the user executing the shell is
3097 substituted instead.
3098 Otherwise, the tilde-prefix is replaced with the home directory
3099 associated with the specified login name.
3100 <P>
3101
3102 If the tilde-prefix is a `~+', the value of the shell variable
3103 <FONT SIZE=-1><B>PWD</B>
3104
3105 </FONT>
3106 replaces the tilde-prefix.
3107 If the tilde-prefix is a `~-', the value of the shell variable
3108 <FONT SIZE=-1><B>OLDPWD</B>,
3109
3110 </FONT>
3111 if it is set, is substituted.
3112 If the characters following the tilde in the tilde-prefix consist
3113 of a number <I>N</I>, optionally prefixed
3114 by a `+' or a `-', the tilde-prefix is replaced with the corresponding
3115 element from the directory stack, as it would be displayed by the
3116 <B>dirs</B>
3117
3118 builtin invoked with the tilde-prefix as an argument.
3119 If the characters following the tilde in the tilde-prefix consist of a
3120 number without a leading `+' or `-', `+' is assumed.
3121 <P>
3122
3123 If the login name is invalid, or the tilde expansion fails, the word
3124 is unchanged.
3125 <P>
3126
3127 Each variable assignment is checked for unquoted tilde-prefixes immediately
3128 following a
3129 <B>:</B>
3130
3131 or the first
3132 <B>=</B>.
3133
3134 In these cases, tilde expansion is also performed.
3135 Consequently, one may use file names with tildes in assignments to
3136 <FONT SIZE=-1><B>PATH</B>,
3137
3138 </FONT>
3139 <FONT SIZE=-1><B>MAILPATH</B>,
3140
3141 </FONT>
3142 and
3143 <FONT SIZE=-1><B>CDPATH</B>,
3144
3145 </FONT>
3146 and the shell assigns the expanded value.
3147 <A NAME="lbBB">&nbsp;</A>
3148 <H4>Parameter Expansion</H4>
3149
3150 <P>
3151
3152 The `<B>$</B>' character introduces parameter expansion,
3153 command substitution, or arithmetic expansion.  The parameter name
3154 or symbol to be expanded may be enclosed in braces, which
3155 are optional but serve to protect the variable to be expanded from
3156 characters immediately following it which could be
3157 interpreted as part of the name.
3158 <P>
3159
3160 When braces are used, the matching ending brace is the first `<B>}</B>'
3161 not escaped by a backslash or within a quoted string, and not within an
3162 embedded arithmetic expansion, command substitution, or parameter
3163 expansion.
3164 <P>
3165
3166
3167 <DL COMPACT>
3168 <DT>${<I>parameter</I>}<DD>
3169 The value of <I>parameter</I> is substituted.  The braces are required
3170 when
3171 <I>parameter</I>
3172
3173 is a positional parameter with more than one digit,
3174 or when
3175 <I>parameter</I>
3176
3177 is followed by a character which is not to be
3178 interpreted as part of its name.
3179
3180 </DL>
3181 <P>
3182
3183 If the first character of <I>parameter</I> is an exclamation point,
3184 a level of variable indirection is introduced.
3185 <B>Bash</B> uses the value of the variable formed from the rest of
3186 <I>parameter</I> as the name of the variable; this variable is then
3187 expanded and that value is used in the rest of the substitution, rather
3188 than the value of <I>parameter</I> itself.
3189 This is known as <I>indirect expansion</I>.
3190 The exceptions to this are the expansions of ${!<I>prefix</I>*} and
3191 ${<B>!</B><I>name</I>[<I>@</I>]} described below.
3192 The exclamation point must immediately follow the left brace in order to
3193 introduce indirection.
3194 <P>
3195
3196 In each of the cases below, <I>word</I> is subject to tilde expansion,
3197 parameter expansion, command substitution, and arithmetic expansion.
3198 <P>
3199
3200 When not performing substring expansion, using the forms documented below,
3201 <B>bash</B> tests for a parameter that is unset or null.  Omitting the colon
3202 results in a test only for a parameter that is unset.
3203 <P>
3204
3205
3206 <DL COMPACT>
3207 <DT>${<I>parameter</I><B>:-</B><I>word</I>}<DD>
3208 <B>Use Default Values</B>.  If
3209 <I>parameter</I>
3210
3211 is unset or null, the expansion of
3212 <I>word</I>
3213
3214 is substituted.  Otherwise, the value of
3215 <I>parameter</I>
3216
3217 is substituted.
3218 <DT>${<I>parameter</I><B>:=</B><I>word</I>}<DD>
3219 <B>Assign Default Values</B>.
3220 If
3221 <I>parameter</I>
3222
3223 is unset or null, the expansion of
3224 <I>word</I>
3225
3226 is assigned to
3227 <I>parameter</I>.
3228
3229 The value of
3230 <I>parameter</I>
3231
3232 is then substituted.  Positional parameters and special parameters may
3233 not be assigned to in this way.
3234 <DT>${<I>parameter</I><B>:?</B><I>word</I>}<DD>
3235 <B>Display Error if Null or Unset</B>.
3236 If
3237 <I>parameter</I>
3238
3239 is null or unset, the expansion of <I>word</I> (or a message to that effect
3240 if
3241 <I>word</I>
3242
3243 is not present) is written to the standard error and the shell, if it
3244 is not interactive, exits.  Otherwise, the value of <I>parameter</I> is
3245 substituted.
3246 <DT>${<I>parameter</I><B>:+</B><I>word</I>}<DD>
3247 <B>Use Alternate Value</B>.
3248 If
3249 <I>parameter</I>
3250
3251 is null or unset, nothing is substituted, otherwise the expansion of
3252 <I>word</I>
3253
3254 is substituted.
3255 <DT>${<I>parameter</I><B>:</B><I>offset</I>}<DD>
3256
3257 <DT>${<I>parameter</I><B>:</B><I>offset</I><B>:</B><I>length</I>}<DD>
3258
3259 <B>Substring Expansion.</B>
3260 Expands to up to <I>length</I> characters of <I>parameter</I>
3261 starting at the character specified by <I>offset</I>.
3262 If <I>length</I> is omitted, expands to the substring of
3263 <I>parameter</I> starting at the character specified by <I>offset</I>.
3264 <I>length</I> and <I>offset</I> are arithmetic expressions (see
3265 <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>
3266
3267 </FONT>
3268 below).
3269 <I>length</I> must evaluate to a number greater than or equal to zero.
3270 If <I>offset</I> evaluates to a number less than zero, the value
3271 is used as an offset from the end of the value of <I>parameter</I>.
3272 If <I>parameter</I> is <B>@</B>, the result is <I>length</I> positional
3273 parameters beginning at <I>offset</I>.
3274 If <I>parameter</I> is an indexed array name subscripted by @ or *,
3275 the result is the <I>length</I>
3276 members of the array beginning with ${<I>parameter</I>[<I>offset</I>]}.
3277 A negative <I>offset</I> is taken relative to one greater than the maximum
3278 index of the specified array.
3279 Substring expansion applied to an associative array produces undefined
3280 results.
3281 Note that a negative offset must be separated from the colon by at least
3282 one space to avoid being confused with the :- expansion.
3283 Substring indexing is zero-based unless the positional parameters 
3284 are used, in which case the indexing starts at 1 by default.
3285 If <I>offset</I> is 0, and the positional parameters are used, <B>$0</B> is
3286 prefixed to the list.
3287 <DT>${<B>!</B><I>prefix</I><B>*</B>}<DD>
3288
3289 <DT>${<B>!</B><I>prefix</I><B>@</B>}<DD>
3290
3291 <B>Names matching prefix.</B>
3292 Expands to the names of variables whose names begin with <I>prefix</I>,
3293 separated by the first character of the
3294 <FONT SIZE=-1><B>IFS</B>
3295
3296 </FONT>
3297 special variable.
3298 When <I>@</I> is used and the expansion appears within double quotes, each
3299 variable name expands to a separate word.
3300 <DT>${<B>!</B><I>name</I>[<I>@</I>]}<DD>
3301
3302 <DT>${<B>!</B><I>name</I>[<I>*</I>]}<DD>
3303
3304 <B>List of array keys.</B>
3305 If <I>name</I> is an array variable, expands to the list of array indices
3306 (keys) assigned in <I>name</I>.
3307 If <I>name</I> is not an array, expands to 0 if <I>name</I> is set and null
3308 otherwise.
3309 When <I>@</I> is used and the expansion appears within double quotes, each
3310 key expands to a separate word.
3311 <DT>${<B>#</B><I>parameter</I>}<DD>
3312 <B>Parameter length.</B>
3313 The length in characters of the value of <I>parameter</I> is substituted.
3314 If
3315 <I>parameter</I>
3316
3317 is
3318 <B>*</B>
3319
3320 or 
3321 <B>@</B>,
3322
3323 the value substituted is the number of positional parameters.
3324 If
3325 <I>parameter</I>
3326
3327 is an array name subscripted by
3328 <B>*</B>
3329
3330 or
3331 <B>@</B>,
3332
3333 the value substituted is the number of elements in the array.
3334 <DT>${<I>parameter</I><B>#</B><I>word</I>}<DD>
3335
3336 <DT>${<I>parameter</I><B>##</B><I>word</I>}<DD>
3337
3338 <B>Remove matching prefix pattern.</B>
3339 The 
3340 <I>word</I>
3341
3342 is expanded to produce a pattern just as in pathname
3343 expansion.  If the pattern matches the beginning of
3344 the value of
3345 <I>parameter</I>,
3346
3347 then the result of the expansion is the expanded value of
3348 <I>parameter</I>
3349
3350 with the shortest matching pattern (the ``<B>#</B>'' case) or the
3351 longest matching pattern (the ``<B>##</B>'' case) deleted.
3352 If
3353 <I>parameter</I>
3354
3355 is
3356 <B>@</B>
3357
3358 or
3359 <B>*</B>,
3360
3361 the pattern removal operation is applied to each positional
3362 parameter in turn, and the expansion is the resultant list.
3363 If
3364 <I>parameter</I>
3365
3366 is an array variable subscripted with
3367 <B>@</B>
3368
3369 or
3370 <B>*</B>,
3371
3372 the pattern removal operation is applied to each member of the
3373 array in turn, and the expansion is the resultant list.
3374 <DT>${<I>parameter</I><B>%</B><I>word</I>}<DD>
3375
3376 <DT>${<I>parameter</I><B>%%</B><I>word</I>}<DD>
3377
3378 <B>Remove matching suffix pattern.</B>
3379 The <I>word</I> is expanded to produce a pattern just as in
3380 pathname expansion.
3381 If the pattern matches a trailing portion of the expanded value of
3382 <I>parameter</I>,
3383
3384 then the result of the expansion is the expanded value of
3385 <I>parameter</I>
3386
3387 with the shortest matching pattern (the ``<B>%</B>'' case) or the
3388 longest matching pattern (the ``<B>%%</B>'' case) deleted.
3389 If
3390 <I>parameter</I>
3391
3392 is
3393 <B>@</B>
3394
3395 or
3396 <B>*</B>,
3397
3398 the pattern removal operation is applied to each positional
3399 parameter in turn, and the expansion is the resultant list.
3400 If
3401 <I>parameter</I>
3402
3403 is an array variable subscripted with
3404 <B>@</B>
3405
3406 or
3407 <B>*</B>,
3408
3409 the pattern removal operation is applied to each member of the
3410 array in turn, and the expansion is the resultant list.
3411 <DT>${<I>parameter</I><B>/</B><I>pattern</I><B>/</B><I>string</I>}<DD>
3412 <B>Pattern substitution.</B>
3413 The <I>pattern</I> is expanded to produce a pattern just as in
3414 pathname expansion.
3415 <I>Parameter</I> is expanded and the longest match of <I>pattern</I>
3416 against its value is replaced with <I>string</I>.
3417 If <I>pattern</I> begins with <B>/</B>, all matches of <I>pattern</I> are
3418 replaced with <I>string</I>.  Normally only the first match is replaced.
3419 If <I>pattern</I> begins with <B>#</B>, it must match at the beginning
3420 of the expanded value of <I>parameter</I>.
3421 If <I>pattern</I> begins with <B>%</B>, it must match at the end
3422 of the expanded value of <I>parameter</I>.
3423 If <I>string</I> is null, matches of <I>pattern</I> are deleted
3424 and the <B>/</B> following <I>pattern</I> may be omitted.
3425 If
3426 <I>parameter</I>
3427
3428 is
3429 <B>@</B>
3430
3431 or
3432 <B>*</B>,
3433
3434 the substitution operation is applied to each positional
3435 parameter in turn, and the expansion is the resultant list.
3436 If
3437 <I>parameter</I>
3438
3439 is an array variable subscripted with
3440 <B>@</B>
3441
3442 or
3443 <B>*</B>,
3444
3445 the substitution operation is applied to each member of the
3446 array in turn, and the expansion is the resultant list.
3447 <DT>${<I>parameter</I><B>^</B><I>pattern</I>}<DD>
3448
3449 <DT>${<I>parameter</I><B>^^</B><I>pattern</I>}<DD>
3450 <DT>${<I>parameter</I><B>,</B><I>pattern</I>}<DD>
3451 <DT>${<I>parameter</I><B>,,</B><I>pattern</I>}<DD>
3452
3453 <B>Case modification.</B>
3454 This expansion modifies the case of alphabetic characters in <I>parameter</I>.
3455 The <I>pattern</I> is expanded to produce a pattern just as in
3456 pathname expansion.
3457 The <B>^</B> operator converts lowercase letters matching <I>pattern</I>
3458 to uppercase; the <B>,</B> operator converts matching uppercase letters
3459 to lowercase.
3460 The <B>^^</B> and <B>,,</B> expansions convert each matched character in the
3461 expanded value; the <B>^</B> and <B>,</B> expansions match and convert only
3462 the first character in the expanded value..
3463 If <I>pattern</I> is omitted, it is treated like a <B>?</B>, which matches
3464 every character.
3465 If
3466 <I>parameter</I>
3467
3468 is
3469 <B>@</B>
3470
3471 or
3472 <B>*</B>,
3473
3474 the case modification operation is applied to each positional
3475 parameter in turn, and the expansion is the resultant list.
3476 If
3477 <I>parameter</I>
3478
3479 is an array variable subscripted with
3480 <B>@</B>
3481
3482 or
3483 <B>*</B>,
3484
3485 the case modification operation is applied to each member of the
3486 array in turn, and the expansion is the resultant list.
3487 </DL>
3488 <A NAME="lbBC">&nbsp;</A>
3489 <H4>Command Substitution</H4>
3490
3491 <P>
3492
3493 <I>Command substitution</I> allows the output of a command to replace
3494 the command name.  There are two forms:
3495 <P>
3496
3497 <DL COMPACT><DT><DD>
3498 <P>
3499
3500 <B>$(</B><I>command</I><B>)</B>
3501 </DL>
3502
3503 or
3504 <DL COMPACT><DT><DD>
3505 <B>`</B><I>command</I><B>`</B>
3506 </DL>
3507
3508 <P>
3509
3510 <B>Bash</B>
3511
3512 performs the expansion by executing <I>command</I> and
3513 replacing the command substitution with the standard output of the
3514 command, with any trailing newlines deleted.
3515 Embedded newlines are not deleted, but they may be removed during
3516 word splitting.
3517 The command substitution <B>$(cat </B><I>file</I>) can be replaced by
3518 the equivalent but faster <B>$(&lt; </B><I>file</I>).
3519 <P>
3520
3521 When the old-style backquote form of substitution is used,
3522 backslash retains its literal meaning except when followed by
3523 <B>$</B>,
3524
3525 <B>`</B>,
3526
3527 or
3528 <B>\</B>.
3529
3530 The first backquote not preceded by a backslash terminates the
3531 command substitution.
3532 When using the $(<I>command</I>) form, all characters between the
3533 parentheses make up the command; none are treated specially.
3534 <P>
3535
3536 Command substitutions may be nested.  To nest when using the backquoted form,
3537 escape the inner backquotes with backslashes.
3538 <P>
3539
3540 If the substitution appears within double quotes, word splitting and
3541 pathname expansion are not performed on the results.
3542 <A NAME="lbBD">&nbsp;</A>
3543 <H4>Arithmetic Expansion</H4>
3544
3545 <P>
3546
3547 Arithmetic expansion allows the evaluation of an arithmetic expression
3548 and the substitution of the result.  The format for arithmetic expansion is:
3549 <DL COMPACT><DT><DD>
3550 <P>
3551
3552 <B>$((</B><I>expression</I><B>))</B>
3553 </DL>
3554
3555 <P>
3556
3557 The
3558 <I>expression</I>
3559
3560 is treated as if it were within double quotes, but a double quote
3561 inside the parentheses is not treated specially.
3562 All tokens in the expression undergo parameter expansion, string
3563 expansion, command substitution, and quote removal.
3564 Arithmetic expansions may be nested.
3565 <P>
3566
3567 The evaluation is performed according to the rules listed below under
3568 <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>.
3569
3570 </FONT>
3571 If
3572 <I>expression</I>
3573
3574 is invalid,
3575 <B>bash</B>
3576
3577 prints a message indicating failure and no substitution occurs.
3578 <A NAME="lbBE">&nbsp;</A>
3579 <H4>Process Substitution</H4>
3580
3581 <P>
3582
3583 <I>Process substitution</I> is supported on systems that support named
3584 pipes (<I>FIFOs</I>) or the <B>/dev/fd</B> method of naming open files.
3585 It takes the form of
3586 <B>&lt;(</B><I>list</I><B>)</B>
3587 or
3588 <B>&gt;(</B><I>list</I><B>)</B>.
3589 The process <I>list</I> is run with its input or output connected to a
3590 <I>FIFO</I> or some file in <B>/dev/fd</B>.  The name of this file is
3591 passed as an argument to the current command as the result of the
3592 expansion.  If the <B>&gt;(</B><I>list</I><B>)</B> form is used, writing to
3593 the file will provide input for <I>list</I>.  If the
3594 <B>&lt;(</B><I>list</I><B>)</B> form is used, the file passed as an
3595 argument should be read to obtain the output of <I>list</I>.
3596 <P>
3597
3598 When available, process substitution is performed
3599 simultaneously with parameter and variable expansion, 
3600 command substitution,
3601 and arithmetic expansion.
3602 <A NAME="lbBF">&nbsp;</A>
3603 <H4>Word Splitting</H4>
3604
3605 <P>
3606
3607 The shell scans the results of
3608 parameter expansion,
3609 command substitution,
3610 and
3611 arithmetic expansion
3612 that did not occur within double quotes for
3613 <I>word splitting</I>.
3614
3615 <P>
3616
3617 The shell treats each character of
3618 <FONT SIZE=-1><B>IFS</B>
3619
3620 </FONT>
3621 as a delimiter, and splits the results of the other
3622 expansions into words on these characters.  If
3623 <FONT SIZE=-1><B>IFS</B>
3624
3625 </FONT>
3626 is unset, or its
3627 value is exactly
3628 <B>&lt;space&gt;&lt;tab&gt;&lt;newline&gt;</B>,
3629
3630 the default, then
3631 sequences of
3632 <B>&lt;space&gt;</B>,
3633
3634 <B>&lt;tab&gt;</B>,
3635
3636 and
3637 <B>&lt;newline&gt;</B>
3638
3639 at the beginning and end of the results of the previous
3640 expansions are ignored, and
3641 any sequence of
3642 <FONT SIZE=-1><B>IFS</B>
3643
3644 </FONT>
3645 characters not at the beginning or end serves to delimit words.
3646 If
3647 <FONT SIZE=-1><B>IFS</B>
3648
3649 </FONT>
3650 has a value other than the default, then sequences of
3651 the whitespace characters
3652 <B>space</B>
3653
3654 and
3655 <B>tab</B>
3656
3657 are ignored at the beginning and end of the
3658 word, as long as the whitespace character is in the
3659 value of
3660 <FONT SIZE=-1><B>IFS</B>
3661
3662 </FONT>
3663 (an
3664 <FONT SIZE=-1><B>IFS</B>
3665
3666 </FONT>
3667 whitespace character).
3668 Any character in
3669 <FONT SIZE=-1><B>IFS</B>
3670
3671 </FONT>
3672 that is not
3673 <FONT SIZE=-1><B>IFS</B>
3674
3675 </FONT>
3676 whitespace, along with any adjacent
3677 <FONT SIZE=-1><B>IFS</B>
3678
3679 </FONT>
3680 whitespace characters, delimits a field.
3681 A sequence of
3682 <FONT SIZE=-1><B>IFS</B>
3683
3684 </FONT>
3685 whitespace characters is also treated as a delimiter.
3686 If the value of
3687 <FONT SIZE=-1><B>IFS</B>
3688
3689 </FONT>
3690 is null, no word splitting occurs.
3691 <P>
3692
3693 Explicit null arguments (<B>&quot;&quot;</B> or <B>aqaq</B>) are retained.
3694 Unquoted implicit null arguments, resulting from the expansion of
3695 parameters that have no values, are removed.
3696 If a parameter with no value is expanded within double quotes, a
3697 null argument results and is retained.
3698 <P>
3699
3700 Note that if no expansion occurs, no splitting
3701 is performed.
3702 <A NAME="lbBG">&nbsp;</A>
3703 <H4>Pathname Expansion</H4>
3704
3705 <P>
3706
3707 After word splitting,
3708 unless the
3709 <B>-f</B>
3710
3711 option has been set,
3712 <B>bash</B>
3713
3714 scans each word for the characters
3715 <B>*</B>,
3716
3717 <B>?</B>,
3718
3719 and
3720 <B>[</B>.
3721
3722 If one of these characters appears, then the word is
3723 regarded as a
3724 <I>pattern</I>,
3725
3726 and replaced with an alphabetically sorted list of
3727 file names matching the pattern.
3728 If no matching file names are found,
3729 and the shell option
3730 <B>nullglob</B>
3731
3732 is not enabled, the word is left unchanged.
3733 If the 
3734 <B>nullglob</B>
3735
3736 option is set, and no matches are found,
3737 the word is removed.
3738 If the
3739 <B>failglob</B>
3740
3741 shell option is set, and no matches are found, an error message
3742 is printed and the command is not executed.
3743 If the shell option
3744 <B>nocaseglob</B>
3745
3746 is enabled, the match is performed without regard to the case
3747 of alphabetic characters.
3748 When a pattern is used for pathname expansion,
3749 the character
3750 <B>``.''</B>
3751
3752 at the start of a name or immediately following a slash
3753 must be matched explicitly, unless the shell option
3754 <B>dotglob</B>
3755
3756 is set.
3757 When matching a pathname, the slash character must always be
3758 matched explicitly.
3759 In other cases, the
3760 <B>``.''</B>
3761
3762 character is not treated specially.
3763 See the description of
3764 <B>shopt</B>
3765
3766 below under
3767 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
3768
3769 </FONT>
3770 for a description of the
3771 <B>nocaseglob</B>,
3772
3773 <B>nullglob</B>,
3774
3775 <B>failglob</B>,
3776
3777 and
3778 <B>dotglob</B>
3779
3780 shell options.
3781 <P>
3782
3783 The
3784 <FONT SIZE=-1><B>GLOBIGNORE</B>
3785
3786 </FONT>
3787 shell variable may be used to restrict the set of file names matching a
3788 <I>pattern</I>.
3789
3790 If
3791 <FONT SIZE=-1><B>GLOBIGNORE</B>
3792
3793 </FONT>
3794 is set, each matching file name that also matches one of the patterns in
3795 <FONT SIZE=-1><B>GLOBIGNORE</B>
3796
3797 </FONT>
3798 is removed from the list of matches.
3799 The file names
3800 <B>``.''</B>
3801
3802 and
3803 <B>``..''</B>
3804
3805 are always ignored when
3806 <FONT SIZE=-1><B>GLOBIGNORE</B>
3807
3808 </FONT>
3809 is set and not null.  However, setting
3810 <FONT SIZE=-1><B>GLOBIGNORE</B>
3811
3812 </FONT>
3813 to a non-null value has the effect of enabling the
3814 <B>dotglob</B>
3815
3816 shell option, so all other file names beginning with a
3817 <B>``.''</B>
3818
3819 will match.
3820 To get the old behavior of ignoring file names beginning with a
3821 <B>``.''</B>,
3822
3823 make
3824 <B>``.*''</B>
3825
3826 one of the patterns in
3827 <FONT SIZE=-1><B>GLOBIGNORE</B>.
3828
3829 </FONT>
3830 The
3831 <B>dotglob</B>
3832
3833 option is disabled when
3834 <FONT SIZE=-1><B>GLOBIGNORE</B>
3835
3836 </FONT>
3837 is unset.
3838 <P>
3839
3840 <B>Pattern Matching</B>
3841 <P>
3842
3843 Any character that appears in a pattern, other than the special pattern
3844 characters described below, matches itself.  The NUL character may not
3845 occur in a pattern.  A backslash escapes the following character; the
3846 escaping backslash is discarded when matching.
3847 The special pattern characters must be quoted if
3848 they are to be matched literally.
3849 <P>
3850
3851 The special pattern characters have the following meanings:
3852 <P>
3853
3854
3855 <DL COMPACT>
3856 <DT><B>*</B>
3857
3858 <DD>
3859 Matches any string, including the null string.
3860 When the <B>globstar</B> shell option is enabled, and <B>*</B> is used in
3861 a filename expansion context, two adjacent <B>*</B>s used as a single
3862 pattern will match all files and zero or more directories and
3863 subdirectories.
3864 If followed by a <B>/</B>, two adjacent <B>*</B>s will match only directories
3865 and subdirectories.
3866 <DT><B>?</B>
3867
3868 <DD>
3869 Matches any single character.
3870 <DT><B>[...]</B>
3871
3872 <DD>
3873 Matches any one of the enclosed characters.  A pair of characters
3874 separated by a hyphen denotes a
3875 <I>range expression</I>;
3876 any character that sorts between those two characters, inclusive,
3877 using the current locale's collating sequence and character set,
3878 is matched.  If the first character following the
3879 <B>[</B>
3880
3881 is a
3882 <B>!</B>
3883
3884 or a
3885 <B>^</B>
3886
3887 then any character not enclosed is matched.
3888 The sorting order of characters in range expressions is determined by
3889 the current locale and the value of the <B>LC_COLLATE</B> shell variable,
3890 if set.
3891
3892 <B>-</B>
3893
3894 may be matched by including it as the first or last character
3895 in the set.
3896 A
3897 <B>]</B>
3898
3899 may be matched by including it as the first character
3900 in the set.
3901 <BR>
3902
3903 <P>
3904
3905
3906 Within
3907 <B>[</B>
3908
3909 and
3910 <B>]</B>,
3911
3912 <I>character classes</I> can be specified using the syntax
3913 <B>[:</B><I>class</I><B>:]</B>, where <I>class</I> is one of the
3914 following classes defined in the POSIX standard:
3915 </DL>
3916 <P>
3917
3918 <DL COMPACT><DT><DD>
3919 <B>
3920 </B>
3921
3922 alnum   alpha   ascii   blank   cntrl   digit   graph   lower   print   punct   space   upper   word   xdigit
3923 <BR>
3924
3925 A character class matches any character belonging to that class.
3926 The <B>word</B> character class matches letters, digits, and the character _.
3927 <BR>
3928
3929 <P>
3930
3931
3932 Within
3933 <B>[</B>
3934
3935 and 
3936 <B>]</B>,
3937
3938 an <I>equivalence class</I> can be specified using the syntax
3939 <B>[=</B><I>c</I><B>=]</B>, which matches all characters with the
3940 same collation weight (as defined by the current locale) as
3941 the character <I>c</I>.
3942 <BR>
3943
3944 <P>
3945
3946
3947 Within
3948 <B>[</B>
3949
3950 and 
3951 <B>]</B>,
3952
3953 the syntax <B>[.</B><I>symbol</I><B>.]</B> matches the collating symbol
3954 <I>symbol</I>.
3955 </DL>
3956
3957
3958 <P>
3959
3960 If the <B>extglob</B> shell option is enabled using the <B>shopt</B>
3961 builtin, several extended pattern matching operators are recognized.
3962 In the following description, a <I>pattern-list</I> is a list of one
3963 or more patterns separated by a <B>|</B>.
3964 Composite patterns may be formed using one or more of the following
3965 sub-patterns:
3966 <P>
3967
3968 <DL COMPACT><DT><DD>
3969 <DL COMPACT>
3970 <DT><B>?(</B><I>pattern-list</I><B>)</B><DD>
3971 Matches zero or one occurrence of the given patterns
3972 <DT><B>*(</B><I>pattern-list</I><B>)</B><DD>
3973 Matches zero or more occurrences of the given patterns
3974 <DT><B>+(</B><I>pattern-list</I><B>)</B><DD>
3975 Matches one or more occurrences of the given patterns
3976 <DT><B>@(</B><I>pattern-list</I><B>)</B><DD>
3977 Matches one of the given patterns
3978 <DT><B>!(</B><I>pattern-list</I><B>)</B><DD>
3979 Matches anything except one of the given patterns
3980 </DL></DL>
3981
3982
3983 <A NAME="lbBH">&nbsp;</A>
3984 <H4>Quote Removal</H4>
3985
3986 <P>
3987
3988 After the preceding expansions, all unquoted occurrences of the
3989 characters
3990 <B>\</B>,
3991
3992 <B>aq</B>,
3993
3994 and <B>&quot;</B> that did not result from one of the above
3995 expansions are removed.
3996 <A NAME="lbBI">&nbsp;</A>
3997 <H3>REDIRECTION</H3>
3998
3999 Before a command is executed, its input and output
4000 may be
4001 <I>redirected</I>
4002
4003 using a special notation interpreted by the shell.
4004 Redirection may also be used to open and close files for the
4005 current shell execution environment.  The following redirection
4006 operators may precede or appear anywhere within a
4007 <I>simple command</I>
4008
4009 or may follow a
4010 <I>command</I>.
4011
4012 Redirections are processed in the order they appear, from
4013 left to right.
4014 <P>
4015
4016 In the following descriptions, if the file descriptor number is
4017 omitted, and the first character of the redirection operator is
4018 <B>&lt;</B>,
4019
4020 the redirection refers to the standard input (file descriptor
4021 0).  If the first character of the redirection operator is
4022 <B>&gt;</B>,
4023
4024 the redirection refers to the standard output (file descriptor
4025 1).
4026 <P>
4027
4028 The word following the redirection operator in the following
4029 descriptions, unless otherwise noted, is subjected to brace expansion,
4030 tilde expansion, parameter expansion, command substitution, arithmetic
4031 expansion, quote removal, pathname expansion, and word splitting.
4032 If it expands to more than one word,
4033 <B>bash</B>
4034
4035 reports an error.
4036 <P>
4037
4038 Note that the order of redirections is significant.  For example, 
4039 the command
4040 <DL COMPACT><DT><DD>
4041 <P>
4042
4043 ls <B>&gt;</B> dirlist 2<B>&gt;&amp;</B>1
4044 </DL>
4045
4046 <P>
4047
4048 directs both standard output and standard error to the file 
4049 <I>dirlist</I>,
4050
4051 while the command
4052 <DL COMPACT><DT><DD>
4053 <P>
4054
4055 ls 2<B>&gt;&amp;</B>1 <B>&gt;</B> dirlist
4056 </DL>
4057
4058 <P>
4059
4060 directs only the standard output to file
4061 <I>dirlist</I>,
4062
4063 because the standard error was duplicated as standard output
4064 before the standard output was redirected to
4065 <I>dirlist</I>.
4066
4067 <P>
4068
4069 <B>Bash</B> handles several filenames specially when they are used in
4070 redirections, as described in the following table:
4071 <DL COMPACT><DT><DD>
4072 <P>
4073
4074
4075 <DL COMPACT>
4076 <DT><B>/dev/fd/</B><I>fd</I>
4077
4078 <DD>
4079 If <I>fd</I> is a valid integer, file descriptor <I>fd</I> is duplicated.
4080 <DT><B>/dev/stdin</B>
4081
4082 <DD>
4083 File descriptor 0 is duplicated.
4084 <DT><B>/dev/stdout</B>
4085
4086 <DD>
4087 File descriptor 1 is duplicated.
4088 <DT><B>/dev/stderr</B>
4089
4090 <DD>
4091 File descriptor 2 is duplicated.
4092 <DT><B>/dev/tcp/</B><I>host</I>/<I>port</I>
4093
4094 <DD>
4095 If <I>host</I> is a valid hostname or Internet address, and <I>port</I>
4096 is an integer port number or service name, <B>bash</B> attempts to open
4097 a TCP connection to the corresponding socket.
4098 <DT><B>/dev/udp/</B><I>host</I>/<I>port</I>
4099
4100 <DD>
4101 If <I>host</I> is a valid hostname or Internet address, and <I>port</I>
4102 is an integer port number or service name, <B>bash</B> attempts to open
4103 a UDP connection to the corresponding socket.
4104
4105 </DL></DL>
4106
4107 <P>
4108
4109 A failure to open or create a file causes the redirection to fail.
4110 <P>
4111
4112 Redirections using file descriptors greater than 9 should be used with
4113 care, as they may conflict with file descriptors the shell uses
4114 internally.
4115 <A NAME="lbBJ">&nbsp;</A>
4116 <H4>Redirecting Input</H4>
4117
4118 <P>
4119
4120 Redirection of input causes the file whose name results from
4121 the expansion of
4122 <I>word</I>
4123
4124 to be opened for reading on file descriptor
4125 <I>n</I>,
4126
4127 or the standard input (file descriptor 0) if
4128 <I>n</I>
4129
4130 is not specified.
4131 <P>
4132
4133 The general format for redirecting input is:
4134 <DL COMPACT><DT><DD>
4135 <P>
4136
4137 [<I>n</I>]<B>&lt;</B><I>word</I>
4138 </DL>
4139
4140 <A NAME="lbBK">&nbsp;</A>
4141 <H4>Redirecting Output</H4>
4142
4143 <P>
4144
4145 Redirection of output causes the file whose name results from
4146 the expansion of
4147 <I>word</I>
4148
4149 to be opened for writing on file descriptor
4150 <I>n</I>,
4151
4152 or the standard output (file descriptor 1) if
4153 <I>n</I>
4154
4155 is not specified.  If the file does not exist it is created;
4156 if it does exist it is truncated to zero size.
4157 <P>
4158
4159 The general format for redirecting output is:
4160 <DL COMPACT><DT><DD>
4161 <P>
4162
4163 [<I>n</I>]<B>&gt;</B><I>word</I>
4164 </DL>
4165
4166 <P>
4167
4168 If the redirection operator is
4169 <B>&gt;</B>,
4170
4171 and the
4172 <B>noclobber</B>
4173
4174 option to the
4175 <B>set</B>
4176
4177 builtin has been enabled, the redirection will fail if the file
4178 whose name results from the expansion of <I>word</I> exists and is
4179 a regular file.
4180 If the redirection operator is
4181 <B>&gt;|</B>,
4182
4183 or the redirection operator is
4184 <B>&gt;</B>
4185
4186 and the
4187 <B>noclobber</B>
4188
4189 option to the
4190 <B>set</B>
4191
4192 builtin command is not enabled, the redirection is attempted even
4193 if the file named by <I>word</I> exists.
4194 <A NAME="lbBL">&nbsp;</A>
4195 <H4>Appending Redirected Output</H4>
4196
4197 <P>
4198
4199 Redirection of output in this fashion
4200 causes the file whose name results from
4201 the expansion of
4202 <I>word</I>
4203
4204 to be opened for appending on file descriptor
4205 <I>n</I>,
4206
4207 or the standard output (file descriptor 1) if
4208 <I>n</I>
4209
4210 is not specified.  If the file does not exist it is created.
4211 <P>
4212
4213 The general format for appending output is:
4214 <DL COMPACT><DT><DD>
4215 <P>
4216
4217 [<I>n</I>]<B>&gt;&gt;</B><I>word</I>
4218 </DL>
4219
4220 <P>
4221
4222 <A NAME="lbBM">&nbsp;</A>
4223 <H4>Redirecting Standard Output and Standard Error</H4>
4224
4225 <P>
4226
4227 This construct allows both the
4228 standard output (file descriptor 1) and
4229 the standard error output (file descriptor 2)
4230 to be redirected to the file whose name is the
4231 expansion of
4232 <I>word</I>.
4233
4234 <P>
4235
4236 There are two formats for redirecting standard output and
4237 standard error:
4238 <DL COMPACT><DT><DD>
4239 <P>
4240
4241 <B>&amp;&gt;</B><I>word</I>
4242 </DL>
4243
4244 and
4245 <DL COMPACT><DT><DD>
4246 <B>&gt;&amp;</B><I>word</I>
4247 </DL>
4248
4249 <P>
4250
4251 Of the two forms, the first is preferred.
4252 This is semantically equivalent to
4253 <DL COMPACT><DT><DD>
4254 <P>
4255
4256 <B>&gt;</B><I>word</I> 2<B>&gt;&amp;</B>1
4257 </DL>
4258
4259 <P>
4260
4261 <A NAME="lbBN">&nbsp;</A>
4262 <H4>Appending Standard Output and Standard Error</H4>
4263
4264 <P>
4265
4266 This construct allows both the
4267 standard output (file descriptor 1) and
4268 the standard error output (file descriptor 2)
4269 to be appended to the file whose name is the
4270 expansion of
4271 <I>word</I>.
4272
4273 <P>
4274
4275 The format for appending standard output and standard error is:
4276 <DL COMPACT><DT><DD>
4277 <P>
4278
4279 <B>&amp;&gt;&gt;</B><I>word</I>
4280 </DL>
4281
4282 <P>
4283
4284 This is semantically equivalent to
4285 <DL COMPACT><DT><DD>
4286 <P>
4287
4288 <B>&gt;&gt;</B><I>word</I> 2<B>&gt;&amp;</B>1
4289 </DL>
4290
4291 <A NAME="lbBO">&nbsp;</A>
4292 <H4>Here Documents</H4>
4293
4294 <P>
4295
4296 This type of redirection instructs the shell to read input from the
4297 current source until a line containing only
4298 <I>delimiter</I>
4299
4300 (with no trailing blanks)
4301 is seen.  All of
4302 the lines read up to that point are then used as the standard
4303 input for a command.
4304 <P>
4305
4306 The format of here-documents is:
4307 <DL COMPACT><DT><DD>
4308 <P>
4309
4310 <PRE>
4311 <B>&lt;&lt;</B>[<B>-</B>]<I>word</I>
4312         <I>here-document</I>
4313 <I>delimiter</I>
4314 </PRE>
4315
4316 </DL>
4317
4318 <P>
4319
4320 No parameter expansion, command substitution, arithmetic expansion,
4321 or pathname expansion is performed on
4322 <I>word</I>.
4323
4324 If any characters in
4325 <I>word</I>
4326
4327 are quoted, the
4328 <I>delimiter</I>
4329
4330 is the result of quote removal on
4331 <I>word</I>,
4332
4333 and the lines in the here-document are not expanded.
4334 If <I>word</I> is unquoted,
4335 all lines of the here-document are subjected to parameter expansion,
4336 command substitution, and arithmetic expansion.  In the latter
4337 case, the character sequence
4338 <B>\&lt;newline&gt;</B>
4339
4340 is ignored, and
4341 <B>\</B>
4342
4343 must be used to quote the characters
4344 <B>\</B>,
4345
4346 <B>$</B>,
4347
4348 and
4349 <B>`</B>.
4350
4351 <P>
4352
4353 If the redirection operator is
4354 <B>&lt;&lt;-</B>,
4355
4356 then all leading tab characters are stripped from input lines and the
4357 line containing
4358 <I>delimiter</I>.
4359
4360 This allows
4361 here-documents within shell scripts to be indented in a
4362 natural fashion.
4363 <A NAME="lbBP">&nbsp;</A>
4364 <H4>Here Strings</H4>
4365
4366 A variant of here documents, the format is:
4367 <DL COMPACT><DT><DD>
4368 <P>
4369
4370 <PRE>
4371 <B>&lt;&lt;&lt;</B><I>word</I>
4372 </PRE>
4373
4374 </DL>
4375
4376 <P>
4377
4378 The <I>word</I> is expanded and supplied to the command on its standard
4379 input.
4380 <A NAME="lbBQ">&nbsp;</A>
4381 <H4>Duplicating File Descriptors</H4>
4382
4383 <P>
4384
4385 The redirection operator
4386 <DL COMPACT><DT><DD>
4387 <P>
4388
4389 [<I>n</I>]<B>&lt;&amp;</B><I>word</I>
4390 </DL>
4391
4392 <P>
4393
4394 is used to duplicate input file descriptors.
4395 If
4396 <I>word</I>
4397
4398 expands to one or more digits, the file descriptor denoted by
4399 <I>n</I>
4400
4401 is made to be a copy of that file descriptor.
4402 If the digits in
4403 <I>word</I>
4404
4405 do not specify a file descriptor open for input, a redirection error occurs.
4406 If
4407 <I>word</I>
4408
4409 evaluates to
4410 <B>-</B>,
4411
4412 file descriptor
4413 <I>n</I>
4414
4415 is closed.  If
4416 <I>n</I>
4417
4418 is not specified, the standard input (file descriptor 0) is used.
4419 <P>
4420
4421 The operator
4422 <DL COMPACT><DT><DD>
4423 <P>
4424
4425 [<I>n</I>]<B>&gt;&amp;</B><I>word</I>
4426 </DL>
4427
4428 <P>
4429
4430 is used similarly to duplicate output file descriptors.  If
4431 <I>n</I>
4432
4433 is not specified, the standard output (file descriptor 1) is used.
4434 If the digits in
4435 <I>word</I>
4436
4437 do not specify a file descriptor open for output, a redirection error occurs.
4438 As a special case, if <I>n</I> is omitted, and <I>word</I> does not
4439 expand to one or more digits, the standard output and standard
4440 error are redirected as described previously.
4441 <A NAME="lbBR">&nbsp;</A>
4442 <H4>Moving File Descriptors</H4>
4443
4444 <P>
4445
4446 The redirection operator
4447 <DL COMPACT><DT><DD>
4448 <P>
4449
4450 [<I>n</I>]<B>&lt;&amp;</B><I>digit</I><B>-</B>
4451 </DL>
4452
4453 <P>
4454
4455 moves the file descriptor <I>digit</I> to file descriptor
4456 <I>n</I>,
4457
4458 or the standard input (file descriptor 0) if <I>n</I> is not specified.
4459 <I>digit</I> is closed after being duplicated to <I>n</I>.
4460 <P>
4461
4462 Similarly, the redirection operator
4463 <DL COMPACT><DT><DD>
4464 <P>
4465
4466 [<I>n</I>]<B>&gt;&amp;</B><I>digit</I><B>-</B>
4467 </DL>
4468
4469 <P>
4470
4471 moves the file descriptor <I>digit</I> to file descriptor
4472 <I>n</I>,
4473
4474 or the standard output (file descriptor 1) if <I>n</I> is not specified.
4475 <A NAME="lbBS">&nbsp;</A>
4476 <H4>Opening File Descriptors for Reading and Writing</H4>
4477
4478 <P>
4479
4480 The redirection operator
4481 <DL COMPACT><DT><DD>
4482 <P>
4483
4484 [<I>n</I>]<B>&lt;&gt;</B><I>word</I>
4485 </DL>
4486
4487 <P>
4488
4489 causes the file whose name is the expansion of
4490 <I>word</I>
4491
4492 to be opened for both reading and writing on file descriptor
4493 <I>n</I>,
4494
4495 or on file descriptor 0 if
4496 <I>n</I>
4497
4498 is not specified.  If the file does not exist, it is created.
4499 <A NAME="lbBT">&nbsp;</A>
4500 <H3>ALIASES</H3>
4501
4502 <I>Aliases</I> allow a string to be substituted for a word when it is used
4503 as the first word of a simple command.
4504 The shell maintains a list of aliases that may be set and unset with the
4505 <B>alias</B>
4506
4507 and
4508 <B>unalias</B>
4509
4510 builtin commands (see
4511 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
4512
4513 </FONT>
4514 below).
4515 The first word of each simple command, if unquoted,
4516 is checked to see if it has an
4517 alias.  If so, that word is replaced by the text of the alias.
4518 The characters <B>/</B>, <B>$</B>, <B>`</B>, and <B>=</B> and
4519 any of the shell <I>metacharacters</I> or quoting characters
4520 listed above may not appear in an alias name.
4521 The replacement text may contain any valid shell input,
4522 including shell metacharacters.
4523 The first word of the replacement text is tested
4524 for aliases, but a word that is identical to an alias being expanded
4525 is not expanded a second time.
4526 This means that one may alias
4527 <B>ls</B>
4528
4529 to
4530 <B>ls -F</B>,
4531
4532 for instance, and
4533 <B>bash</B>
4534
4535 does not try to recursively expand the replacement text.
4536 If the last character of the alias value is a
4537 <I>blank</I>,
4538
4539 then the next command
4540 word following the alias is also checked for alias expansion.
4541 <P>
4542
4543 Aliases are created and listed with the
4544 <B>alias</B>
4545
4546 command, and removed with the
4547 <B>unalias</B>
4548
4549 command.
4550 <P>
4551
4552 There is no mechanism for using arguments in the replacement text.
4553 If arguments are needed, a shell function should be used (see
4554 <FONT SIZE=-1><B>FUNCTIONS</B>
4555
4556 </FONT>
4557 below).
4558 <P>
4559
4560 Aliases are not expanded when the shell is not interactive, unless
4561 the
4562 <B>expand_aliases</B>
4563
4564 shell option is set using
4565 <B>shopt</B>
4566
4567 (see the description of
4568 <B>shopt</B>
4569
4570 under
4571 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B></FONT>
4572 below).
4573 <P>
4574
4575 The rules concerning the definition and use of aliases are
4576 somewhat confusing.
4577 <B>Bash</B>
4578
4579 always reads at least one complete line
4580 of input before executing any
4581 of the commands on that line.  Aliases are expanded when a
4582 command is read, not when it is executed.  Therefore, an
4583 alias definition appearing on the same line as another
4584 command does not take effect until the next line of input is read.
4585 The commands following the alias definition
4586 on that line are not affected by the new alias.
4587 This behavior is also an issue when functions are executed.
4588 Aliases are expanded when a function definition is read,
4589 not when the function is executed, because a function definition
4590 is itself a compound command.  As a consequence, aliases
4591 defined in a function are not available until after that
4592 function is executed.  To be safe, always put
4593 alias definitions on a separate line, and do not use
4594 <B>alias</B>
4595
4596 in compound commands.
4597 <P>
4598
4599 For almost every purpose, aliases are superseded by
4600 shell functions.
4601 <A NAME="lbBU">&nbsp;</A>
4602 <H3>FUNCTIONS</H3>
4603
4604 A shell function, defined as described above under
4605 <FONT SIZE=-1><B>SHELL GRAMMAR</B>,
4606
4607 </FONT>
4608 stores a series of commands for later execution.
4609 When the name of a shell function is used as a simple command name,
4610 the list of commands associated with that function name is executed.
4611 Functions are executed in the context of the
4612 current shell; no new process is created to interpret
4613 them (contrast this with the execution of a shell script).
4614 When a function is executed, the arguments to the
4615 function become the positional parameters
4616 during its execution.
4617 The special parameter
4618 <B>#</B>
4619
4620 is updated to reflect the change.  Special parameter 0
4621 is unchanged.
4622 The first element of the
4623 <FONT SIZE=-1><B>FUNCNAME</B>
4624
4625 </FONT>
4626 variable is set to the name of the function while the function
4627 is executing.
4628 All other aspects of the shell execution
4629 environment are identical between a function and its caller
4630 with the exception that the
4631 <FONT SIZE=-1><B>DEBUG</B>
4632
4633 </FONT>
4634 and
4635 <B>RETURN</B>
4636
4637 traps (see the description of the
4638 <B>trap</B>
4639
4640 builtin under
4641 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
4642
4643 </FONT>
4644 below) are not inherited unless the function has been given the
4645 <B>trace</B> attribute (see the description of the
4646 <FONT SIZE=-1><B>declare</B>
4647
4648 </FONT>
4649 builtin below) or the
4650 <B>-o functrace</B> shell option has been enabled with
4651 the <B>set</B> builtin
4652 (in which case all functions inherit the <B>DEBUG</B> and <B>RETURN</B> traps).
4653 <P>
4654
4655 Variables local to the function may be declared with the
4656 <B>local</B>
4657
4658 builtin command.  Ordinarily, variables and their values
4659 are shared between the function and its caller.
4660 <P>
4661
4662 If the builtin command
4663 <B>return</B>
4664
4665 is executed in a function, the function completes and
4666 execution resumes with the next command after the function
4667 call.
4668 Any command associated with the <B>RETURN</B> trap is executed
4669 before execution resumes.
4670 When a function completes, the values of the
4671 positional parameters and the special parameter
4672 <B>#</B>
4673
4674 are restored to the values they had prior to the function's
4675 execution.
4676 <P>
4677
4678 Function names and definitions may be listed with the
4679 <B>-f</B>
4680
4681 option to the
4682 <B>declare</B>
4683
4684 or
4685 <B>typeset</B>
4686
4687 builtin commands.  The
4688 <B>-F</B>
4689
4690 option to
4691 <B>declare</B>
4692
4693 or
4694 <B>typeset</B>
4695
4696 will list the function names only
4697 (and optionally the source file and line number, if the <B>extdebug</B>
4698 shell option is enabled).
4699 Functions may be exported so that subshells
4700 automatically have them defined with the
4701 <B>-f</B>
4702
4703 option to the 
4704 <B>export</B>
4705
4706 builtin.
4707 A function definition may be deleted using the <B>-f</B> option to
4708 the
4709 <B>unset</B>
4710
4711 builtin.
4712 Note that shell functions and variables with the same name may result
4713 in multiple identically-named entries in the environment passed to the
4714 shell's children.
4715 Care should be taken in cases where this may cause a problem.
4716 <P>
4717
4718 Functions may be recursive.  No limit is imposed on the number
4719 of recursive calls.
4720 <A NAME="lbBV">&nbsp;</A>
4721 <H3>ARITHMETIC EVALUATION</H3>
4722
4723 The shell allows arithmetic expressions to be evaluated, under
4724 certain circumstances (see the <B>let</B> and <B>declare</B> builtin
4725 commands and <B>Arithmetic Expansion</B>).
4726 Evaluation is done in fixed-width integers with no check for overflow,
4727 though division by 0 is trapped and flagged as an error.
4728 The operators and their precedence, associativity, and values
4729 are the same as in the C language.
4730 The following list of operators is grouped into levels of
4731 equal-precedence operators.
4732 The levels are listed in order of decreasing precedence.
4733 <P>
4734
4735
4736 <DL COMPACT>
4737 <DT><B></B><I>id</I>++ <I>id</I>--
4738
4739 <DD>
4740 variable post-increment and post-decrement
4741 <DT><B>++</B><I>id</I> --<I>id</I>
4742
4743 <DD>
4744 variable pre-increment and pre-decrement
4745 <DT><B>- +</B>
4746
4747 <DD>
4748 unary minus and plus
4749 <DT><B>! ~</B>
4750
4751 <DD>
4752 logical and bitwise negation
4753 <DT><B>**</B>
4754
4755 <DD>
4756 exponentiation
4757 <DT><B>* / %</B>
4758
4759 <DD>
4760 multiplication, division, remainder
4761 <DT><B>+ -</B>
4762
4763 <DD>
4764 addition, subtraction
4765 <DT><B>&lt;&lt; &gt;&gt;</B>
4766
4767 <DD>
4768 left and right bitwise shifts
4769 <DT><B>&lt;= &gt;= &lt; &gt;</B>
4770
4771 <DD>
4772 comparison
4773 <DT><B>== !=</B>
4774
4775 <DD>
4776 equality and inequality
4777 <DT><B>&amp;</B>
4778
4779 <DD>
4780 bitwise AND
4781 <DT><B>^</B>
4782
4783 <DD>
4784 bitwise exclusive OR
4785 <DT><B>|</B>
4786
4787 <DD>
4788 bitwise OR
4789 <DT><B>&amp;&amp;</B>
4790
4791 <DD>
4792 logical AND
4793 <DT><B>||</B>
4794
4795 <DD>
4796 logical OR
4797 <DT><B></B><I>expr</I>?<I>expr</I>:<I>expr</I>
4798
4799 <DD>
4800 conditional operator
4801 <DT><B>= *= /= %= += -= &lt;&lt;= &gt;&gt;= &amp;= ^= |=</B>
4802
4803 <DD>
4804 assignment
4805 <DT><B></B><I>expr1</I> , <I>expr2</I>
4806
4807 <DD>
4808 comma
4809
4810 </DL>
4811 <P>
4812
4813 Shell variables are allowed as operands; parameter expansion is
4814 performed before the expression is evaluated.
4815 Within an expression, shell variables may also be referenced by name
4816 without using the parameter expansion syntax.
4817 A shell variable that is null or unset evaluates to 0 when referenced
4818 by name without using the parameter expansion syntax.
4819 The value of a variable is evaluated as an arithmetic expression
4820 when it is referenced, or when a variable which has been given the
4821 <I>integer</I> attribute using <B>declare -i</B> is assigned a value.
4822 A null value evaluates to 0.
4823 A shell variable need not have its integer attribute
4824 turned on to be used in an expression.
4825 <P>
4826
4827 Constants with a leading 0 are interpreted as octal numbers.
4828 A leading 0x or 0X denotes hexadecimal.
4829 Otherwise, numbers take the form [<I>base#</I>]n, where <I>base</I>
4830 is a decimal number between 2 and 64 representing the arithmetic
4831 base, and <I>n</I> is a number in that base.
4832 If <I>base#</I> is omitted, then base 10 is used.
4833 The digits greater than 9 are represented by the lowercase letters,
4834 the uppercase letters, @, and _, in that order.
4835 If <I>base</I> is less than or equal to 36, lowercase and uppercase
4836 letters may be used interchangeably to represent numbers between 10
4837 and 35.
4838 <P>
4839
4840 Operators are evaluated in order of precedence.  Sub-expressions in
4841 parentheses are evaluated first and may override the precedence
4842 rules above.
4843 <A NAME="lbBW">&nbsp;</A>
4844 <H3>CONDITIONAL EXPRESSIONS</H3>
4845
4846 Conditional expressions are used by the <B>[[</B> compound command and
4847 the <B>test</B> and <B>[</B> builtin commands to test file attributes
4848 and perform string and arithmetic comparisons.
4849 Expressions are formed from the following unary or binary primaries.
4850 If any <I>file</I> argument to one of the primaries is of the form
4851 <I>/dev/fd/n</I>, then file descriptor <I>n</I> is checked.
4852 If the <I>file</I> argument to one of the primaries is one of
4853 <I>/dev/stdin</I>, <I>/dev/stdout</I>, or <I>/dev/stderr</I>, file
4854 descriptor 0, 1, or 2, respectively, is checked.
4855 <P>
4856
4857 Unless otherwise specified, primaries that operate on files follow symbolic
4858 links and operate on the target of the link, rather than the link itself.
4859 <P>
4860
4861 <DL COMPACT>
4862 <DT><B>-a </B><I>file</I>
4863
4864 <DD>
4865 True if <I>file</I> exists.
4866 <DT><B>-b </B><I>file</I>
4867
4868 <DD>
4869 True if <I>file</I> exists and is a block special file.
4870 <DT><B>-c </B><I>file</I>
4871
4872 <DD>
4873 True if <I>file</I> exists and is a character special file.
4874 <DT><B>-d </B><I>file</I>
4875
4876 <DD>
4877 True if <I>file</I> exists and is a directory.
4878 <DT><B>-e </B><I>file</I>
4879
4880 <DD>
4881 True if <I>file</I> exists.
4882 <DT><B>-f </B><I>file</I>
4883
4884 <DD>
4885 True if <I>file</I> exists and is a regular file.
4886 <DT><B>-g </B><I>file</I>
4887
4888 <DD>
4889 True if <I>file</I> exists and is set-group-id.
4890 <DT><B>-h </B><I>file</I>
4891
4892 <DD>
4893 True if <I>file</I> exists and is a symbolic link.
4894 <DT><B>-k </B><I>file</I>
4895
4896 <DD>
4897 True if <I>file</I> exists and its ``sticky'' bit is set.
4898 <DT><B>-p </B><I>file</I>
4899
4900 <DD>
4901 True if <I>file</I> exists and is a named pipe (FIFO).
4902 <DT><B>-r </B><I>file</I>
4903
4904 <DD>
4905 True if <I>file</I> exists and is readable.
4906 <DT><B>-s </B><I>file</I>
4907
4908 <DD>
4909 True if <I>file</I> exists and has a size greater than zero.
4910 <DT><B>-t </B><I>fd</I>
4911
4912 <DD>
4913 True if file descriptor
4914 <I>fd</I>
4915
4916 is open and refers to a terminal.
4917 <DT><B>-u </B><I>file</I>
4918
4919 <DD>
4920 True if <I>file</I> exists and its set-user-id bit is set.
4921 <DT><B>-w </B><I>file</I>
4922
4923 <DD>
4924 True if <I>file</I> exists and is writable.
4925 <DT><B>-x </B><I>file</I>
4926
4927 <DD>
4928 True if <I>file</I> exists and is executable.
4929 <DT><B>-O </B><I>file</I>
4930
4931 <DD>
4932 True if <I>file</I> exists and is owned by the effective user id.
4933 <DT><B>-G </B><I>file</I>
4934
4935 <DD>
4936 True if <I>file</I> exists and is owned by the effective group id.
4937 <DT><B>-L </B><I>file</I>
4938
4939 <DD>
4940 True if <I>file</I> exists and is a symbolic link.
4941 <DT><B>-S </B><I>file</I>
4942
4943 <DD>
4944 True if <I>file</I> exists and is a socket.
4945 <DT><B>-N </B><I>file</I>
4946
4947 <DD>
4948 True if <I>file</I> exists and has been modified since it was last read.
4949 <DT><I>file1</I> -<B>nt</B> <I>file2</I><DD>
4950 True if <I>file1</I> is newer (according to modification date) than <I>file2</I>,
4951 or if <I>file1</I> exists and file2 does not.
4952 <DT><I>file1</I> -<B>ot</B> <I>file2</I><DD>
4953 True if <I>file1</I> is older than <I>file2</I>, or if <I>file2</I> exists
4954 and <I>file1</I> does not.
4955 <DT><I>file1</I> <B>-ef</B> <I>file2</I><DD>
4956 True if <I>file1</I> and <I>file2</I> refer to the same device and
4957 inode numbers.
4958 <DT><B>-o </B><I>optname</I>
4959
4960 <DD>
4961 True if shell option
4962 <I>optname</I>
4963
4964 is enabled.
4965 See the list of options under the description of the
4966 <B>-o</B>
4967
4968 option to the
4969 <B>set</B>
4970
4971 builtin below.
4972 <DT><B>-z </B><I>string</I>
4973
4974 <DD>
4975 True if the length of <I>string</I> is zero.
4976 <DT><I>string</I><DD>
4977
4978 <DT><B>-n </B><I>string</I>
4979
4980 <DD>
4981
4982 True if the length of
4983 <I>string</I>
4984
4985 is non-zero.
4986 <DT><I>string1</I> <B>==</B> <I>string2</I><DD>
4987 True if the strings are equal.  <B>=</B> may be used in place of
4988 <B>==</B> for strict POSIX compliance.
4989 <DT><I>string1</I> <B>!=</B> <I>string2</I><DD>
4990 True if the strings are not equal.
4991 <DT><I>string1</I> <B>&lt;</B> <I>string2</I><DD>
4992 True if <I>string1</I> sorts before <I>string2</I> lexicographically
4993 in the current locale.
4994 <DT><I>string1</I> <B>&gt;</B> <I>string2</I><DD>
4995 True if <I>string1</I> sorts after <I>string2</I> lexicographically
4996 in the current locale.
4997 <DT><I>arg1</I> <B>OP</B> <I>arg2</I>
4998
4999 <DD>
5000 <FONT SIZE=-1><B>OP</B>
5001
5002 </FONT>
5003 is one of
5004 <B>-eq</B>,
5005
5006 <B>-ne</B>,
5007
5008 <B>-lt</B>,
5009
5010 <B>-le</B>,
5011
5012 <B>-gt</B>,
5013
5014 or
5015 <B>-ge</B>.
5016
5017 These arithmetic binary operators return true if <I>arg1</I>
5018 is equal to, not equal to, less than, less than or equal to,
5019 greater than, or greater than or equal to <I>arg2</I>, respectively.
5020 <I>Arg1</I>
5021
5022 and
5023 <I>arg2</I>
5024
5025 may be positive or negative integers.
5026
5027 </DL>
5028 <A NAME="lbBX">&nbsp;</A>
5029 <H3>SIMPLE COMMAND EXPANSION</H3>
5030
5031 When a simple command is executed, the shell performs the following
5032 expansions, assignments, and redirections, from left to right.
5033 <DL COMPACT>
5034 <DT>1.<DD>
5035 The words that the parser has marked as variable assignments (those
5036 preceding the command name) and redirections are saved for later
5037 processing.
5038 <DT>2.<DD>
5039 The words that are not variable assignments or redirections are
5040 expanded.  If any words remain after expansion, the first word
5041 is taken to be the name of the command and the remaining words are
5042 the arguments.
5043 <DT>3.<DD>
5044 Redirections are performed as described above under
5045 <FONT SIZE=-1><B>REDIRECTION</B>.
5046
5047 </FONT>
5048 <DT>4.<DD>
5049 The text after the <B>=</B> in each variable assignment undergoes tilde
5050 expansion, parameter expansion, command substitution, arithmetic expansion,
5051 and quote removal before being assigned to the variable.
5052 </DL>
5053 <P>
5054
5055 If no command name results, the variable assignments affect the current
5056 shell environment.  Otherwise, the variables are added to the environment
5057 of the executed command and do not affect the current shell environment.
5058 If any of the assignments attempts to assign a value to a readonly variable,
5059 an error occurs, and the command exits with a non-zero status.
5060 <P>
5061
5062 If no command name results, redirections are performed, but do not
5063 affect the current shell environment.  A redirection error causes the
5064 command to exit with a non-zero status.
5065 <P>
5066
5067 If there is a command name left after expansion, execution proceeds as
5068 described below.  Otherwise, the command exits.  If one of the expansions
5069 contained a command substitution, the exit status of the command is
5070 the exit status of the last command substitution performed.  If there
5071 were no command substitutions, the command exits with a status of zero.
5072 <A NAME="lbBY">&nbsp;</A>
5073 <H3>COMMAND EXECUTION</H3>
5074
5075 After a command has been split into words, if it results in a
5076 simple command and an optional list of arguments, the following
5077 actions are taken.
5078 <P>
5079
5080 If the command name contains no slashes, the shell attempts to
5081 locate it.  If there exists a shell function by that name, that
5082 function is invoked as described above in
5083 <FONT SIZE=-1><B>FUNCTIONS</B>.
5084
5085 </FONT>
5086 If the name does not match a function, the shell searches for
5087 it in the list of shell builtins.  If a match is found, that
5088 builtin is invoked.
5089 <P>
5090
5091 If the name is neither a shell function nor a builtin,
5092 and contains no slashes,
5093 <B>bash</B>
5094
5095 searches each element of the
5096 <FONT SIZE=-1><B>PATH</B>
5097
5098 </FONT>
5099 for a directory containing an executable file by that name.
5100 <B>Bash</B>
5101
5102 uses a hash table to remember the full pathnames of executable
5103 files (see
5104 <B>hash</B>
5105
5106 under
5107 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
5108
5109 </FONT>
5110 below).
5111 A full search of the directories in
5112 <FONT SIZE=-1><B>PATH</B>
5113
5114 </FONT>
5115 is performed only if the command is not found in the hash table.
5116 If the search is unsuccessful, the shell searches for a defined shell
5117 function named <B>command_not_found_handle</B>.
5118 If that function exists, it is invoked with the original command and
5119 the original command's arguments as its arguments, and the function's
5120 exit status becomes the exit status of the shell.
5121 If that function is not defined, the shell prints an error
5122 message and returns an exit status of 127.
5123 <P>
5124
5125 If the search is successful, or if the command name contains
5126 one or more slashes, the shell executes the named program in a
5127 separate execution environment.
5128 Argument 0 is set to the name given, and the remaining arguments
5129 to the command are set to the arguments given, if any.
5130 <P>
5131
5132 If this execution fails because the file is not in executable
5133 format, and the file is not a directory, it is assumed to be
5134 a <I>shell script</I>, a file
5135 containing shell commands.  A subshell is spawned to execute
5136 it.  This subshell reinitializes itself, so
5137 that the effect is as if a new shell had been invoked
5138 to handle the script, with the exception that the locations of
5139 commands remembered by the parent (see
5140 <B>hash</B>
5141
5142 below under
5143 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>)</FONT>
5144 are retained by the child.
5145 <P>
5146
5147 If the program is a file beginning with
5148 <B>#!</B>,
5149
5150 the remainder of the first line specifies an interpreter
5151 for the program.  The shell executes the
5152 specified interpreter on operating systems that do not
5153 handle this executable format themselves.  The arguments to the 
5154 interpreter consist of a single optional argument following the
5155 interpreter name on the first line of the program, followed
5156 by the name of the program, followed by the command
5157 arguments, if any.
5158 <A NAME="lbBZ">&nbsp;</A>
5159 <H3>COMMAND EXECUTION ENVIRONMENT</H3>
5160
5161 The shell has an <I>execution environment</I>, which consists of the
5162 following:
5163 <P>
5164 <DL COMPACT>
5165 <DT>*<DD>
5166 open files inherited by the shell at invocation, as modified by
5167 redirections supplied to the <B>exec</B> builtin
5168 <DT>*<DD>
5169 the current working directory as set by <B>cd</B>, <B>pushd</B>, or
5170 <B>popd</B>, or inherited by the shell at invocation
5171 <DT>*<DD>
5172 the file creation mode mask as set by <B>umask</B> or inherited from
5173 the shell's parent
5174 <DT>*<DD>
5175 current traps set by <B>trap</B>
5176 <DT>*<DD>
5177 shell parameters that are set by variable assignment or with <B>set</B>
5178 or inherited from the shell's parent in the environment
5179 <DT>*<DD>
5180 shell functions defined during execution or inherited from the shell's
5181 parent in the environment
5182 <DT>*<DD>
5183 options enabled at invocation (either by default or with command-line
5184 arguments) or by <B>set</B>
5185 <DT>*<DD>
5186 options enabled by <B>shopt</B>
5187 <DT>*<DD>
5188 shell aliases defined with <B>alias</B>
5189 <DT>*<DD>
5190 various process IDs, including those of background jobs, the value
5191 of <B>$$</B>, and the value of <B>$PPID</B>
5192 </DL>
5193 <P>
5194
5195 When a simple command other than a builtin or shell function
5196 is to be executed, it
5197 is invoked in a separate execution environment that consists of
5198 the following.  Unless otherwise noted, the values are inherited
5199 from the shell.
5200 <P>
5201 <DL COMPACT>
5202 <DT>*<DD>
5203 the shell's open files, plus any modifications and additions specified
5204 by redirections to the command
5205 <DT>*<DD>
5206 the current working directory
5207 <DT>*<DD>
5208 the file creation mode mask
5209 <DT>*<DD>
5210 shell variables and functions marked for export, along with variables
5211 exported for the command, passed in the environment
5212 <DT>*<DD>
5213 traps caught by the shell are reset to the values inherited from the
5214 shell's parent, and traps ignored by the shell are ignored
5215 </DL>
5216 <P>
5217
5218 A command invoked in this separate environment cannot affect the
5219 shell's execution environment. 
5220 <P>
5221
5222 Command substitution, commands grouped with parentheses,
5223 and asynchronous commands are invoked in a
5224 subshell environment that is a duplicate of the shell environment,
5225 except that traps caught by the shell are reset to the values
5226 that the shell inherited from its parent at invocation.  Builtin
5227 commands that are invoked as part of a pipeline are also executed in a
5228 subshell environment.  Changes made to the subshell environment
5229 cannot affect the shell's execution environment.
5230 <P>
5231
5232 Subshells spawned to execute command substitutions inherit the value of
5233 the <B>-e</B> option from the parent shell.  When not in posix mode,
5234 Bash clears the <B>-e</B> option in such subshells.
5235 <P>
5236
5237 If a command is followed by a <B>&amp;</B> and job control is not active, the
5238 default standard input for the command is the empty file <I>/dev/null</I>.
5239 Otherwise, the invoked command inherits the file descriptors of the calling
5240 shell as modified by redirections.
5241 <A NAME="lbCA">&nbsp;</A>
5242 <H3>ENVIRONMENT</H3>
5243
5244 When a program is invoked it is given an array of strings
5245 called the
5246 <I>environment</I>.
5247
5248 This is a list of 
5249 <I>name</I>-<I>value</I> pairs, of the form
5250 <I>name</I>=value.
5251
5252 <P>
5253
5254 The shell provides several ways to manipulate the environment.
5255 On invocation, the shell scans its own environment and
5256 creates a parameter for each name found, automatically marking
5257 it for
5258 <I>export</I>
5259
5260 to child processes.  Executed commands inherit the environment.
5261 The
5262 <B>export</B>
5263
5264 and
5265 <B>declare -x</B>
5266
5267 commands allow parameters and functions to be added to and
5268 deleted from the environment.  If the value of a parameter
5269 in the environment is modified, the new value becomes part
5270 of the environment, replacing the old.  The environment
5271 inherited by any executed command consists of the shell's
5272 initial environment, whose values may be modified in the shell,
5273 less any pairs removed by the
5274 <B>unset</B>
5275
5276 command, plus any additions via the
5277 <B>export</B>
5278
5279 and
5280 <B>declare -x</B>
5281
5282 commands.
5283 <P>
5284
5285 The environment for any
5286 <I>simple command</I>
5287
5288 or function may be augmented temporarily by prefixing it with
5289 parameter assignments, as described above in
5290 <FONT SIZE=-1><B>PARAMETERS</B>.
5291
5292 </FONT>
5293 These assignment statements affect only the environment seen
5294 by that command.
5295 <P>
5296
5297 If the 
5298 <B>-k</B>
5299
5300 option is set (see the
5301 <B>set</B>
5302
5303 builtin command below), then
5304 <I>all</I>
5305
5306 parameter assignments are placed in the environment for a command,
5307 not just those that precede the command name.
5308 <P>
5309
5310 When
5311 <B>bash</B>
5312
5313 invokes an external command, the variable
5314 <B>_</B>
5315
5316 is set to the full file name of the command and passed to that
5317 command in its environment.
5318 <A NAME="lbCB">&nbsp;</A>
5319 <H3>EXIT STATUS</H3>
5320
5321 <P>
5322
5323 The exit status of an executed command is the value returned by the
5324 <I>waitpid</I> system call or equivalent function.  Exit statuses
5325 fall between 0 and 255, though, as explained below, the shell may
5326 use values above 125 specially.  Exit statuses from shell builtins and
5327 compound commands are also limited to this range. Under certain
5328 circumstances, the shell will use special values to indicate specific
5329 failure modes.
5330 <P>
5331
5332 For the shell's purposes, a command which exits with a 
5333 zero exit status has succeeded.  An exit status of zero
5334 indicates success.  A non-zero exit status indicates failure.
5335 When a command terminates on a fatal signal <I>N</I>, <B>bash</B> uses
5336 the value of 128+<I>N</I> as the exit status.
5337 <P>
5338
5339 If a command is not found, the child process created to
5340 execute it returns a status of 127.  If a command is found
5341 but is not executable, the return status is 126.
5342 <P>
5343
5344 If a command fails because of an error during expansion or redirection,
5345 the exit status is greater than zero.
5346 <P>
5347
5348 Shell builtin commands return a status of 0 (<I>true</I>) if
5349 successful, and non-zero (<I>false</I>) if an error occurs
5350 while they execute. 
5351 All builtins return an exit status of 2 to indicate incorrect usage.
5352 <P>
5353
5354 <B>Bash</B> itself returns the exit status of the last command
5355 executed, unless a syntax error occurs, in which case it exits
5356 with a non-zero value.  See also the <B>exit</B> builtin
5357 command below.
5358 <A NAME="lbCC">&nbsp;</A>
5359 <H3>SIGNALS</H3>
5360
5361 When <B>bash</B> is interactive, in the absence of any traps, it ignores
5362 <FONT SIZE=-1><B>SIGTERM</B>
5363
5364 </FONT>
5365 (so that <B>kill 0</B> does not kill an interactive shell),
5366 and
5367 <FONT SIZE=-1><B>SIGINT</B>
5368
5369 </FONT>
5370 is caught and handled (so that the <B>wait</B> builtin is interruptible).
5371 In all cases, <B>bash</B> ignores
5372 <FONT SIZE=-1><B>SIGQUIT</B>.
5373
5374 </FONT>
5375 If job control is in effect,
5376 <B>bash</B>
5377
5378 ignores
5379 <FONT SIZE=-1><B>SIGTTIN</B>,
5380
5381 </FONT>
5382 <FONT SIZE=-1><B>SIGTTOU</B>,
5383
5384 </FONT>
5385 and
5386 <FONT SIZE=-1><B>SIGTSTP</B>.
5387
5388 </FONT>
5389 <P>
5390
5391 Non-builtin commands run by <B>bash</B> have signal handlers
5392 set to the values inherited by the shell from its parent.
5393 When job control is not in effect, asynchronous commands
5394 ignore
5395 <FONT SIZE=-1><B>SIGINT</B>
5396
5397 </FONT>
5398 and
5399 <FONT SIZE=-1><B>SIGQUIT</B>
5400
5401 </FONT>
5402 in addition to these inherited handlers.
5403 Commands run as a result of command substitution ignore the
5404 keyboard-generated job control signals
5405 <FONT SIZE=-1><B>SIGTTIN</B>,
5406
5407 </FONT>
5408 <FONT SIZE=-1><B>SIGTTOU</B>,
5409
5410 </FONT>
5411 and
5412 <FONT SIZE=-1><B>SIGTSTP</B>.
5413
5414 </FONT>
5415 <P>
5416
5417 The shell exits by default upon receipt of a
5418 <FONT SIZE=-1><B>SIGHUP</B>.
5419
5420 </FONT>
5421 Before exiting, an interactive shell resends the
5422 <FONT SIZE=-1><B>SIGHUP</B>
5423
5424 </FONT>
5425 to all jobs, running or stopped.
5426 Stopped jobs are sent
5427 <FONT SIZE=-1><B>SIGCONT</B>
5428
5429 </FONT>
5430 to ensure that they receive the
5431 <FONT SIZE=-1><B>SIGHUP</B>.
5432
5433 </FONT>
5434 To prevent the shell from
5435 sending the signal to a particular job, it should be removed from the
5436 jobs table with the 
5437 <B>disown</B>
5438
5439 builtin (see
5440 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
5441
5442 </FONT>
5443 below) or marked 
5444 to not receive
5445 <FONT SIZE=-1><B>SIGHUP</B>
5446
5447 </FONT>
5448 using
5449 <B>disown -h</B>.
5450
5451 <P>
5452
5453 If the
5454 <B>huponexit</B>
5455
5456 shell option has been set with
5457 <B>shopt</B>,
5458
5459 <B>bash</B>
5460
5461 sends a 
5462 <FONT SIZE=-1><B>SIGHUP</B>
5463
5464 </FONT>
5465 to all jobs when an interactive login shell exits.
5466 <P>
5467
5468 If <B>bash</B> is waiting for a command to complete and receives a signal
5469 for which a trap has been set, the trap will not be executed until
5470 the command completes. 
5471 When <B>bash</B> is waiting for an asynchronous command via the <B>wait</B>
5472 builtin, the reception of a signal for which a trap has been set will
5473 cause the <B>wait</B> builtin to return immediately with an exit status
5474 greater than 128, immediately after which the trap is executed.
5475 <A NAME="lbCD">&nbsp;</A>
5476 <H3>JOB CONTROL</H3>
5477
5478 <I>Job control</I>
5479
5480 refers to the ability to selectively stop (<I>suspend</I>)
5481 the execution of processes and continue (<I>resume</I>)
5482 their execution at a later point.  A user typically employs
5483 this facility via an interactive interface supplied jointly
5484 by the system's terminal driver and
5485 <B>bash</B>.
5486
5487 <P>
5488
5489 The shell associates a
5490 <I>job</I>
5491
5492 with each pipeline.  It keeps a table of currently executing
5493 jobs, which may be listed with the
5494 <B>jobs</B>
5495
5496 command.  When
5497 <B>bash</B>
5498
5499 starts a job asynchronously (in the
5500 <I>background</I>),
5501
5502 it prints a line that looks like:
5503 <DL COMPACT><DT><DD>
5504 <P>
5505
5506 [1] 25647
5507 </DL>
5508
5509 <P>
5510
5511 indicating that this job is job number 1 and that the process ID
5512 of the last process in the pipeline associated with this job is 25647.
5513 All of the processes in a single pipeline are members of the same job.
5514 <B>Bash</B>
5515
5516 uses the
5517 <I>job</I>
5518
5519 abstraction as the basis for job control.
5520 <P>
5521
5522 To facilitate the implementation of the user interface to job
5523 control, the operating system maintains the notion of a <I>current terminal
5524 process group ID</I>.  Members of this process group (processes whose
5525 process group ID is equal to the current terminal process group ID)
5526 receive keyboard-generated signals such as
5527 <FONT SIZE=-1><B>SIGINT</B>.
5528
5529 </FONT>
5530 These processes are said to be in the
5531 <I>foreground</I>.
5532
5533 <I>Background</I>
5534
5535 processes are those whose process group ID differs from the terminal's;
5536 such processes are immune to keyboard-generated signals.
5537 Only foreground processes are allowed to read from or write to the
5538 terminal.  Background processes which attempt to read from (write to) the
5539 terminal are sent a 
5540 <FONT SIZE=-1><B>SIGTTIN (SIGTTOU)</B>
5541
5542 </FONT>
5543 signal by the terminal driver, 
5544 which, unless caught, suspends the process.
5545 <P>
5546
5547 If the operating system on which
5548 <B>bash</B>
5549
5550 is running supports
5551 job control,
5552 <B>bash</B>
5553
5554 contains facilities to use it.
5555 Typing the
5556 <I>suspend</I>
5557
5558 character (typically
5559 <B>^Z</B>,
5560
5561 Control-Z) while a process is running
5562 causes that process to be stopped and returns control to 
5563 <B>bash</B>.
5564
5565 Typing the
5566 <I>delayed suspend</I>
5567
5568 character (typically
5569 <B>^Y</B>,
5570
5571 Control-Y) causes the process to be stopped when it
5572 attempts to read input from the terminal, and control to
5573 be returned to
5574 <B>bash</B>.
5575
5576 The user may then manipulate the state of this job, using the
5577 <B>bg</B>
5578
5579 command to continue it in the background, the
5580 <B>fg</B>
5581
5582 command to continue it in the foreground, or
5583 the
5584 <B>kill</B>
5585
5586 command to kill it.  A <B>^Z</B> takes effect immediately,
5587 and has the additional side effect of causing pending output
5588 and typeahead to be discarded.
5589 <P>
5590
5591 There are a number of ways to refer to a job in the shell.
5592 The character
5593 <B>%</B>
5594
5595 introduces a job specification (<I>jobspec</I>).  Job number
5596 <I>n</I>
5597
5598 may be referred to as
5599 <B>%n</B>.
5600
5601 A job may also be referred to using a prefix of the name used to
5602 start it, or using a substring that appears in its command line.
5603 For example,
5604 <B>%ce</B>
5605
5606 refers to a stopped
5607 <B>ce</B>
5608
5609 job.  If a prefix matches more than one job,
5610 <B>bash</B>
5611
5612 reports an error.  Using
5613 <B>%?ce</B>,
5614
5615 on the other hand, refers to any job containing the string
5616 <B>ce</B>
5617
5618 in its command line.  If the substring matches more than one job,
5619 <B>bash</B>
5620
5621 reports an error.  The symbols
5622 <B>%%</B>
5623
5624 and
5625 <B>%+</B>
5626
5627 refer to the shell's notion of the
5628 <I>current job</I>,
5629
5630 which is the last job stopped while it was in
5631 the foreground or started in the background.
5632 The 
5633 <I>previous job</I>
5634
5635 may be referenced using
5636 <B>%-</B>.
5637
5638 If there is only a single job, <B>%+</B> and <B>%-</B> can both be used
5639 to refer to that job.
5640 In output pertaining to jobs (e.g., the output of the
5641 <B>jobs</B>
5642
5643 command), the current job is always flagged with a
5644 <B>+</B>,
5645
5646 and the previous job with a
5647 <B>-</B>.
5648
5649 A single % (with no accompanying job specification) also refers to the
5650 current job.
5651 <P>
5652
5653 Simply naming a job can be used to bring it into the
5654 foreground:
5655 <B>%1</B>
5656
5657 is a synonym for
5658 <B>``fg %1''</B>,
5659 bringing job 1 from the background into the foreground.
5660 Similarly,
5661 <B>``%1 &amp;''</B>
5662
5663 resumes job 1 in the background, equivalent to
5664 <B>``bg %1''</B>.
5665 <P>
5666
5667 The shell learns immediately whenever a job changes state.
5668 Normally,
5669 <B>bash</B>
5670
5671 waits until it is about to print a prompt before reporting
5672 changes in a job's status so as to not interrupt
5673 any other output.  If the 
5674 <B>-b</B>
5675
5676 option to the
5677 <B>set</B>
5678
5679 builtin command
5680 is enabled,
5681 <B>bash</B>
5682
5683 reports such changes immediately.
5684 Any trap on
5685 <FONT SIZE=-1><B>SIGCHLD</B>
5686
5687 </FONT>
5688 is executed for each child that exits.
5689 <P>
5690
5691 If an attempt to exit
5692 <B>bash</B>
5693
5694 is made while jobs are stopped (or, if the <B>checkjobs</B> shell option has
5695 been enabled using the <B>shopt</B> builtin, running), the shell prints a
5696 warning message, and, if the <B>checkjobs</B> option is enabled, lists the
5697 jobs and their statuses.
5698 The
5699 <B>jobs</B>
5700
5701 command may then be used to inspect their status. 
5702 If a second attempt to exit is made without an intervening command,
5703 the shell does not print another warning, and any stopped
5704 jobs are terminated.
5705 <A NAME="lbCE">&nbsp;</A>
5706 <H3>PROMPTING</H3>
5707
5708 When executing interactively, 
5709 <B>bash</B>
5710
5711 displays the primary prompt
5712 <FONT SIZE=-1><B>PS1</B>
5713
5714 </FONT>
5715 when it is ready to read a command, and the secondary prompt
5716 <FONT SIZE=-1><B>PS2</B>
5717
5718 </FONT>
5719 when it needs more input to complete a command.
5720 <B>Bash</B>
5721
5722 allows these prompt strings to be customized by inserting a number of
5723 backslash-escaped special characters that are decoded as follows:
5724 <DL COMPACT><DT><DD>
5725
5726 <DL COMPACT>
5727 <DT><B>\a</B>
5728
5729 <DD>
5730 an ASCII bell character (07)
5731 <DT><B>\d</B>
5732
5733 <DD>
5734 the date in &quot;Weekday Month Date&quot; format (e.g., &quot;Tue May 26&quot;)
5735 <DT><B>\D{</B><I>format</I>}
5736
5737 <DD>
5738 the <I>format</I> is passed to <I>strftime</I>(3) and the result is inserted
5739 into the prompt string; an empty <I>format</I> results in a locale-specific
5740 time representation.  The braces are required
5741 <DT><B>\e</B>
5742
5743 <DD>
5744 an ASCII escape character (033)
5745 <DT><B>\h</B>
5746
5747 <DD>
5748 the hostname up to the first `.'
5749 <DT><B>\H</B>
5750
5751 <DD>
5752 the hostname
5753 <DT><B>\j</B>
5754
5755 <DD>
5756 the number of jobs currently managed by the shell
5757 <DT><B>\l</B>
5758
5759 <DD>
5760 the basename of the shell's terminal device name
5761 <DT><B>\n</B>
5762
5763 <DD>
5764 newline
5765 <DT><B>\r</B>
5766
5767 <DD>
5768 carriage return
5769 <DT><B>\s</B>
5770
5771 <DD>
5772 the name of the shell, the basename of
5773 <B>$0</B>
5774
5775 (the portion following the final slash)
5776 <DT><B>\t</B>
5777
5778 <DD>
5779 the current time in 24-hour HH:MM:SS format
5780 <DT><B>\T</B>
5781
5782 <DD>
5783 the current time in 12-hour HH:MM:SS format
5784 <DT><B>\@</B>
5785
5786 <DD>
5787 the current time in 12-hour am/pm format
5788 <DT><B>\A</B>
5789
5790 <DD>
5791 the current time in 24-hour HH:MM format
5792 <DT><B>\u</B>
5793
5794 <DD>
5795 the username of the current user
5796 <DT><B>\v</B>
5797
5798 <DD>
5799 the version of <B>bash</B> (e.g., 2.00)
5800 <DT><B>\V</B>
5801
5802 <DD>
5803 the release of <B>bash</B>, version + patch level (e.g., 2.00.0)
5804 <DT><B>\w</B>
5805
5806 <DD>
5807 the current working directory, with <B>$HOME</B> abbreviated with a tilde
5808 (uses the <B>$PROMPT_DIRTRIM</B> variable)
5809 <DT><B>\W</B>
5810
5811 <DD>
5812 the basename of the current working directory, with <B>$HOME</B>
5813 abbreviated with a tilde
5814 <DT><B>\!</B>
5815
5816 <DD>
5817 the history number of this command
5818 <DT><B>\#</B>
5819
5820 <DD>
5821 the command number of this command
5822 <DT><B>\$</B>
5823
5824 <DD>
5825 if the effective UID is 0, a
5826 <B>#</B>,
5827
5828 otherwise a
5829 <B>$</B>
5830
5831 <DT><B>\</B><I>nnn</I>
5832
5833 <DD>
5834 the character corresponding to the octal number <I>nnn</I>
5835 <DT><B>\\</B>
5836
5837 <DD>
5838 a backslash
5839 <DT><B>\[</B>
5840
5841 <DD>
5842 begin a sequence of non-printing characters, which could be used to
5843 embed a terminal control sequence into the prompt
5844 <DT><B>\]</B>
5845
5846 <DD>
5847 end a sequence of non-printing characters
5848
5849 </DL></DL>
5850
5851 <P>
5852
5853 The command number and the history number are usually different:
5854 the history number of a command is its position in the history
5855 list, which may include commands restored from the history file
5856 (see
5857 <FONT SIZE=-1><B>HISTORY</B>
5858
5859 </FONT>
5860 below), while the command number is the position in the sequence
5861 of commands executed during the current shell session.
5862 After the string is decoded, it is expanded via
5863 parameter expansion, command substitution, arithmetic
5864 expansion, and quote removal, subject to the value of the
5865 <B>promptvars</B>
5866
5867 shell option (see the description of the
5868 <B>shopt</B>
5869
5870 command under
5871 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
5872
5873 </FONT>
5874 below).
5875 <A NAME="lbCF">&nbsp;</A>
5876 <H3>READLINE</H3>
5877
5878 This is the library that handles reading input when using an interactive
5879 shell, unless the
5880 <B>--noediting</B>
5881
5882 option is given at shell invocation.
5883 Line editing is also used when using the <B>-e</B> option to the
5884 <B>read</B> builtin.
5885 By default, the line editing commands are similar to those of emacs.
5886 A vi-style line editing interface is also available.
5887 Line editing can be enabled at any time using the
5888 <B>-o emacs</B>
5889
5890 or
5891 <B>-o vi</B>
5892
5893 options to the
5894 <B>set</B>
5895
5896 builtin (see
5897 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
5898
5899 </FONT>
5900 below).
5901 To turn off line editing after the shell is running, use the
5902 <B>+o emacs</B>
5903
5904 or
5905 <B>+o vi</B>
5906
5907 options to the
5908 <B>set</B>
5909
5910 builtin.
5911 <A NAME="lbCG">&nbsp;</A>
5912 <H4>Readline Notation</H4>
5913
5914 <P>
5915
5916 In this section, the emacs-style notation is used to denote
5917 keystrokes.  Control keys are denoted by C-<I>key</I>, e.g., C-n
5918 means Control-N.  Similarly, 
5919 <I>meta</I>
5920
5921 keys are denoted by M-<I>key</I>, so M-x means Meta-X.  (On keyboards
5922 without a 
5923 <I>meta</I>
5924
5925 key, M-<I>x</I> means ESC <I>x</I>, i.e., press the Escape key
5926 then the
5927 <I>x</I>
5928
5929 key.  This makes ESC the <I>meta prefix</I>.
5930 The combination M-C-<I>x</I> means ESC-Control-<I>x</I>,
5931 or press the Escape key
5932 then hold the Control key while pressing the
5933 <I>x</I>
5934
5935 key.)
5936 <P>
5937
5938 Readline commands may be given numeric
5939 <I>arguments</I>,
5940
5941 which normally act as a repeat count.
5942 Sometimes, however, it is the sign of the argument that is significant.
5943 Passing a negative argument to a command that acts in the forward
5944 direction (e.g., <B>kill-line</B>) causes that command to act in a
5945 backward direction. 
5946 Commands whose behavior with arguments deviates from this are noted
5947 below.
5948 <P>
5949
5950 When a command is described as <I>killing</I> text, the text
5951 deleted is saved for possible future retrieval
5952 (<I>yanking</I>).  The killed text is saved in a
5953 <I>kill ring</I>.  Consecutive kills cause the text to be
5954 accumulated into one unit, which can be yanked all at once. 
5955 Commands which do not kill text separate the chunks of text
5956 on the kill ring.
5957 <A NAME="lbCH">&nbsp;</A>
5958 <H4>Readline Initialization</H4>
5959
5960 <P>
5961
5962 Readline is customized by putting commands in an initialization
5963 file (the <I>inputrc</I> file).
5964 The name of this file is taken from the value of the
5965 <FONT SIZE=-1><B>INPUTRC</B>
5966
5967 </FONT>
5968 variable.  If that variable is unset, the default is
5969 <A HREF="file:~/.inputrc"><I>~/.inputrc</I></A>.
5970
5971 When a program which uses the readline library starts up, the
5972 initialization file is read, and the key bindings and variables
5973 are set.
5974 There are only a few basic constructs allowed in the
5975 readline initialization file.
5976 Blank lines are ignored.
5977 Lines beginning with a <B>#</B> are comments.
5978 Lines beginning with a <B>$</B> indicate conditional constructs.
5979 Other lines denote key bindings and variable settings.
5980 <P>
5981
5982 The default key-bindings may be changed with an
5983 <I>inputrc </I>
5984
5985 file.
5986 Other programs that use this library may add their own commands
5987 and bindings.
5988 <P>
5989
5990 For example, placing
5991 <DL COMPACT><DT><DD>
5992 <P>
5993
5994 M-Control-u: universal-argument
5995 </DL>
5996
5997 or
5998 <DL COMPACT><DT><DD>
5999 C-Meta-u: universal-argument
6000 </DL>
6001
6002 into the 
6003 <I>inputrc</I>
6004
6005 would make M-C-u execute the readline command
6006 <I>universal-argument</I>.
6007
6008 <P>
6009
6010 The following symbolic character names are recognized:
6011 <I>RUBOUT</I>,
6012
6013 <I>DEL</I>,
6014
6015 <I>ESC</I>,
6016
6017 <I>LFD</I>,
6018
6019 <I>NEWLINE</I>,
6020
6021 <I>RET</I>,
6022
6023 <I>RETURN</I>,
6024
6025 <I>SPC</I>,
6026
6027 <I>SPACE</I>,
6028
6029 and
6030 <I>TAB</I>.
6031
6032 <P>
6033
6034 In addition to command names, readline allows keys to be bound
6035 to a string that is inserted when the key is pressed (a <I>macro</I>).
6036 <A NAME="lbCI">&nbsp;</A>
6037 <H4>Readline Key Bindings</H4>
6038
6039 <P>
6040
6041 The syntax for controlling key bindings in the
6042 <I>inputrc</I>
6043
6044 file is simple.  All that is required is the name of the
6045 command or the text of a macro and a key sequence to which
6046 it should be bound. The name may be specified in one of two ways:
6047 as a symbolic key name, possibly with <I>Meta-</I> or <I>Control-</I>
6048 prefixes, or as a key sequence.
6049 <P>
6050
6051 When using the form <B>keyname</B>:<I>function-name</I> or <I>macro</I>,
6052 <I>keyname</I>
6053
6054 is the name of a key spelled out in English.  For example:
6055 <P>
6056 <DL COMPACT><DT><DD>
6057 Control-u: universal-argument
6058 <BR>
6059
6060 Meta-Rubout: backward-kill-word
6061 <BR>
6062
6063 Control-o: &quot;&gt; output&quot;
6064 </DL>
6065
6066 <P>
6067
6068 In the above example,
6069 <I>C-u</I>
6070
6071 is bound to the function
6072 <B>universal-argument</B>,
6073
6074 <I>M-DEL</I>
6075
6076 is bound to the function
6077 <B>backward-kill-word</B>,
6078
6079 and
6080 <I>C-o</I>
6081
6082 is bound to run the macro
6083 expressed on the right hand side (that is, to insert the text
6084 <TT>&gt; output</TT>
6085
6086 into the line).
6087 <P>
6088
6089 In the second form, <B>&quot;keyseq&quot;</B>:<I>function-name</I> or <I>macro</I>,
6090 <B>keyseq</B>
6091
6092 differs from
6093 <B>keyname</B>
6094
6095 above in that strings denoting
6096 an entire key sequence may be specified by placing the sequence
6097 within double quotes.  Some GNU Emacs style key escapes can be
6098 used, as in the following example, but the symbolic character names
6099 are not recognized.
6100 <P>
6101 <DL COMPACT><DT><DD>
6102 &quot;\C-u&quot;: universal-argument
6103 <BR>
6104
6105 &quot;\C-x\C-r&quot;: re-read-init-file
6106 <BR>
6107
6108 &quot;\e[11~&quot;: &quot;Function Key 1&quot;
6109 </DL>
6110
6111 <P>
6112
6113 In this example,
6114 <I>C-u</I>
6115
6116 is again bound to the function
6117 <B>universal-argument</B>.
6118
6119 <I>C-x C-r</I>
6120
6121 is bound to the function
6122 <B>re-read-init-file</B>,
6123
6124 and 
6125 <I>ESC [ 1 1 ~</I>
6126
6127 is bound to insert the text
6128 <TT>Function Key 1</TT>.
6129
6130 <P>
6131
6132 The full set of GNU Emacs style escape sequences is
6133 <DL COMPACT><DT><DD>
6134
6135 <DL COMPACT>
6136 <DT><B>\C-</B>
6137
6138 <DD>
6139 control prefix
6140 <DT><B>\M-</B>
6141
6142 <DD>
6143 meta prefix
6144 <DT><B>\e</B>
6145
6146 <DD>
6147 an escape character
6148 <DT><B>\\</B>
6149
6150 <DD>
6151 backslash
6152 <DT><B>\</B>
6153
6154 <DD>
6155 literal &quot;
6156 <DT><B>\aq</B>
6157
6158 <DD>
6159 literal aq
6160 </DL></DL>
6161
6162
6163 <P>
6164
6165 In addition to the GNU Emacs style escape sequences, a second
6166 set of backslash escapes is available:
6167 <DL COMPACT><DT><DD>
6168
6169 <DL COMPACT>
6170 <DT><B>\a</B>
6171
6172 <DD>
6173 alert (bell)
6174 <DT><B>\b</B>
6175
6176 <DD>
6177 backspace
6178 <DT><B>\d</B>
6179
6180 <DD>
6181 delete
6182 <DT><B>\f</B>
6183
6184 <DD>
6185 form feed
6186 <DT><B>\n</B>
6187
6188 <DD>
6189 newline
6190 <DT><B>\r</B>
6191
6192 <DD>
6193 carriage return
6194 <DT><B>\t</B>
6195
6196 <DD>
6197 horizontal tab
6198 <DT><B>\v</B>
6199
6200 <DD>
6201 vertical tab
6202 <DT><B>\</B><I>nnn</I>
6203
6204 <DD>
6205 the eight-bit character whose value is the octal value <I>nnn</I>
6206 (one to three digits)
6207 <DT><B>\x</B><I>HH</I>
6208
6209 <DD>
6210 the eight-bit character whose value is the hexadecimal value <I>HH</I>
6211 (one or two hex digits)
6212 </DL></DL>
6213
6214
6215 <P>
6216
6217 When entering the text of a macro, single or double quotes must
6218 be used to indicate a macro definition.
6219 Unquoted text is assumed to be a function name.
6220 In the macro body, the backslash escapes described above are expanded.
6221 Backslash will quote any other character in the macro text,
6222 including &quot; and aq.
6223 <P>
6224
6225 <B>Bash</B>
6226
6227 allows the current readline key bindings to be displayed or modified
6228 with the
6229 <B>bind</B>
6230
6231 builtin command.  The editing mode may be switched during interactive
6232 use by using the
6233 <B>-o</B>
6234
6235 option to the
6236 <B>set</B>
6237
6238 builtin command (see
6239 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
6240
6241 </FONT>
6242 below).
6243 <A NAME="lbCJ">&nbsp;</A>
6244 <H4>Readline Variables</H4>
6245
6246 <P>
6247
6248 Readline has variables that can be used to further customize its
6249 behavior.  A variable may be set in the
6250 <I>inputrc</I>
6251
6252 file with a statement of the form
6253 <DL COMPACT><DT><DD>
6254 <P>
6255
6256 <B>set</B> <I>variable-name</I> <I>value</I>
6257 </DL>
6258
6259 <P>
6260
6261 Except where noted, readline variables can take the values
6262 <B>On</B>
6263
6264 or
6265 <B>Off</B>
6266
6267 (without regard to case).
6268 Unrecognized variable names are ignored.
6269 When a variable value is read, empty or null values, &quot;on&quot; (case-insensitive),
6270 and &quot;1&quot; are equivalent to <B>On</B>.  All other values are equivalent to
6271 <B>Off</B>.
6272 The variables and their default values are:
6273 <P>
6274
6275
6276 <DL COMPACT>
6277 <DT><B>bell-style (audible)</B>
6278
6279 <DD>
6280 Controls what happens when readline wants to ring the terminal bell.
6281 If set to <B>none</B>, readline never rings the bell.  If set to
6282 <B>visible</B>, readline uses a visible bell if one is available.
6283 If set to <B>audible</B>, readline attempts to ring the terminal's bell.
6284 <DT><B>bind-tty-special-chars (On)</B>
6285
6286 <DD>
6287 If set to <B>On</B>, readline attempts to bind the control characters
6288 treated specially by the kernel's terminal driver to their readline
6289 equivalents.
6290 <DT><B>comment-begin (``#'')</B>
6291
6292 <DD>
6293 The string that is inserted when the readline
6294 <B>insert-comment</B>
6295
6296 command is executed.
6297 This command is bound to
6298 <B>M-#</B>
6299
6300 in emacs mode and to
6301 <B>#</B>
6302
6303 in vi command mode.
6304 <DT><B>completion-ignore-case (Off)</B>
6305
6306 <DD>
6307 If set to <B>On</B>, readline performs filename matching and completion
6308 in a case-insensitive fashion.
6309 <DT><B>completion-prefix-display-length (0)</B>
6310
6311 <DD>
6312 The length in characters of the common prefix of a list of possible
6313 completions that is displayed without modification.  When set to a
6314 value greater than zero, common prefixes longer than this value are
6315 replaced with an ellipsis when displaying possible completions.
6316 <DT><B>completion-query-items (100)</B>
6317
6318 <DD>
6319 This determines when the user is queried about viewing
6320 the number of possible completions
6321 generated by the <B>possible-completions</B> command.
6322 It may be set to any integer value greater than or equal to
6323 zero.  If the number of possible completions is greater than
6324 or equal to the value of this variable, the user is asked whether
6325 or not he wishes to view them; otherwise they are simply listed
6326 on the terminal.
6327 <DT><B>convert-meta (On)</B>
6328
6329 <DD>
6330 If set to <B>On</B>, readline will convert characters with the
6331 eighth bit set to an ASCII key sequence
6332 by stripping the eighth bit and prefixing an
6333 escape character (in effect, using escape as the <I>meta prefix</I>).
6334 <DT><B>disable-completion (Off)</B>
6335
6336 <DD>
6337 If set to <B>On</B>, readline will inhibit word completion.  Completion
6338 characters will be inserted into the line as if they had been
6339 mapped to <B>self-insert</B>.
6340 <DT><B>editing-mode (emacs)</B>
6341
6342 <DD>
6343 Controls whether readline begins with a set of key bindings similar
6344 to <I>emacs</I> or <I>vi</I>.
6345 <B>editing-mode</B>
6346
6347 can be set to either
6348 <B>emacs</B>
6349
6350 or
6351 <B>vi</B>.
6352
6353 <DT><B>enable-keypad (Off)</B>
6354
6355 <DD>
6356 When set to <B>On</B>, readline will try to enable the application
6357 keypad when it is called.  Some systems need this to enable the
6358 arrow keys.
6359 <DT><B>expand-tilde (Off)</B>
6360
6361 <DD>
6362 If set to <B>on</B>, tilde expansion is performed when readline
6363 attempts word completion.
6364 <DT><B>history-preserve-point (Off)</B>
6365
6366 <DD>
6367 If set to <B>on</B>, the history code attempts to place point at the
6368 same location on each history line retrieved with <B>previous-history</B>
6369 or <B>next-history</B>.
6370 <DT><B>history-size (0)</B>
6371
6372 <DD>
6373 Set the maximum number of history entries saved in the history list.  If
6374 set to zero, the number of entries in the history list is not limited.
6375 <DT><B>horizontal-scroll-mode (Off)</B>
6376
6377 <DD>
6378 When set to <B>On</B>, makes readline use a single line for display,
6379 scrolling the input horizontally on a single screen line when it
6380 becomes longer than the screen width rather than wrapping to a new line.
6381 <DT><B>input-meta (Off)</B>
6382
6383 <DD>
6384 If set to <B>On</B>, readline will enable eight-bit input (that is,
6385 it will not strip the high bit from the characters it reads),
6386 regardless of what the terminal claims it can support.  The name
6387 <B>meta-flag</B>
6388
6389 is a synonym for this variable.
6390 <DT><B>isearch-terminators (``C-[C-J'')</B>
6391
6392 <DD>
6393 The string of characters that should terminate an incremental
6394 search without subsequently executing the character as a command.
6395 If this variable has not been given a value, the characters
6396 <I>ESC</I> and <I>C-J</I> will terminate an incremental search.
6397 <DT><B>keymap (emacs)</B>
6398
6399 <DD>
6400 Set the current readline keymap.  The set of valid keymap names is
6401 <I>emacs, emacs-standard, emacs-meta, emacs-ctlx, vi,
6402 vi-command</I>, and
6403 <I>vi-insert</I>.
6404
6405 <I>vi</I> is equivalent to <I>vi-command</I>; <I>emacs</I> is
6406 equivalent to <I>emacs-standard</I>.  The default value is
6407 <I>emacs</I>;
6408
6409 the value of
6410 <B>editing-mode</B>
6411
6412 also affects the default keymap.
6413 <DT><B>mark-directories (On)</B>
6414
6415 <DD>
6416 If set to <B>On</B>, completed directory names have a slash
6417 appended.
6418 <DT><B>mark-modified-lines (Off)</B>
6419
6420 <DD>
6421 If set to <B>On</B>, history lines that have been modified are displayed
6422 with a preceding asterisk (<B>*</B>).
6423 <DT><B>mark-symlinked-directories (Off)</B>
6424
6425 <DD>
6426 If set to <B>On</B>, completed names which are symbolic links to directories
6427 have a slash appended (subject to the value of
6428 <B>mark-directories</B>).
6429 <DT><B>match-hidden-files (On)</B>
6430
6431 <DD>
6432 This variable, when set to <B>On</B>, causes readline to match files whose
6433 names begin with a `.' (hidden files) when performing filename 
6434 completion, unless the leading `.' is
6435 supplied by the user in the filename to be completed.
6436 <DT><B>output-meta (Off)</B>
6437
6438 <DD>
6439 If set to <B>On</B>, readline will display characters with the
6440 eighth bit set directly rather than as a meta-prefixed escape
6441 sequence.
6442 <DT><B>page-completions (On)</B>
6443
6444 <DD>
6445 If set to <B>On</B>, readline uses an internal <I>more</I>-like pager
6446 to display a screenful of possible completions at a time.
6447 <DT><B>print-completions-horizontally (Off)</B>
6448
6449 <DD>
6450 If set to <B>On</B>, readline will display completions with matches
6451 sorted horizontally in alphabetical order, rather than down the screen.
6452 <DT><B>revert-all-at-newline (Off)</B>
6453
6454 <DD>
6455 If set to <B>on</B>, readline will undo all changes to history lines 
6456 before returning when <B>accept-line</B> is executed.  By default,
6457 history lines may be modified and retain individual undo lists across
6458 calls to <B>readline</B>.
6459 <DT><B>show-all-if-ambiguous (Off)</B>
6460
6461 <DD>
6462 This alters the default behavior of the completion functions.  If
6463 set to
6464 <B>on</B>,
6465
6466 words which have more than one possible completion cause the
6467 matches to be listed immediately instead of ringing the bell.
6468 <DT><B>show-all-if-unmodified (Off)</B>
6469
6470 <DD>
6471 This alters the default behavior of the completion functions in
6472 a fashion similar to <B>show-all-if-ambiguous</B>.
6473 If set to
6474 <B>on</B>,
6475
6476 words which have more than one possible completion without any
6477 possible partial completion (the possible completions don't share
6478 a common prefix) cause the matches to be listed immediately instead
6479 of ringing the bell.
6480 <DT><B>visible-stats (Off)</B>
6481
6482 <DD>
6483 If set to <B>On</B>, a character denoting a file's type as reported
6484 by <I>stat</I>(2) is appended to the filename when listing possible
6485 completions.
6486
6487 </DL>
6488 <A NAME="lbCK">&nbsp;</A>
6489 <H4>Readline Conditional Constructs</H4>
6490
6491 <P>
6492
6493 Readline implements a facility similar in spirit to the conditional
6494 compilation features of the C preprocessor which allows key
6495 bindings and variable settings to be performed as the result
6496 of tests.  There are four parser directives used.
6497 <DL COMPACT>
6498 <DT><B>$if</B><DD>
6499 The 
6500 <B>$if</B>
6501
6502 construct allows bindings to be made based on the
6503 editing mode, the terminal being used, or the application using
6504 readline.  The text of the test extends to the end of the line;
6505 no characters are required to isolate it.
6506 <DL COMPACT><DT><DD>
6507 <DL COMPACT>
6508 <DT><B>mode</B><DD>
6509 The <B>mode=</B> form of the <B>$if</B> directive is used to test
6510 whether readline is in emacs or vi mode.
6511 This may be used in conjunction
6512 with the <B>set keymap</B> command, for instance, to set bindings in
6513 the <I>emacs-standard</I> and <I>emacs-ctlx</I> keymaps only if
6514 readline is starting out in emacs mode.
6515 <DT><B>term</B><DD>
6516 The <B>term=</B> form may be used to include terminal-specific
6517 key bindings, perhaps to bind the key sequences output by the
6518 terminal's function keys.  The word on the right side of the
6519 <B>=</B>
6520
6521 is tested against the both full name of the terminal and the portion
6522 of the terminal name before the first <B>-</B>.  This allows
6523 <I>sun</I>
6524
6525 to match both
6526 <I>sun</I>
6527
6528 and
6529 <I>sun-cmd</I>,
6530
6531 for instance.
6532 <DT><B>application</B><DD>
6533 The <B>application</B> construct is used to include
6534 application-specific settings.  Each program using the readline
6535 library sets the <I>application name</I>, and an initialization
6536 file can test for a particular value.
6537 This could be used to bind key sequences to functions useful for
6538 a specific program.  For instance, the following command adds a
6539 key sequence that quotes the current or previous word in Bash:
6540 <P>
6541 <DL COMPACT><DT><DD>
6542 <PRE>
6543 <B>$if</B> Bash
6544 # Quote the current or previous word
6545 &quot;\C-xq&quot;: &quot;\eb\&quot;\ef\&quot;&quot;
6546 <B>$endif</B>
6547 </PRE>
6548
6549 </DL>
6550
6551 </DL></DL>
6552
6553 <DT><B>$endif</B><DD>
6554 This command, as seen in the previous example, terminates an
6555 <B>$if</B> command.
6556 <DT><B>$else</B><DD>
6557 Commands in this branch of the <B>$if</B> directive are executed if
6558 the test fails.
6559 <DT><B>$include</B><DD>
6560 This directive takes a single filename as an argument and reads commands
6561 and bindings from that file.  For example, the following directive
6562 would read <A HREF="file:/etc/inputrc"><I>/etc/inputrc</I></A>:
6563 <P>
6564 <DL COMPACT><DT><DD>
6565 <PRE>
6566 <B>$include</B>  <A HREF="file:/etc/inputrc"><I>/etc/inputrc</I></A>
6567 </PRE>
6568
6569 </DL>
6570
6571 </DL>
6572 <A NAME="lbCL">&nbsp;</A>
6573 <H4>Searching</H4>
6574
6575 <P>
6576
6577 Readline provides commands for searching through the command history
6578 (see
6579 <FONT SIZE=-1><B>HISTORY</B>
6580
6581 </FONT>
6582 below) for lines containing a specified string.
6583 There are two search modes:
6584 <I>incremental</I>
6585
6586 and
6587 <I>non-incremental</I>.
6588
6589 <P>
6590
6591 Incremental searches begin before the user has finished typing the
6592 search string.
6593 As each character of the search string is typed, readline displays
6594 the next entry from the history matching the string typed so far.
6595 An incremental search requires only as many characters as needed to
6596 find the desired history entry.
6597 The characters present in the value of the <B>isearch-terminators</B>
6598 variable are used to terminate an incremental search.
6599 If that variable has not been assigned a value the Escape and
6600 Control-J characters will terminate an incremental search.
6601 Control-G will abort an incremental search and restore the original
6602 line.
6603 When the search is terminated, the history entry containing the
6604 search string becomes the current line.
6605 <P>
6606
6607 To find other matching entries in the history list, type Control-S or
6608 Control-R as appropriate.
6609 This will search backward or forward in the history for the next
6610 entry matching the search string typed so far.
6611 Any other key sequence bound to a readline command will terminate
6612 the search and execute that command.
6613 For instance, a <I>newline</I> will terminate the search and accept
6614 the line, thereby executing the command from the history list.
6615 <P>
6616
6617 Readline remembers the last incremental search string.  If two
6618 Control-Rs are typed without any intervening characters defining a
6619 new search string, any remembered search string is used.
6620 <P>
6621
6622 Non-incremental searches read the entire search string before starting
6623 to search for matching history lines.  The search string may be
6624 typed by the user or be part of the contents of the current line.
6625 <A NAME="lbCM">&nbsp;</A>
6626 <H4>Readline Command Names</H4>
6627
6628 <P>
6629
6630 The following is a list of the names of the commands and the default
6631 key sequences to which they are bound.
6632 Command names without an accompanying key sequence are unbound by default.
6633 In the following descriptions, <I>point</I> refers to the current cursor
6634 position, and <I>mark</I> refers to a cursor position saved by the
6635 <B>set-mark</B> command.
6636 The text between the point and mark is referred to as the <I>region</I>.
6637 <A NAME="lbCN">&nbsp;</A>
6638 <H4>Commands for Moving</H4>
6639
6640 <P>
6641
6642
6643 <DL COMPACT>
6644 <DT><B>beginning-of-line (C-a)</B>
6645
6646 <DD>
6647 Move to the start of the current line.
6648 <DT><B>end-of-line (C-e)</B>
6649
6650 <DD>
6651 Move to the end of the line.
6652 <DT><B>forward-char (C-f)</B>
6653
6654 <DD>
6655 Move forward a character.
6656 <DT><B>backward-char (C-b)</B>
6657
6658 <DD>
6659 Move back a character.
6660 <DT><B>forward-word (M-f)</B>
6661
6662 <DD>
6663 Move forward to the end of the next word.  Words are composed of
6664 alphanumeric characters (letters and digits).
6665 <DT><B>backward-word (M-b)</B>
6666
6667 <DD>
6668 Move back to the start of the current or previous word.
6669 Words are composed of alphanumeric characters (letters and digits).
6670 <DT><B>shell-forward-word</B>
6671
6672 <DD>
6673 Move forward to the end of the next word.
6674 Words are delimited by non-quoted shell metacharacters.
6675 <DT><B>shell-backward-word</B>
6676
6677 <DD>
6678 Move back to the start of the current or previous word.
6679 Words are delimited by non-quoted shell metacharacters.
6680 <DT><B>clear-screen (C-l)</B>
6681
6682 <DD>
6683 Clear the screen leaving the current line at the top of the screen.
6684 With an argument, refresh the current line without clearing the
6685 screen.
6686 <DT><B>redraw-current-line</B>
6687
6688 <DD>
6689 Refresh the current line.
6690
6691 </DL>
6692 <A NAME="lbCO">&nbsp;</A>
6693 <H4>Commands for Manipulating the History</H4>
6694
6695 <P>
6696
6697
6698 <DL COMPACT>
6699 <DT><B>accept-line (Newline, Return)</B>
6700
6701 <DD>
6702 Accept the line regardless of where the cursor is.  If this line is
6703 non-empty, add it to the history list according to the state of the
6704 <FONT SIZE=-1><B>HISTCONTROL</B>
6705
6706 </FONT>
6707 variable.  If the line is a modified history
6708 line, then restore the history line to its original state.
6709 <DT><B>previous-history (C-p)</B>
6710
6711 <DD>
6712 Fetch the previous command from the history list, moving back in
6713 the list.
6714 <DT><B>next-history (C-n)</B>
6715
6716 <DD>
6717 Fetch the next command from the history list, moving forward in the
6718 list.
6719 <DT><B>beginning-of-history (M-&lt;)</B>
6720
6721 <DD>
6722 Move to the first line in the history.
6723 <DT><B>end-of-history (M-&gt;)</B>
6724
6725 <DD>
6726 Move to the end of the input history, i.e., the line currently being
6727 entered.
6728 <DT><B>reverse-search-history (C-r)</B>
6729
6730 <DD>
6731 Search backward starting at the current line and moving `up' through
6732 the history as necessary.  This is an incremental search.
6733 <DT><B>forward-search-history (C-s)</B>
6734
6735 <DD>
6736 Search forward starting at the current line and moving `down' through
6737 the history as necessary.  This is an incremental search.
6738 <DT><B>non-incremental-reverse-search-history (M-p)</B>
6739
6740 <DD>
6741 Search backward through the history starting at the current line
6742 using a non-incremental search for a string supplied by the user.
6743 <DT><B>non-incremental-forward-search-history (M-n)</B>
6744
6745 <DD>
6746 Search forward through the history using a non-incremental search for
6747 a string supplied by the user.
6748 <DT><B>history-search-forward</B>
6749
6750 <DD>
6751 Search forward through the history for the string of characters
6752 between the start of the current line and the point.
6753 This is a non-incremental search.
6754 <DT><B>history-search-backward</B>
6755
6756 <DD>
6757 Search backward through the history for the string of characters
6758 between the start of the current line and the point.
6759 This is a non-incremental search.
6760 <DT><B>yank-nth-arg (M-C-y)</B>
6761
6762 <DD>
6763 Insert the first argument to the previous command (usually
6764 the second word on the previous line) at point.
6765 With an argument
6766 <I>n</I>,
6767
6768 insert the <I>n</I>th word from the previous command (the words
6769 in the previous command begin with word 0).  A negative argument
6770 inserts the <I>n</I>th word from the end of the previous command.
6771 Once the argument <I>n</I> is computed, the argument is extracted
6772 as if the &quot;!<I>n</I>&quot; history expansion had been specified.
6773 <DT><B>yank-last-arg (M-., M-_)</B>
6774
6775 <DD>
6776 Insert the last argument to the previous command (the last word of
6777 the previous history entry).  With an argument,
6778 behave exactly like <B>yank-nth-arg</B>.
6779 Successive calls to <B>yank-last-arg</B> move back through the history
6780 list, inserting the last argument of each line in turn.
6781 The history expansion facilities are used to extract the last argument,
6782 as if the &quot;!$&quot; history expansion had been specified.
6783 <DT><B>shell-expand-line (M-C-e)</B>
6784
6785 <DD>
6786 Expand the line as the shell does.  This
6787 performs alias and history expansion as well as all of the shell
6788 word expansions.  See
6789 <FONT SIZE=-1><B>HISTORY EXPANSION</B>
6790
6791 </FONT>
6792 below for a description of history expansion.
6793 <DT><B>history-expand-line (M-^)</B>
6794
6795 <DD>
6796 Perform history expansion on the current line.
6797 See
6798 <FONT SIZE=-1><B>HISTORY EXPANSION</B>
6799
6800 </FONT>
6801 below for a description of history expansion.
6802 <DT><B>magic-space</B>
6803
6804 <DD>
6805 Perform history expansion on the current line and insert a space.
6806 See
6807 <FONT SIZE=-1><B>HISTORY EXPANSION</B>
6808
6809 </FONT>
6810 below for a description of history expansion.
6811 <DT><B>alias-expand-line</B>
6812
6813 <DD>
6814 Perform alias expansion on the current line.
6815 See
6816 <FONT SIZE=-1><B>ALIASES</B>
6817
6818 </FONT>
6819 above for a description of alias expansion.
6820 <DT><B>history-and-alias-expand-line</B>
6821
6822 <DD>
6823 Perform history and alias expansion on the current line.
6824 <DT><B>insert-last-argument (M-., M-_)</B>
6825
6826 <DD>
6827 A synonym for <B>yank-last-arg</B>.
6828 <DT><B>operate-and-get-next (C-o)</B>
6829
6830 <DD>
6831 Accept the current line for execution and fetch the next line
6832 relative to the current line from the history for editing.  Any
6833 argument is ignored.
6834 <DT><B>edit-and-execute-command (C-xC-e)</B>
6835
6836 <DD>
6837 Invoke an editor on the current command line, and execute the result as shell
6838 commands.
6839 <B>Bash</B> attempts to invoke
6840 <FONT SIZE=-1><B>$VISUAL</B>,
6841
6842 </FONT>
6843 <FONT SIZE=-1><B>$EDITOR</B>,
6844
6845 </FONT>
6846 and <I>emacs</I> as the editor, in that order.
6847
6848 </DL>
6849 <A NAME="lbCP">&nbsp;</A>
6850 <H4>Commands for Changing Text</H4>
6851
6852 <P>
6853
6854
6855 <DL COMPACT>
6856 <DT><B>delete-char (C-d)</B>
6857
6858 <DD>
6859 Delete the character at point.  If point is at the
6860 beginning of the line, there are no characters in the line, and
6861 the last character typed was not bound to <B>delete-char</B>,
6862 then return
6863 <FONT SIZE=-1><B>EOF</B>.
6864
6865 </FONT>
6866 <DT><B>backward-delete-char (Rubout)</B>
6867
6868 <DD>
6869 Delete the character behind the cursor.  When given a numeric argument,
6870 save the deleted text on the kill ring.
6871 <DT><B>forward-backward-delete-char</B>
6872
6873 <DD>
6874 Delete the character under the cursor, unless the cursor is at the
6875 end of the line, in which case the character behind the cursor is
6876 deleted.
6877 <DT><B>quoted-insert (C-q, C-v)</B>
6878
6879 <DD>
6880 Add the next character typed to the line verbatim.  This is
6881 how to insert characters like <B>C-q</B>, for example.
6882 <DT><B>tab-insert (C-v TAB)</B>
6883
6884 <DD>
6885 Insert a tab character.
6886 <DT><B>self-insert (a,&nbsp;b,&nbsp;A,&nbsp;1,&nbsp;!,&nbsp;...)</B>
6887
6888 <DD>
6889 Insert the character typed.
6890 <DT><B>transpose-chars (C-t)</B>
6891
6892 <DD>
6893 Drag the character before point forward over the character at point,
6894 moving point forward as well.
6895 If point is at the end of the line, then this transposes
6896 the two characters before point.
6897 Negative arguments have no effect.
6898 <DT><B>transpose-words (M-t)</B>
6899
6900 <DD>
6901 Drag the word before point past the word after point,
6902 moving point over that word as well.
6903 If point is at the end of the line, this transposes
6904 the last two words on the line.   
6905 <DT><B>upcase-word (M-u)</B>
6906
6907 <DD>
6908 Uppercase the current (or following) word.  With a negative argument,
6909 uppercase the previous word, but do not move point.
6910 <DT><B>downcase-word (M-l)</B>
6911
6912 <DD>
6913 Lowercase the current (or following) word.  With a negative argument,
6914 lowercase the previous word, but do not move point.
6915 <DT><B>capitalize-word (M-c)</B>
6916
6917 <DD>
6918 Capitalize the current (or following) word.  With a negative argument,
6919 capitalize the previous word, but do not move point.
6920 <DT><B>overwrite-mode</B>
6921
6922 <DD>
6923 Toggle overwrite mode.  With an explicit positive numeric argument,
6924 switches to overwrite mode.  With an explicit non-positive numeric
6925 argument, switches to insert mode.  This command affects only
6926 <B>emacs</B> mode; <B>vi</B> mode does overwrite differently.
6927 Each call to <I>readline()</I> starts in insert mode.
6928 In overwrite mode, characters bound to <B>self-insert</B> replace   
6929 the text at point rather than pushing the text to the right.
6930 Characters bound to <B>backward-delete-char</B> replace the character
6931 before point with a space.  By default, this command is unbound.
6932
6933 </DL>
6934 <A NAME="lbCQ">&nbsp;</A>
6935 <H4>Killing and Yanking</H4>
6936
6937 <P>
6938
6939
6940 <DL COMPACT>
6941 <DT><B>kill-line (C-k)</B>
6942
6943 <DD>
6944 Kill the text from point to the end of the line.
6945 <DT><B>backward-kill-line (C-x Rubout)</B>
6946
6947 <DD>
6948 Kill backward to the beginning of the line.
6949 <DT><B>unix-line-discard (C-u)</B>
6950
6951 <DD>
6952 Kill backward from point to the beginning of the line.
6953 The killed text is saved on the kill-ring.
6954
6955 <DT><B>kill-whole-line</B>
6956
6957 <DD>
6958 Kill all characters on the current line, no matter where point is.
6959 <DT><B>kill-word  (M-d)</B>
6960
6961 <DD>
6962 Kill from point to the end of the current word, or if between
6963 words, to the end of the next word.
6964 Word boundaries are the same as those used by <B>forward-word</B>.
6965 <DT><B>backward-kill-word (M-Rubout)</B>
6966
6967 <DD>
6968 Kill the word behind point.
6969 Word boundaries are the same as those used by <B>backward-word</B>.
6970 <DT><B>shell-kill-word  (M-d)</B>
6971
6972 <DD>
6973 Kill from point to the end of the current word, or if between
6974 words, to the end of the next word.
6975 Word boundaries are the same as those used by <B>shell-forward-word</B>.
6976 <DT><B>shell-backward-kill-word (M-Rubout)</B>
6977
6978 <DD>
6979 Kill the word behind point.
6980 Word boundaries are the same as those used by <B>shell-backward-word</B>.
6981 <DT><B>unix-word-rubout (C-w)</B>
6982
6983 <DD>
6984 Kill the word behind point, using white space as a word boundary.
6985 The killed text is saved on the kill-ring.
6986 <DT><B>unix-filename-rubout</B>
6987
6988 <DD>
6989 Kill the word behind point, using white space and the slash character
6990 as the word boundaries.
6991 The killed text is saved on the kill-ring.
6992 <DT><B>delete-horizontal-space (M-\)</B>
6993
6994 <DD>
6995 Delete all spaces and tabs around point.
6996 <DT><B>kill-region</B>
6997
6998 <DD>
6999 Kill the text in the current region.
7000 <DT><B>copy-region-as-kill</B>
7001
7002 <DD>
7003 Copy the text in the region to the kill buffer.
7004 <DT><B>copy-backward-word</B>
7005
7006 <DD>
7007 Copy the word before point to the kill buffer.
7008 The word boundaries are the same as <B>backward-word</B>.
7009 <DT><B>copy-forward-word</B>
7010
7011 <DD>
7012 Copy the word following point to the kill buffer.
7013 The word boundaries are the same as <B>forward-word</B>.
7014 <DT><B>yank (C-y)</B>
7015
7016 <DD>
7017 Yank the top of the kill ring into the buffer at point.
7018 <DT><B>yank-pop (M-y)</B>
7019
7020 <DD>
7021 Rotate the kill ring, and yank the new top.  Only works following
7022 <B>yank</B>
7023
7024 or
7025 <B>yank-pop</B>.
7026
7027
7028 </DL>
7029 <A NAME="lbCR">&nbsp;</A>
7030 <H4>Numeric Arguments</H4>
7031
7032 <P>
7033
7034
7035 <DL COMPACT>
7036 <DT><B>digit-argument (M-0, M-1, ..., M--)</B>
7037
7038 <DD>
7039 Add this digit to the argument already accumulating, or start a new
7040 argument.  M-- starts a negative argument.
7041 <DT><B>universal-argument</B>
7042
7043 <DD>
7044 This is another way to specify an argument.
7045 If this command is followed by one or more digits, optionally with a
7046 leading minus sign, those digits define the argument.
7047 If the command is followed by digits, executing
7048 <B>universal-argument</B>
7049
7050 again ends the numeric argument, but is otherwise ignored.
7051 As a special case, if this command is immediately followed by a
7052 character that is neither a digit or minus sign, the argument count
7053 for the next command is multiplied by four.
7054 The argument count is initially one, so executing this function the
7055 first time makes the argument count four, a second time makes the
7056 argument count sixteen, and so on.
7057
7058 </DL>
7059 <A NAME="lbCS">&nbsp;</A>
7060 <H4>Completing</H4>
7061
7062 <P>
7063
7064
7065 <DL COMPACT>
7066 <DT><B>complete (TAB)</B>
7067
7068 <DD>
7069 Attempt to perform completion on the text before point.
7070 <B>Bash</B>
7071
7072 attempts completion treating the text as a variable (if the
7073 text begins with <B>$</B>), username (if the text begins with
7074 <B>~</B>), hostname (if the text begins with <B>@</B>), or
7075 command (including aliases and functions) in turn.  If none
7076 of these produces a match, filename completion is attempted.
7077 <DT><B>possible-completions (M-?)</B>
7078
7079 <DD>
7080 List the possible completions of the text before point.
7081 <DT><B>insert-completions (M-*)</B>
7082
7083 <DD>
7084 Insert all completions of the text before point
7085 that would have been generated by
7086 <B>possible-completions</B>.
7087 <DT><B>menu-complete</B>
7088
7089 <DD>
7090 Similar to <B>complete</B>, but replaces the word to be completed
7091 with a single match from the list of possible completions.
7092 Repeated execution of <B>menu-complete</B> steps through the list
7093 of possible completions, inserting each match in turn.
7094 At the end of the list of completions, the bell is rung
7095 (subject to the setting of <B>bell-style</B>)
7096 and the original text is restored.
7097 An argument of <I>n</I> moves <I>n</I> positions forward in the list
7098 of matches; a negative argument may be used to move backward
7099 through the list.
7100 This command is intended to be bound to <B>TAB</B>, but is unbound
7101 by default.
7102 <DT><B>delete-char-or-list</B>
7103
7104 <DD>
7105 Deletes the character under the cursor if not at the beginning or
7106 end of the line (like <B>delete-char</B>).
7107 If at the end of the line, behaves identically to
7108 <B>possible-completions</B>.
7109 This command is unbound by default.
7110 <DT><B>complete-filename (M-/)</B>
7111
7112 <DD>
7113 Attempt filename completion on the text before point.
7114 <DT><B>possible-filename-completions (C-x /)</B>
7115
7116 <DD>
7117 List the possible completions of the text before point,
7118 treating it as a filename.
7119 <DT><B>complete-username (M-~)</B>
7120
7121 <DD>
7122 Attempt completion on the text before point, treating
7123 it as a username.
7124 <DT><B>possible-username-completions (C-x ~)</B>
7125
7126 <DD>
7127 List the possible completions of the text before point,
7128 treating it as a username.
7129 <DT><B>complete-variable (M-$)</B>
7130
7131 <DD>
7132 Attempt completion on the text before point, treating
7133 it as a shell variable.
7134 <DT><B>possible-variable-completions (C-x $)</B>
7135
7136 <DD>
7137 List the possible completions of the text before point,
7138 treating it as a shell variable.
7139 <DT><B>complete-hostname (M-@)</B>
7140
7141 <DD>
7142 Attempt completion on the text before point, treating
7143 it as a hostname.
7144 <DT><B>possible-hostname-completions (C-x @)</B>
7145
7146 <DD>
7147 List the possible completions of the text before point,
7148 treating it as a hostname.
7149 <DT><B>complete-command (M-!)</B>
7150
7151 <DD>
7152 Attempt completion on the text before point, treating
7153 it as a command name.  Command completion attempts to
7154 match the text against aliases, reserved words, shell
7155 functions, shell builtins, and finally executable filenames,
7156 in that order.
7157 <DT><B>possible-command-completions (C-x !)</B>
7158
7159 <DD>
7160 List the possible completions of the text before point,
7161 treating it as a command name.
7162 <DT><B>dynamic-complete-history (M-TAB)</B>
7163
7164 <DD>
7165 Attempt completion on the text before point, comparing
7166 the text against lines from the history list for possible
7167 completion matches.
7168 <DT><B>dabbrev-expand</B>
7169
7170 <DD>
7171 Attempt menu completion on the text before point, comparing
7172 the text against lines from the history list for possible
7173 completion matches.
7174 <DT><B>complete-into-braces (M-{)</B>
7175
7176 <DD>
7177 Perform filename completion and insert the list of possible completions
7178 enclosed within braces so the list is available to the shell (see
7179 <B>Brace Expansion</B>
7180
7181 above).
7182
7183 </DL>
7184 <A NAME="lbCT">&nbsp;</A>
7185 <H4>Keyboard Macros</H4>
7186
7187 <P>
7188
7189
7190 <DL COMPACT>
7191 <DT><B>start-kbd-macro (C-x ()</B>
7192
7193 <DD>
7194 Begin saving the characters typed into the current keyboard macro.
7195 <DT><B>end-kbd-macro (C-x ))</B>
7196
7197 <DD>
7198 Stop saving the characters typed into the current keyboard macro
7199 and store the definition.
7200 <DT><B>call-last-kbd-macro (C-x e)</B>
7201
7202 <DD>
7203 Re-execute the last keyboard macro defined, by making the characters
7204 in the macro appear as if typed at the keyboard.
7205
7206 </DL>
7207 <A NAME="lbCU">&nbsp;</A>
7208 <H4>Miscellaneous</H4>
7209
7210 <P>
7211
7212
7213 <DL COMPACT>
7214 <DT><B>re-read-init-file (C-x C-r)</B>
7215
7216 <DD>
7217 Read in the contents of the <I>inputrc</I> file, and incorporate
7218 any bindings or variable assignments found there.
7219 <DT><B>abort (C-g)</B>
7220
7221 <DD>
7222 Abort the current editing command and
7223 ring the terminal's bell (subject to the setting of
7224 <B>bell-style</B>).
7225
7226 <DT><B>do-uppercase-version (M-a, M-b, M-</B><I>x</I>, ...)
7227
7228 <DD>
7229 If the metafied character <I>x</I> is lowercase, run the command
7230 that is bound to the corresponding uppercase character.
7231 <DT><B>prefix-meta (ESC)</B>
7232
7233 <DD>
7234 Metafy the next character typed.
7235 <FONT SIZE=-1><B>ESC</B>
7236
7237 </FONT>
7238 <B>f</B>
7239
7240 is equivalent to
7241 <B>Meta-f</B>.
7242
7243 <DT><B>undo (C-_, C-x C-u)</B>
7244
7245 <DD>
7246 Incremental undo, separately remembered for each line.
7247 <DT><B>revert-line (M-r)</B>
7248
7249 <DD>
7250 Undo all changes made to this line.  This is like executing the
7251 <B>undo</B>
7252
7253 command enough times to return the line to its initial state.
7254 <DT><B>tilde-expand (M-&amp;)</B>
7255
7256 <DD>
7257 Perform tilde expansion on the current word.
7258 <DT><B>set-mark (C-@, M-&lt;space&gt;)</B>
7259
7260 <DD>
7261 Set the mark to the point.  If a
7262 numeric argument is supplied, the mark is set to that position.
7263 <DT><B>exchange-point-and-mark (C-x C-x)</B>
7264
7265 <DD>
7266 Swap the point with the mark.  The current cursor position is set to
7267 the saved position, and the old cursor position is saved as the mark.
7268 <DT><B>character-search (C-])</B>
7269
7270 <DD>
7271 A character is read and point is moved to the next occurrence of that
7272 character.  A negative count searches for previous occurrences.
7273 <DT><B>character-search-backward (M-C-])</B>
7274
7275 <DD>
7276 A character is read and point is moved to the previous occurrence of that
7277 character.  A negative count searches for subsequent occurrences.
7278 <DT><B>insert-comment (M-#)</B>
7279
7280 <DD>
7281 Without a numeric argument, the value of the readline
7282 <B>comment-begin</B>
7283
7284 variable is inserted at the beginning of the current line.
7285 If a numeric argument is supplied, this command acts as a toggle:  if
7286 the characters at the beginning of the line do not match the value
7287 of <B>comment-begin</B>, the value is inserted, otherwise
7288 the characters in <B>comment-begin</B> are deleted from the beginning of 
7289 the line.
7290 In either case, the line is accepted as if a newline had been typed.
7291 The default value of
7292 <B>comment-begin</B> causes this command to make the current line
7293 a shell comment.
7294 If a numeric argument causes the comment character to be removed, the line
7295 will be executed by the shell.
7296 <DT><B>glob-complete-word (M-g)</B>
7297
7298 <DD>
7299 The word before point is treated as a pattern for pathname expansion,
7300 with an asterisk implicitly appended.  This pattern is used to
7301 generate a list of matching file names for possible completions.
7302 <DT><B>glob-expand-word (C-x *)</B>
7303
7304 <DD>
7305 The word before point is treated as a pattern for pathname expansion,
7306 and the list of matching file names is inserted, replacing the word.
7307 If a numeric argument is supplied, an asterisk is appended before
7308 pathname expansion.
7309 <DT><B>glob-list-expansions (C-x g)</B>
7310
7311 <DD>
7312 The list of expansions that would have been generated by
7313 <B>glob-expand-word</B>
7314
7315 is displayed, and the line is redrawn.
7316 If a numeric argument is supplied, an asterisk is appended before
7317 pathname expansion.
7318 <DT><B>dump-functions</B>
7319
7320 <DD>
7321 Print all of the functions and their key bindings to the
7322 readline output stream.  If a numeric argument is supplied,
7323 the output is formatted in such a way that it can be made part
7324 of an <I>inputrc</I> file.
7325 <DT><B>dump-variables</B>
7326
7327 <DD>
7328 Print all of the settable readline variables and their values to the
7329 readline output stream.  If a numeric argument is supplied,
7330 the output is formatted in such a way that it can be made part
7331 of an <I>inputrc</I> file.
7332 <DT><B>dump-macros</B>
7333
7334 <DD>
7335 Print all of the readline key sequences bound to macros and the
7336 strings they output.  If a numeric argument is supplied,
7337 the output is formatted in such a way that it can be made part
7338 of an <I>inputrc</I> file.
7339 <DT><B>display-shell-version (C-x C-v)</B>
7340
7341 <DD>
7342 Display version information about the current instance of
7343 <B>bash</B>.
7344
7345
7346 </DL>
7347 <A NAME="lbCV">&nbsp;</A>
7348 <H4>Programmable Completion</H4>
7349
7350 <P>
7351
7352 When word completion is attempted for an argument to a command for
7353 which a completion specification (a <I>compspec</I>) has been defined
7354 using the <B>complete</B> builtin (see
7355 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
7356
7357 </FONT>
7358 below), the programmable completion facilities are invoked.
7359 <P>
7360
7361 First, the command name is identified.
7362 If a compspec has been defined for that command, the
7363 compspec is used to generate the list of possible completions for the word.
7364 If the command word is a full pathname, a compspec for the full
7365 pathname is searched for first.
7366 If no compspec is found for the full pathname, an attempt is made to
7367 find a compspec for the portion following the final slash.
7368 <P>
7369
7370 Once a compspec has been found, it is used to generate the list of
7371 matching words.
7372 If a compspec is not found, the default <B>bash</B> completion as
7373 described above under <B>Completing</B> is performed.
7374 <P>
7375
7376 First, the actions specified by the compspec are used.
7377 Only matches which are prefixed by the word being completed are
7378 returned.
7379 When the
7380 <B>-f</B>
7381
7382 or
7383 <B>-d</B>
7384
7385 option is used for filename or directory name completion, the shell
7386 variable
7387 <FONT SIZE=-1><B>FIGNORE</B>
7388
7389 </FONT>
7390 is used to filter the matches.
7391 <P>
7392
7393 Any completions specified by a filename expansion pattern to the
7394 <B>-G</B> option are generated next.
7395 The words generated by the pattern need not match the word
7396 being completed.
7397 The
7398 <FONT SIZE=-1><B>GLOBIGNORE</B>
7399
7400 </FONT>
7401 shell variable is not used to filter the matches, but the
7402 <FONT SIZE=-1><B>FIGNORE</B>
7403
7404 </FONT>
7405 variable is used.
7406 <P>
7407
7408 Next, the string specified as the argument to the <B>-W</B> option
7409 is considered.
7410 The string is first split using the characters in the
7411 <FONT SIZE=-1><B>IFS</B>
7412
7413 </FONT>
7414 special variable as delimiters.
7415 Shell quoting is honored.
7416 Each word is then expanded using
7417 brace expansion, tilde expansion, parameter and variable expansion,
7418 command substitution, and arithmetic expansion,
7419 as described above under 
7420 <FONT SIZE=-1><B>EXPANSION</B>.
7421
7422 </FONT>
7423 The results are split using the rules described above under
7424 <B>Word Splitting</B>.
7425 The results of the expansion are prefix-matched against the word being
7426 completed, and the matching words become the possible completions.
7427 <P>
7428
7429 After these matches have been generated, any shell function or command
7430 specified with the <B>-F</B> and <B>-C</B> options is invoked.
7431 When the command or function is invoked, the
7432 <FONT SIZE=-1><B>COMP_LINE</B>,
7433
7434 </FONT>
7435 <FONT SIZE=-1><B>COMP_POINT</B>,
7436
7437 </FONT>
7438 <FONT SIZE=-1><B>COMP_KEY</B>,
7439
7440 </FONT>
7441 and
7442 <FONT SIZE=-1><B>COMP_TYPE</B>
7443
7444 </FONT>
7445 variables are assigned values as described above under
7446 <B>Shell Variables</B>.
7447 If a shell function is being invoked, the 
7448 <FONT SIZE=-1><B>COMP_WORDS</B>
7449
7450 </FONT>
7451 and
7452 <FONT SIZE=-1><B>COMP_CWORD</B>
7453
7454 </FONT>
7455 variables are also set.
7456 When the function or command is invoked, the first argument is the
7457 name of the command whose arguments are being completed, the
7458 second argument is the word being completed, and the third argument
7459 is the word preceding the word being completed on the current command line.
7460 No filtering of the generated completions against the word being completed
7461 is performed; the function or command has complete freedom in generating
7462 the matches.
7463 <P>
7464
7465 Any function specified with <B>-F</B> is invoked first.
7466 The function may use any of the shell facilities, including the
7467 <B>compgen</B> builtin described below, to generate the matches.
7468 It must put the possible completions in the
7469 <FONT SIZE=-1><B>COMPREPLY</B>
7470
7471 </FONT>
7472 array variable.
7473 <P>
7474
7475 Next, any command specified with the <B>-C</B> option is invoked
7476 in an environment equivalent to command substitution.
7477 It should print a list of completions, one per line, to the
7478 standard output.
7479 Backslash may be used to escape a newline, if necessary.
7480 <P>
7481
7482 After all of the possible completions are generated, any filter
7483 specified with the <B>-X</B> option is applied to the list.
7484 The filter is a pattern as used for pathname expansion; a <B>&amp;</B>
7485 in the pattern is replaced with the text of the word being completed.
7486 A literal <B>&amp;</B> may be escaped with a backslash; the backslash
7487 is removed before attempting a match.
7488 Any completion that matches the pattern will be removed from the list.
7489 A leading <B>!</B> negates the pattern; in this case any completion
7490 not matching the pattern will be removed.
7491 <P>
7492
7493 Finally, any prefix and suffix specified with the <B>-P</B> and <B>-S</B>
7494 options are added to each member of the completion list, and the result is
7495 returned to the readline completion code as the list of possible
7496 completions.
7497 <P>
7498
7499 If the previously-applied actions do not generate any matches, and the
7500 <B>-o dirnames</B> option was supplied to <B>complete</B> when the
7501 compspec was defined, directory name completion is attempted.
7502 <P>
7503
7504 If the <B>-o plusdirs</B> option was supplied to <B>complete</B> when the
7505 compspec was defined, directory name completion is attempted and any
7506 matches are added to the results of the other actions.
7507 <P>
7508
7509 By default, if a compspec is found, whatever it generates is returned
7510 to the completion code as the full set of possible completions.
7511 The default <B>bash</B> completions are not attempted, and the readline
7512 default of filename completion is disabled.
7513 If the <B>-o bashdefault</B> option was supplied to <B>complete</B> when
7514 the compspec was defined, the <B>bash</B> default completions are attempted
7515 if the compspec generates no matches.
7516 If the <B>-o default</B> option was supplied to <B>complete</B> when the
7517 compspec was defined, readline's default completion will be performed
7518 if the compspec (and, if attempted, the default <B>bash</B> completions)
7519 generate no matches.
7520 <P>
7521
7522 When a compspec indicates that directory name completion is desired,
7523 the programmable completion functions force readline to append a slash
7524 to completed names which are symbolic links to directories, subject to  
7525 the value of the <B>mark-directories</B> readline variable, regardless
7526 of the setting of the <B>mark-symlinked-directories</B> readline variable.
7527 <A NAME="lbCW">&nbsp;</A>
7528 <H3>HISTORY</H3>
7529
7530 When the
7531 <B>-o history</B>
7532
7533 option to the
7534 <B>set</B>
7535
7536 builtin is enabled, the shell provides access to the
7537 <I>command history</I>,
7538 the list of commands previously typed.
7539 The value of the <B>HISTSIZE</B> variable is used as the
7540 number of commands to save in a history list.
7541 The text of the last
7542 <FONT SIZE=-1><B>HISTSIZE</B>
7543
7544 </FONT>
7545 commands (default 500) is saved.  The shell
7546 stores each command in the history list prior to parameter and
7547 variable expansion (see
7548 <FONT SIZE=-1><B>EXPANSION</B>
7549
7550 </FONT>
7551 above) but after history expansion is performed, subject to the
7552 values of the shell variables
7553 <FONT SIZE=-1><B>HISTIGNORE</B>
7554
7555 </FONT>
7556 and
7557 <FONT SIZE=-1><B>HISTCONTROL</B>.
7558
7559 </FONT>
7560 <P>
7561
7562 On startup, the history is initialized from the file named by
7563 the variable
7564 <FONT SIZE=-1><B>HISTFILE</B>
7565
7566 </FONT>
7567 (default <A HREF="file:~/.bash_history"><I>~/.bash_history</I></A>).
7568 The file named by the value of
7569 <FONT SIZE=-1><B>HISTFILE</B>
7570
7571 </FONT>
7572 is truncated, if necessary, to contain no more than
7573 the number of lines specified by the value of
7574 <FONT SIZE=-1><B>HISTFILESIZE</B>.
7575
7576 </FONT>
7577 When the history file is read,
7578 lines beginning with the history comment character followed immediately
7579 by a digit are interpreted as timestamps for the preceding history line.
7580 These timestamps are optionally displayed depending on the value of the
7581 <FONT SIZE=-1><B>HISTTIMEFORMAT</B>
7582
7583 </FONT>
7584 variable.
7585 When an interactive shell exits, the last
7586 <FONT SIZE=-1><B>$HISTSIZE</B>
7587
7588 </FONT>
7589 lines are copied from the history list to
7590 <FONT SIZE=-1><B>$HISTFILE</B>.
7591
7592 </FONT>
7593 If the
7594 <B>histappend</B>
7595
7596 shell option is enabled
7597 (see the description of
7598 <B>shopt</B>
7599
7600 under
7601 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
7602
7603 </FONT>
7604 below), the lines are appended to the history file,
7605 otherwise the history file is overwritten.
7606 If
7607 <FONT SIZE=-1><B>HISTFILE</B>
7608
7609 </FONT>
7610 is unset, or if the history file is unwritable, the history is
7611 not saved.
7612 If the
7613 <FONT SIZE=-1>
7614 </FONT>
7615 variable is set, time stamps are written to the history file, marked
7616 with the history comment character, so
7617 they may be preserved across shell sessions.
7618 This uses the history comment character to distinguish timestamps from
7619 other history lines.
7620 After saving the history, the history file is truncated
7621 to contain no more than
7622 <FONT SIZE=-1><B>HISTFILESIZE</B>
7623
7624 </FONT>
7625 lines.  If
7626 <FONT SIZE=-1><B>HISTFILESIZE</B>
7627
7628 </FONT>
7629 is not set, no truncation is performed.
7630 <P>
7631
7632 The builtin command
7633 <B>fc</B>
7634
7635 (see
7636 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
7637
7638 </FONT>
7639 below) may be used to list or edit and re-execute a portion of
7640 the history list.
7641 The
7642 <B>history</B>
7643
7644 builtin may be used to display or modify the history list and
7645 manipulate the history file.
7646 When using command-line editing, search commands
7647 are available in each editing mode that provide access to the
7648 history list.
7649 <P>
7650
7651 The shell allows control over which commands are saved on the history
7652 list.  The
7653 <FONT SIZE=-1><B>HISTCONTROL</B>
7654
7655 </FONT>
7656 and
7657 <FONT SIZE=-1><B>HISTIGNORE</B>
7658
7659 </FONT>
7660 variables may be set to cause the shell to save only a subset of the
7661 commands entered.
7662 The
7663 <B>cmdhist</B>
7664
7665 shell option, if enabled, causes the shell to attempt to save each
7666 line of a multi-line command in the same history entry, adding
7667 semicolons where necessary to preserve syntactic correctness.
7668 The
7669 <B>lithist</B>
7670
7671 shell option causes the shell to save the command with embedded newlines
7672 instead of semicolons.  See the description of the
7673 <B>shopt</B>
7674
7675 builtin below under
7676 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
7677
7678 </FONT>
7679 for information on setting and unsetting shell options.
7680 <A NAME="lbCX">&nbsp;</A>
7681 <H3>HISTORY EXPANSION</H3>
7682
7683 <P>
7684
7685 The shell supports a history expansion feature that
7686 is similar to the history expansion in
7687 <B>csh.</B>
7688
7689 This section describes what syntax features are available.  This
7690 feature is enabled by default for interactive shells, and can be
7691 disabled using the
7692 <B>+H</B>
7693
7694 option to the
7695 <B>set</B>
7696
7697 builtin command (see
7698 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
7699
7700 </FONT>
7701 below).  Non-interactive shells do not perform history expansion
7702 by default.
7703 <P>
7704
7705 History expansions introduce words from the history list into
7706 the input stream, making it easy to repeat commands, insert the
7707 arguments to a previous command into the current input line, or
7708 fix errors in previous commands quickly.
7709 <P>
7710
7711 History expansion is performed immediately after a complete line
7712 is read, before the shell breaks it into words.
7713 It takes place in two parts.
7714 The first is to determine which line from the history list
7715 to use during substitution.
7716 The second is to select portions of that line for inclusion into
7717 the current one.
7718 The line selected from the history is the <I>event</I>,
7719 and the portions of that line that are acted upon are <I>words</I>.
7720 Various <I>modifiers</I> are available to manipulate the selected words.
7721 The line is broken into words in the same fashion as when reading input,
7722 so that several <I>metacharacter</I>-separated words surrounded by
7723 quotes are considered one word.
7724 History expansions are introduced by the appearance of the
7725 history expansion character, which is <B>!</B> by default.
7726 Only backslash (<B>\</B>) and single quotes can quote
7727 the history expansion character.
7728 <P>
7729
7730 Several characters inhibit history expansion if found immediately
7731 following the history expansion character, even if it is unquoted:
7732 space, tab, newline, carriage return, and <B>=</B>.
7733 If the <B>extglob</B> shell option is enabled, <B>(</B> will also
7734 inhibit expansion.
7735 <P>
7736
7737 Several shell options settable with the
7738 <B>shopt</B>
7739
7740 builtin may be used to tailor the behavior of history expansion.
7741 If the
7742 <B>histverify</B>
7743
7744 shell option is enabled (see the description of the
7745 <B>shopt</B>
7746
7747 builtin), and
7748 <B>readline</B>
7749
7750 is being used, history substitutions are not immediately passed to
7751 the shell parser.
7752 Instead, the expanded line is reloaded into the
7753 <B>readline</B>
7754
7755 editing buffer for further modification.
7756 If
7757 <B>readline</B>
7758
7759 is being used, and the
7760 <B>histreedit</B>
7761
7762 shell option is enabled, a failed history substitution will be reloaded
7763 into the
7764 <B>readline</B>
7765
7766 editing buffer for correction.
7767 The
7768 <B>-p</B>
7769
7770 option to the
7771 <B>history</B>
7772
7773 builtin command may be used to see what a history expansion will
7774 do before using it.
7775 The
7776 <B>-s</B>
7777
7778 option to the
7779 <B>history</B>
7780
7781 builtin may be used to add commands to the end of the history list
7782 without actually executing them, so that they are available for
7783 subsequent recall.
7784 <P>
7785
7786 The shell allows control of the various characters used by the
7787 history expansion mechanism (see the description of
7788 <B>histchars</B>
7789
7790 above under
7791 <B>Shell Variables</B>).
7792
7793 The shell uses
7794 the history comment character to mark history timestamps when
7795 writing the history file.
7796 <A NAME="lbCY">&nbsp;</A>
7797 <H4>Event Designators</H4>
7798
7799 <P>
7800
7801 An event designator is a reference to a command line entry in the
7802 history list.
7803 <P>
7804
7805
7806 <DL COMPACT>
7807 <DT><B>!</B>
7808
7809 <DD>
7810 Start a history substitution, except when followed by a
7811 <B>blank</B>,
7812
7813 newline, carriage return, =
7814 or ( (when the <B>extglob</B> shell option is enabled using
7815 the <B>shopt</B> builtin).
7816 <DT><B>!</B><I>n</I>
7817
7818 <DD>
7819 Refer to command line
7820 <I>n</I>.
7821
7822 <DT><B>!-</B><I>n</I>
7823
7824 <DD>
7825 Refer to the current command line minus
7826 <I>n</I>.
7827
7828 <DT><B>!!</B>
7829
7830 <DD>
7831 Refer to the previous command.  This is a synonym for `!-1'.
7832 <DT><B>!</B><I>string</I>
7833
7834 <DD>
7835 Refer to the most recent command starting with 
7836 <I>string</I>.
7837
7838 <DT><B>!?</B><I>string</I><B>[?]</B>
7839
7840 <DD>
7841 Refer to the most recent command containing
7842 <I>string</I>.
7843
7844 The trailing <B>?</B> may be omitted if
7845 <I>string</I>
7846
7847 is followed immediately by a newline.
7848 <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>
7849
7850 <DD>
7851 Quick substitution.  Repeat the last command, replacing
7852 <I>string1</I>
7853
7854 with
7855 <I>string2</I>.
7856
7857 Equivalent to
7858 ``!!:s/<I>string1</I>/<I>string2</I>/''
7859 (see <B>Modifiers</B> below).
7860 <DT><B>!#</B>
7861
7862 <DD>
7863 The entire command line typed so far.
7864
7865 </DL>
7866 <A NAME="lbCZ">&nbsp;</A>
7867 <H4>Word Designators</H4>
7868
7869 <P>
7870
7871 Word designators are used to select desired words from the event.
7872
7873 <B>:</B>
7874
7875 separates the event specification from the word designator.
7876 It may be omitted if the word designator begins with a
7877 <B>^</B>,
7878
7879 <B>$</B>,
7880
7881 <B>*</B>,
7882
7883 <B>-</B>,
7884
7885 or
7886 <B>%</B>.
7887
7888 Words are numbered from the beginning of the line,
7889 with the first word being denoted by 0 (zero).
7890 Words are inserted into the current line separated by single spaces.
7891 <P>
7892
7893
7894 <DL COMPACT>
7895 <DT><B>0 (zero)</B>
7896
7897 <DD>
7898 The zeroth word.  For the shell, this is the command
7899 word.
7900 <DT><I>n</I>
7901
7902 <DD>
7903 The <I>n</I>th word.
7904 <DT><B>^</B>
7905
7906 <DD>
7907 The first argument.  That is, word 1.
7908 <DT><B>$</B>
7909
7910 <DD>
7911 The last argument.
7912 <DT><B>%</B>
7913
7914 <DD>
7915 The word matched by the most recent `?<I>string</I>?' search.
7916 <DT><I>x</I><B>-</B>y
7917
7918 <DD>
7919 A range of words; `-<I>y</I>' abbreviates `0-<I>y</I>'.
7920 <DT><B>*</B>
7921
7922 <DD>
7923 All of the words but the zeroth.  This is a synonym
7924 for `<I>1-$</I>'.  It is not an error to use
7925 <B>*</B>
7926
7927 if there is just one
7928 word in the event; the empty string is returned in that case.
7929 <DT><B>x*</B>
7930
7931 <DD>
7932 Abbreviates <I>x-$</I>.
7933 <DT><B>x-</B>
7934
7935 <DD>
7936 Abbreviates <I>x-$</I> like <B>x*</B>, but omits the last word.
7937
7938 </DL>
7939 <P>
7940
7941 If a word designator is supplied without an event specification, the
7942 previous command is used as the event.
7943 <A NAME="lbDA">&nbsp;</A>
7944 <H4>Modifiers</H4>
7945
7946 <P>
7947
7948 After the optional word designator, there may appear a sequence of
7949 one or more of the following modifiers, each preceded by a `:'.
7950 <P>
7951
7952
7953 <P>
7954
7955 <DL COMPACT>
7956 <DT><B>h</B>
7957
7958 <DD>
7959 Remove a trailing file name component, leaving only the head.
7960 <DT><B>t</B>
7961
7962 <DD>
7963 Remove all leading file name components, leaving the tail.
7964 <DT><B>r</B>
7965
7966 <DD>
7967 Remove a trailing suffix of the form <I>.xxx</I>, leaving the
7968 basename.
7969 <DT><B>e</B>
7970
7971 <DD>
7972 Remove all but the trailing suffix.
7973 <DT><B>p</B>
7974
7975 <DD>
7976 Print the new command but do not execute it.
7977 <DT><B>q</B>
7978
7979 <DD>
7980 Quote the substituted words, escaping further substitutions.
7981 <DT><B>x</B>
7982
7983 <DD>
7984 Quote the substituted words as with
7985 <B>q</B>,
7986
7987 but break into words at
7988 <B>blanks</B>
7989
7990 and newlines.
7991 <DT><B>s/</B><I>old</I>/<I>new</I>/
7992
7993 <DD>
7994 Substitute
7995 <I>new</I>
7996
7997 for the first occurrence of
7998 <I>old</I>
7999
8000 in the event line.  Any delimiter can be used in place of /.  The
8001 final delimiter is optional if it is the last character of the
8002 event line.  The delimiter may be quoted in
8003 <I>old</I>
8004
8005 and
8006 <I>new</I>
8007
8008 with a single backslash.  If &amp; appears in
8009 <I>new</I>,
8010
8011 it is replaced by
8012 <I>old</I>.
8013
8014 A single backslash will quote the &amp;.  If
8015 <I>old</I>
8016
8017 is null, it is set to the last
8018 <I>old</I>
8019
8020 substituted, or, if no previous history substitutions took place,
8021 the last
8022 <I>string</I>
8023
8024 in a
8025 <B>!?</B><I>string</I><B>[?]</B>
8026
8027 search.
8028 <DT><B>&amp;</B>
8029
8030 <DD>
8031 Repeat the previous substitution.
8032 <DT><B>g</B>
8033
8034 <DD>
8035 Cause changes to be applied over the entire event line.  This is
8036 used in conjunction with `<B>:s</B>' (e.g., `<B>:gs/</B><I>old</I>/<I>new</I>/')
8037 or `<B>:&amp;</B>'.  If used with
8038 `<B>:s</B>', any delimiter can be used
8039 in place of /, and the final delimiter is optional
8040 if it is the last character of the event line.
8041 An <B>a</B> may be used as a synonym for <B>g</B>.
8042 <DT><B>G</B>
8043
8044 <DD>
8045 Apply the following `<B>s</B>' modifier once to each word in the event line.
8046
8047 </DL>
8048 <A NAME="lbDB">&nbsp;</A>
8049 <H3>SHELL BUILTIN COMMANDS</H3>
8050
8051
8052
8053 <P>
8054
8055 Unless otherwise noted, each builtin command documented in this
8056 section as accepting options preceded by
8057 <B>-</B>
8058
8059 accepts
8060 <B>--</B>
8061
8062 to signify the end of the options.
8063 For example, the <B>:</B>, <B>true</B>, <B>false</B>, and <B>test</B> builtins
8064 do not accept options.
8065 <P>
8066
8067 <DL COMPACT>
8068 <DT><B>:</B> [<I>arguments</I>]<DD>
8069
8070 No effect; the command does nothing beyond expanding
8071 <I>arguments</I>
8072
8073 and performing any specified
8074 redirections.  A zero exit code is returned.
8075 <DT><B> . </B> <I>filename</I> [<I>arguments</I>]<DD>
8076
8077 <DT><B>source</B> <I>filename</I> [<I>arguments</I>]<DD>
8078
8079 Read and execute commands from
8080 <I>filename</I>
8081
8082 in the current
8083 shell environment and return the exit status of the last command
8084 executed from
8085 <I>filename</I>.
8086
8087 If
8088 <I>filename</I>
8089
8090 does not contain a slash, file names in
8091 <FONT SIZE=-1><B>PATH</B>
8092
8093 </FONT>
8094 are used to find the directory containing
8095 <I>filename</I>.
8096
8097 The file searched for in
8098 <FONT SIZE=-1><B>PATH</B>
8099
8100 </FONT>
8101 need not be executable.
8102 When <B>bash</B> is not in <I>posix mode</I>, the current directory is
8103 searched if no file is found in
8104 <FONT SIZE=-1><B>PATH</B>.
8105
8106 </FONT>
8107 If the
8108 <B>sourcepath</B>
8109
8110 option to the
8111 <B>shopt</B>
8112
8113 builtin command is turned off, the
8114 <FONT SIZE=-1><B>PATH</B>
8115
8116 </FONT>
8117 is not searched.
8118 If any <I>arguments</I> are supplied, they become the positional
8119 parameters when <I>filename</I> is executed.  Otherwise the positional
8120 parameters are unchanged.
8121 The return status is the status of the last command exited within
8122 the script (0 if no commands are executed), and false if
8123 <I>filename</I>
8124
8125 is not found or cannot be read.
8126 <DT><B>alias</B> [<B>-p</B>] [<I>name</I>[=<I>value</I>] ...]<DD>
8127 <B>Alias</B> with no arguments or with the
8128 <B>-p</B>
8129
8130 option prints the list of aliases in the form
8131 <B>alias</B> <I>name</I>=<I>value</I> on standard output.
8132 When arguments are supplied, an alias is defined for
8133 each <I>name</I> whose <I>value</I> is given.
8134 A trailing space in  <I>value</I> causes the next word to be
8135 checked for alias substitution when the alias is expanded.
8136 For each <I>name</I> in the argument list for which no <I>value</I>
8137 is supplied, the name and value of the alias is printed.
8138 <B>Alias</B> returns true unless a <I>name</I> is given for which
8139 no alias has been defined.
8140 <DT><B>bg</B> [<I>jobspec</I> ...]<DD>
8141 Resume each suspended job <I>jobspec</I> in the background, as if it
8142 had been started with
8143 <B>&amp;</B>.
8144
8145 If
8146 <I>jobspec</I>
8147
8148 is not present, the shell's notion of the <I>current job</I> is used.
8149 <B>bg</B>
8150
8151 <I>jobspec</I>
8152
8153 returns 0 unless run when job control is disabled or, when run with
8154 job control enabled, any specified <I>jobspec</I> was not found
8155 or was started without job control.
8156 <DT><B>bind</B> [<B>-m</B> <I>keymap</I>] [<B>-lpsvPSV</B>]<DD>
8157
8158 <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>
8159 <DT><B>bind</B> [<B>-m</B> <I>keymap</I>] <B>-f</B> <I>filename</I><DD>
8160 <DT><B>bind</B> [<B>-m</B> <I>keymap</I>] <B>-x</B> <I>keyseq</I>:<I>shell-command</I><DD>
8161 <DT><B>bind</B> [<B>-m</B> <I>keymap</I>] <I>keyseq</I>:<I>function-name</I><DD>
8162 <DT><B>bind</B> <I>readline-command</I><DD>
8163
8164 Display current
8165 <B>readline</B>
8166
8167 key and function bindings, bind a key sequence to a
8168 <B>readline</B>
8169
8170 function or macro, or set a
8171 <B>readline</B>
8172
8173 variable.
8174 Each non-option argument is a command as it would appear in
8175 <I>.inputrc</I>,
8176
8177 but each binding or command must be passed as a separate argument;
8178 e.g., '&quot;\C-x\C-r&quot;: re-read-init-file'.
8179 Options, if supplied, have the following meanings:
8180 <DL COMPACT><DT><DD>
8181
8182 <DL COMPACT>
8183 <DT><B>-m </B><I>keymap</I>
8184
8185 <DD>
8186 Use
8187 <I>keymap</I>
8188
8189 as the keymap to be affected by the subsequent bindings.
8190 Acceptable
8191 <I>keymap</I>
8192
8193 names are
8194 <I>emacs, emacs-standard, emacs-meta, emacs-ctlx, vi,
8195 vi-move, vi-command</I>, and
8196 <I>vi-insert</I>.
8197
8198 <I>vi</I> is equivalent to <I>vi-command</I>; <I>emacs</I> is
8199 equivalent to <I>emacs-standard</I>.
8200 <DT><B>-l</B>
8201
8202 <DD>
8203 List the names of all <B>readline</B> functions.
8204 <DT><B>-p</B>
8205
8206 <DD>
8207 Display <B>readline</B> function names and bindings in such a way
8208 that they can be re-read.
8209 <DT><B>-P</B>
8210
8211 <DD>
8212 List current <B>readline</B> function names and bindings.
8213 <DT><B>-s</B>
8214
8215 <DD>
8216 Display <B>readline</B> key sequences bound to macros and the strings
8217 they output in such a way that they can be re-read.
8218 <DT><B>-S</B>
8219
8220 <DD>
8221 Display <B>readline</B> key sequences bound to macros and the strings
8222 they output.
8223 <DT><B>-v</B>
8224
8225 <DD>
8226 Display <B>readline</B> variable names and values in such a way that they
8227 can be re-read.
8228 <DT><B>-V</B>
8229
8230 <DD>
8231 List current <B>readline</B> variable names and values.
8232 <DT><B>-f </B><I>filename</I>
8233
8234 <DD>
8235 Read key bindings from <I>filename</I>.
8236 <DT><B>-q </B><I>function</I>
8237
8238 <DD>
8239 Query about which keys invoke the named <I>function</I>.
8240 <DT><B>-u </B><I>function</I>
8241
8242 <DD>
8243 Unbind all keys bound to the named <I>function</I>.
8244 <DT><B>-r </B><I>keyseq</I>
8245
8246 <DD>
8247 Remove any current binding for <I>keyseq</I>.
8248 <DT><B>-x </B><I>keyseq</I>:<I>shell-command</I>
8249
8250 <DD>
8251 Cause <I>shell-command</I> to be executed whenever <I>keyseq</I> is
8252 entered.
8253 When <I>shell-command</I> is executed, the shell sets the
8254 <B>READLINE_LINE</B>
8255
8256 variable to the contents of the <B>readline</B> line buffer and the
8257 <B>READLINE_POINT</B>
8258
8259 variable to the current location of the insertion point.
8260 If the executed command changes the value of
8261 <B>READLINE_LINE</B>
8262
8263 or
8264 <B>READLINE_POINT</B>,
8265
8266 those new values will be reflected in the editing state.
8267
8268 </DL>
8269 <P>
8270
8271 The return value is 0 unless an unrecognized option is given or an
8272 error occurred.
8273 </DL>
8274
8275 <DT><B>break</B> [<I>n</I>]<DD>
8276 Exit from within a
8277 <B>for</B>,
8278
8279 <B>while</B>,
8280
8281 <B>until</B>,
8282
8283 or
8284 <B>select</B>
8285
8286 loop.  If <I>n</I> is specified, break <I>n</I> levels.
8287 <I>n</I>
8288
8289 must be >= 1.  If
8290 <I>n</I>
8291
8292 is greater than the number of enclosing loops, all enclosing loops
8293 are exited.
8294 The return value is 0 unless <I>n</I> is not greater than or equal to 1.
8295 <DT><B>builtin</B> <I>shell-builtin</I> [<I>arguments</I>]<DD>
8296 Execute the specified shell builtin, passing it
8297 <I>arguments</I>,
8298
8299 and return its exit status.
8300 This is useful when defining a
8301 function whose name is the same as a shell builtin,
8302 retaining the functionality of the builtin within the function.
8303 The <B>cd</B> builtin is commonly redefined this way.
8304 The return status is false if
8305 <I>shell-builtin</I>
8306
8307 is not a shell builtin command.
8308 <DT><B>caller</B> [<I>expr</I>]<DD>
8309 Returns the context of any active subroutine call (a shell function or
8310 a script executed with the <B>.</B> or <B>source</B> builtins.
8311 Without <I>expr</I>, <B>caller</B> displays the line number and source
8312 filename of the current subroutine call.
8313 If a non-negative integer is supplied as <I>expr</I>, <B>caller</B> 
8314 displays the line number, subroutine name, and source file corresponding
8315 to that position in the current execution call stack.  This extra
8316 information may be used, for example, to print a stack trace.  The
8317 current frame is frame 0.
8318 The return value is 0 unless the shell is not executing a subroutine
8319 call or <I>expr</I> does not correspond to a valid position in the
8320 call stack.
8321 <DT><B>cd</B> [<B>-L|-P</B>] [<I>dir</I>]<DD>
8322 Change the current directory to <I>dir</I>.  The variable
8323 <FONT SIZE=-1><B>HOME</B>
8324
8325 </FONT>
8326 is the
8327 default
8328 <I>dir</I>.
8329
8330 The variable
8331 <FONT SIZE=-1><B>CDPATH</B>
8332
8333 </FONT>
8334 defines the search path for the directory containing
8335 <I>dir</I>.
8336
8337 Alternative directory names in
8338 <FONT SIZE=-1><B>CDPATH</B>
8339
8340 </FONT>
8341 are separated by a colon (:).  A null directory name in
8342 <FONT SIZE=-1><B>CDPATH</B>
8343
8344 </FONT>
8345 is the same as the current directory, i.e., ``<B>.</B>''.  If
8346 <I>dir</I>
8347
8348 begins with a slash (/),
8349 then
8350 <FONT SIZE=-1><B>CDPATH</B>
8351
8352 </FONT>
8353 is not used. The
8354 <B>-P</B>
8355
8356 option says to use the physical directory structure instead of
8357 following symbolic links (see also the
8358 <B>-P</B>
8359
8360 option to the
8361 <B>set</B>
8362
8363 builtin command); the
8364 <B>-L</B>
8365
8366 option forces symbolic links to be followed.  An argument of
8367 <B>-</B>
8368
8369 is equivalent to
8370 <FONT SIZE=-1><B>$OLDPWD</B>.
8371
8372 </FONT>
8373 If a non-empty directory name from <B>CDPATH</B> is used, or if
8374 <B>-</B> is the first argument, and the directory change is
8375 successful, the absolute pathname of the new working directory is
8376 written to the standard output.
8377 The return value is true if the directory was successfully changed;
8378 false otherwise.
8379 <DT><B>command</B> [<B>-pVv</B>] <I>command</I> [<I>arg</I> ...]<DD>
8380 Run
8381 <I>command</I>
8382
8383 with
8384 <I>args</I>
8385
8386 suppressing the normal shell function lookup. Only builtin
8387 commands or commands found in the
8388 <FONT SIZE=-1><B>PATH</B>
8389
8390 </FONT>
8391 are executed.  If the
8392 <B>-p</B>
8393
8394 option is given, the search for
8395 <I>command</I>
8396
8397 is performed using a default value for
8398 <B>PATH</B>
8399
8400 that is guaranteed to find all of the standard utilities.
8401 If either the
8402 <B>-V</B>
8403
8404 or
8405 <B>-v</B>
8406
8407 option is supplied, a description of
8408 <I>command</I>
8409
8410 is printed.  The
8411 <B>-v</B>
8412
8413 option causes a single word indicating the command or file name
8414 used to invoke
8415 <I>command</I>
8416
8417 to be displayed; the
8418 <B>-V</B>
8419
8420 option produces a more verbose description.
8421 If the
8422 <B>-V</B>
8423
8424 or
8425 <B>-v</B>
8426
8427 option is supplied, the exit status is 0 if
8428 <I>command</I>
8429
8430 was found, and 1 if not.  If neither option is supplied and
8431 an error occurred or
8432 <I>command</I>
8433
8434 cannot be found, the exit status is 127.  Otherwise, the exit status of the
8435 <B>command</B>
8436
8437 builtin is the exit status of
8438 <I>command</I>.
8439
8440 <DT><B>compgen</B> [<I>option</I>] [<I>word</I>]<DD>
8441 Generate possible completion matches for <I>word</I> according to
8442 the <I>option</I>s, which may be any option accepted by the
8443 <B>complete</B>
8444
8445 builtin with the exception of <B>-p</B> and <B>-r</B>, and write
8446 the matches to the standard output.
8447 When using the <B>-F</B> or <B>-C</B> options, the various shell variables
8448 set by the programmable completion facilities, while available, will not
8449 have useful values.
8450 <P>
8451 The matches will be generated in the same way as if the programmable
8452 completion code had generated them directly from a completion specification
8453 with the same flags.
8454 If <I>word</I> is specified, only those completions matching <I>word</I>
8455 will be displayed.
8456 <P>
8457 The return value is true unless an invalid option is supplied, or no
8458 matches were generated.
8459 <DT><B>complete</B> [<B>-abcdefgjksuv</B>] [<B>-o</B> <I>comp-option</I>] [<B>-E</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>
8460 <BR>
8461
8462 [<B>-X</B> <I>filterpat</I>] [<B>-P</B> <I>prefix</I>] [<B>-S</B> <I>suffix</I>] <I>name</I> [<I>name ...</I>]
8463
8464 <DT><B>complete</B> <B>-pr</B> [<B>-E</B>] [<I>name</I> ...]<DD>
8465
8466 Specify how arguments to each <I>name</I> should be completed.
8467 If the <B>-p</B> option is supplied, or if no options are supplied,
8468 existing completion specifications are printed in a way that allows
8469 them to be reused as input.
8470 The <B>-r</B> option removes a completion specification for
8471 each <I>name</I>, or, if no <I>name</I>s are supplied, all
8472 completion specifications.
8473 The <B>-E</B> option indicates that the remaining options and actions should
8474 apply to ``empty'' command completion; that is, completion attempted on a
8475 blank line.
8476 <P>
8477 The process of applying these completion specifications when word completion
8478 is attempted is described above under <B>Programmable Completion</B>.
8479 <P>
8480 Other options, if specified, have the following meanings.
8481 The arguments to the <B>-G</B>, <B>-W</B>, and <B>-X</B> options
8482 (and, if necessary, the <B>-P</B> and <B>-S</B> options)
8483 should be quoted to protect them from expansion before the
8484 <B>complete</B>
8485
8486 builtin is invoked.
8487 <DL COMPACT><DT><DD>
8488
8489 <DL COMPACT>
8490 <DT><B>-o</B> <I>comp-option</I><DD>
8491 The <I>comp-option</I> controls several aspects of the compspec's behavior
8492 beyond the simple generation of completions.
8493 <I>comp-option</I> may be one of:
8494 <DL COMPACT><DT><DD>
8495 <DL COMPACT>
8496 <DT><B>bashdefault</B>
8497
8498 <DD>
8499 Perform the rest of the default <B>bash</B> completions if the compspec
8500 generates no matches.
8501 <DT><B>default</B>
8502
8503 <DD>
8504 Use readline's default filename completion if the compspec generates
8505 no matches.
8506 <DT><B>dirnames</B>
8507
8508 <DD>
8509 Perform directory name completion if the compspec generates no matches.
8510 <DT><B>filenames</B>
8511
8512 <DD>
8513 Tell readline that the compspec generates filenames, so it can perform any
8514 filename-specific processing (like adding a slash to directory names,
8515 quoting special characters, or suppressing trailing spaces).
8516 Intended to be used with shell functions.
8517 <DT><B>nospace</B>
8518
8519 <DD>
8520 Tell readline not to append a space (the default) to words completed at
8521 the end of the line.
8522 <DT><B>plusdirs</B>
8523
8524 <DD>
8525 After any matches defined by the compspec are generated, 
8526 directory name completion is attempted and any
8527 matches are added to the results of the other actions.
8528 </DL></DL>
8529
8530 <DT><B>-A</B> <I>action</I><DD>
8531 The <I>action</I> may be one of the following to generate a list of possible
8532 completions:
8533 <DL COMPACT><DT><DD>
8534 <DL COMPACT>
8535 <DT><B>alias</B>
8536
8537 <DD>
8538 Alias names.  May also be specified as <B>-a</B>.
8539 <DT><B>arrayvar</B>
8540
8541 <DD>
8542 Array variable names.
8543 <DT><B>binding</B>
8544
8545 <DD>
8546 <B>Readline</B> key binding names.
8547 <DT><B>builtin</B>
8548
8549 <DD>
8550 Names of shell builtin commands.  May also be specified as <B>-b</B>.
8551 <DT><B>command</B>
8552
8553 <DD>
8554 Command names.  May also be specified as <B>-c</B>.
8555 <DT><B>directory</B>
8556
8557 <DD>
8558 Directory names.  May also be specified as <B>-d</B>.
8559 <DT><B>disabled</B>
8560
8561 <DD>
8562 Names of disabled shell builtins.
8563 <DT><B>enabled</B>
8564
8565 <DD>
8566 Names of enabled shell builtins.
8567 <DT><B>export</B>
8568
8569 <DD>
8570 Names of exported shell variables.  May also be specified as <B>-e</B>.
8571 <DT><B>file</B>
8572
8573 <DD>
8574 File names.  May also be specified as <B>-f</B>.
8575 <DT><B>function</B>
8576
8577 <DD>
8578 Names of shell functions.
8579 <DT><B>group</B>
8580
8581 <DD>
8582 Group names.  May also be specified as <B>-g</B>.
8583 <DT><B>helptopic</B>
8584
8585 <DD>
8586 Help topics as accepted by the <B>help</B> builtin.
8587 <DT><B>hostname</B>
8588
8589 <DD>
8590 Hostnames, as taken from the file specified by the
8591 <FONT SIZE=-1><B>HOSTFILE</B>
8592
8593 </FONT>
8594 shell variable.
8595 <DT><B>job</B>
8596
8597 <DD>
8598 Job names, if job control is active.  May also be specified as <B>-j</B>.
8599 <DT><B>keyword</B>
8600
8601 <DD>
8602 Shell reserved words.  May also be specified as <B>-k</B>.
8603 <DT><B>running</B>
8604
8605 <DD>
8606 Names of running jobs, if job control is active.
8607 <DT><B>service</B>
8608
8609 <DD>
8610 Service names.  May also be specified as <B>-s</B>.
8611 <DT><B>setopt</B>
8612
8613 <DD>
8614 Valid arguments for the <B>-o</B> option to the <B>set</B> builtin.
8615 <DT><B>shopt</B>
8616
8617 <DD>
8618 Shell option names as accepted by the <B>shopt</B> builtin.
8619 <DT><B>signal</B>
8620
8621 <DD>
8622 Signal names.
8623 <DT><B>stopped</B>
8624
8625 <DD>
8626 Names of stopped jobs, if job control is active.
8627 <DT><B>user</B>
8628
8629 <DD>
8630 User names.  May also be specified as <B>-u</B>.
8631 <DT><B>variable</B>
8632
8633 <DD>
8634 Names of all shell variables.  May also be specified as <B>-v</B>.
8635 </DL></DL>
8636
8637 <DT><B>-G</B> <I>globpat</I><DD>
8638 The filename expansion pattern <I>globpat</I> is expanded to generate
8639 the possible completions.
8640 <DT><B>-W</B> <I>wordlist</I><DD>
8641 The <I>wordlist</I> is split using the characters in the
8642 <FONT SIZE=-1><B>IFS</B>
8643
8644 </FONT>
8645 special variable as delimiters, and each resultant word is expanded.
8646 The possible completions are the members of the resultant list which
8647 match the word being completed.
8648 <DT><B>-C</B> <I>command</I><DD>
8649 <I>command</I> is executed in a subshell environment, and its output is
8650 used as the possible completions.
8651 <DT><B>-F</B> <I>function</I><DD>
8652 The shell function <I>function</I> is executed in the current shell
8653 environment.
8654 When it finishes, the possible completions are retrieved from the value
8655 of the
8656 <FONT SIZE=-1><B>COMPREPLY</B>
8657
8658 </FONT>
8659 array variable.
8660 <DT><B>-X</B> <I>filterpat</I><DD>
8661 <I>filterpat</I> is a pattern as used for filename expansion.
8662 It is applied to the list of possible completions generated by the
8663 preceding options and arguments, and each completion matching
8664 <I>filterpat</I> is removed from the list.
8665 A leading <B>!</B> in <I>filterpat</I> negates the pattern; in this
8666 case, any completion not matching <I>filterpat</I> is removed.
8667 <DT><B>-P</B> <I>prefix</I><DD>
8668 <I>prefix</I> is added at the beginning of each possible completion
8669 after all other options have been applied.
8670 <DT><B>-S</B> <I>suffix</I><DD>
8671 <I>suffix</I> is appended to each possible completion
8672 after all other options have been applied.
8673
8674 </DL>
8675 <P>
8676
8677 The return value is true unless an invalid option is supplied, an option
8678 other than <B>-p</B> or <B>-r</B> is supplied without a <I>name</I>
8679 argument, an attempt is made to remove a completion specification for
8680 a <I>name</I> for which no specification exists, or
8681 an error occurs adding a completion specification.
8682 </DL>
8683
8684 <DT><B>compopt</B> [<B>-o</B> <I>option</I>] [<B>+o</B> <I>option</I>] [<I>name</I>]<DD>
8685 Modify completion options for each <I>name</I> according to the
8686 <I>option</I>s, or for the
8687 currently-execution completion if no <I>name</I>s are supplied.
8688 If no <I>option</I>s are given, display the completion options for each
8689 <I>name</I> or the current completion.
8690 The possible values of <I>option</I> are those valid for the <B>complete</B>
8691 builtin described above.
8692 </DL>
8693 <P>
8694
8695 The return value is true unless an invalid option is supplied, an attempt
8696 is made to modify the options for a <I>name</I> for which no completion
8697 specification exists, or an output error occurs.
8698 <DL COMPACT>
8699 <DT><B>continue</B> [<I>n</I>]<DD>
8700 Resume the next iteration of the enclosing
8701 <B>for</B>,
8702
8703 <B>while</B>,
8704
8705 <B>until</B>,
8706
8707 or
8708 <B>select</B>
8709
8710 loop.
8711 If
8712 <I>n</I>
8713
8714 is specified, resume at the <I>n</I>th enclosing loop.
8715 <I>n</I>
8716
8717 must be >= 1.  If
8718 <I>n</I>
8719
8720 is greater than the number of enclosing loops, the last enclosing loop
8721 (the ``top-level'' loop) is resumed.
8722 The return value is 0 unless <I>n</I> is not greater than or equal to 1.
8723 <DT><B>declare</B> [<B>-aAfFilrtux</B>] [<B>-p</B>] [<I>name</I>[=<I>value</I>] ...]<DD>
8724
8725 <DT><B>typeset</B> [<B>-aAfFilrtux</B>] [<B>-p</B>] [<I>name</I>[=<I>value</I>] ...]<DD>
8726
8727 Declare variables and/or give them attributes.
8728 If no <I>name</I>s are given then display the values of variables.
8729 The
8730 <B>-p</B>
8731
8732 option will display the attributes and values of each
8733 <I>name</I>.
8734
8735 When
8736 <B>-p</B>
8737
8738 is used with <I>name</I> arguments, additional options are ignored.
8739 When
8740 <B>-p</B>
8741
8742 is supplied without <I>name</I> arguments, it will display the attributes
8743 and values of all variables having the attributes specified by the
8744 additional options.
8745 If no other options are supplied with <B>-p</B>, <B>declare</B> will display
8746 the attributes and values of all shell variables.  The <B>-f</B> option
8747 will restrict the display to shell functions.
8748 The
8749 <B>-F</B>
8750
8751 option inhibits the display of function definitions; only the
8752 function name and attributes are printed.
8753 If the <B>extdebug</B> shell option is enabled using <B>shopt</B>,
8754 the source file name and line number where the function is defined
8755 are displayed as well.  The
8756 <B>-F</B>
8757
8758 option implies
8759 <B>-f</B>.
8760
8761 The following options can
8762 be used to restrict output to variables with the specified attribute or
8763 to give variables attributes:
8764 <DL COMPACT><DT><DD>
8765
8766 <DL COMPACT>
8767 <DT><B>-a</B>
8768
8769 <DD>
8770 Each <I>name</I> is an indexed array variable (see
8771 <B>Arrays</B>
8772
8773 above).
8774 <DT><B>-A</B>
8775
8776 <DD>
8777 Each <I>name</I> is an associative array variable (see
8778 <B>Arrays</B>
8779
8780 above).
8781 <DT><B>-f</B>
8782
8783 <DD>
8784 Use function names only.
8785 <DT><B>-i</B>
8786
8787 <DD>
8788 The variable is treated as an integer; arithmetic evaluation (see
8789 <FONT SIZE=-1><B>ARITHMETIC EVALUATION ) </B>
8790
8791 </FONT>
8792 is performed when the variable is assigned a value.
8793 <DT><B>-l</B>
8794
8795 <DD>
8796 When the variable is assigned a value, all upper-case characters are
8797 converted to lower-case.
8798 The upper-case attribute is disabled.
8799 <DT><B>-r</B>
8800
8801 <DD>
8802 Make <I>name</I>s readonly.  These names cannot then be assigned values
8803 by subsequent assignment statements or unset.
8804 <DT><B>-t</B>
8805
8806 <DD>
8807 Give each <I>name</I> the <I>trace</I> attribute.
8808 Traced functions inherit the <B>DEBUG</B> and <B>RETURN</B> traps from
8809 the calling shell.
8810 The trace attribute has no special meaning for variables.
8811 <DT><B>-u</B>
8812
8813 <DD>
8814 When the variable is assigned a value, all lower-case characters are
8815 converted to upper-case.
8816 The lower-case attribute is disabled.
8817 <DT><B>-x</B>
8818
8819 <DD>
8820 Mark <I>name</I>s for export to subsequent commands via the environment.
8821
8822 </DL>
8823 <P>
8824
8825 Using `+' instead of `-'
8826 turns off the attribute instead,
8827 with the exceptions that <B>+a</B>
8828 may not be used to destroy an array variable and <B>+r will not
8829 remove the readonly attribute.
8830 When used in a function,
8831 makes each
8832 </B><I>name</I> local, as with the 
8833 <B>local</B>
8834
8835 command.
8836 If a variable name is followed by =<I>value</I>, the value of
8837 the variable is set to <I>value</I>.
8838 The return value is 0 unless an invalid option is encountered,
8839 an attempt is made to define a function using
8840
8841 <TT>-f foo=bar</TT>,
8842 an attempt is made to assign a value to a readonly variable,
8843 an attempt is made to assign a value to an array variable without
8844 using the compound assignment syntax (see
8845 <B>Arrays</B>
8846
8847 above), one of the <I>names</I> is not a valid shell variable name,
8848 an attempt is made to turn off readonly status for a readonly variable,
8849 an attempt is made to turn off array status for an array variable,
8850 or an attempt is made to display a non-existent function with <B>-f</B>.
8851 </DL>
8852
8853 <DT><B>dirs [+</B><I>n</I>] [-<I>n</I>] [<B>-cplv</B>]
8854
8855 <DD>
8856 Without options, displays the list of currently remembered directories.
8857 The default display is on a single line with directory names separated
8858 by spaces.
8859 Directories are added to the list with the 
8860 <B>pushd</B>
8861
8862 command; the
8863 <B>popd</B>
8864
8865 command removes entries from the list.
8866 <DL COMPACT><DT><DD>
8867
8868 <DL COMPACT>
8869 <DT><B>+</B><I>n</I><DD>
8870 Displays the <I>n</I>th entry counting from the left of the list
8871 shown by
8872 <B>dirs</B>
8873
8874 when invoked without options, starting with zero.
8875 <DT><B>-</B><I>n</I><DD>
8876 Displays the <I>n</I>th entry counting from the right of the list
8877 shown by
8878 <B>dirs</B>
8879
8880 when invoked without options, starting with zero.
8881 <DT><B>-c</B>
8882
8883 <DD>
8884 Clears the directory stack by deleting all of the entries.
8885 <DT><B>-l</B>
8886
8887 <DD>
8888 Produces a longer listing; the default listing format uses a 
8889 tilde to denote the home directory.
8890 <DT><B>-p</B>
8891
8892 <DD>
8893 Print the directory stack with one entry per line.
8894 <DT><B>-v</B>
8895
8896 <DD>
8897 Print the directory stack with one entry per line,
8898 prefixing each entry with its index in the stack.
8899
8900 </DL>
8901 <P>
8902
8903 The return value is 0 unless an
8904 invalid option is supplied or <I>n</I> indexes beyond the end
8905 of the directory stack.
8906 </DL>
8907
8908 <DT><B>disown</B> [<B>-ar</B>] [<B>-h</B>] [<I>jobspec</I> ...]<DD>
8909 Without options, each
8910 <I>jobspec</I>
8911
8912 is removed from the table of active jobs.
8913 If
8914 <I>jobspec</I>
8915
8916 is not present, and neither <B>-a nor -r</B> is supplied,
8917 the shell's notion of the <I>current job</I> is used.
8918 If the <B>-h</B> option is given, each
8919 <I>jobspec</I>
8920
8921 is not removed from the table, but is marked so that
8922 <FONT SIZE=-1><B>SIGHUP</B>
8923
8924 </FONT>
8925 is not sent to the job if the shell receives a
8926 <FONT SIZE=-1><B>SIGHUP</B>.
8927
8928 </FONT>
8929 If no
8930 <I>jobspec</I>
8931
8932 is present, and neither the
8933 <B>-a</B>
8934
8935 nor the
8936 <B>-r</B>
8937
8938 option is supplied, the <I>current job</I> is used.
8939 If no
8940 <I>jobspec</I>
8941
8942 is supplied, the
8943 <B>-a</B>
8944
8945 option means to remove or mark all jobs; the
8946 <B>-r</B>
8947
8948 option without a
8949 <I>jobspec</I>
8950
8951 argument restricts operation to running jobs.
8952 The return value is 0 unless a
8953 <I>jobspec</I>
8954
8955 does not specify a valid job.
8956 <DT><B>echo</B> [<B>-neE</B>] [<I>arg</I> ...]<DD>
8957 Output the <I>arg</I>s, separated by spaces, followed by a newline.
8958 The return status is always 0.
8959 If <B>-n</B> is specified, the trailing newline is
8960 suppressed.  If the <B>-e</B> option is given, interpretation of
8961 the following backslash-escaped characters is enabled.  The
8962 <B>-E</B>
8963
8964 option disables the interpretation of these escape characters,
8965 even on systems where they are interpreted by default.
8966 The <B>xpg_echo</B> shell option may be used to
8967 dynamically determine whether or not <B>echo</B> expands these
8968 escape characters by default.
8969 <B>echo</B>
8970
8971 does not interpret <B>--</B> to mean the end of options.
8972 <B>echo</B>
8973
8974 interprets the following escape sequences:
8975 <DL COMPACT><DT><DD>
8976
8977 <DL COMPACT>
8978 <DT><B>\a</B>
8979
8980 <DD>
8981 alert (bell)
8982 <DT><B>\b</B>
8983
8984 <DD>
8985 backspace
8986 <DT><B>\c</B>
8987
8988 <DD>
8989 suppress further output
8990 <DT><B>\e</B>
8991
8992 <DD>
8993 an escape character
8994 <DT><B>\f</B>
8995
8996 <DD>
8997 form feed
8998 <DT><B>\n</B>
8999
9000 <DD>
9001 new line
9002 <DT><B>\r</B>
9003
9004 <DD>
9005 carriage return
9006 <DT><B>\t</B>
9007
9008 <DD>
9009 horizontal tab
9010 <DT><B>\v</B>
9011
9012 <DD>
9013 vertical tab
9014 <DT><B>\\</B>
9015
9016 <DD>
9017 backslash
9018 <DT><B>\0</B><I>nnn</I>
9019
9020 <DD>
9021 the eight-bit character whose value is the octal value <I>nnn</I>
9022 (zero to three octal digits)
9023 <DT><B>\x</B><I>HH</I>
9024
9025 <DD>
9026 the eight-bit character whose value is the hexadecimal value <I>HH</I>
9027 (one or two hex digits)
9028
9029 </DL></DL>
9030
9031 <DT><B>enable</B> [<B>-a</B>] [<B>-dnps</B>] [<B>-f</B> <I>filename</I>] [<I>name</I> ...]<DD>
9032 Enable and disable builtin shell commands.
9033 Disabling a builtin allows a disk command which has the same name
9034 as a shell builtin to be executed without specifying a full pathname,
9035 even though the shell normally searches for builtins before disk commands.
9036 If <B>-n</B> is used, each <I>name</I>
9037 is disabled; otherwise,
9038 <I>names</I> are enabled.  For example, to use the
9039 <B>test</B>
9040
9041 binary found via the
9042 <FONT SIZE=-1><B>PATH</B>
9043
9044 </FONT>
9045 instead of the shell builtin version, run
9046 <TT>enable -n test</TT>.
9047
9048 The
9049 <B>-f</B>
9050
9051 option means to load the new builtin command
9052 <I>name</I>
9053
9054 from shared object
9055 <I>filename</I>,
9056
9057 on systems that support dynamic loading.  The
9058 <B>-d</B>
9059
9060 option will delete a builtin previously loaded with
9061 <B>-f</B>.
9062
9063 If no <I>name</I> arguments are given, or if the
9064 <B>-p</B>
9065
9066 option is supplied, a list of shell builtins is printed.
9067 With no other option arguments, the list consists of all enabled
9068 shell builtins.
9069 If <B>-n</B> is supplied, only disabled builtins are printed.
9070 If <B>-a</B> is supplied, the list printed includes all builtins, with an
9071 indication of whether or not each is enabled.
9072 If <B>-s</B> is supplied, the output is restricted to the POSIX
9073 <I>special</I> builtins.
9074 The return value is 0 unless a
9075 <I>name</I>
9076
9077 is not a shell builtin or there is an error loading a new builtin
9078 from a shared object.
9079 <DT><B>eval</B> [<I>arg</I> ...]<DD>
9080 The <I>arg</I>s are read and concatenated together into a single
9081 command.  This command is then read and executed by the shell, and
9082 its exit status is returned as the value of
9083 <B>eval</B>.
9084
9085 If there are no
9086 <I>args</I>,
9087
9088 or only null arguments,
9089 <B>eval</B>
9090
9091 returns 0.
9092 <DT><B>exec</B> [<B>-cl</B>] [<B>-a</B> <I>name</I>] [<I>command</I> [<I>arguments</I>]]<DD>
9093 If
9094 <I>command</I>
9095
9096 is specified, it replaces the shell.
9097 No new process is created.  The
9098 <I>arguments</I>
9099
9100 become the arguments to <I>command</I>.
9101 If the
9102 <B>-l</B>
9103
9104 option is supplied,
9105 the shell places a dash at the beginning of the zeroth argument passed to 
9106 <I>command</I>.
9107
9108 This is what
9109 <I>login</I>(1)
9110
9111 does.  The
9112 <B>-c</B>
9113
9114 option causes
9115 <I>command</I>
9116
9117 to be executed with an empty environment.  If
9118 <B>-a</B>
9119
9120 is supplied, the shell passes
9121 <I>name</I>
9122
9123 as the zeroth argument to the executed command.  If
9124 <I>command</I>
9125
9126 cannot be executed for some reason, a non-interactive shell exits,
9127 unless the shell option
9128 <B>execfail</B>
9129
9130 is enabled, in which case it returns failure.
9131 An interactive shell returns failure if the file cannot be executed.
9132 If
9133 <I>command</I>
9134
9135 is not specified, any redirections take effect in the current shell,
9136 and the return status is 0.  If there is a redirection error, the
9137 return status is 1.
9138 <DT><B>exit</B> [<I>n</I>]<DD>
9139 Cause the shell to exit
9140 with a status of <I>n</I>.  If
9141 <I>n</I>
9142
9143 is omitted, the exit status
9144 is that of the last command executed.
9145 A trap on
9146 <FONT SIZE=-1><B>EXIT</B>
9147
9148 </FONT>
9149 is executed before the shell terminates.
9150 <DT><B>export</B> [<B>-fn</B>] [<I>name</I>[=<I>word</I>]] ...<DD>
9151
9152 <DT><B>export -p</B>
9153
9154 <DD>
9155
9156 The supplied
9157 <I>names</I>
9158
9159 are marked for automatic export to the environment of
9160 subsequently executed commands.  If the 
9161 <B>-f</B>
9162
9163 option is given,
9164 the 
9165 <I>names</I>
9166
9167 refer to functions.
9168 If no
9169 <I>names</I>
9170
9171 are given, or if the
9172 <B>-p</B>
9173
9174 option is supplied, a list
9175 of all names that are exported in this shell is printed.
9176 The
9177 <B>-n</B>
9178
9179 option causes the export property to be removed from each
9180 <I>name</I>.
9181 If a variable name is followed by =<I>word</I>, the value of
9182 the variable is set to <I>word</I>.
9183 <B>export</B>
9184
9185 returns an exit status of 0 unless an invalid option is
9186 encountered,
9187 one of the <I>names</I> is not a valid shell variable name, or
9188 <B>-f</B>
9189
9190 is supplied with a
9191 <I>name</I>
9192
9193 that is not a function.
9194 <DT><B>fc</B> [<B>-e</B> <I>ename</I>] [<B>-lnr</B>] [<I>first</I>] [<I>last</I>]<DD>
9195
9196 <DT><B>fc</B> <B>-s</B> [<I>pat</I>=<I>rep</I>] [<I>cmd</I>]<DD>
9197
9198 Fix Command.  In the first form, a range of commands from
9199 <I>first</I>
9200
9201 to
9202 <I>last</I>
9203
9204 is selected from the history list.
9205 <I>First</I>
9206
9207 and
9208 <I>last</I>
9209
9210 may be specified as a string (to locate the last command beginning
9211 with that string) or as a number (an index into the history list,
9212 where a negative number is used as an offset from the current
9213 command number).  If 
9214 <I>last</I>
9215
9216 is not specified it is set to
9217 the current command for listing (so that
9218
9219 <TT>fc -l -10</TT>
9220 prints the last 10 commands) and to
9221 <I>first</I>
9222
9223 otherwise.
9224 If
9225 <I>first</I>
9226
9227 is not specified it is set to the previous
9228 command for editing and -16 for listing.
9229 <P>
9230 The
9231 <B>-n</B>
9232
9233 option suppresses
9234 the command numbers when listing.  The
9235 <B>-r</B>
9236
9237 option reverses the order of
9238 the commands.  If the
9239 <B>-l</B>
9240
9241 option is given,
9242 the commands are listed on
9243 standard output.  Otherwise, the editor given by
9244 <I>ename</I>
9245
9246 is invoked
9247 on a file containing those commands.  If
9248 <I>ename</I>
9249
9250 is not given, the
9251 value of the
9252 <FONT SIZE=-1><B>FCEDIT</B>
9253
9254 </FONT>
9255 variable is used, and
9256 the value of
9257 <FONT SIZE=-1><B>EDITOR</B>
9258
9259 </FONT>
9260 if
9261 <FONT SIZE=-1><B>FCEDIT</B>
9262
9263 </FONT>
9264 is not set.  If neither variable is set,
9265
9266 <I>vi</I>
9267
9268 is used.  When editing is complete, the edited commands are
9269 echoed and executed.
9270 <P>
9271 In the second form, <I>command</I> is re-executed after each instance
9272 of <I>pat</I> is replaced by <I>rep</I>.
9273 A useful alias to use with this is
9274
9275 <TT>r='fc -s'</TT>,
9276 so that typing
9277
9278 <TT>r cc</TT>
9279 runs the last command beginning with
9280
9281 <TT>cc</TT>
9282 and typing
9283
9284 <TT>r</TT>
9285 re-executes the last command.
9286 <P>
9287 If the first form is used, the return value is 0 unless an invalid
9288 option is encountered or
9289 <I>first</I>
9290
9291 or
9292 <I>last</I>
9293
9294 specify history lines out of range.
9295 If the
9296 <B>-e</B>
9297
9298 option is supplied, the return value is the value of the last
9299 command executed or failure if an error occurs with the temporary
9300 file of commands.  If the second form is used, the return status
9301 is that of the command re-executed, unless
9302 <I>cmd</I>
9303
9304 does not specify a valid history line, in which case
9305 <B>fc</B>
9306
9307 returns failure.
9308 <DT><B>fg</B> [<I>jobspec</I>]<DD>
9309 Resume
9310 <I>jobspec</I>
9311
9312 in the foreground, and make it the current job.
9313 If
9314 <I>jobspec</I>
9315
9316 is not present, the shell's notion of the <I>current job</I> is used.
9317 The return value is that of the command placed into the foreground,
9318 or failure if run when job control is disabled or, when run with
9319 job control enabled, if
9320 <I>jobspec</I>
9321
9322 does not specify a valid job or
9323 <I>jobspec</I>
9324
9325 specifies a job that was started without job control.
9326 <DT><B>getopts</B> <I>optstring</I> <I>name</I> [<I>args</I>]<DD>
9327 <B>getopts</B>
9328
9329 is used by shell procedures to parse positional parameters.
9330 <I>optstring</I>
9331
9332 contains the option characters to be recognized; if a character
9333 is followed by a colon, the option is expected to have an
9334 argument, which should be separated from it by white space.
9335 The colon and question mark characters may not be used as
9336 option characters.
9337 Each time it is invoked,
9338 <B>getopts</B>
9339
9340 places the next option in the shell variable
9341 <I>name</I>,
9342
9343 initializing
9344 <I>name</I>
9345
9346 if it does not exist,
9347 and the index of the next argument to be processed into the
9348 variable
9349 <FONT SIZE=-1><B>OPTIND</B>.
9350
9351 </FONT>
9352 <FONT SIZE=-1><B>OPTIND</B>
9353
9354 </FONT>
9355 is initialized to 1 each time the shell or a shell script
9356 is invoked.  When an option requires an argument,
9357 <B>getopts</B>
9358
9359 places that argument into the variable
9360 <FONT SIZE=-1><B>OPTARG</B>.
9361
9362 </FONT>
9363 The shell does not reset
9364 <FONT SIZE=-1><B>OPTIND</B>
9365
9366 </FONT>
9367 automatically; it must be manually reset between multiple
9368 calls to
9369 <B>getopts</B>
9370
9371 within the same shell invocation if a new set of parameters
9372 is to be used.
9373 <P>
9374 When the end of options is encountered, <B>getopts</B> exits with a
9375 return value greater than zero.
9376 <B>OPTIND</B> is set to the index of the first non-option argument,
9377 and <B>name</B> is set to ?.
9378 <P>
9379 <B>getopts</B>
9380
9381 normally parses the positional parameters, but if more arguments are
9382 given in
9383 <I>args</I>,
9384
9385 <B>getopts</B>
9386
9387 parses those instead.
9388 <P>
9389 <B>getopts</B>
9390
9391 can report errors in two ways.  If the first character of
9392 <I>optstring</I>
9393
9394 is a colon,
9395 <I>silent</I>
9396
9397 error reporting is used.  In normal operation diagnostic messages
9398 are printed when invalid options or missing option arguments are
9399 encountered.
9400 If the variable
9401 <FONT SIZE=-1><B>OPTERR</B>
9402
9403 </FONT>
9404 is set to 0, no error messages will be displayed, even if the first
9405 character of 
9406 <I>optstring</I>
9407
9408 is not a colon.
9409 <P>
9410 If an invalid option is seen,
9411 <B>getopts</B>
9412
9413 places ? into
9414 <I>name</I>
9415
9416 and, if not silent,
9417 prints an error message and unsets
9418 <FONT SIZE=-1><B>OPTARG</B>.
9419
9420 </FONT>
9421 If
9422 <B>getopts</B>
9423
9424 is silent,
9425 the option character found is placed in
9426 <FONT SIZE=-1><B>OPTARG</B>
9427
9428 </FONT>
9429 and no diagnostic message is printed.
9430 <P>
9431 If a required argument is not found, and
9432 <B>getopts</B>
9433
9434 is not silent,
9435 a question mark (<B>?</B>) is placed in
9436 <I>name</I>,
9437
9438 <FONT SIZE=-1><B>OPTARG</B>
9439
9440 </FONT>
9441 is unset, and a diagnostic message is printed.
9442 If
9443 <B>getopts</B>
9444
9445 is silent, then a colon (<B>:</B>) is placed in
9446 <I>name</I>
9447
9448 and
9449 <FONT SIZE=-1><B>OPTARG</B>
9450
9451 </FONT>
9452 is set to the option character found.
9453 <P>
9454 <B>getopts</B>
9455
9456 returns true if an option, specified or unspecified, is found.
9457 It returns false if the end of options is encountered or an
9458 error occurs.
9459 <DT><B>hash</B> [<B>-lr</B>] [<B>-p</B> <I>filename</I>] [<B>-dt</B>] [<I>name</I>]<DD>
9460 For each
9461 <I>name</I>,
9462
9463 the full file name of the command is determined by searching
9464 the directories in
9465 <B>$PATH</B>
9466
9467 and remembered.
9468 If the
9469 <B>-p</B>
9470
9471 option is supplied, no path search is performed, and
9472 <I>filename</I>
9473
9474 is used as the full file name of the command.
9475 The
9476 <B>-r</B>
9477
9478 option causes the shell to forget all
9479 remembered locations.
9480 The
9481 <B>-d</B>
9482
9483 option causes the shell to forget the remembered location of each <I>name</I>.
9484 If the
9485 <B>-t</B>
9486
9487 option is supplied, the full pathname to which each <I>name</I> corresponds
9488 is printed.  If multiple <I>name</I> arguments are supplied with <B>-t</B>,
9489 the <I>name</I> is printed before the hashed full pathname.
9490 The
9491 <B>-l</B>
9492
9493 option causes output to be displayed in a format that may be reused as input.
9494 If no arguments are given, or if only <B>-l</B> is supplied,
9495 information about remembered commands is printed.
9496 The return status is true unless a
9497 <I>name</I>
9498
9499 is not found or an invalid option is supplied.
9500 <DT><B>help</B> [<B>-dms</B>] [<I>pattern</I>]<DD>
9501 Display helpful information about builtin commands.  If
9502 <I>pattern</I>
9503
9504 is specified,
9505 <B>help</B>
9506
9507 gives detailed help on all commands matching
9508 <I>pattern</I>;
9509
9510 otherwise help for all the builtins and shell control structures
9511 is printed.
9512 <DL COMPACT><DT><DD>
9513
9514 <DL COMPACT>
9515 <DT><B>-d</B>
9516
9517 <DD>
9518 Display a short description of each <I>pattern</I>
9519 <DT><B>&nbsp;-m</B>
9520
9521 <DD>
9522 Display the description of each <I>pattern</I> in a manpage-like format
9523 <DT><B>-s</B>
9524
9525 <DD>
9526 Display only a short usage synopsis for each <I>pattern</I>
9527
9528 </DL></DL>
9529
9530 The return status is 0 unless no command matches
9531 <I>pattern</I>.
9532
9533 <DT><B>history [</B><I>n</I>]<DD>
9534
9535 <DT><B>history</B> <B>-c</B><DD>
9536 <DT><B>history -d</B> <I>offset</I><DD>
9537 <DT><B>history</B> <B>-anrw</B> [<I>filename</I>]<DD>
9538 <DT><B>history</B> <B>-p</B> <I>arg</I> [<I>arg ...</I>]<DD>
9539 <DT><B>history</B> <B>-s</B> <I>arg</I> [<I>arg ...</I>]<DD>
9540
9541 With no options, display the command
9542 history list with line numbers.  Lines listed
9543 with a 
9544 <B>*</B>
9545
9546 have been modified.  An argument of
9547 <I>n</I>
9548
9549 lists only the last
9550 <I>n</I>
9551
9552 lines.
9553 If the shell variable <B>HISTTIMEFORMAT</B> is set and not null,
9554 it is used as a format string for <I>strftime</I>(3) to display
9555 the time stamp associated with each displayed history entry.
9556 No intervening blank is printed between the formatted time stamp
9557 and the history line.
9558 If <I>filename</I> is supplied, it is used as the
9559 name of the history file; if not, the value of
9560 <FONT SIZE=-1><B>HISTFILE</B>
9561
9562 </FONT>
9563 is used.  Options, if supplied, have the following meanings:
9564 <DL COMPACT><DT><DD>
9565
9566 <DL COMPACT>
9567 <DT><B>-c</B>
9568
9569 <DD>
9570 Clear the history list by deleting all the entries.
9571 <DT><B>-d</B> <I>offset</I><DD>
9572 Delete the history entry at position <I>offset</I>.
9573 <DT><B>-a</B>
9574
9575 <DD>
9576 Append the ``new'' history lines (history lines entered since the
9577 beginning of the current <B>bash</B> session) to the history file.
9578 <DT><B>-n</B>
9579
9580 <DD>
9581 Read the history lines not already read from the history
9582 file into the current history list.  These are lines
9583 appended to the history file since the beginning of the
9584 current <B>bash</B> session.
9585 <DT><B>-r</B>
9586
9587 <DD>
9588 Read the contents of the history file
9589 and use them as the current history.
9590 <DT><B>-w</B>
9591
9592 <DD>
9593 Write the current history to the history file, overwriting the
9594 history file's contents.
9595 <DT><B>-p</B>
9596
9597 <DD>
9598 Perform history substitution on the following <I>args</I> and display
9599 the result on the standard output.
9600 Does not store the results in the history list.
9601 Each <I>arg</I> must be quoted to disable normal history expansion.
9602 <DT><B>-s</B>
9603
9604 <DD>
9605 Store the
9606 <I>args</I>
9607
9608 in the history list as a single entry.  The last command in the
9609 history list is removed before the
9610 <I>args</I>
9611
9612 are added.
9613
9614 </DL>
9615 <P>
9616
9617 If the <B>HISTTIMEFORMAT</B> is set, the time stamp information
9618 associated with each history entry is written to the history file,
9619 marked with the history comment character.
9620 When the history file is read, lines beginning with the history
9621 comment character followed immediately by a digit are interpreted
9622 as timestamps for the previous history line.
9623 The return value is 0 unless an invalid option is encountered, an
9624 error occurs while reading or writing the history file, an invalid
9625 <I>offset</I> is supplied as an argument to <B>-d</B>, or the
9626 history expansion supplied as an argument to <B>-p</B> fails.
9627 </DL>
9628
9629 <DT><B>jobs</B> [<B>-lnprs</B>] [ <I>jobspec</I> ... ]<DD>
9630
9631 <DT><B>jobs</B> <B>-x</B> <I>command</I> [ <I>args</I> ... ]<DD>
9632
9633 The first form lists the active jobs.  The options have the following
9634 meanings:
9635 <DL COMPACT><DT><DD>
9636
9637 <DL COMPACT>
9638 <DT><B>-l</B>
9639
9640 <DD>
9641 List process IDs
9642 in addition to the normal information.
9643 <DT><B>-p</B>
9644
9645 <DD>
9646 List only the process ID of the job's process group
9647 leader.
9648 <DT><B>-n</B>
9649
9650 <DD>
9651 Display information only about jobs that have changed status since
9652 the user was last notified of their status.
9653 <DT><B>-r</B>
9654
9655 <DD>
9656 Restrict output to running jobs.
9657 <DT><B>-s</B>
9658
9659 <DD>
9660 Restrict output to stopped jobs.
9661
9662 </DL>
9663 <P>
9664
9665 If
9666 <I>jobspec</I>
9667
9668 is given, output is restricted to information about that job.
9669 The return status is 0 unless an invalid option is encountered
9670 or an invalid
9671 <I>jobspec</I>
9672
9673 is supplied.
9674 <P>
9675
9676 If the
9677 <B>-x</B>
9678
9679 option is supplied,
9680 <B>jobs</B>
9681
9682 replaces any
9683 <I>jobspec</I>
9684
9685 found in
9686 <I>command</I>
9687
9688 or
9689 <I>args</I>
9690
9691 with the corresponding process group ID, and executes
9692 <I>command</I>
9693
9694 passing it
9695 <I>args</I>,
9696
9697 returning its exit status.
9698 </DL>
9699
9700 <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>
9701
9702 <DT><B>kill</B> <B>-l</B> [<I>sigspec</I> | <I>exit_status</I>]<DD>
9703
9704 Send the signal named by
9705 <I>sigspec</I>
9706
9707 or
9708 <I>signum</I>
9709
9710 to the processes named by
9711 <I>pid</I>
9712
9713 or
9714 <I>jobspec</I>.
9715
9716 <I>sigspec</I>
9717
9718 is either a case-insensitive signal name such as
9719 <FONT SIZE=-1><B>SIGKILL</B>
9720
9721 </FONT>
9722 (with or without the
9723 <FONT SIZE=-1><B>SIG</B>
9724
9725 </FONT>
9726 prefix) or a signal number;
9727 <I>signum</I>
9728
9729 is a signal number.
9730 If
9731 <I>sigspec</I>
9732
9733 is not present, then
9734 <FONT SIZE=-1><B>SIGTERM</B>
9735
9736 </FONT>
9737 is assumed.
9738 An argument of
9739 <B>-l</B>
9740
9741 lists the signal names.
9742 If any arguments are supplied when
9743 <B>-l</B>
9744
9745 is given, the names of the signals corresponding to the arguments are
9746 listed, and the return status is 0.
9747 The <I>exit_status</I> argument to
9748 <B>-l</B>
9749
9750 is a number specifying either a signal number or the exit status of
9751 a process terminated by a signal.
9752 <B>kill</B>
9753
9754 returns true if at least one signal was successfully sent, or false
9755 if an error occurs or an invalid option is encountered.
9756 <DT><B>let</B> <I>arg</I> [<I>arg</I> ...]<DD>
9757 Each
9758 <I>arg</I>
9759
9760 is an arithmetic expression to be evaluated (see
9761 <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>).
9762
9763 </FONT>
9764 If the last
9765 <I>arg</I>
9766
9767 evaluates to 0,
9768 <B>let</B>
9769
9770 returns 1; 0 is returned otherwise.
9771 <DT><B>local</B> [<I>option</I>] [<I>name</I>[=<I>value</I>] ...]<DD>
9772 For each argument, a local variable named
9773 <I>name </I>
9774
9775 is created, and assigned
9776 <I>value</I>.
9777
9778 The <I>option</I> can be any of the options accepted by <B>declare</B>.
9779 When
9780 <B>local</B>
9781
9782 is used within a function, it causes the variable
9783 <I>name</I>
9784
9785 to have a visible scope restricted to that function and its children.
9786 With no operands,
9787 <B>local</B>
9788
9789 writes a list of local variables to the standard output.  It is
9790 an error to use
9791 <B>local</B>
9792
9793 when not within a function.  The return status is 0 unless
9794 <B>local</B>
9795
9796 is used outside a function, an invalid
9797 <I>name</I>
9798
9799 is supplied, or
9800 <I>name</I> is a readonly variable.
9801 <DT><B>logout</B>
9802
9803 <DD>
9804 Exit a login shell.
9805 <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>
9806
9807 <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>
9808
9809 Read lines from the standard input into array variable
9810 <I>array</I>,
9811
9812 or from file descriptor 
9813 <I>fd</I>
9814
9815 if the 
9816 <B>-u</B>
9817
9818 option is supplied.
9819 The variable <B>MAPFILE</B> is the default <I>array</I>.
9820 Options, if supplied, have the following meanings:
9821 <DL COMPACT><DT><DD>
9822
9823 <DL COMPACT>
9824 <DT><B>-n</B>
9825
9826 <DD>
9827 Copy at most
9828 <I>count</I>
9829
9830 lines.  If <I>count</I> is 0, all lines are copied.
9831 <DT><B>-O</B>
9832
9833 <DD>
9834 Begin assigning to
9835 <I>array</I>
9836
9837 at index
9838 <I>origin</I>.
9839
9840 The default index is 0.
9841 <DT><B>-s</B>
9842
9843 <DD>
9844 Discard the first <I>count</I> lines read.
9845 <DT><B>-t</B>
9846
9847 <DD>
9848 Remove a trailing line from each line read.
9849 <DT><B>-u</B>
9850
9851 <DD>
9852 Read lines from file descriptor <I>fd</I> instead of the standard input.
9853 <DT><B>-C</B>
9854
9855 <DD>
9856 Evaluate
9857 <I>callback</I>
9858
9859 each time <I>quantum</I> lines are read.  The <B>-c</B> option specifies
9860 <I>quantum</I>.
9861
9862 <DT><B>-c</B>
9863
9864 <DD>
9865 Specify the number of lines read between each call to
9866 <I>callback</I>.
9867
9868
9869 </DL>
9870 <P>
9871
9872 If
9873 <B>-C</B>
9874
9875 is specified without 
9876 <B>-c</B>,
9877
9878 the default quantum is 5000.
9879 When <I>callback</I> is evaluated, it is supplied the index of the next
9880 array element to be assigned as an additional argument.
9881 <I>callback</I> is evaluated after the line is read but before the 
9882 array element is assigned.
9883 <P>
9884
9885 If not supplied with an explicit origin, <B>mapfile</B> will clear <I>array</I>
9886 before assigning to it.
9887 <P>
9888
9889 <B>mapfile</B> returns successfully unless an invalid option or option
9890 argument is supplied, or <I>array</I> is invalid or unassignable.
9891 </DL>
9892
9893 <DT><B>popd</B> [-<B>n</B>] [+<I>n</I>] [-<I>n</I>]<DD>
9894 Removes entries from the directory stack.  With no arguments,
9895 removes the top directory from the stack, and performs a
9896 <B>cd</B>
9897
9898 to the new top directory.
9899 Arguments, if supplied, have the following meanings:
9900 <DL COMPACT><DT><DD>
9901
9902 <DL COMPACT>
9903 <DT><B>-n</B>
9904
9905 <DD>
9906 Suppresses the normal change of directory when removing directories
9907 from the stack, so that only the stack is manipulated.
9908 <DT><B>+</B><I>n</I><DD>
9909 Removes the <I>n</I>th entry counting from the left of the list
9910 shown by
9911 <B>dirs</B>,
9912
9913 starting with zero.  For example:
9914
9915 <TT>popd +0</TT>
9916 removes the first directory,
9917
9918 <TT>popd +1</TT>
9919 the second.
9920 <DT><B>-</B><I>n</I><DD>
9921 Removes the <I>n</I>th entry counting from the right of the list
9922 shown by
9923 <B>dirs</B>,
9924
9925 starting with zero.  For example:
9926
9927 <TT>popd -0</TT>
9928 removes the last directory,
9929
9930 <TT>popd -1</TT>
9931 the next to last.
9932
9933 </DL>
9934 <P>
9935
9936 If the
9937 <B>popd</B>
9938
9939 command is successful, a 
9940 <B>dirs</B>
9941
9942 is performed as well, and the return status is 0.
9943 <B>popd</B>
9944
9945 returns false if an invalid option is encountered, the directory stack
9946 is empty, a non-existent directory stack entry is specified, or the
9947 directory change fails.
9948 </DL>
9949
9950 <DT><B>printf</B> [<B>-v</B> <I>var</I>] <I>format</I> [<I>arguments</I>]<DD>
9951 Write the formatted <I>arguments</I> to the standard output under the
9952 control of the <I>format</I>.
9953 The <I>format</I> is a character string which contains three types of objects:
9954 plain characters, which are simply copied to standard output, character
9955 escape sequences, which are converted and copied to the standard output, and
9956 format specifications, each of which causes printing of the next successive
9957 <I>argument</I>.
9958 In addition to the standard <I>printf</I>(1) formats, <B>%b</B> causes
9959 <B>printf</B> to expand backslash escape sequences in the corresponding
9960 <I>argument</I> (except that <B>\c</B> terminates output, backslashes in
9961 <B>\aq</B>, <B>\&quot;</B>, and <B>\?</B> are not removed, and octal escapes
9962 beginning with <B>\0</B> may contain up to four digits),
9963 and <B>%q</B> causes <B>printf</B> to output the corresponding
9964 <I>argument</I> in a format that can be reused as shell input.
9965 <P>
9966 The <B>-v</B> option causes the output to be assigned to the variable
9967 <I>var</I> rather than being printed to the standard output.
9968 <P>
9969 The <I>format</I> is reused as necessary to consume all of the <I>arguments</I>.
9970 If the <I>format</I> requires more <I>arguments</I> than are supplied, the
9971 extra format specifications behave as if a zero value or null string, as
9972 appropriate, had been supplied.  The return value is zero on success,
9973 non-zero on failure.
9974 <DT><B>pushd</B> [<B>-n</B>] [+<I>n</I>] [-<I>n</I>]<DD>
9975
9976 <DT><B>pushd</B> [<B>-n</B>] [<I>dir</I>]<DD>
9977
9978 Adds a directory to the top of the directory stack, or rotates
9979 the stack, making the new top of the stack the current working
9980 directory.  With no arguments, exchanges the top two directories
9981 and returns 0, unless the directory stack is empty.
9982 Arguments, if supplied, have the following meanings:
9983 <DL COMPACT><DT><DD>
9984
9985 <DL COMPACT>
9986 <DT><B>-n</B>
9987
9988 <DD>
9989 Suppresses the normal change of directory when adding directories
9990 to the stack, so that only the stack is manipulated.
9991 <DT><B>+</B><I>n</I><DD>
9992 Rotates the stack so that the <I>n</I>th directory
9993 (counting from the left of the list shown by
9994 <B>dirs</B>,
9995
9996 starting with zero)
9997 is at the top.
9998 <DT><B>-</B><I>n</I><DD>
9999 Rotates the stack so that the <I>n</I>th directory
10000 (counting from the right of the list shown by
10001 <B>dirs</B>,
10002
10003 starting with zero) is at the top.
10004 <DT><I>dir</I>
10005
10006 <DD>
10007 Adds
10008 <I>dir</I>
10009
10010 to the directory stack at the top, making it the
10011 new current working directory.
10012
10013 </DL>
10014 <P>
10015
10016 If the
10017 <B>pushd</B>
10018
10019 command is successful, a 
10020 <B>dirs</B>
10021
10022 is performed as well.
10023 If the first form is used,
10024 <B>pushd</B>
10025
10026 returns 0 unless the cd to
10027 <I>dir</I>
10028
10029 fails.  With the second form,
10030 <B>pushd</B>
10031
10032 returns 0 unless the directory stack is empty,
10033 a non-existent directory stack element is specified,
10034 or the directory change to the specified new current directory
10035 fails.
10036 </DL>
10037
10038 <DT><B>pwd</B> [<B>-LP</B>]<DD>
10039 Print the absolute pathname of the current working directory.
10040 The pathname printed contains no symbolic links if the
10041 <B>-P</B>
10042
10043 option is supplied or the 
10044 <B>-o physical</B>
10045
10046 option to the
10047 <B>set</B>
10048
10049 builtin command is enabled.
10050 If the
10051 <B>-L</B>
10052
10053 option is used, the pathname printed may contain symbolic links.
10054 The return status is 0 unless an error occurs while
10055 reading the name of the current directory or an
10056 invalid option is supplied.
10057 <DT><B>read</B> [<B>-ers</B>] [<B>-a</B> <I>aname</I>] [<B>-d</B> <I>delim</I>] [<B>-</B> <I>text</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>
10058 One line is read from the standard input, or from the file descriptor
10059 <I>fd</I> supplied as an argument to the <B>-u</B> option, and the first word
10060 is assigned to the first
10061 <I>name</I>,
10062
10063 the second word to the second
10064 <I>name</I>,
10065
10066 and so on, with leftover words and their intervening separators assigned
10067 to the last
10068 <I>name</I>.
10069
10070 If there are fewer words read from the input stream than names,
10071 the remaining names are assigned empty values.
10072 The characters in 
10073 <FONT SIZE=-1><B>IFS</B>
10074
10075 </FONT>
10076 are used to split the line into words.
10077 The backslash character (<B>\</B>) may be used to remove any special
10078 meaning for the next character read and for line continuation.
10079 Options, if supplied, have the following meanings:
10080 <DL COMPACT><DT><DD>
10081
10082 <DL COMPACT>
10083 <DT><B>-a </B><I>aname</I>
10084
10085 <DD>
10086 The words are assigned to sequential indices
10087 of the array variable
10088 <I>aname</I>,
10089
10090 starting at 0.
10091 <I>aname</I>
10092
10093 is unset before any new values are assigned.
10094 Other <I>name</I> arguments are ignored.
10095 <DT><B>-d </B><I>delim</I>
10096
10097 <DD>
10098 The first character of <I>delim</I> is used to terminate the input line,
10099 rather than newline.
10100 <DT><B>-e</B>
10101
10102 <DD>
10103 If the standard input
10104 is coming from a terminal,
10105 <B>readline</B>
10106
10107 (see
10108 <FONT SIZE=-1><B>READLINE</B>
10109
10110 </FONT>
10111 above) is used to obtain the line.
10112 Readline uses the current (or default, if line editing was not previously
10113 active) editing settings.
10114 <DT><B>-i </B><I>text</I>
10115
10116 <DD>
10117 If
10118 <B>readline</B>
10119
10120 is being used to read the line, <I>text</I> is placed into the editing
10121 buffer before editing begins.
10122 <DT><B>-n </B><I>nchars</I>
10123
10124 <DD>
10125 <B>read</B> returns after reading <I>nchars</I> characters rather than
10126 waiting for a complete line of input.
10127 <DT><B>-p </B><I>prompt</I>
10128
10129 <DD>
10130 Display <I>prompt</I> on standard error, without a
10131 trailing newline, before attempting to read any input.  The prompt
10132 is displayed only if input is coming from a terminal.
10133 <DT><B>-r</B>
10134
10135 <DD>
10136 Backslash does not act as an escape character.
10137 The backslash is considered to be part of the line.
10138 In particular, a backslash-newline pair may not be used as a line
10139 continuation.
10140 <DT><B>-s</B>
10141
10142 <DD>
10143 Silent mode.  If input is coming from a terminal, characters are
10144 not echoed.
10145 <DT><B>-t </B><I>timeout</I>
10146
10147 <DD>
10148 Cause <B>read</B> to time out and return failure if a complete line of
10149 input is not read within <I>timeout</I> seconds.
10150 <I>timeout</I> may be a decimal number with a fractional portion following
10151 the decimal point.
10152 This option is only effective if <B>read</B> is reading input from a
10153 terminal, pipe, or other special file; it has no effect when reading
10154 from regular files.
10155 If <I>timeout</I> is 0, <B>read</B> returns success if input is available on
10156 the specified file descriptor, failure otherwise.
10157 The exit status is greater than 128 if the timeout is exceeded.
10158 <DT><B>-u </B><I>fd</I>
10159
10160 <DD>
10161 Read input from file descriptor <I>fd</I>.
10162
10163 </DL>
10164 <P>
10165
10166 If no
10167 <I>names</I>
10168
10169 are supplied, the line read is assigned to the variable
10170 <FONT SIZE=-1><B>REPLY</B>.
10171
10172 </FONT>
10173 The return code is zero, unless end-of-file is encountered, <B>read</B>
10174 times out (in which case the return code is greater than 128), or an
10175 invalid file descriptor is supplied as the argument to <B>-u</B>.
10176 </DL>
10177
10178 <DT><B>readonly</B> [<B>-aApf</B>] [<I>name</I>[=<I>word</I>] ...]<DD>
10179
10180 The given
10181 <I>names</I> are marked readonly; the values of these
10182 <I>names</I>
10183
10184 may not be changed by subsequent assignment.
10185 If the
10186 <B>-f</B>
10187
10188 option is supplied, the functions corresponding to the
10189 <I>names</I> are so
10190 marked.
10191 The
10192 <B>-a</B>
10193
10194 option restricts the variables to indexed arrays; the
10195 <B>-A</B>
10196
10197 option restricts the variables to associative arrays.
10198 If no
10199 <I>name</I>
10200
10201 arguments are given, or if the
10202 <B>-p</B>
10203
10204 option is supplied, a list of all readonly names is printed.
10205 The
10206 <B>-p</B>
10207
10208 option causes output to be displayed in a format that
10209 may be reused as input.
10210 If a variable name is followed by =<I>word</I>, the value of
10211 the variable is set to <I>word</I>.
10212 The return status is 0 unless an invalid option is encountered,
10213 one of the
10214 <I>names</I>
10215
10216 is not a valid shell variable name, or
10217 <B>-f</B>
10218
10219 is supplied with a
10220 <I>name</I>
10221
10222 that is not a function.
10223 <DT><B>return</B> [<I>n</I>]<DD>
10224 Causes a function to exit with the return value specified by
10225 <I>n</I>.
10226
10227 If 
10228 <I>n</I>
10229
10230 is omitted, the return status is that of the last command
10231 executed in the function body.  If used outside a function,
10232 but during execution of a script by the 
10233 <B>.</B>
10234
10235 (<B>source</B>) command, it causes the shell to stop executing
10236 that script and return either
10237 <I>n</I>
10238
10239 or the exit status of the last command executed within the
10240 script as the exit status of the script.  If used outside a
10241 function and not during execution of a script by <B>.</B>,
10242 the return status is false.
10243 Any command associated with the <B>RETURN</B> trap is executed
10244 before execution resumes after the function or script.
10245 <DT><B>set</B> [<B>--abefhkmnptuvxBCEHPT</B>] [<B>-o</B> <I>option</I>] [<I>arg</I> ...]<DD>
10246
10247 <DT><B>set</B> [<B>+abefhkmnptuvxBCEHPT</B>] [<B>+o</B> <I>option</I>] [<I>arg</I> ...]<DD>
10248
10249 Without options, the name and value of each shell variable are displayed
10250 in a format that can be reused as input
10251 for setting or resetting the currently-set variables.
10252 Read-only variables cannot be reset.
10253 In <I>posix mode</I>, only shell variables are listed.
10254 The output is sorted according to the current locale.
10255 When options are specified, they set or unset shell attributes.
10256 Any arguments remaining after option processing are treated
10257 as values for the positional parameters and are assigned, in order, to 
10258 <B>$1</B>,
10259
10260 <B>$2</B>,
10261
10262 <B>...</B>
10263
10264 <B>$</B><I>n</I>.
10265
10266 Options, if specified, have the following meanings:
10267 <DL COMPACT><DT><DD>
10268
10269 <DL COMPACT>
10270 <DT><B>-a</B>
10271
10272 <DD>
10273 Automatically mark variables and functions which are modified or
10274 created for export to the environment of subsequent commands.
10275 <DT><B>-b</B>
10276
10277 <DD>
10278 Report the status of terminated background jobs
10279 immediately, rather than before the next primary prompt.  This is
10280 effective only when job control is enabled.
10281 <DT><B>-e</B>
10282
10283 <DD>
10284 Exit immediately if a <I>simple command</I> (see
10285 <FONT SIZE=-1><B>SHELL GRAMMAR</B>
10286
10287 </FONT>
10288 above) exits with a non-zero status.
10289 The shell does not exit if the
10290 command that fails is part of the command list immediately following a
10291 <B>while</B>
10292
10293 or
10294 <B>until</B>
10295
10296 keyword, 
10297 part of the test in an
10298 <B>if</B>
10299
10300 statement, part of a command executed in a
10301 <B>&amp;&amp;</B>
10302
10303 or
10304 <B>||</B>
10305
10306 list,
10307 any command in a pipeline but the last,
10308 or if the command's return value is
10309 being inverted via
10310 <B>!</B>.
10311
10312 Failing simple commands that are part of shell functions or command lists
10313 enclosed in braces or parentheses satisfying the above conditions do not
10314 cause the shell to exit.
10315 A trap on <B>ERR</B>, if set, is executed before the shell exits.
10316 <DT><B>-f</B>
10317
10318 <DD>
10319 Disable pathname expansion.
10320 <DT><B>-h</B>
10321
10322 <DD>
10323 Remember the location of commands as they are looked up for execution.
10324 This is enabled by default.
10325 <DT><B>-k</B>
10326
10327 <DD>
10328 All arguments in the form of assignment statements
10329 are placed in the environment for a command, not just
10330 those that precede the command name.
10331 <DT><B>-m</B>
10332
10333 <DD>
10334 Monitor mode.  Job control is enabled.  This option is on
10335 by default for interactive shells on systems that support
10336 it (see
10337 <FONT SIZE=-1><B>JOB CONTROL</B>
10338
10339 </FONT>
10340 above).  Background processes run in a separate process
10341 group and a line containing their exit status is printed
10342 upon their completion.
10343 <DT><B>-n</B>
10344
10345 <DD>
10346 Read commands but do not execute them.  This may be used to 
10347 check a shell script for syntax errors.  This is ignored by
10348 interactive shells.
10349 <DT><B>-o </B><I>option-name</I>
10350
10351 <DD>
10352 The <I>option-name</I> can be one of the following:
10353 <DL COMPACT><DT><DD>
10354 <DL COMPACT>
10355 <DT><B>allexport</B>
10356
10357 <DD>
10358 Same as
10359 <B>-a</B>.
10360
10361 <DT><B>braceexpand</B>
10362
10363 <DD>
10364 Same as
10365 <B>-B</B>.
10366
10367 <DT><B>emacs</B>
10368
10369 <DD>
10370 Use an emacs-style command line editing interface.  This is enabled
10371 by default when the shell is interactive, unless the shell is started
10372 with the
10373 <B>--noediting</B>
10374
10375 option.
10376 This also affects the editing interface used for <B>read -e</B>.
10377 <DT><B>errtrace</B>
10378
10379 <DD>
10380 Same as
10381 <B>-E</B>.
10382
10383 <DT><B>functrace</B>
10384
10385 <DD>
10386 Same as
10387 <B>-T</B>.
10388
10389 <DT><B>errexit</B>
10390
10391 <DD>
10392 Same as
10393 <B>-e</B>.
10394
10395 <DT><B>hashall</B>
10396
10397 <DD>
10398 Same as
10399 <B>-h</B>.
10400
10401 <DT><B>histexpand</B>
10402
10403 <DD>
10404 Same as
10405 <B>-H</B>.
10406
10407 <DT><B>history</B>
10408
10409 <DD>
10410 Enable command history, as described above under
10411 <FONT SIZE=-1><B>HISTORY</B>.
10412
10413 </FONT>
10414 This option is on by default in interactive shells.
10415 <DT><B>ignoreeof</B>
10416
10417 <DD>
10418 The effect is as if the shell command
10419 <TT>IGNOREEOF=10</TT>
10420
10421 had been executed
10422 (see
10423 <B>Shell Variables</B>
10424
10425 above).
10426 <DT><B>keyword</B>
10427
10428 <DD>
10429 Same as
10430 <B>-k</B>.
10431
10432 <DT><B>monitor</B>
10433
10434 <DD>
10435 Same as
10436 <B>-m</B>.
10437
10438 <DT><B>noclobber</B>
10439
10440 <DD>
10441 Same as
10442 <B>-C</B>.
10443
10444 <DT><B>noexec</B>
10445
10446 <DD>
10447 Same as
10448 <B>-n</B>.
10449
10450 <DT><B>noglob</B>
10451
10452 <DD>
10453 Same as
10454 <B>-f</B>.
10455
10456 <DT><B>nolog</B>
10457
10458 <DD>
10459 Currently ignored.
10460 <DT><B>notify</B>
10461
10462 <DD>
10463 Same as
10464 <B>-b</B>.
10465
10466 <DT><B>nounset</B>
10467
10468 <DD>
10469 Same as
10470 <B>-u</B>.
10471
10472 <DT><B>onecmd</B>
10473
10474 <DD>
10475 Same as
10476 <B>-t</B>.
10477
10478 <DT><B>physical</B>
10479
10480 <DD>
10481 Same as
10482 <B>-P</B>.
10483
10484 <DT><B>pipefail</B>
10485
10486 <DD>
10487 If set, the return value of a pipeline is the value of the last
10488 (rightmost) command to exit with a non-zero status, or zero if all
10489 commands in the pipeline exit successfully.
10490 This option is disabled by default.
10491 <DT><B>posix</B>
10492
10493 <DD>
10494 Change the behavior of
10495 <B>bash</B>
10496
10497 where the default operation differs
10498 from the POSIX standard to match the standard (<I>posix mode</I>).
10499 <DT><B>privileged</B>
10500
10501 <DD>
10502 Same as
10503 <B>-p</B>.
10504
10505 <DT><B>verbose</B>
10506
10507 <DD>
10508 Same as
10509 <B>-v</B>.
10510
10511 <DT><B>vi</B>
10512
10513 <DD>
10514 Use a vi-style command line editing interface.
10515 This also affects the editing interface used for <B>read -e</B>.
10516 <DT><B>xtrace</B>
10517
10518 <DD>
10519 Same as
10520 <B>-x</B>.
10521
10522 <P>
10523 </DL>
10524 <P>
10525
10526 If
10527 <B>-o</B>
10528
10529 is supplied with no <I>option-name</I>, the values of the current options are
10530 printed.
10531 If
10532 <B>+o</B>
10533
10534 is supplied with no <I>option-name</I>, a series of
10535 <B>set</B>
10536
10537 commands to recreate the current option settings is displayed on
10538 the standard output.
10539 </DL>
10540
10541 <DT><B>-p</B>
10542
10543 <DD>
10544 Turn on
10545 <I>privileged</I>
10546
10547 mode.  In this mode, the
10548 <FONT SIZE=-1><B>$ENV</B>
10549
10550 </FONT>
10551 and
10552 <FONT SIZE=-1><B>$BASH_ENV</B>
10553
10554 </FONT>
10555 files are not processed, shell functions are not inherited from the
10556 environment, and the
10557 <FONT SIZE=-1><B>SHELLOPTS</B>,
10558
10559 </FONT>
10560 <B>CDPATH</B>,
10561
10562 and
10563 <B>GLOBIGNORE</B>
10564
10565 variables, if they appear in the environment, are ignored.
10566 If the shell is started with the effective user (group) id not equal to the
10567 real user (group) id, and the <B>-p</B> option is not supplied, these actions
10568 are taken and the effective user id is set to the real user id.
10569 If the <B>-p</B> option is supplied at startup, the effective user id is
10570 not reset.
10571 Turning this option off causes the effective user
10572 and group ids to be set to the real user and group ids.
10573 <DT><B>-t</B>
10574
10575 <DD>
10576 Exit after reading and executing one command.
10577 <DT><B>-u</B>
10578
10579 <DD>
10580 Treat unset variables as an error when performing
10581 parameter expansion.  If expansion is attempted on an
10582 unset variable, the shell prints an error message, and,
10583 if not interactive, exits with a non-zero status.
10584 <DT><B>-v</B>
10585
10586 <DD>
10587 Print shell input lines as they are read.
10588 <DT><B>-x</B>
10589
10590 <DD>
10591 After expanding each <I>simple command</I>,
10592 <B>for</B> command, <B>case</B> command, <B>select</B> command, or
10593 arithmetic <B>for</B> command, display the expanded value of
10594 <FONT SIZE=-1><B>PS4</B>,
10595
10596 </FONT>
10597 followed by the command and its expanded arguments
10598 or associated word list.
10599 <DT><B>-B</B>
10600
10601 <DD>
10602 The shell performs brace expansion (see
10603 <B>Brace Expansion</B>
10604
10605 above).  This is on by default.
10606 <DT><B>-C</B>
10607
10608 <DD>
10609 If set,
10610 <B>bash</B>
10611
10612 does not overwrite an existing file with the
10613 <B>&gt;</B>,
10614
10615 <B>&gt;&amp;</B>,
10616
10617 and
10618 <B>&lt;&gt;</B>
10619
10620 redirection operators.  This may be overridden when 
10621 creating output files by using the redirection operator
10622 <B>&gt;|</B>
10623
10624 instead of
10625 <B>&gt;</B>.
10626
10627 <DT><B>-E</B>
10628
10629 <DD>
10630 If set, any trap on <B>ERR</B> is inherited by shell functions, command
10631 substitutions, and commands executed in a subshell environment.
10632 The <B>ERR</B> trap is normally not inherited in such cases.
10633 <DT><B>-H</B>
10634
10635 <DD>
10636 Enable
10637 <B>!</B>
10638
10639 style history substitution.  This option is on by
10640 default when the shell is interactive.
10641 <DT><B>-P</B>
10642
10643 <DD>
10644 If set, the shell does not follow symbolic links when executing
10645 commands such as
10646 <B>cd</B>
10647
10648 that change the current working directory.  It uses the
10649 physical directory structure instead.  By default,
10650 <B>bash</B>
10651
10652 follows the logical chain of directories when performing commands
10653 which change the current directory.
10654 <DT><B>-T</B>
10655
10656 <DD>
10657 If set, any traps on <B>DEBUG</B> and <B>RETURN</B> are inherited by shell
10658 functions, command substitutions, and commands executed in a
10659 subshell environment.
10660 The <B>DEBUG</B> and <B>RETURN</B> traps are normally not inherited
10661 in such cases.
10662 <DT><B>--</B>
10663
10664 <DD>
10665 If no arguments follow this option, then the positional parameters are
10666 unset.  Otherwise, the positional parameters are set to the
10667 <I>arg</I>s, even if some of them begin with a
10668 <B>-</B>.
10669
10670 <DT><B>-</B>
10671
10672 <DD>
10673 Signal the end of options, cause all remaining <I>arg</I>s to be
10674 assigned to the positional parameters.  The
10675 <B>-x</B>
10676
10677 and
10678 <B>-v</B>
10679
10680 options are turned off.
10681 If there are no <I>arg</I>s,
10682 the positional parameters remain unchanged.
10683
10684 </DL>
10685 <P>
10686
10687 The options are off by default unless otherwise noted.
10688 Using + rather than - causes these options to be turned off.
10689 The options can also be specified as arguments to an invocation of
10690 the shell.
10691 The current set of options may be found in
10692 <B>$-</B>.
10693
10694 The return status is always true unless an invalid option is encountered.
10695 </DL>
10696
10697 <DT><B>shift</B> [<I>n</I>]<DD>
10698 The positional parameters from <I>n</I>+1 ... are renamed to
10699 <B>$1</B>
10700
10701 <B>....</B>
10702
10703 Parameters represented by the numbers <B>$#</B>
10704 down to <B>$#</B>-<I>n</I>+1 are unset.
10705 <I>n</I>
10706
10707 must be a non-negative number less than or equal to <B>$#</B>.
10708 If
10709 <I>n</I>
10710
10711 is 0, no parameters are changed.
10712 If
10713 <I>n </I>
10714
10715 is not given, it is assumed to be 1.
10716 If
10717 <I>n</I>
10718
10719 is greater than <B>$#</B>, the positional parameters are not changed.
10720 The return status is greater than zero if
10721 <I>n</I>
10722
10723 is greater than
10724 <B>$#</B>
10725
10726 or less than zero; otherwise 0.
10727 <DT><B>shopt</B> [<B>-pqsu</B>] [<B>-o</B>] [<I>optname</I> ...]<DD>
10728 Toggle the values of variables controlling optional shell behavior.
10729 With no options, or with the
10730 <B>-p</B>
10731
10732 option, a list of all settable options is displayed, with
10733 an indication of whether or not each is set.
10734 The <B>-p</B> option causes output to be displayed in a form that
10735 may be reused as input.
10736 Other options have the following meanings:
10737 <DL COMPACT><DT><DD>
10738
10739 <DL COMPACT>
10740 <DT><B>-s</B>
10741
10742 <DD>
10743 Enable (set) each <I>optname</I>.
10744 <DT><B>-u</B>
10745
10746 <DD>
10747 Disable (unset) each <I>optname</I>.
10748 <DT><B>-q</B>
10749
10750 <DD>
10751 Suppresses normal output (quiet mode); the return status indicates
10752 whether the <I>optname</I> is set or unset.
10753 If multiple <I>optname</I> arguments are given with
10754 <B>-q</B>,
10755
10756 the return status is zero if all <I>optnames</I> are enabled; non-zero
10757 otherwise.
10758 <DT><B>-o</B>
10759
10760 <DD>
10761 Restricts the values of <I>optname</I> to be those defined for the
10762 <B>-o</B>
10763
10764 option to the
10765 <B>set</B>
10766
10767 builtin.
10768
10769 </DL>
10770 <P>
10771
10772 If either
10773 <B>-s</B>
10774
10775 or
10776 <B>-u</B>
10777
10778 is used with no <I>optname</I> arguments, the display is limited to
10779 those options which are set or unset, respectively.
10780 Unless otherwise noted, the <B>shopt</B> options are disabled (unset)
10781 by default.
10782 <P>
10783
10784 The return status when listing options is zero if all <I>optnames</I>
10785 are enabled, non-zero otherwise.  When setting or unsetting options,
10786 the return status is zero unless an <I>optname</I> is not a valid shell
10787 option.
10788 <P>
10789
10790 The list of <B>shopt</B> options is:
10791 <P>
10792
10793
10794
10795 <DL COMPACT>
10796 <DT><B>autocd</B>
10797
10798 <DD>
10799 If set, a command name that is the name of a directory is executed as if
10800 it were the argument to the <B>cd</B> command.
10801 This option is only used by interactive shells.
10802 <DT><B>cdable_vars</B>
10803
10804 <DD>
10805 If set, an argument to the
10806 <B>cd</B>
10807
10808 builtin command that
10809 is not a directory is assumed to be the name of a variable whose
10810 value is the directory to change to.
10811 <DT><B>cdspell</B>
10812
10813 <DD>
10814 If set, minor errors in the spelling of a directory component in a
10815 <B>cd</B>
10816
10817 command will be corrected.
10818 The errors checked for are transposed characters,
10819 a missing character, and one character too many.
10820 If a correction is found, the corrected file name is printed,
10821 and the command proceeds.
10822 This option is only used by interactive shells.
10823 <DT><B>checkhash</B>
10824
10825 <DD>
10826 If set, <B>bash</B> checks that a command found in the hash
10827 table exists before trying to execute it.  If a hashed command no
10828 longer exists, a normal path search is performed.
10829 <DT><B>checkjobs</B>
10830
10831 <DD>
10832 If set, <B>bash</B> lists the status of any stopped and running jobs before
10833 exiting an interactive shell.  If any jobs are running, this causes
10834 the exit to be deferred until a second exit is attempted without an
10835 intervening command (see <B>JOB CONTROL</B> above).  The shell always
10836 postpones exiting if any jobs are stopped.
10837 <DT><B>checkwinsize</B>
10838
10839 <DD>
10840 If set, <B>bash</B> checks the window size after each command
10841 and, if necessary, updates the values of
10842 <FONT SIZE=-1><B>LINES</B>
10843
10844 </FONT>
10845 and
10846 <FONT SIZE=-1><B>COLUMNS</B>.
10847
10848 </FONT>
10849 <DT><B>cmdhist</B>
10850
10851 <DD>
10852 If set,
10853 <B>bash</B>
10854
10855 attempts to save all lines of a multiple-line
10856 command in the same history entry.  This allows
10857 easy re-editing of multi-line commands.
10858 <DT><B>compat31</B>
10859
10860 <DD>
10861 If set,
10862 <B>bash</B>
10863
10864 changes its behavior to that of version 3.1 with respect to quoted
10865 arguments to the conditional command's =~ operator.
10866 <DT><B>dirspell</B>
10867
10868 <DD>
10869 If set,
10870 <B>bash</B>
10871
10872 attempts spelling correction on directory names during word completion
10873 if the directory name initially supplied does not exist.
10874 <DT><B>dotglob</B>
10875
10876 <DD>
10877 If set, 
10878 <B>bash</B>
10879
10880 includes filenames beginning with a `.' in the results of pathname
10881 expansion.
10882 <DT><B>execfail</B>
10883
10884 <DD>
10885 If set, a non-interactive shell will not exit if
10886 it cannot execute the file specified as an argument to the
10887 <B>exec</B>
10888
10889 builtin command.  An interactive shell does not exit if
10890 <B>exec</B>
10891
10892 fails.
10893 <DT><B>expand_aliases</B>
10894
10895 <DD>
10896 If set, aliases are expanded as described above under
10897 <FONT SIZE=-1><B>ALIASES</B>.
10898
10899 </FONT>
10900 This option is enabled by default for interactive shells.
10901 <DT><B>extdebug</B>
10902
10903 <DD>
10904 If set, behavior intended for use by debuggers is enabled:
10905 <DL COMPACT><DT><DD>
10906 <DL COMPACT>
10907 <DT><B>1.</B>
10908
10909 <DD>
10910 The <B>-F</B> option to the <B>declare</B> builtin displays the source
10911 file name and line number corresponding to each function name supplied
10912 as an argument.
10913 <DT><B>2.</B>
10914
10915 <DD>
10916 If the command run by the <B>DEBUG</B> trap returns a non-zero value, the
10917 next command is skipped and not executed.
10918 <DT><B>3.</B>
10919
10920 <DD>
10921 If the command run by the <B>DEBUG</B> trap returns a value of 2, and the
10922 shell is executing in a subroutine (a shell function or a shell script
10923 executed by the <B>.</B> or <B>source</B> builtins), a call to
10924 <B>return</B> is simulated.
10925 <DT><B>4.</B>
10926
10927 <DD>
10928 <B>BASH_ARGC</B> and <B>BASH_ARGV</B> are updated as described in their
10929 descriptions above.
10930 <DT><B>5.</B>
10931
10932 <DD>
10933 Function tracing is enabled:  command substitution, shell functions, and
10934 subshells invoked with <B>(</B> <I>command</I> <B>)</B> inherit the
10935 <B>DEBUG</B> and <B>RETURN</B> traps.
10936 <DT><B>6.</B>
10937
10938 <DD>
10939 Error tracing is enabled:  command substitution, shell functions, and
10940 subshells invoked with <B>(</B> <I>command</I> <B>)</B> inherit the
10941 <B>ERROR</B> trap.
10942 </DL></DL>
10943
10944 <DT><B>extglob</B>
10945
10946 <DD>
10947 If set, the extended pattern matching features described above under
10948 <B>Pathname Expansion</B> are enabled.
10949 <DT><B>extquote</B>
10950
10951 <DD>
10952 If set, <B>$</B>aq<I>string</I>aq and <B>$</B>&quot;<I>string</I>&quot; quoting is
10953 performed within <B>${</B><I>parameter</I><B>}</B> expansions
10954 enclosed in double quotes.  This option is enabled by default.
10955 <DT><B>failglob</B>
10956
10957 <DD>
10958 If set, patterns which fail to match filenames during pathname expansion
10959 result in an expansion error.
10960 <DT><B>force_fignore</B>
10961
10962 <DD>
10963 If set, the suffixes specified by the <B>FIGNORE</B> shell variable
10964 cause words to be ignored when performing word completion even if
10965 the ignored words are the only possible completions.
10966 See
10967 <FONT SIZE=-1><B>SHELL VARIABLES</B></FONT>
10968 above for a description of <B>FIGNORE</B>.
10969 This option is enabled by default.
10970 <DT><B>globstar</B>
10971
10972 <DD>
10973 If set, the pattern <B>**</B> used in a filename expansion context will
10974 match a files and zero or more directories and subdirectories.
10975 If the pattern is followed by a <B>/</B>, only directories and
10976 subdirectories match.
10977 <DT><B>gnu_errfmt</B>
10978
10979 <DD>
10980 If set, shell error messages are written in the standard GNU error
10981 message format.
10982 <DT><B>histappend</B>
10983
10984 <DD>
10985 If set, the history list is appended to the file named by the value
10986 of the
10987 <B>HISTFILE</B>
10988
10989 variable when the shell exits, rather than overwriting the file.
10990 <DT><B>histreedit</B>
10991
10992 <DD>
10993 If set, and
10994 <B>readline</B>
10995
10996 is being used, a user is given the opportunity to re-edit a
10997 failed history substitution.
10998 <DT><B>histverify</B>
10999
11000 <DD>
11001 If set, and 
11002 <B>readline</B>
11003
11004 is being used, the results of history substitution are not immediately
11005 passed to the shell parser.  Instead, the resulting line is loaded into
11006 the <B>readline</B> editing buffer, allowing further modification.
11007 <DT><B>hostcomplete</B>
11008
11009 <DD>
11010 If set, and
11011 <B>readline</B>
11012
11013 is being used, <B>bash</B> will attempt to perform hostname completion when a
11014 word containing a <B>@</B> is being completed (see
11015 <B>Completing</B>
11016
11017 under
11018 <FONT SIZE=-1><B>READLINE</B>
11019
11020 </FONT>
11021 above).
11022 This is enabled by default.
11023 <DT><B>huponexit</B>
11024
11025 <DD>
11026 If set, <B>bash</B> will send
11027 <FONT SIZE=-1><B>SIGHUP</B>
11028
11029 </FONT>
11030 to all jobs when an interactive login shell exits.
11031 <DT><B>interactive_comments</B>
11032
11033 <DD>
11034 If set, allow a word beginning with
11035 <B>#</B>
11036
11037 to cause that word and all remaining characters on that
11038 line to be ignored in an interactive shell (see
11039 <FONT SIZE=-1><B>COMMENTS</B>
11040
11041 </FONT>
11042 above).  This option is enabled by default.
11043 <DT><B>lithist</B>
11044
11045 <DD>
11046 If set, and the
11047 <B>cmdhist</B>
11048
11049 option is enabled, multi-line commands are saved to the history with
11050 embedded newlines rather than using semicolon separators where possible.
11051 <DT><B>login_shell</B>
11052
11053 <DD>
11054 The shell sets this option if it is started as a login shell (see
11055 <FONT SIZE=-1><B>INVOCATION</B>
11056
11057 </FONT>
11058 above).
11059 The value may not be changed.
11060 <DT><B>mailwarn</B>
11061
11062 <DD>
11063 If set, and a file that <B>bash</B> is checking for mail has been  
11064 accessed since the last time it was checked, the message ``The mail in
11065 <I>mailfile</I> has been read'' is displayed.
11066 <DT><B>no_empty_cmd_completion</B>
11067
11068 <DD>
11069 If set, and
11070 <B>readline</B>
11071
11072 is being used,
11073 <B>bash</B>
11074
11075 will not attempt to search the <B>PATH</B> for possible completions when
11076 completion is attempted on an empty line.
11077 <DT><B>nocaseglob</B>
11078
11079 <DD>
11080 If set,
11081 <B>bash</B>
11082
11083 matches filenames in a case-insensitive fashion when performing pathname
11084 expansion (see
11085 <B>Pathname Expansion</B>
11086
11087 above).
11088 <DT><B>nocasematch</B>
11089
11090 <DD>
11091 If set,
11092 <B>bash</B>
11093
11094 matches patterns in a case-insensitive fashion when performing matching
11095 while executing <B>case</B> or <B>[[</B> conditional commands.
11096 <DT><B>nullglob</B>
11097
11098 <DD>
11099 If set,
11100 <B>bash</B>
11101
11102 allows patterns which match no
11103 files (see
11104 <B>Pathname Expansion</B>
11105
11106 above)
11107 to expand to a null string, rather than themselves.
11108 <DT><B>progcomp</B>
11109
11110 <DD>
11111 If set, the programmable completion facilities (see
11112 <B>Programmable Completion</B> above) are enabled.
11113 This option is enabled by default.
11114 <DT><B>promptvars</B>
11115
11116 <DD>
11117 If set, prompt strings undergo
11118 parameter expansion, command substitution, arithmetic
11119 expansion, and quote removal after being expanded as described in
11120 <FONT SIZE=-1><B>PROMPTING</B>
11121
11122 </FONT>
11123 above.  This option is enabled by default.
11124 <DT><B>restricted_shell</B>
11125
11126 <DD>
11127 The shell sets this option if it is started in restricted mode (see
11128 <FONT SIZE=-1><B>RESTRICTED SHELL</B>
11129
11130 </FONT>
11131 below).
11132 The value may not be changed.
11133 This is not reset when the startup files are executed, allowing
11134 the startup files to discover whether or not a shell is restricted.
11135 <DT><B>shift_verbose</B>
11136
11137 <DD>
11138 If set, the
11139 <B>shift</B>
11140
11141 builtin prints an error message when the shift count exceeds the
11142 number of positional parameters.
11143 <DT><B>sourcepath</B>
11144
11145 <DD>
11146 If set, the
11147 <B>source</B> (<B>.</B>) builtin uses the value of
11148 <FONT SIZE=-1><B>PATH</B>
11149
11150 </FONT>
11151 to find the directory containing the file supplied as an argument.
11152 This option is enabled by default.
11153 <DT><B>xpg_echo</B>
11154
11155 <DD>
11156 If set, the <B>echo</B> builtin expands backslash-escape sequences
11157 by default.
11158 </DL></DL>
11159
11160 <DT><B>suspend</B> [<B>-f</B>]<DD>
11161 Suspend the execution of this shell until it receives a
11162 <FONT SIZE=-1><B>SIGCONT</B>
11163
11164 </FONT>
11165 signal.  A login shell cannot be suspended; the
11166 <B>-f</B>
11167
11168 option can be used to override this and force the suspension.
11169 The return status is 0 unless the shell is a login shell and
11170 <B>-f</B>
11171
11172 is not supplied, or if job control is not enabled.
11173 <DT><B>test</B> <I>expr</I><DD>
11174
11175 <DT><B>[</B> <I>expr</I> <B>]</B><DD>
11176 Return a status of 0 or 1 depending on
11177 the evaluation of the conditional expression
11178 <I>expr</I>.
11179
11180 Each operator and operand must be a separate argument.
11181 Expressions are composed of the primaries described above under
11182 <FONT SIZE=-1><B>CONDITIONAL EXPRESSIONS</B>.
11183
11184 </FONT>
11185 <B>test</B> does not accept any options, nor does it accept and ignore
11186 an argument of <B>--</B> as signifying the end of options.
11187 <P>
11188
11189
11190 Expressions may be combined using the following operators, listed
11191 in decreasing order of precedence.
11192 The evaluation depends on the number of arguments; see below.
11193 <DL COMPACT><DT><DD>
11194
11195 <DL COMPACT>
11196 <DT><B>! </B><I>expr</I>
11197
11198 <DD>
11199 True if
11200 <I>expr</I>
11201
11202 is false.
11203 <DT><B>( </B><I>expr</I> )
11204
11205 <DD>
11206 Returns the value of <I>expr</I>.
11207 This may be used to override the normal precedence of operators.
11208 <DT><I>expr1</I> -<B>a</B> <I>expr2</I><DD>
11209 True if both
11210 <I>expr1</I>
11211
11212 and
11213 <I>expr2</I>
11214
11215 are true.
11216 <DT><I>expr1</I> -<B>o</B> <I>expr2</I><DD>
11217 True if either
11218 <I>expr1</I>
11219
11220 or
11221 <I>expr2</I>
11222
11223 is true.
11224
11225 </DL>
11226 <P>
11227
11228 <B>test</B> and <B>[</B> evaluate conditional
11229 expressions using a set of rules based on the number of arguments.
11230 <P>
11231
11232
11233
11234 <DL COMPACT>
11235 <DT>0 arguments<DD>
11236 The expression is false.
11237 <DT>1 argument<DD>
11238 The expression is true if and only if the argument is not null.
11239 <DT>2 arguments<DD>
11240 If the first argument is <B>!</B>, the expression is true if and
11241 only if the second argument is null.
11242 If the first argument is one of the unary conditional operators listed above
11243 under
11244 <FONT SIZE=-1><B>CONDITIONAL EXPRESSIONS</B>,
11245
11246 </FONT>
11247 the expression is true if the unary test is true.
11248 If the first argument is not a valid unary conditional operator, the expression
11249 is false.
11250 <DT>3 arguments<DD>
11251 If the second argument is one of the binary conditional operators listed above
11252 under
11253 <FONT SIZE=-1><B>CONDITIONAL EXPRESSIONS</B>,
11254
11255 </FONT>
11256 the result of the expression is the result of the binary test using
11257 the first and third arguments as operands.
11258 The <B>-a</B> and <B>-o</B> operators are considered binary operators
11259 when there are three arguments.  
11260 If the first argument is <B>!</B>, the value is the negation of
11261 the two-argument test using the second and third arguments.
11262 If the first argument is exactly <B>(</B> and the third argument is
11263 exactly <B>)</B>, the result is the one-argument test of the second
11264 argument.
11265 Otherwise, the expression is false.
11266 <DT>4 arguments<DD>
11267 If the first argument is <B>!</B>, the result is the negation of
11268 the three-argument expression composed of the remaining arguments.
11269 Otherwise, the expression is parsed and evaluated according to 
11270 precedence using the rules listed above.
11271 <DT>5 or more arguments<DD>
11272 The expression is parsed and evaluated according to precedence
11273 using the rules listed above.
11274 </DL></DL>
11275
11276
11277 <DT><B>times</B>
11278
11279 <DD>
11280 Print the accumulated user and system times for the shell and
11281 for processes run from the shell.  The return status is 0.
11282 <DT><B>trap</B> [<B>-lp</B>] [[<I>arg</I>] <I>sigspec</I> ...]<DD>
11283 The command
11284 <I>arg</I>
11285
11286 is to be read and executed when the shell receives
11287 signal(s)
11288 <I>sigspec</I>.
11289
11290 If
11291 <I>arg</I>
11292
11293 is absent (and there is a single <I>sigspec</I>) or
11294 <B>-</B>,
11295
11296 each specified signal is
11297 reset to its original disposition (the value it had
11298 upon entrance to the shell).
11299 If 
11300 <I>arg</I>
11301
11302 is the null string the signal specified by each
11303 <I>sigspec</I>
11304
11305 is ignored by the shell and by the commands it invokes.
11306 If
11307 <I>arg</I>
11308
11309 is not present and
11310 <B>-p</B>
11311
11312 has been supplied, then the trap commands associated with each
11313 <I>sigspec</I>
11314
11315 are displayed.
11316 If no arguments are supplied or if only
11317 <B>-p</B>
11318
11319 is given,
11320 <B>trap</B>
11321
11322 prints the list of commands associated with each signal.
11323 The
11324 <B>-l</B>
11325
11326 option causes the shell to print a list of signal names and
11327 their corresponding numbers.
11328 Each
11329 <I>sigspec</I>
11330
11331 is either
11332 a signal name defined in &lt;<I>signal.h</I>&gt;, or a signal number.
11333 Signal names are case insensitive and the SIG prefix is optional.
11334 If a
11335 <I>sigspec</I>
11336
11337 is
11338 <FONT SIZE=-1><B>EXIT</B>
11339
11340 </FONT>
11341 (0) the command
11342 <I>arg</I>
11343
11344 is executed on exit from the shell.
11345 If a
11346 <I>sigspec</I>
11347
11348 is
11349 <FONT SIZE=-1><B>DEBUG</B>,
11350
11351 </FONT>
11352 the command
11353 <I>arg</I>
11354
11355 is executed before every <I>simple command</I>, <I>for</I> command,
11356 <I>case</I> command, <I>select</I> command, every arithmetic <I>for</I>
11357 command, and before the first command executes in a shell function (see
11358 <FONT SIZE=-1><B>SHELL GRAMMAR</B>
11359
11360 </FONT>
11361 above).
11362 Refer to the description of the <B>extdebug</B> option to the
11363 <B>shopt</B> builtin for details of its effect on the <B>DEBUG</B> trap.
11364 If a
11365 <I>sigspec</I>
11366
11367 is
11368 <FONT SIZE=-1><B>ERR</B>,
11369
11370 </FONT>
11371 the command
11372 <I>arg</I>
11373
11374 is executed whenever a simple command has a non-zero exit status,
11375 subject to the following conditions.
11376 The
11377 <FONT SIZE=-1><B>ERR</B>
11378
11379 </FONT>
11380 trap is not executed if the failed
11381 command is part of the command list immediately following a
11382 <B>while</B>
11383
11384 or
11385 <B>until</B>
11386
11387 keyword, 
11388 part of the test in an
11389 <I>if</I>
11390
11391 statement, part of a command executed in a
11392 <B>&amp;&amp;</B>
11393
11394 or
11395 <B>||</B>
11396
11397 list, or if the command's return value is
11398 being inverted via
11399 <B>!</B>.
11400
11401 These are the same conditions obeyed by the <B>errexit</B> option.
11402 If a
11403 <I>sigspec</I>
11404
11405 is
11406 <FONT SIZE=-1><B>RETURN</B>,
11407
11408 </FONT>
11409 the command
11410 <I>arg</I>
11411
11412 is executed each time a shell function or a script executed with the
11413 <B>.</B> or <B>source</B> builtins finishes executing.
11414 Signals ignored upon entry to the shell cannot be trapped or reset.
11415 Trapped signals that are not being ignored are reset to their original
11416 values in a child process when it is created.
11417 The return status is false if any
11418 <I>sigspec</I>
11419
11420 is invalid; otherwise
11421 <B>trap</B>
11422
11423 returns true.
11424 <DT><B>type</B> [<B>-aftpP</B>] <I>name</I> [<I>name</I> ...]<DD>
11425 With no options, 
11426 indicate how each
11427 <I>name</I>
11428
11429 would be interpreted if used as a command name.
11430 If the
11431 <B>-t</B>
11432
11433 option is used,
11434 <B>type</B>
11435
11436 prints a string which is one of
11437 <I>alias</I>,
11438
11439 <I>keyword</I>,
11440
11441 <I>function</I>,
11442
11443 <I>builtin</I>,
11444
11445 or
11446 <I>file </I>
11447
11448 if
11449 <I>name</I>
11450
11451 is an alias, shell reserved word, function, builtin, or disk file,
11452 respectively.
11453 If the
11454 <I>name</I>
11455
11456 is not found, then nothing is printed, and an exit status of false
11457 is returned.
11458 If the
11459 <B>-p</B>
11460
11461 option is used,
11462 <B>type</B>
11463
11464 either returns the name of the disk file
11465 that would be executed if
11466 <I>name</I>
11467
11468 were specified as a command name,
11469 or nothing if
11470 <TT>type -t name</TT>
11471
11472 would not return
11473 <I>file</I>.
11474
11475 The
11476 <B>-P</B>
11477
11478 option forces a
11479 <FONT SIZE=-1><B>PATH</B>
11480
11481 </FONT>
11482 search for each <I>name</I>, even if
11483 <TT>type -t name</TT>
11484
11485 would not return
11486 <I>file</I>.
11487
11488 If a command is hashed,
11489 <B>-p</B>
11490
11491 and
11492 <B>-P</B>
11493
11494 print the hashed value, not necessarily the file that appears
11495 first in 
11496 <FONT SIZE=-1><B>PATH</B>.
11497
11498 </FONT>
11499 If the
11500 <B>-a</B>
11501
11502 option is used, 
11503 <B>type</B>
11504
11505 prints all of the places that contain
11506 an executable named 
11507 <I>name</I>.
11508
11509 This includes aliases and functions,
11510 if and only if the 
11511 <B>-p</B>
11512
11513 option is not also used.
11514 The table of hashed commands is not consulted
11515 when using
11516 <B>-a</B>.
11517
11518 The
11519 <B>-f</B>
11520
11521 option suppresses shell function lookup, as with the <B>command</B> builtin.
11522 <B>type</B>
11523
11524 returns true if all of the arguments are found, false if
11525 any are not found.
11526 <DT><B>ulimit</B> [<B>-HSTabcdefilmnpqrstuvx</B> [<I>limit</I>]]<DD>
11527 Provides control over the resources available to the shell and to
11528 processes started by it, on systems that allow such control.
11529 The <B>-H</B> and <B>-S</B> options specify that the hard or soft limit is
11530 set for the given resource.
11531 A hard limit cannot be increased by a non-root user once it is set;
11532 a soft limit may be increased up to the value of the hard limit.
11533 If neither <B>-H</B> nor <B>-S</B> is specified, both the soft and hard
11534 limits are set.
11535 The value of
11536 <I>limit</I>
11537
11538 can be a number in the unit specified for the resource
11539 or one of the special values
11540 <B>hard</B>,
11541
11542 <B>soft</B>,
11543
11544 or
11545 <B>unlimited</B>,
11546
11547 which stand for the current hard limit, the current soft limit, and
11548 no limit, respectively.
11549 If
11550 <I>limit</I>
11551
11552 is omitted, the current value of the soft limit of the resource is
11553 printed, unless the <B>-H</B> option is given.  When more than one
11554 resource is specified, the limit name and unit are printed before the value.
11555 Other options are interpreted as follows:
11556 <DL COMPACT><DT><DD>
11557
11558 <DL COMPACT>
11559 <DT><B>-a</B>
11560
11561 <DD>
11562 All current limits are reported
11563 <DT><B>-b</B>
11564
11565 <DD>
11566 The maximum socket buffer size
11567 <DT><B>-c</B>
11568
11569 <DD>
11570 The maximum size of core files created
11571 <DT><B>-d</B>
11572
11573 <DD>
11574 The maximum size of a process's data segment
11575 <DT><B>-e</B>
11576
11577 <DD>
11578 The maximum scheduling priority (&quot;nice&quot;)
11579 <DT><B>-f</B>
11580
11581 <DD>
11582 The maximum size of files written by the shell and its children
11583 <DT><B>-i</B>
11584
11585 <DD>
11586 The maximum number of pending signals
11587 <DT><B>-l</B>
11588
11589 <DD>
11590 The maximum size that may be locked into memory
11591 <DT><B>-m</B>
11592
11593 <DD>
11594 The maximum resident set size
11595 <DT><B>-n</B>
11596
11597 <DD>
11598 The maximum number of open file descriptors (most systems do not
11599 allow this value to be set)
11600 <DT><B>-p</B>
11601
11602 <DD>
11603 The pipe size in 512-byte blocks (this may not be set)
11604 <DT><B>-q</B>
11605
11606 <DD>
11607 The maximum number of bytes in POSIX message queues
11608 <DT><B>-r</B>
11609
11610 <DD>
11611 The maximum real-time scheduling priority
11612 <DT><B>-s</B>
11613
11614 <DD>
11615 The maximum stack size
11616 <DT><B>-t</B>
11617
11618 <DD>
11619 The maximum amount of cpu time in seconds
11620 <DT><B>-u</B>
11621
11622 <DD>
11623 The maximum number of processes available to a single user
11624 <DT><B>-v</B>
11625
11626 <DD>
11627 The maximum amount of virtual memory available to the shell
11628 <DT><B>-x</B>
11629
11630 <DD>
11631 The maximum number of file locks
11632 <DT><B>-T</B>
11633
11634 <DD>
11635 The maximum number of threads
11636
11637 </DL>
11638 <P>
11639
11640 If
11641 <I>limit</I>
11642
11643 is given, it is the new value of the specified resource (the
11644 <B>-a</B>
11645
11646 option is display only).
11647 If no option is given, then
11648 <B>-f</B>
11649
11650 is assumed.  Values are in 1024-byte increments, except for
11651 <B>-t</B>,
11652
11653 which is in seconds,
11654 <B>-p</B>,
11655
11656 which is in units of 512-byte blocks,
11657 and
11658 <B>-T</B>,
11659
11660 <B>-b</B>,
11661
11662 <B>-n</B>,
11663
11664 and
11665 <B>-u</B>,
11666
11667 which are unscaled values.
11668 The return status is 0 unless an invalid option or argument is supplied,
11669 or an error occurs while setting a new limit.
11670 </DL>
11671
11672 <DT><B>umask</B> [<B>-p</B>] [<B>-S</B>] [<I>mode</I>]<DD>
11673 The user file-creation mask is set to 
11674 <I>mode</I>.
11675
11676 If
11677 <I>mode</I>
11678
11679 begins with a digit, it
11680 is interpreted as an octal number; otherwise
11681 it is interpreted as a symbolic mode mask similar
11682 to that accepted by
11683 <I>chmod</I>(1).
11684
11685 If
11686 <I>mode</I>
11687
11688 is omitted, the current value of the mask is printed.
11689 The
11690 <B>-S</B>
11691
11692 option causes the mask to be printed in symbolic form; the
11693 default output is an octal number.
11694 If the
11695 <B>-p</B>
11696
11697 option is supplied, and
11698 <I>mode</I>
11699
11700 is omitted, the output is in a form that may be reused as input.
11701 The return status is 0 if the mode was successfully changed or if
11702 no <I>mode</I> argument was supplied, and false otherwise.
11703 <DT><B>unalias</B> [-<B>a</B>] [<I>name</I> ...]<DD>
11704 Remove each <I>name</I> from the list of defined aliases.  If
11705 <B>-a</B>
11706
11707 is supplied, all alias definitions are removed.  The return
11708 value is true unless a supplied
11709 <I>name</I>
11710
11711 is not a defined alias.
11712 <DT><B>unset</B> [-<B>fv</B>] [<I>name</I> ...]<DD>
11713 For each
11714 <I>name</I>,
11715
11716 remove the corresponding variable or function.
11717 If no options are supplied, or the
11718 <B>-v</B>
11719
11720 option is given, each
11721 <I>name</I>
11722
11723 refers to a shell variable.
11724 Read-only variables may not be unset.
11725 If
11726 <B>-f</B>
11727
11728 is specified, each
11729 <I>name</I>
11730
11731 refers to a shell function, and the function definition
11732 is removed.
11733 Each unset variable or function is removed from the environment
11734 passed to subsequent commands.
11735 If any of
11736 <FONT SIZE=-1><B>RANDOM</B>,
11737
11738 </FONT>
11739 <FONT SIZE=-1><B>SECONDS</B>,
11740
11741 </FONT>
11742 <FONT SIZE=-1><B>LINENO</B>,
11743
11744 </FONT>
11745 <FONT SIZE=-1><B>HISTCMD</B>,
11746
11747 </FONT>
11748 <FONT SIZE=-1><B>FUNCNAME</B>,
11749
11750 </FONT>
11751 <FONT SIZE=-1><B>GROUPS</B>,
11752
11753 </FONT>
11754 or
11755 <FONT SIZE=-1><B>DIRSTACK</B>
11756
11757 </FONT>
11758 are unset, they lose their special properties, even if they are
11759 subsequently reset.  The exit status is true unless a
11760 <I>name</I>
11761
11762 is readonly.
11763 <DT><B>wait</B> [<I>n ...</I>]<DD>
11764 Wait for each specified process and return its termination status.
11765 Each
11766 <I>n</I>
11767
11768 may be a process
11769 ID or a job specification; if a job spec is given, all processes
11770 in that job's pipeline are waited for.  If
11771 <I>n</I>
11772
11773 is not given, all currently active child processes
11774 are waited for, and the return status is zero.  If
11775 <I>n</I>
11776
11777 specifies a non-existent process or job, the return status is
11778 127.  Otherwise, the return status is the exit status of the last
11779 process or job waited for.
11780
11781
11782 </DL>
11783 <A NAME="lbDC">&nbsp;</A>
11784 <H3>RESTRICTED SHELL</H3>
11785
11786
11787
11788 <P>
11789
11790 If
11791 <B>bash</B>
11792
11793 is started with the name
11794 <B>rbash</B>,
11795
11796 or the
11797 <B>-r</B>
11798
11799 option is supplied at invocation,
11800 the shell becomes restricted.
11801 A restricted shell is used to
11802 set up an environment more controlled than the standard shell.
11803 It behaves identically to
11804 <B>bash</B>
11805
11806 with the exception that the following are disallowed or not performed:
11807 <DL COMPACT>
11808 <DT>*<DD>
11809 changing directories with <B>cd</B>
11810 <DT>*<DD>
11811 setting or unsetting the values of
11812 <B>SHELL</B>,
11813
11814 <B>PATH</B>,
11815
11816 <B>ENV</B>,
11817
11818 or
11819 <B>BASH_ENV</B>
11820
11821 <DT>*<DD>
11822 specifying command names containing
11823 <B>/</B>
11824
11825 <DT>*<DD>
11826 specifying a file name containing a
11827 <B>/</B>
11828
11829 as an argument to the
11830 <B>.</B>
11831
11832 builtin command
11833 <DT>*<DD>
11834 Specifying a filename containing a slash as an argument to the
11835 <B>-p</B>
11836
11837 option to the
11838 <B>hash</B>
11839
11840 builtin command
11841 <DT>*<DD>
11842 importing function definitions from the shell environment at startup
11843 <DT>*<DD>
11844 parsing the value of <B>SHELLOPTS</B> from the shell environment at startup
11845 <DT>*<DD>
11846 redirecting output using the &gt;, &gt;|, &lt;&gt;, &gt;&amp;, &amp;&gt;, and &gt;&gt; redirection operators
11847 <DT>*<DD>
11848 using the
11849 <B>exec</B>
11850
11851 builtin command to replace the shell with another command
11852 <DT>*<DD>
11853 adding or deleting builtin commands with the
11854 <B>-f</B>
11855
11856 and
11857 <B>-d</B>
11858
11859 options to the
11860 <B>enable</B>
11861
11862 builtin command
11863 <DT>*<DD>
11864 Using the <B>enable</B> builtin command to enable disabled shell builtins
11865 <DT>*<DD>
11866 specifying the
11867 <B>-p</B>
11868
11869 option to the
11870 <B>command</B>
11871
11872 builtin command
11873 <DT>*<DD>
11874 turning off restricted mode with
11875 <B>set +r</B> or <B>set +o restricted</B>.
11876 </DL>
11877 <P>
11878
11879 These restrictions are enforced after any startup files are read.
11880 <P>
11881
11882
11883  When a command that is found to be a shell script is executed
11884 (see
11885 <FONT SIZE=-1><B>COMMAND EXECUTION</B>
11886
11887 </FONT>
11888
11889 above),
11890
11891 <B>rbash</B>
11892
11893 turns off any restrictions in the shell spawned to execute the
11894 script.
11895
11896
11897 <A NAME="lbDD">&nbsp;</A>
11898 <H3>SEE ALSO</H3>
11899
11900
11901 <DL COMPACT>
11902 <DT><I>Bash Reference Manual</I>, Brian Fox and Chet Ramey<DD>
11903 <DT><I>The Gnu Readline Library</I>, Brian Fox and Chet Ramey<DD>
11904 <DT><I>The Gnu History Library</I>, Brian Fox and Chet Ramey<DD>
11905 <DT><I>Portable Operating System Interface (POSIX) Part 2: Shell and Utilities</I>, IEEE<DD>
11906 <DT><I>sh</I>(1), <I>ksh</I>(1), <I>csh</I>(1)<DD>
11907 <DT><I>emacs</I>(1), <I>vi</I>(1)<DD>
11908 <DT><I>readline</I>(3)<DD>
11909
11910 </DL>
11911 <A NAME="lbDE">&nbsp;</A>
11912 <H3>FILES</H3>
11913
11914
11915 <DL COMPACT>
11916 <DT>
11917 <A HREF="file:/bin/bash"><I>/bin/bash</I></A>
11918
11919 <DD>
11920 The <B>bash</B> executable
11921 <DT>
11922 <A HREF="file:/etc/profile"><I>/etc/profile</I></A>
11923
11924 <DD>
11925 The systemwide initialization file, executed for login shells
11926 <DT>
11927 <A HREF="file:~/.bash_profile"><I>~/.bash_profile</I></A>
11928
11929 <DD>
11930 The personal initialization file, executed for login shells
11931 <DT>
11932 <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>
11933
11934 <DD>
11935 The individual per-interactive-shell startup file
11936 <DT>
11937 <A HREF="file:~/.bash_logout"><I>~/.bash_logout</I></A>
11938
11939 <DD>
11940 The individual login shell cleanup file, executed when a login shell exits
11941 <DT>
11942 <A HREF="file:~/.inputrc"><I>~/.inputrc</I></A>
11943
11944 <DD>
11945 Individual <I>readline</I> initialization file
11946
11947 </DL>
11948 <A NAME="lbDF">&nbsp;</A>
11949 <H3>AUTHORS</H3>
11950
11951 Brian Fox, Free Software Foundation
11952 <BR>
11953
11954 <A HREF="mailto:bfox@gnu.org">bfox@gnu.org</A>
11955 <P>
11956
11957 Chet Ramey, Case Western Reserve University
11958 <BR>
11959
11960 <A HREF="mailto:chet@po.cwru.edu">chet@po.cwru.edu</A>
11961 <A NAME="lbDG">&nbsp;</A>
11962 <H3>BUG REPORTS</H3>
11963
11964 If you find a bug in
11965 <B>bash,</B>
11966
11967 you should report it.  But first, you should
11968 make sure that it really is a bug, and that it appears in the latest
11969 version of
11970 <B>bash</B>.
11971
11972 The latest version is always available from
11973 <I><A HREF="ftp://ftp.gnu.org/pub/bash/">ftp://ftp.gnu.org/pub/bash/</A></I>.
11974 <P>
11975
11976 Once you have determined that a bug actually exists, use the
11977 <I>bashbug</I>
11978
11979 command to submit a bug report.
11980 If you have a fix, you are encouraged to mail that as well!
11981 Suggestions and `philosophical' bug reports may be mailed
11982 to <I><A HREF="mailto:bug-bash@gnu.org">bug-bash@gnu.org</A></I> or posted to the Usenet
11983 newsgroup
11984 <A HREF="news:gnu.bash.bug">gnu.bash.bug</A>.
11985
11986 <P>
11987
11988 ALL bug reports should include:
11989 <P>
11990
11991
11992 <DL COMPACT>
11993 <DT>The version number of <B>bash</B><DD>
11994 <DT>The hardware and operating system<DD>
11995 <DT>The compiler used to compile<DD>
11996 <DT>A description of the bug behaviour<DD>
11997 <DT>A short script or `recipe' which exercises the bug<DD>
11998
11999 </DL>
12000 <P>
12001
12002 <I>bashbug</I>
12003
12004 inserts the first three items automatically into the template
12005 it provides for filing a bug report.
12006 <P>
12007
12008 Comments and bug reports concerning
12009 this manual page should be directed to
12010 <I><A HREF="mailto:chet@po.cwru.edu">chet@po.cwru.edu</A></I>.
12011
12012 <A NAME="lbDH">&nbsp;</A>
12013 <H3>BUGS</H3>
12014
12015 <P>
12016
12017 It's too big and too slow.
12018 <P>
12019
12020 There are some subtle differences between 
12021 <B>bash</B>
12022
12023 and traditional versions of
12024 <B>sh</B>,
12025
12026 mostly because of the
12027 <FONT SIZE=-1><B>POSIX</B>
12028
12029 </FONT>
12030 specification.
12031 <P>
12032
12033 Aliases are confusing in some uses.
12034 <P>
12035
12036 Shell builtin commands and functions are not stoppable/restartable.
12037 <P>
12038
12039 Compound commands and command sequences of the form `a ; b ; c'
12040 are not handled gracefully when process suspension is attempted.
12041 When a process is stopped, the shell immediately executes the next
12042 command in the sequence.
12043 It suffices to place the sequence of commands between
12044 parentheses to force it into a subshell, which may be stopped as
12045 a unit.
12046 <P>
12047
12048 Array variables may not (yet) be exported.
12049 <P>
12050
12051 There may be only one active coprocess at a time.
12052
12053
12054
12055 <HR>
12056 <TABLE WIDTH=100%>
12057 <TR>
12058 <TH ALIGN=LEFT width=33%>GNU Bash-4.0<TH ALIGN=CENTER width=33%>2008 December 29<TH ALIGN=RIGHT width=33%>BASH(1)
12059 </TR>
12060 </TABLE>
12061 <HR>
12062 <A NAME="index">&nbsp;</A><H2>Index</H2>
12063 <DL>
12064 <DT><A HREF="#lbAB">NAME</A><DD>
12065 <DT><A HREF="#lbAC">SYNOPSIS</A><DD>
12066 <DT><A HREF="#lbAD">COPYRIGHT</A><DD>
12067 <DT><A HREF="#lbAE">DESCRIPTION</A><DD>
12068 <DT><A HREF="#lbAF">OPTIONS</A><DD>
12069 <DT><A HREF="#lbAG">ARGUMENTS</A><DD>
12070 <DT><A HREF="#lbAH">INVOCATION</A><DD>
12071 <DT><A HREF="#lbAI">DEFINITIONS</A><DD>
12072 <DT><A HREF="#lbAJ">RESERVED WORDS</A><DD>
12073 <DT><A HREF="#lbAK">SHELL GRAMMAR</A><DD>
12074 <DL>
12075 <DT><A HREF="#lbAL">Simple Commands</A><DD>
12076 <DT><A HREF="#lbAM">Pipelines</A><DD>
12077 <DT><A HREF="#lbAN">Lists</A><DD>
12078 <DT><A HREF="#lbAO">Compound Commands</A><DD>
12079 <DT><A HREF="#lbAP">Coprocesses</A><DD>
12080 <DT><A HREF="#lbAQ">Shell Function Definitions</A><DD>
12081 </DL>
12082 <DT><A HREF="#lbAR">COMMENTS</A><DD>
12083 <DT><A HREF="#lbAS">QUOTING</A><DD>
12084 <DT><A HREF="#lbAT">PARAMETERS</A><DD>
12085 <DL>
12086 <DT><A HREF="#lbAU">Positional Parameters</A><DD>
12087 <DT><A HREF="#lbAV">Special Parameters</A><DD>
12088 <DT><A HREF="#lbAW">Shell Variables</A><DD>
12089 <DT><A HREF="#lbAX">Arrays</A><DD>
12090 </DL>
12091 <DT><A HREF="#lbAY">EXPANSION</A><DD>
12092 <DL>
12093 <DT><A HREF="#lbAZ">Brace Expansion</A><DD>
12094 <DT><A HREF="#lbBA">Tilde Expansion</A><DD>
12095 <DT><A HREF="#lbBB">Parameter Expansion</A><DD>
12096 <DT><A HREF="#lbBC">Command Substitution</A><DD>
12097 <DT><A HREF="#lbBD">Arithmetic Expansion</A><DD>
12098 <DT><A HREF="#lbBE">Process Substitution</A><DD>
12099 <DT><A HREF="#lbBF">Word Splitting</A><DD>
12100 <DT><A HREF="#lbBG">Pathname Expansion</A><DD>
12101 <DT><A HREF="#lbBH">Quote Removal</A><DD>
12102 </DL>
12103 <DT><A HREF="#lbBI">REDIRECTION</A><DD>
12104 <DL>
12105 <DT><A HREF="#lbBJ">Redirecting Input</A><DD>
12106 <DT><A HREF="#lbBK">Redirecting Output</A><DD>
12107 <DT><A HREF="#lbBL">Appending Redirected Output</A><DD>
12108 <DT><A HREF="#lbBM">Redirecting Standard Output and Standard Error</A><DD>
12109 <DT><A HREF="#lbBN">Appending Standard Output and Standard Error</A><DD>
12110 <DT><A HREF="#lbBO">Here Documents</A><DD>
12111 <DT><A HREF="#lbBP">Here Strings</A><DD>
12112 <DT><A HREF="#lbBQ">Duplicating File Descriptors</A><DD>
12113 <DT><A HREF="#lbBR">Moving File Descriptors</A><DD>
12114 <DT><A HREF="#lbBS">Opening File Descriptors for Reading and Writing</A><DD>
12115 </DL>
12116 <DT><A HREF="#lbBT">ALIASES</A><DD>
12117 <DT><A HREF="#lbBU">FUNCTIONS</A><DD>
12118 <DT><A HREF="#lbBV">ARITHMETIC EVALUATION</A><DD>
12119 <DT><A HREF="#lbBW">CONDITIONAL EXPRESSIONS</A><DD>
12120 <DT><A HREF="#lbBX">SIMPLE COMMAND EXPANSION</A><DD>
12121 <DT><A HREF="#lbBY">COMMAND EXECUTION</A><DD>
12122 <DT><A HREF="#lbBZ">COMMAND EXECUTION ENVIRONMENT</A><DD>
12123 <DT><A HREF="#lbCA">ENVIRONMENT</A><DD>
12124 <DT><A HREF="#lbCB">EXIT STATUS</A><DD>
12125 <DT><A HREF="#lbCC">SIGNALS</A><DD>
12126 <DT><A HREF="#lbCD">JOB CONTROL</A><DD>
12127 <DT><A HREF="#lbCE">PROMPTING</A><DD>
12128 <DT><A HREF="#lbCF">READLINE</A><DD>
12129 <DL>
12130 <DT><A HREF="#lbCG">Readline Notation</A><DD>
12131 <DT><A HREF="#lbCH">Readline Initialization</A><DD>
12132 <DT><A HREF="#lbCI">Readline Key Bindings</A><DD>
12133 <DT><A HREF="#lbCJ">Readline Variables</A><DD>
12134 <DT><A HREF="#lbCK">Readline Conditional Constructs</A><DD>
12135 <DT><A HREF="#lbCL">Searching</A><DD>
12136 <DT><A HREF="#lbCM">Readline Command Names</A><DD>
12137 <DT><A HREF="#lbCN">Commands for Moving</A><DD>
12138 <DT><A HREF="#lbCO">Commands for Manipulating the History</A><DD>
12139 <DT><A HREF="#lbCP">Commands for Changing Text</A><DD>
12140 <DT><A HREF="#lbCQ">Killing and Yanking</A><DD>
12141 <DT><A HREF="#lbCR">Numeric Arguments</A><DD>
12142 <DT><A HREF="#lbCS">Completing</A><DD>
12143 <DT><A HREF="#lbCT">Keyboard Macros</A><DD>
12144 <DT><A HREF="#lbCU">Miscellaneous</A><DD>
12145 <DT><A HREF="#lbCV">Programmable Completion</A><DD>
12146 </DL>
12147 <DT><A HREF="#lbCW">HISTORY</A><DD>
12148 <DT><A HREF="#lbCX">HISTORY EXPANSION</A><DD>
12149 <DL>
12150 <DT><A HREF="#lbCY">Event Designators</A><DD>
12151 <DT><A HREF="#lbCZ">Word Designators</A><DD>
12152 <DT><A HREF="#lbDA">Modifiers</A><DD>
12153 </DL>
12154 <DT><A HREF="#lbDB">SHELL BUILTIN COMMANDS</A><DD>
12155 <DT><A HREF="#lbDC">RESTRICTED SHELL</A><DD>
12156 <DT><A HREF="#lbDD">SEE ALSO</A><DD>
12157 <DT><A HREF="#lbDE">FILES</A><DD>
12158 <DT><A HREF="#lbDF">AUTHORS</A><DD>
12159 <DT><A HREF="#lbDG">BUG REPORTS</A><DD>
12160 <DT><A HREF="#lbDH">BUGS</A><DD>
12161 </DL>
12162 <HR>
12163 This document was created by man2html from bash.1.<BR>
12164 Time: 05 February 2009 08:05:34 EST
12165 </BODY>
12166 </HTML>