2aa2825744628dcad9106beff2f0f4f6b10a4f3d
[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%>2009 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 <FONT SIZE=-1><B>BASHOPTS</B>,
562
563 </FONT>
564 <FONT SIZE=-1><B>CDPATH</B>,
565
566 </FONT>
567 and
568 <FONT SIZE=-1><B>GLOBIGNORE</B>
569
570 </FONT>
571 variables, if they appear in the environment, are ignored,
572 and the effective user id is set to the real user id.
573 If the <B>-p</B> option is supplied at invocation, the startup behavior is
574 the same, but the effective user id is not reset.
575 <A NAME="lbAI">&nbsp;</A>
576 <H3>DEFINITIONS</H3>
577
578 <P>
579
580 The following definitions are used throughout the rest of this
581 document.
582
583 <DL COMPACT>
584 <DT><B>blank </B>
585
586 <DD>
587 A space or tab.
588 <DT><B>word</B>
589
590 <DD>
591 A sequence of characters considered as a single unit by the shell.
592 Also known as a
593 <B>token</B>.
594
595 <DT><B>name</B>
596
597 <DD>
598
599 <I>word</I>
600
601 consisting only of alphanumeric characters and underscores, and
602 beginning with an alphabetic character or an underscore.  Also
603 referred to as an
604 <B>identifier</B>.
605
606 <DT><B>metacharacter</B>
607
608 <DD>
609 A character that, when unquoted, separates words.  One of the following:
610 <BR>
611
612 <DL COMPACT><DT><DD>
613 <P>
614
615 <B>|  &amp;  ;  (  )  &lt;  &gt;  space  tab</B>
616
617 </DL>
618
619 </DL>
620 <P>
621
622 <DL COMPACT>
623 <DT><B>control operator</B>
624
625 <DD>
626 A <I>token</I> that performs a control function.  It is one of the following
627 symbols:
628 <DL COMPACT><DT><DD>
629 <P>
630
631 <B>||  &amp;  &amp;&amp;  ;  ;;  (  )  |  |&amp;    &lt;newline&gt;</B>
632
633 </DL>
634
635
636 </DL>
637 <A NAME="lbAJ">&nbsp;</A>
638 <H3>RESERVED WORDS</H3>
639
640 <I>Reserved words</I> are words that have a special meaning to the shell.
641 The following words are recognized as reserved when unquoted and either
642 the first word of a simple command (see
643 <FONT SIZE=-1><B>SHELL GRAMMAR</B>
644
645 </FONT>
646 below) or the third word of a 
647 <B>case </B>
648
649 or
650 <B>for</B>
651
652 command:
653 <DL COMPACT><DT><DD>
654
655 <P>
656
657 <B>
658 </B>
659
660 !    case    do    done    elif    else    esac    fi    for    function    if    in    select    then    until    while    {    }    time    [[    ]]
661 </DL>
662
663
664 <A NAME="lbAK">&nbsp;</A>
665 <H3>SHELL GRAMMAR</H3>
666
667 <A NAME="lbAL">&nbsp;</A>
668 <H4>Simple Commands</H4>
669
670 <P>
671
672 A <I>simple command</I> is a sequence of optional variable assignments
673 followed by <B>blank</B>-separated words and redirections, and
674 terminated by a <I>control operator</I>.  The first word
675 specifies the command to be executed, and is passed as argument zero.
676 The remaining words are passed as arguments to the invoked command.
677 <P>
678
679 The return value of a <I>simple command</I> is its exit status, or
680 128+<I>n</I> if the command is terminated by signal
681 <I>n</I>.
682
683 <A NAME="lbAM">&nbsp;</A>
684 <H4>Pipelines</H4>
685
686 <P>
687
688 A <I>pipeline</I> is a sequence of one or more commands separated by
689 one of the control operators
690 <B>|</B>
691
692 or <B>|&amp;</B>.
693 The format for a pipeline is:
694 <DL COMPACT><DT><DD>
695 <P>
696
697 [<B>time</B> [<B>-p</B>]] [ ! ] <I>command</I> [ [<B>|</B>|<B>|&amp;</B>] <I>command2</I> ... ]
698 </DL>
699
700 <P>
701
702 The standard output of
703 <I>command</I>
704
705 is connected via a pipe to the standard input of
706 <I>command2</I>.
707
708 This connection is performed before any redirections specified by the
709 command (see
710 <FONT SIZE=-1><B>REDIRECTION</B>
711
712 </FONT>
713 below).
714 If <B>|&amp;</B> is used, the standard error of <I>command</I> is connected to
715 <I>command2</I>'s standard input through the pipe; it is shorthand for
716 <B>2&gt;&amp;1 |</B>.
717 This implicit redirection of the standard error is performed after any
718 redirections specified by the command.
719 <P>
720
721 The return status of a pipeline is the exit status of the last
722 command, unless the <B>pipefail</B> option is enabled.
723 If <B>pipefail</B> is enabled, the pipeline's return status is the
724 value of the last (rightmost) command to exit with a non-zero status,
725 or zero if all commands exit successfully.
726 If the reserved word
727 <B>!</B>
728
729 precedes a pipeline, the exit status of that pipeline is the logical
730 negation of the exit status as described above.
731 The shell waits for all commands in the pipeline to
732 terminate before returning a value.
733 <P>
734
735 If the
736 <B>time</B>
737
738 reserved word precedes a pipeline, the elapsed as well as user and
739 system time consumed by its execution are reported when the pipeline
740 terminates.
741 The <B>-p</B> option changes the output format to that specified by POSIX.
742 The
743 <FONT SIZE=-1><B>TIMEFORMAT</B>
744
745 </FONT>
746 variable may be set to a format string that specifies how the timing
747 information should be displayed; see the description of
748 <FONT SIZE=-1><B>TIMEFORMAT</B>
749
750 </FONT>
751 under
752 <B>Shell Variables</B>
753
754 below.
755 <P>
756
757 Each command in a pipeline is executed as a separate process (i.e., in a
758 subshell).
759 <A NAME="lbAN">&nbsp;</A>
760 <H4>Lists</H4>
761
762 <P>
763
764 A <I>list</I> is a sequence of one or more pipelines separated by one
765 of the operators
766 <B>;</B>,
767
768 <B>&amp;</B>,
769
770 <B>&amp;&amp;</B>,
771
772 or
773 <B>||</B>,
774
775 and optionally terminated by one of
776 <B>;</B>,
777
778 <B>&amp;</B>,
779
780 or
781 <B>&lt;newline&gt;</B>.
782
783 <P>
784
785 Of these list operators,
786 <B>&amp;&amp;</B>
787
788 and
789 <B>||</B>
790
791 have equal precedence, followed by
792 <B>;</B>
793
794 and
795 <B>&amp;</B>,
796
797 which have equal precedence.
798 <P>
799
800 A sequence of one or more newlines may appear in a <I>list</I> instead
801 of a semicolon to delimit commands.
802 <P>
803
804 If a command is terminated by the control operator
805 <B>&amp;</B>,
806
807 the shell executes the command in the <I>background</I>
808 in a subshell.  The shell does not wait for the command to
809 finish, and the return status is 0.  Commands separated by a
810 <B>;</B>
811
812 are executed sequentially; the shell waits for each
813 command to terminate in turn.  The return status is the
814 exit status of the last command executed.
815 <P>
816
817 AND and OR lists are sequences of one of more pipelines separated by the
818 <B>&amp;&amp;</B> and <B>||</B> control operators, respectively.
819 AND and OR lists are executed with left associativity.
820 An AND list has the form
821 <DL COMPACT><DT><DD>
822 <P>
823
824 <I>command1</I> <B>&amp;&amp;</B> <I>command2</I>
825 </DL>
826
827 <P>
828
829 <I>command2</I>
830
831 is executed if, and only if,
832 <I>command1</I>
833
834 returns an exit status of zero.
835 <P>
836
837 An OR list has the form
838 <DL COMPACT><DT><DD>
839 <P>
840
841 <I>command1</I> <B>||</B> <I>command2</I>
842 <P>
843
844 </DL>
845
846 <P>
847
848 <I>command2</I>
849
850 is executed if and only if
851 <I>command1</I>
852
853 returns a non-zero exit status.
854 The return status of
855 AND and OR lists is the exit status of the last command
856 executed in the list.
857 <A NAME="lbAO">&nbsp;</A>
858 <H4>Compound Commands</H4>
859
860 <P>
861
862 A <I>compound command</I> is one of the following:
863 <DL COMPACT>
864 <DT>(<I>list</I>)<DD>
865 <I>list</I> is executed in a subshell environment (see
866 <FONT SIZE=-1><B>COMMAND EXECUTION ENVIRONMENT</B></FONT>
867 below).
868 Variable assignments and builtin
869 commands that affect the shell's environment do not remain in effect
870 after the command completes.  The return status is the exit status of
871 <I>list</I>.
872 <DT>{ <I>list</I>; }<DD>
873 <I>list</I> is simply executed in the current shell environment.
874 <I>list</I> must be terminated with a newline or semicolon.
875 This is known as a <I>group command</I>.
876 The return status is the exit status of
877 <I>list</I>.
878 Note that unlike the metacharacters <B>(</B> and <B>)</B>, <B>{</B> and
879 <B>}</B> are <I>reserved words</I> and must occur where a reserved
880 word is permitted to be recognized.  Since they do not cause a word
881 break, they must be separated from <I>list</I> by whitespace or another
882 shell metacharacter.
883 <DT>((<I>expression</I>))<DD>
884 The <I>expression</I> is evaluated according to the rules described
885 below under
886 <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>.
887
888 </FONT>
889 If the value of the expression is non-zero, the return status is 0;
890 otherwise the return status is 1.  This is exactly equivalent to
891 <B>let &quot;</B><I>expression</I>&quot;.
892 <DT><B>[[</B> <I>expression</I> <B>]]</B><DD>
893 Return a status of 0 or 1 depending on the evaluation of
894 the conditional expression <I>expression</I>.
895 Expressions are composed of the primaries described below under
896 <FONT SIZE=-1><B>CONDITIONAL EXPRESSIONS</B>.
897
898 </FONT>
899 Word splitting and pathname expansion are not performed on the words
900 between the <B>[[</B> and <B>]]</B>; tilde expansion, parameter and
901 variable expansion, arithmetic expansion, command substitution, process
902 substitution, and quote removal are performed.
903 Conditional operators such as <B>-f</B> must be unquoted to be recognized
904 as primaries.
905 <P>
906
907
908 When used with <B>[[</B>, The <B>&lt;</B> and <B>&gt;</B> operators sort
909 lexicographically using the current locale.
910 <P>
911
912
913 When the <B>==</B> and <B>!=</B> operators are used, the string to the
914 right of the operator is considered a pattern and matched according
915 to the rules described below under <B>Pattern Matching</B>.
916 If the shell option
917 <B>nocasematch</B>
918
919 is enabled, the match is performed without regard to the case
920 of alphabetic characters.
921 The return value is 0 if the string matches (<B>==</B>) or does not match
922 (<B>!=</B>) the pattern, and 1 otherwise.
923 Any part of the pattern may be quoted to force it to be matched as a
924 string.
925 <P>
926
927
928 An additional binary operator, <B>=~</B>, is available, with the same
929 precedence as <B>==</B> and <B>!=</B>.
930 When it is used, the string to the right of the operator is considered
931 an extended regular expression and matched accordingly (as in <I>regex</I>(3)).  
932 The return value is 0 if the string matches
933 the pattern, and 1 otherwise.
934 If the regular expression is syntactically incorrect, the conditional
935 expression's return value is 2.
936 If the shell option
937 <B>nocasematch</B>
938
939 is enabled, the match is performed without regard to the case
940 of alphabetic characters.
941 Any part of the pattern may be quoted to force it to be matched as a
942 string.
943 Substrings matched by parenthesized subexpressions within the regular
944 expression are saved in the array variable
945 <FONT SIZE=-1><B>BASH_REMATCH</B>.
946
947 </FONT>
948 The element of
949 <FONT SIZE=-1><B>BASH_REMATCH</B>
950
951 </FONT>
952 with index 0 is the portion of the string
953 matching the entire regular expression.
954 The element of
955 <FONT SIZE=-1><B>BASH_REMATCH</B>
956
957 </FONT>
958 with index <I>n</I> is the portion of the
959 string matching the <I>n</I>th parenthesized subexpression.
960 <P>
961
962
963 Expressions may be combined using the following operators, listed
964 in decreasing order of precedence:
965 <P>
966
967
968 <DL COMPACT><DT><DD>
969
970 <DL COMPACT>
971 <DT><B>( </B><I>expression</I> )
972
973 <DD>
974 Returns the value of <I>expression</I>.
975 This may be used to override the normal precedence of operators.
976 <DT><B>! </B><I>expression</I>
977
978 <DD>
979 True if
980 <I>expression</I>
981
982 is false.
983 <DT><I>expression1</I> <B>&amp;&amp;</B> <I>expression2</I><DD>
984 True if both
985 <I>expression1</I>
986
987 and
988 <I>expression2</I>
989
990 are true.
991 <DT><I>expression1</I> <B>||</B> <I>expression2</I>
992 <DD>
993
994 True if either
995 <I>expression1</I>
996
997 or
998 <I>expression2</I>
999
1000 is true.
1001
1002 </DL>
1003 <P>
1004
1005 The <B>&amp;&amp;</B> and
1006 <B>||</B>
1007
1008 operators do not evaluate <I>expression2</I> if the value of
1009 <I>expression1</I> is sufficient to determine the return value of
1010 the entire conditional expression.
1011 </DL>
1012
1013 <DT><B>for</B> <I>name</I> [ [ <B>in</B> [ <I>word ...</I> ] ] ; ] <B>do</B> <I>list</I> ; <B>done</B><DD>
1014 The list of words following <B>in</B> is expanded, generating a list
1015 of items.
1016 The variable <I>name</I> is set to each element of this list
1017 in turn, and <I>list</I> is executed each time.
1018 If the <B>in</B> <I>word</I> is omitted, the <B>for</B> command executes
1019 <I>list</I> once for each positional parameter that is set (see
1020 <FONT SIZE=-1><B>PARAMETERS</B>
1021
1022 </FONT>
1023 below).
1024 The return status is the exit status of the last command that executes.
1025 If the expansion of the items following <B>in</B> results in an empty
1026 list, no commands are executed, and the return status is 0.
1027 <DT><B>for</B> (( <I>expr1</I> ; <I>expr2</I> ; <I>expr3</I> )) ; <B>do</B> <I>list</I> ; <B>done</B><DD>
1028 First, the arithmetic expression <I>expr1</I> is evaluated according
1029 to the rules described below under
1030 <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>.
1031
1032 </FONT>
1033 The arithmetic expression <I>expr2</I> is then evaluated repeatedly
1034 until it evaluates to zero.
1035 Each time <I>expr2</I> evaluates to a non-zero value, <I>list</I> is
1036 executed and the arithmetic expression <I>expr3</I> is evaluated.
1037 If any expression is omitted, it behaves as if it evaluates to 1.
1038 The return value is the exit status of the last command in <I>list</I>
1039 that is executed, or false if any of the expressions is invalid.
1040 <DT><B>select</B> <I>name</I> [ <B>in</B> <I>word</I> ] ; <B>do</B> <I>list</I> ; <B>done</B><DD>
1041 The list of words following <B>in</B> is expanded, generating a list
1042 of items.  The set of expanded words is printed on the standard
1043 error, each preceded by a number.  If the <B>in</B>
1044 <I>word</I> is omitted, the positional parameters are printed (see
1045 <FONT SIZE=-1><B>PARAMETERS</B>
1046
1047 </FONT>
1048 below).  The
1049 <FONT SIZE=-1><B>PS3</B>
1050
1051 </FONT>
1052 prompt is then displayed and a line read from the standard input.
1053 If the line consists of a number corresponding to one of
1054 the displayed words, then the value of
1055 <I>name</I>
1056
1057 is set to that word.  If the line is empty, the words and prompt
1058 are displayed again.  If EOF is read, the command completes.  Any
1059 other value read causes
1060 <I>name</I>
1061
1062 to be set to null.  The line read is saved in the variable
1063 <FONT SIZE=-1><B>REPLY</B>.
1064
1065 </FONT>
1066 The
1067 <I>list</I>
1068
1069 is executed after each selection until a
1070 <B>break</B>
1071
1072 command is executed.
1073 The exit status of
1074 <B>select</B>
1075
1076 is the exit status of the last command executed in
1077 <I>list</I>,
1078
1079 or zero if no commands were executed.
1080 <DT><B>case</B> <I>word</I> <B>in</B> [ [(] <I>pattern</I> [ <B>|</B> <I>pattern</I> ] 
1081 <DD>
1082 A <B>case</B> command first expands <I>word</I>, and tries to match
1083 it against each <I>pattern</I> in turn, using the same matching rules
1084 as for pathname expansion (see
1085 <B>Pathname Expansion</B>
1086
1087 below).
1088 The <I>word</I> is expanded using tilde
1089 expansion, parameter and variable expansion, arithmetic substitution,
1090 command substitution, process substitution and quote removal.
1091 Each <I>pattern</I> examined is expanded using tilde
1092 expansion, parameter and variable expansion, arithmetic substitution,
1093 command substitution, and process substitution.
1094 If the shell option
1095 <B>nocasematch</B>
1096
1097 is enabled, the match is performed without regard to the case
1098 of alphabetic characters.
1099 When a match is found, the corresponding <I>list</I> is executed.
1100 If the <B>;;</B> operator is used, no subsequent matches are attempted after
1101 the first pattern match.
1102 Using <B>;&amp;</B> in place of <B>;;</B> causes execution to continue with
1103 the <I>list</I> associated with the next set of patterns.
1104 Using <B>;;&amp;</B> in place of <B>;;</B> causes the shell to test the next
1105 pattern list in the statement, if any, and execute any associated <I>list</I>
1106 on a successful match.
1107 The exit status is zero if no
1108 pattern matches.  Otherwise, it is the exit status of the
1109 last command executed in <I>list</I>.
1110 <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>
1111 The
1112 <B>if </B>
1113
1114 <I>list</I>
1115
1116 is executed.  If its exit status is zero, the
1117 <B>then</B> <I>list</I> is executed.  Otherwise, each <B>elif</B>
1118 <I>list</I> is executed in turn, and if its exit status is zero,
1119 the corresponding <B>then</B> <I>list</I> is executed and the
1120 command completes.  Otherwise, the <B>else</B> <I>list</I> is
1121 executed, if present.  The exit status is the exit status of the
1122 last command executed, or zero if no condition tested true.
1123 <DT><B>while</B> <I>list</I>; <B>do</B> <I>list</I>; <B>done</B><DD>
1124
1125 <DT><B>until</B> <I>list</I>; <B>do</B> <I>list</I>; <B>done</B><DD>
1126
1127 The <B>while</B> command continuously executes the <B>do</B>
1128 <I>list</I> as long as the last command in <I>list</I> returns
1129 an exit status of zero.  The <B>until</B> command is identical
1130 to the <B>while</B> command, except that the test is negated;
1131 the
1132 <B>do</B>
1133
1134 <I>list</I>
1135
1136 is executed as long as the last command in
1137 <I>list</I>
1138
1139 returns a non-zero exit status.
1140 The exit status of the <B>while</B> and <B>until</B> commands
1141 is the exit status
1142 of the last <B>do</B> <I>list</I> command executed, or zero if
1143 none was executed.
1144 </DL>
1145 <A NAME="lbAP">&nbsp;</A>
1146 <H4>Coprocesses</H4>
1147
1148 <P>
1149
1150 A <I>coprocess</I> is a shell command preceded by the <B>coproc</B> reserved
1151 word.
1152 A coprocess is executed asynchronously in a subshell, as if the command
1153 had been terminated with the <B>&amp;</B> control operator, with a two-way pipe
1154 established between the executing shell and the coprocess.
1155 <P>
1156
1157 The format for a coprocess is:
1158 <DL COMPACT><DT><DD>
1159 <P>
1160
1161 <B>coproc</B> [<I>NAME</I>] <I>command</I> [<I>redirections</I>]
1162 </DL>
1163
1164 <P>
1165
1166 This creates a coprocess named <I>NAME</I>.
1167 If <I>NAME</I> is not supplied, the default name is <I>COPROC</I>.
1168 <I>NAME</I> must not be supplied if <I>command</I> is a <I>simple
1169 command</I> (see above); otherwise, it is interpreted as the first word
1170 of the simple command.
1171 When the coproc is executed, the shell creates an array variable (see
1172 <B>Arrays</B>
1173
1174 below) named <I>NAME</I> in the context of the executing shell.
1175 The standard output of
1176 <I>command</I>
1177
1178 is connected via a pipe to a file descriptor in the executing shell,
1179 and that file descriptor is assigned to <I>NAME</I>[0].
1180 The standard input of
1181 <I>command</I>
1182
1183 is connected via a pipe to a file descriptor in the executing shell,
1184 and that file descriptor is assigned to <I>NAME</I>[1].
1185 This pipe is established before any redirections specified by the
1186 command (see
1187 <FONT SIZE=-1><B>REDIRECTION</B>
1188
1189 </FONT>
1190 below).
1191 The file descriptors can be utilized as arguments to shell commands
1192 and redirections using standard word expansions.
1193 The process id of the shell spawned to execute the coprocess is
1194 available as the value of the variable <I>NAME</I>_PID.
1195 The <B>wait</B>
1196 builtin command may be used to wait for the coprocess to terminate.
1197 <P>
1198
1199 The return status of a coprocess is the exit status of <I>command</I>.
1200 <A NAME="lbAQ">&nbsp;</A>
1201 <H4>Shell Function Definitions</H4>
1202
1203 <P>
1204
1205 A shell function is an object that is called like a simple command and
1206 executes a compound command with a new set of positional parameters.
1207 Shell functions are declared as follows:
1208 <DL COMPACT>
1209 <DT>[ <B>function</B> ] <I>name</I> () <I>compound-command</I> [<I>redirection</I>]<DD>
1210 This defines a function named <I>name</I>.
1211 The reserved word <B>function</B> is optional.
1212 If the <B>function</B> reserved word is supplied, the parentheses are optional.
1213 The <I>body</I> of the function is the compound command
1214 <I>compound-command </I>
1215
1216 (see <B>Compound Commands</B> above).
1217 That command is usually a <I>list</I> of commands between { and }, but
1218 may be any command listed under <B>Compound Commands</B> above.
1219 <I>compound-command</I> is executed whenever <I>name</I> is specified as the
1220 name of a simple command.
1221 Any redirections (see
1222 <FONT SIZE=-1><B>REDIRECTION</B>
1223
1224 </FONT>
1225 below) specified when a function is defined are performed
1226 when the function is executed.
1227 The exit status of a function definition is zero unless a syntax error
1228 occurs or a readonly function with the same name already exists.
1229 When executed, the exit status of a function is the exit status of the
1230 last command executed in the body.  (See
1231 <FONT SIZE=-1><B>FUNCTIONS</B>
1232
1233 </FONT>
1234 below.)
1235 </DL>
1236 <A NAME="lbAR">&nbsp;</A>
1237 <H3>COMMENTS</H3>
1238
1239 In a non-interactive shell, or an interactive shell in which the
1240 <B>interactive_comments</B>
1241
1242 option to the
1243 <B>shopt</B>
1244
1245 builtin is enabled (see
1246 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
1247
1248 </FONT>
1249 below), a word beginning with
1250 <B>#</B>
1251
1252 causes that word and all remaining characters on that line to
1253 be ignored.  An interactive shell without the
1254 <B>interactive_comments</B>
1255
1256 option enabled does not allow comments.  The
1257 <B>interactive_comments</B>
1258
1259 option is on by default in interactive shells.
1260 <A NAME="lbAS">&nbsp;</A>
1261 <H3>QUOTING</H3>
1262
1263 <I>Quoting</I> is used to remove the special meaning of certain
1264 characters or words to the shell.  Quoting can be used to 
1265 disable special treatment for special characters, to prevent
1266 reserved words from being recognized as such, and to prevent
1267 parameter expansion.
1268 <P>
1269
1270 Each of the <I>metacharacters</I> listed above under
1271 <FONT SIZE=-1><B>DEFINITIONS</B>
1272
1273 </FONT>
1274 has special meaning to the shell and must be quoted if it is to
1275 represent itself.
1276 <P>
1277
1278 When the command history expansion facilities are being used
1279 (see
1280 <FONT SIZE=-1><B>HISTORY EXPANSION</B>
1281
1282 </FONT>
1283 below), the
1284 <I>history expansion</I> character, usually <B>!</B>, must be quoted
1285 to prevent history expansion.
1286 <P>
1287
1288 There are three quoting mechanisms: the
1289 <I>escape character</I>,
1290
1291 single quotes, and double quotes.
1292 <P>
1293
1294 A non-quoted backslash (<B>\</B>) is the
1295 <I>escape character</I>.
1296
1297 It preserves the literal value of the next character that follows,
1298 with the exception of &lt;newline&gt;.  If a <B>\</B>&lt;newline&gt; pair
1299 appears, and the backslash is not itself quoted, the <B>\</B>&lt;newline&gt;
1300 is treated as a line continuation (that is, it is removed from the
1301 input stream and effectively ignored).
1302 <P>
1303
1304 Enclosing characters in single quotes preserves the literal value
1305 of each character within the quotes.  A single quote may not occur
1306 between single quotes, even when preceded by a backslash.
1307 <P>
1308
1309 Enclosing characters in double quotes preserves the literal value
1310 of all characters within the quotes, with the exception of
1311 <B>$</B>,
1312
1313 <B>`</B>,
1314
1315 <B>\</B>,
1316
1317 and, when history expansion is enabled,
1318 <B>!</B>.
1319
1320 The characters
1321 <B>$</B>
1322
1323 and
1324 <B>`</B>
1325
1326 retain their special meaning within double quotes.  The backslash
1327 retains its special meaning only when followed by one of the following
1328 characters:
1329 <B>$</B>,
1330
1331 <B>`</B>,
1332
1333 <B>&quot;</B>,
1334 <B>\</B>,
1335
1336 or
1337 <B>&lt;newline&gt;</B>.
1338
1339 A double quote may be quoted within double quotes by preceding it with
1340 a backslash.
1341 If enabled, history expansion will be performed unless an
1342 <B>!</B>
1343
1344 appearing in double quotes is escaped using a backslash.
1345 The backslash preceding the
1346 <B>!</B>
1347
1348 is not removed.
1349 <P>
1350
1351 The special parameters
1352 <B>*</B>
1353
1354 and
1355 <B>@</B>
1356
1357 have special meaning when in double
1358 quotes (see
1359 <FONT SIZE=-1><B>PARAMETERS</B>
1360
1361 </FONT>
1362 below).
1363 <P>
1364
1365 Words of the form <B>$</B>aq<I>string</I>aq are treated specially.  The
1366 word expands to <I>string</I>, with backslash-escaped characters replaced
1367 as specified by the ANSI C standard.  Backslash escape sequences, if
1368 present, are decoded as follows:
1369 <DL COMPACT><DT><DD>
1370
1371 <DL COMPACT>
1372 <DT><B>\a</B>
1373
1374 <DD>
1375 alert (bell)
1376 <DT><B>\b</B>
1377
1378 <DD>
1379 backspace
1380 <DT><B>\e</B>
1381
1382 <DD>
1383 <DT><B>\E</B>
1384
1385 <DD>
1386 an escape character
1387 <DT><B>\f</B>
1388
1389 <DD>
1390 form feed
1391 <DT><B>\n</B>
1392
1393 <DD>
1394 new line
1395 <DT><B>\r</B>
1396
1397 <DD>
1398 carriage return
1399 <DT><B>\t</B>
1400
1401 <DD>
1402 horizontal tab
1403 <DT><B>\v</B>
1404
1405 <DD>
1406 vertical tab
1407 <DT><B>\\</B>
1408
1409 <DD>
1410 backslash
1411 <DT><B>\aq</B>
1412
1413 <DD>
1414 single quote
1415 <DT><B>\dq</B>
1416
1417 <DD>
1418 double quote
1419 <DT><B>\</B><I>nnn</I>
1420
1421 <DD>
1422 the eight-bit character whose value is the octal value <I>nnn</I>
1423 (one to three digits)
1424 <DT><B>\x</B><I>HH</I>
1425
1426 <DD>
1427 the eight-bit character whose value is the hexadecimal value <I>HH</I>
1428 (one or two hex digits)
1429 <DT><B>\c</B><I>x</I>
1430
1431 <DD>
1432 a control-<I>x</I> character
1433
1434 </DL></DL>
1435
1436 <P>
1437
1438 The expanded result is single-quoted, as if the dollar sign had
1439 not been present.
1440 <P>
1441
1442 A double-quoted string preceded by a dollar sign (<B>$</B>dq<I>string</I>dq)
1443 will cause the string to be translated according to the current locale.
1444 If the current locale is <B>C</B> or <B>POSIX</B>, the dollar sign
1445 is ignored.
1446 If the string is translated and replaced, the replacement is
1447 double-quoted.
1448 <A NAME="lbAT">&nbsp;</A>
1449 <H3>PARAMETERS</H3>
1450
1451 A
1452 <I>parameter</I>
1453
1454 is an entity that stores values.
1455 It can be a
1456 <I>name</I>,
1457
1458 a number, or one of the special characters listed below under
1459 <B>Special Parameters</B>.
1460
1461 A
1462 <I>variable</I>
1463
1464 is a parameter denoted by a
1465 <I>name</I>.
1466
1467 A variable has a <I>value</I> and zero or more <I>attributes</I>.
1468 Attributes are assigned using the
1469 <B>declare</B>
1470
1471 builtin command (see
1472 <B>declare</B>
1473
1474 below in
1475 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>).
1476
1477 </FONT>
1478 <P>
1479
1480 A parameter is set if it has been assigned a value.  The null string is
1481 a valid value.  Once a variable is set, it may be unset only by using
1482 the
1483 <B>unset</B>
1484
1485 builtin command (see
1486 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
1487
1488 </FONT>
1489 below).
1490 <P>
1491
1492 A
1493 <I>variable</I>
1494
1495 may be assigned to by a statement of the form
1496 <DL COMPACT><DT><DD>
1497 <P>
1498
1499 <I>name</I>=[<I>value</I>]
1500 </DL>
1501
1502 <P>
1503
1504 If
1505 <I>value</I>
1506
1507 is not given, the variable is assigned the null string.  All
1508 <I>values</I>
1509
1510 undergo tilde expansion, parameter and variable expansion,
1511 command substitution, arithmetic expansion, and quote
1512 removal (see
1513 <FONT SIZE=-1><B>EXPANSION</B>
1514
1515 </FONT>
1516 below).  If the variable has its
1517 <B>integer</B>
1518
1519 attribute set, then
1520 <I>value</I>
1521
1522 is evaluated as an arithmetic expression even if the $((...)) expansion is
1523 not used (see
1524 <B>Arithmetic Expansion</B>
1525
1526 below).
1527 Word splitting is not performed, with the exception
1528 of <B>&quot;$@&quot;</B> as explained below under
1529 <B>Special Parameters</B>.
1530
1531 Pathname expansion is not performed.
1532 Assignment statements may also appear as arguments to the
1533 <B>alias</B>,
1534
1535 <B>declare</B>,
1536
1537 <B>typeset</B>,
1538
1539 <B>export</B>,
1540
1541 <B>readonly</B>,
1542
1543 and
1544 <B>local</B>
1545
1546 builtin commands.
1547 <P>
1548
1549 In the context where an assignment statement is assigning a value
1550 to a shell variable or array index, the += operator can be used to
1551 append to or add to the variable's previous value.
1552 When += is applied to a variable for which the integer attribute has been
1553 set, <I>value</I> is evaluated as an arithmetic expression and added to the
1554 variable's current value, which is also evaluated.
1555 When += is applied to an array variable using compound assignment (see
1556 <B>Arrays</B>
1557
1558 below), the
1559 variable's value is not unset (as it is when using =), and new values are
1560 appended to the array beginning at one greater than the array's maximum index
1561 (for indexed arrays) or added as additional key-value pairs in an
1562 associative array.
1563 When applied to a string-valued variable, <I>value</I> is expanded and
1564 appended to the variable's value.
1565 <A NAME="lbAU">&nbsp;</A>
1566 <H4>Positional Parameters</H4>
1567
1568 <P>
1569
1570 A
1571 <I>positional parameter</I>
1572
1573 is a parameter denoted by one or more
1574 digits, other than the single digit 0.  Positional parameters are
1575 assigned from the shell's arguments when it is invoked,
1576 and may be reassigned using the
1577 <B>set</B>
1578
1579 builtin command.  Positional parameters may not be assigned to
1580 with assignment statements.  The positional parameters are
1581 temporarily replaced when a shell function is executed (see
1582 <FONT SIZE=-1><B>FUNCTIONS</B>
1583
1584 </FONT>
1585 below).
1586 <P>
1587
1588 When a positional parameter consisting of more than a single
1589 digit is expanded, it must be enclosed in braces (see
1590 <FONT SIZE=-1><B>EXPANSION</B>
1591
1592 </FONT>
1593 below).
1594 <A NAME="lbAV">&nbsp;</A>
1595 <H4>Special Parameters</H4>
1596
1597 <P>
1598
1599 The shell treats several parameters specially.  These parameters may
1600 only be referenced; assignment to them is not allowed.
1601
1602 <DL COMPACT>
1603 <DT><B>*</B>
1604
1605 <DD>
1606 Expands to the positional parameters, starting from one.  When the
1607 expansion occurs within double quotes, it expands to a single word
1608 with the value of each parameter separated by the first character
1609 of the 
1610 <FONT SIZE=-1><B>IFS</B>
1611
1612 </FONT>
1613 special variable.  That is, &quot;<B>$*</B>&quot; is equivalent
1614 to &quot;<B>$1</B><I>c</I><B>$2</B><I>c</I><B>...</B>&quot;, where
1615 <I>c</I>
1616
1617 is the first character of the value of the
1618 <FONT SIZE=-1><B>IFS</B>
1619
1620 </FONT>
1621 variable.  If
1622 <FONT SIZE=-1><B>IFS</B>
1623
1624 </FONT>
1625 is unset, the parameters are separated by spaces.
1626 If
1627 <FONT SIZE=-1><B>IFS</B>
1628
1629 </FONT>
1630 is null, the parameters are joined without intervening separators.
1631 <DT><B>@</B>
1632
1633 <DD>
1634 Expands to the positional parameters, starting from one.  When the
1635 expansion occurs within double quotes, each parameter expands to a
1636 separate word.  That is, &quot;<B>$@</B>&quot; is equivalent to
1637 &quot;<B>$1</B>&quot; &quot;<B>$2</B>&quot; ...
1638 If the double-quoted expansion occurs within a word, the expansion of
1639 the first parameter is joined with the beginning part of the original
1640 word, and the expansion of the last parameter is joined with the last
1641 part of the original word.
1642 When there are no positional parameters, &quot;<B>$@</B>&quot; and 
1643 <B>$@</B>
1644
1645 expand to nothing (i.e., they are removed).
1646 <DT><B>#</B>
1647
1648 <DD>
1649 Expands to the number of positional parameters in decimal.
1650 <DT><B>?</B>
1651
1652 <DD>
1653 Expands to the exit status of the most recently executed foreground
1654 pipeline.
1655 <DT><B>-</B>
1656
1657 <DD>
1658 Expands to the current option flags as specified upon invocation, 
1659 by the
1660 <B>set</B>
1661
1662 builtin command, or those set by the shell itself
1663 (such as the
1664 <B>-i</B>
1665
1666 option).
1667 <DT><B>$</B>
1668
1669 <DD>
1670 Expands to the process ID of the shell.  In a () subshell, it
1671 expands to the process ID of the current shell, not the
1672 subshell.
1673 <DT><B>!</B>
1674
1675 <DD>
1676 Expands to the process ID of the most recently executed background
1677 (asynchronous) command.
1678 <DT><B>0</B>
1679
1680 <DD>
1681 Expands to the name of the shell or shell script.  This is set at
1682 shell initialization.  If
1683 <B>bash</B>
1684
1685 is invoked with a file of commands,
1686 <B>$0</B>
1687
1688 is set to the name of that file.  If
1689 <B>bash</B>
1690
1691 is started with the
1692 <B>-c</B>
1693
1694 option, then
1695 <B>$0</B>
1696
1697 is set to the first argument after the string to be
1698 executed, if one is present.  Otherwise, it is set
1699 to the file name used to invoke
1700 <B>bash</B>,
1701
1702 as given by argument zero.
1703 <DT><B>_</B>
1704
1705 <DD>
1706 At shell startup, set to the absolute pathname used to invoke the
1707 shell or shell script being executed as passed in the environment
1708 or argument list.
1709 Subsequently, expands to the last argument to the previous command,
1710 after expansion.
1711 Also set to the full pathname used to invoke each command executed
1712 and placed in the environment exported to that command.
1713 When checking mail, this parameter holds the name of the mail file
1714 currently being checked.
1715
1716 </DL>
1717 <A NAME="lbAW">&nbsp;</A>
1718 <H4>Shell Variables</H4>
1719
1720 <P>
1721
1722 The following variables are set by the shell:
1723 <P>
1724
1725
1726 <DL COMPACT>
1727 <DT><B>BASH</B>
1728
1729 <DD>
1730 Expands to the full file name used to invoke this instance of
1731 <B>bash</B>.
1732
1733 <DT><B>BASHOPTS</B>
1734
1735 <DD>
1736 A colon-separated list of enabled shell options.  Each word in
1737 the list is a valid argument for the
1738 <B>-s</B>
1739
1740 option to the
1741 <B>shopt</B>
1742
1743 builtin command (see
1744 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
1745
1746 </FONT>
1747 below).  The options appearing in
1748 <FONT SIZE=-1><B>BASHOPTS</B>
1749
1750 </FONT>
1751 are those reported as
1752 <I>on</I>
1753
1754 by <B>shopt</B>.
1755 If this variable is in the environment when
1756 <B>bash</B>
1757
1758 starts up, each shell option in the list will be enabled before
1759 reading any startup files.
1760 This variable is read-only.
1761 <DT><B>BASHPID</B>
1762
1763 <DD>
1764 Expands to the process id of the current <B>bash</B> process.
1765 This differs from <B>$$</B> under certain circumstances, such as subshells
1766 that do not require <B>bash</B> to be re-initialized.
1767 <DT><B>BASH_ALIASES</B>
1768
1769 <DD>
1770 An associative array variable whose members correspond to the internal
1771 list of aliases as maintained by the <B>alias</B> builtin
1772 Elements added to this array appear in the alias list; unsetting array
1773 elements cause aliases to be removed from the alias list.
1774 <DT><B>BASH_ARGC</B>
1775
1776 <DD>
1777 An array variable whose values are the number of parameters in each
1778 frame of the current <B>bash</B> execution call stack.
1779 The number of
1780 parameters to the current subroutine (shell function or script executed
1781 with <B>.</B> or <B>source</B>) is at the top of the stack.
1782 When a subroutine is executed, the number of parameters passed is pushed onto
1783 <FONT SIZE=-1><B>BASH_ARGC</B>.
1784
1785 </FONT>
1786 The shell sets
1787 <FONT SIZE=-1><B>BASH_ARGC</B>
1788
1789 </FONT>
1790 only when in extended debugging mode (see the description of the
1791 <B>extdebug</B>
1792
1793 option to the
1794 <B>shopt</B>
1795
1796 builtin below)
1797 <DT><B>BASH_ARGV</B>
1798
1799 <DD>
1800 An array variable containing all of the parameters in the current <B>bash</B>
1801 execution call stack.  The final parameter of the last subroutine call
1802 is at the top of the stack; the first parameter of the initial call is
1803 at the bottom.  When a subroutine is executed, the parameters supplied
1804 are pushed onto
1805 <FONT SIZE=-1><B>BASH_ARGV</B>.
1806
1807 </FONT>
1808 The shell sets
1809 <FONT SIZE=-1><B>BASH_ARGV</B>
1810
1811 </FONT>
1812 only when in extended debugging mode
1813 (see the description of the
1814 <B>extdebug</B>
1815
1816 option to the
1817 <B>shopt</B>
1818
1819 builtin below)
1820 <DT><B>BASH_CMDS</B>
1821
1822 <DD>
1823 An associative array variable whose members correspond to the internal
1824 hash table of commands as maintained by the <B>hash</B> builtin.
1825 Elements added to this array appear in the hash table; unsetting array
1826 elements cause commands to be removed from the hash table.
1827 <DT><B>BASH_COMMAND</B>
1828
1829 <DD>
1830 The command currently being executed or about to be executed, unless the
1831 shell is executing a command as the result of a trap,
1832 in which case it is the command executing at the time of the trap.
1833 <DT><B>BASH_EXECUTION_STRING</B>
1834
1835 <DD>
1836 The command argument to the <B>-c</B> invocation option.
1837 <DT><B>BASH_LINENO</B>
1838
1839 <DD>
1840 An array variable whose members are the line numbers in source files
1841 corresponding to each member of
1842 <FONT SIZE=-1><B>FUNCNAME</B>.
1843
1844 </FONT>
1845 <B>${BASH_LINENO[</B><I>$i</I><B>]}</B> is the line number in the source
1846 file where <B>${FUNCNAME[</B><I>$i</I><B>]}</B> was called
1847 (or <B>${BASH_LINENO[</B><I>$i-1</I><B>]}</B> if referenced within another
1848 shell function).
1849 The corresponding source file name is <B>${BASH_SOURCE[</B><I>$i</I><B>]}</B>.
1850 Use
1851 <FONT SIZE=-1><B>LINENO</B>
1852
1853 </FONT>
1854 to obtain the current line number.
1855 <DT><B>BASH_REMATCH</B>
1856
1857 <DD>
1858 An array variable whose members are assigned by the <B>=~</B> binary
1859 operator to the <B>[[</B> conditional command.
1860 The element with index 0 is the portion of the string
1861 matching the entire regular expression.
1862 The element with index <I>n</I> is the portion of the
1863 string matching the <I>n</I>th parenthesized subexpression.
1864 This variable is read-only.
1865 <DT><B>BASH_SOURCE</B>
1866
1867 <DD>
1868 An array variable whose members are the source filenames corresponding
1869 to the elements in the
1870 <FONT SIZE=-1><B>FUNCNAME</B>
1871
1872 </FONT>
1873 array variable.
1874 <DT><B>BASH_SUBSHELL</B>
1875
1876 <DD>
1877 Incremented by one each time a subshell or subshell environment is spawned.
1878 The initial value is 0.
1879 <DT><B>BASH_VERSINFO</B>
1880
1881 <DD>
1882 A readonly array variable whose members hold version information for
1883 this instance of
1884 <B>bash</B>.
1885
1886 The values assigned to the array members are as follows:
1887 <P>
1888 <DL COMPACT><DT><DD>
1889
1890 <DL COMPACT>
1891 <DT><B>BASH_VERSINFO[</B>0]
1892
1893 <DD>
1894 The major version number (the <I>release</I>).
1895 <DT><B>BASH_VERSINFO[</B>1]
1896
1897 <DD>
1898 The minor version number (the <I>version</I>).
1899 <DT><B>BASH_VERSINFO[</B>2]
1900
1901 <DD>
1902 The patch level.
1903 <DT><B>BASH_VERSINFO[</B>3]
1904
1905 <DD>
1906 The build version.
1907 <DT><B>BASH_VERSINFO[</B>4]
1908
1909 <DD>
1910 The release status (e.g., <I>beta1</I>).
1911 <DT><B>BASH_VERSINFO[</B>5]
1912
1913 <DD>
1914 The value of
1915 <FONT SIZE=-1><B>MACHTYPE</B>.
1916
1917 </FONT>
1918
1919 </DL></DL>
1920
1921 <DT><B>BASH_VERSION</B>
1922
1923 <DD>
1924 Expands to a string describing the version of this instance of
1925 <B>bash</B>.
1926
1927 <DT><B>COMP_CWORD</B>
1928
1929 <DD>
1930 An index into <B>${COMP_WORDS}</B> of the word containing the current
1931 cursor position.
1932 This variable is available only in shell functions invoked by the
1933 programmable completion facilities (see <B>Programmable Completion</B>
1934 below).
1935 <DT><B>COMP_KEY</B>
1936
1937 <DD>
1938 The key (or final key of a key sequence) used to invoke the current
1939 completion function.
1940 <DT><B>COMP_LINE</B>
1941
1942 <DD>
1943 The current command line.
1944 This variable is available only in shell functions and external
1945 commands invoked by the
1946 programmable completion facilities (see <B>Programmable Completion</B>
1947 below).
1948 <DT><B>COMP_POINT</B>
1949
1950 <DD>
1951 The index of the current cursor position relative to the beginning of
1952 the current command.
1953 If the current cursor position is at the end of the current command,
1954 the value of this variable is equal to <B>${#COMP_LINE}</B>.
1955 This variable is available only in shell functions and external
1956 commands invoked by the
1957 programmable completion facilities (see <B>Programmable Completion</B>
1958 below).
1959 <DT><B>COMP_TYPE</B>
1960
1961 <DD>
1962 Set to an integer value corresponding to the type of completion attempted
1963 that caused a completion function to be called:
1964 <I>TAB</I>, for normal completion,
1965 <I>?</I>, for listing completions after successive tabs,
1966 <I>!</I>, for listing alternatives on partial word completion,
1967 <I>@</I>, to list completions if the word is not unmodified,
1968 or
1969 <I>%</I>, for menu completion.
1970 This variable is available only in shell functions and external
1971 commands invoked by the
1972 programmable completion facilities (see <B>Programmable Completion</B>
1973 below).
1974 <DT><B>COMP_WORDBREAKS</B>
1975
1976 <DD>
1977 The set of characters that the <B>readline</B> library treats as word
1978 separators when performing word completion.
1979 If
1980 <FONT SIZE=-1><B>COMP_WORDBREAKS</B>
1981
1982 </FONT>
1983 is unset, it loses its special properties, even if it is
1984 subsequently reset.
1985 <DT><B>COMP_WORDS</B>
1986
1987 <DD>
1988 An array variable (see <B>Arrays</B> below) consisting of the individual
1989 words in the current command line.
1990 The line is split into words as <B>readline</B> would split it, using
1991 <FONT SIZE=-1><B>COMP_WORDBREAKS</B>
1992
1993 </FONT>
1994 as described above.
1995 This variable is available only in shell functions invoked by the
1996 programmable completion facilities (see <B>Programmable Completion</B>
1997 below).
1998 <DT><B>DIRSTACK</B>
1999
2000 <DD>
2001 An array variable (see
2002 <B>Arrays</B>
2003
2004 below) containing the current contents of the directory stack.
2005 Directories appear in the stack in the order they are displayed by the
2006 <B>dirs</B>
2007
2008 builtin.
2009 Assigning to members of this array variable may be used to modify
2010 directories already in the stack, but the
2011 <B>pushd</B>
2012
2013 and
2014 <B>popd</B>
2015
2016 builtins must be used to add and remove directories.
2017 Assignment to this variable will not change the current directory.
2018 If
2019 <FONT SIZE=-1><B>DIRSTACK</B>
2020
2021 </FONT>
2022 is unset, it loses its special properties, even if it is
2023 subsequently reset.
2024 <DT><B>EUID</B>
2025
2026 <DD>
2027 Expands to the effective user ID of the current user, initialized at
2028 shell startup.  This variable is readonly.
2029 <DT><B>FUNCNAME</B>
2030
2031 <DD>
2032 An array variable containing the names of all shell functions
2033 currently in the execution call stack.
2034 The element with index 0 is the name of any currently-executing
2035 shell function.
2036 The bottom-most element is
2037 <TT>&quot;main&quot;</TT>.
2038
2039 This variable exists only when a shell function is executing.
2040 Assignments to
2041 <FONT SIZE=-1><B>FUNCNAME</B>
2042
2043 </FONT>
2044 have no effect and return an error status.
2045 If
2046 <FONT SIZE=-1><B>FUNCNAME</B>
2047
2048 </FONT>
2049 is unset, it loses its special properties, even if it is
2050 subsequently reset.
2051 <DT><B>GROUPS</B>
2052
2053 <DD>
2054 An array variable containing the list of groups of which the current
2055 user is a member.
2056 Assignments to    
2057 <FONT SIZE=-1><B>GROUPS</B>
2058
2059 </FONT>
2060 have no effect and return an error status.
2061 If
2062 <FONT SIZE=-1><B>GROUPS</B>
2063
2064 </FONT>
2065 is unset, it loses its special properties, even if it is
2066 subsequently reset.
2067 <DT><B>HISTCMD</B>
2068
2069 <DD>
2070 The history number, or index in the history list, of the current
2071 command.
2072 If
2073 <FONT SIZE=-1><B>HISTCMD</B>
2074
2075 </FONT>
2076 is unset, it loses its special properties, even if it is
2077 subsequently reset.
2078 <DT><B>HOSTNAME</B>
2079
2080 <DD>
2081 Automatically set to the name of the current host.
2082 <DT><B>HOSTTYPE</B>
2083
2084 <DD>
2085 Automatically set to a string that uniquely
2086 describes the type of machine on which
2087 <B>bash</B>
2088
2089 is executing.
2090 The default is system-dependent.
2091 <DT><B>LINENO</B>
2092
2093 <DD>
2094 Each time this parameter is referenced, the shell substitutes
2095 a decimal number representing the current sequential line number
2096 (starting with 1) within a script or function.  When not in a
2097 script or function, the value substituted is not guaranteed to
2098 be meaningful.
2099 If
2100 <FONT SIZE=-1><B>LINENO</B>
2101
2102 </FONT>
2103 is unset, it loses its special properties, even if it is
2104 subsequently reset.
2105 <DT><B>MACHTYPE</B>
2106
2107 <DD>
2108 Automatically set to a string that fully describes the system
2109 type on which
2110 <B>bash</B>
2111
2112 is executing, in the standard GNU <I>cpu-company-system</I> format.
2113 The default is system-dependent.
2114 <DT><B>OLDPWD</B>
2115
2116 <DD>
2117 The previous working directory as set by the
2118 <B>cd</B>
2119
2120 command.
2121 <DT><B>OPTARG</B>
2122
2123 <DD>
2124 The value of the last option argument processed by the
2125 <B>getopts</B>
2126
2127 builtin command (see
2128 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
2129
2130 </FONT>
2131 below).
2132 <DT><B>OPTIND</B>
2133
2134 <DD>
2135 The index of the next argument to be processed by the
2136 <B>getopts</B>
2137
2138 builtin command (see
2139 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
2140
2141 </FONT>
2142 below).
2143 <DT><B>OSTYPE</B>
2144
2145 <DD>
2146 Automatically set to a string that
2147 describes the operating system on which
2148 <B>bash</B>
2149
2150 is executing.
2151 The default is system-dependent.
2152 <DT><B>PIPESTATUS</B>
2153
2154 <DD>
2155 An array variable (see
2156 <B>Arrays</B>
2157
2158 below) containing a list of exit status values from the processes
2159 in the most-recently-executed foreground pipeline (which may
2160 contain only a single command).
2161 <DT><B>PPID</B>
2162
2163 <DD>
2164 The process ID of the shell's parent.  This variable is readonly.
2165 <DT><B>PWD</B>
2166
2167 <DD>
2168 The current working directory as set by the
2169 <B>cd</B>
2170
2171 command.
2172 <DT><B>RANDOM</B>
2173
2174 <DD>
2175 Each time this parameter is referenced, a random integer between
2176 0 and 32767 is
2177 generated.  The sequence of random numbers may be initialized by assigning
2178 a value to
2179 <FONT SIZE=-1><B>RANDOM</B>.
2180
2181 </FONT>
2182 If
2183 <FONT SIZE=-1><B>RANDOM</B>
2184
2185 </FONT>
2186 is unset, it loses its special properties, even if it is
2187 subsequently reset.
2188 <DT><B>REPLY</B>
2189
2190 <DD>
2191 Set to the line of input read by the
2192 <B>read</B>
2193
2194 builtin command when no arguments are supplied.
2195 <DT><B>SECONDS</B>
2196
2197 <DD>
2198 Each time this parameter is
2199 referenced, the number of seconds since shell invocation is returned.  If a
2200 value is assigned to 
2201 <FONT SIZE=-1><B>SECONDS</B>,
2202
2203 </FONT>
2204 the value returned upon subsequent
2205 references is
2206 the number of seconds since the assignment plus the value assigned.
2207 If
2208 <FONT SIZE=-1><B>SECONDS</B>
2209
2210 </FONT>
2211 is unset, it loses its special properties, even if it is
2212 subsequently reset.
2213 <DT><B>SHELLOPTS</B>
2214
2215 <DD>
2216 A colon-separated list of enabled shell options.  Each word in
2217 the list is a valid argument for the
2218 <B>-o</B>
2219
2220 option to the
2221 <B>set</B>
2222
2223 builtin command (see
2224 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
2225
2226 </FONT>
2227 below).  The options appearing in
2228 <FONT SIZE=-1><B>SHELLOPTS</B>
2229
2230 </FONT>
2231 are those reported as
2232 <I>on</I>
2233
2234 by <B>set -o</B>.
2235 If this variable is in the environment when
2236 <B>bash</B>
2237
2238 starts up, each shell option in the list will be enabled before
2239 reading any startup files.
2240 This variable is read-only.
2241 <DT><B>SHLVL</B>
2242
2243 <DD>
2244 Incremented by one each time an instance of
2245 <B>bash</B>
2246
2247 is started.
2248 <DT><B>UID</B>
2249
2250 <DD>
2251 Expands to the user ID of the current user, initialized at shell startup.
2252 This variable is readonly.
2253
2254 </DL>
2255 <P>
2256
2257 The following variables are used by the shell.  In some cases,
2258 <B>bash</B>
2259
2260 assigns a default value to a variable; these cases are noted
2261 below.
2262 <P>
2263
2264
2265 <DL COMPACT>
2266 <DT><B>BASH_ENV</B>
2267
2268 <DD>
2269 If this parameter is set when <B>bash</B> is executing a shell script,
2270 its value is interpreted as a filename containing commands to
2271 initialize the shell, as in
2272 <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>.
2273
2274 The value of
2275 <FONT SIZE=-1><B>BASH_ENV</B>
2276
2277 </FONT>
2278 is subjected to parameter expansion, command substitution, and arithmetic
2279 expansion before being interpreted as a file name.
2280 <FONT SIZE=-1><B>PATH</B>
2281
2282 </FONT>
2283 is not used to search for the resultant file name.
2284 <DT><B>CDPATH</B>
2285
2286 <DD>
2287 The search path for the
2288 <B>cd</B>
2289
2290 command.
2291 This is a colon-separated list of directories in which the shell looks
2292 for destination directories specified by the
2293 <B>cd</B>
2294
2295 command.
2296 A sample value is
2297 <TT>&quot;.:~:/usr&quot;</TT>.
2298
2299 <DT><B>BASH_XTRACEFD</B>
2300
2301 <DD>
2302 If set to an integer corresponding to a valid file descriptor, <B>bash</B>
2303 will write the trace output generated when
2304 <TT>set -x</TT>
2305
2306 is enabled to that file descriptor.
2307 The file descriptor is closed when
2308 <FONT SIZE=-1><B>BASH_XTRACEFD</B>
2309
2310 </FONT>
2311 is unset or assigned a new value.
2312 Unsetting
2313 <FONT SIZE=-1><B>BASH_XTRACEFD</B>
2314
2315 </FONT>
2316 or assigning it the empty string causes the
2317 trace output to be sent to the standard error.
2318 Note that setting
2319 <FONT SIZE=-1><B>BASH_XTRACEFD</B>
2320
2321 </FONT>
2322 to 2 (the standard error file
2323 descriptor) and then unsetting it will result in the standard error
2324 being closed.
2325 <DT><B>COLUMNS</B>
2326
2327 <DD>
2328 Used by the <B>select</B> builtin command to determine the terminal width
2329 when printing selection lists.  Automatically set upon receipt of a SIGWINCH.
2330 <DT><B>COMPREPLY</B>
2331
2332 <DD>
2333 An array variable from which <B>bash</B> reads the possible completions
2334 generated by a shell function invoked by the programmable completion
2335 facility (see <B>Programmable Completion</B> below).
2336 <DT><B>EMACS</B>
2337
2338 <DD>
2339 If <B>bash</B> finds this variable in the environment when the shell starts
2340 with value
2341 <TT>t</TT>,
2342
2343 it assumes that the shell is running in an emacs shell buffer and disables
2344 line editing.
2345 <DT><B>FCEDIT</B>
2346
2347 <DD>
2348 The default editor for the
2349 <B>fc</B>
2350
2351 builtin command.
2352 <DT><B>FIGNORE</B>
2353
2354 <DD>
2355 A colon-separated list of suffixes to ignore when performing
2356 filename completion (see
2357 <FONT SIZE=-1><B>READLINE</B>
2358
2359 </FONT>
2360 below).
2361 A filename whose suffix matches one of the entries in 
2362 <FONT SIZE=-1><B>FIGNORE</B>
2363
2364 </FONT>
2365 is excluded from the list of matched filenames.
2366 A sample value is
2367 <TT>&quot;.o:~&quot;</TT>.
2368
2369 <DT><B>GLOBIGNORE</B>
2370
2371 <DD>
2372 A colon-separated list of patterns defining the set of filenames to
2373 be ignored by pathname expansion.
2374 If a filename matched by a pathname expansion pattern also matches one
2375 of the patterns in
2376 <FONT SIZE=-1><B>GLOBIGNORE</B>,
2377
2378 </FONT>
2379 it is removed from the list of matches.
2380 <DT><B>HISTCONTROL</B>
2381
2382 <DD>
2383 A colon-separated list of values controlling how commands are saved on
2384 the history list.
2385 If the list of values includes
2386 <I>ignorespace</I>,
2387
2388 lines which begin with a
2389 <B>space</B>
2390
2391 character are not saved in the history list.
2392 A value of 
2393 <I>ignoredups</I>
2394
2395 causes lines matching the previous history entry to not be saved.
2396 A value of
2397 <I>ignoreboth</I>
2398
2399 is shorthand for <I>ignorespace</I> and <I>ignoredups</I>.
2400 A value of
2401 <I>erasedups</I>
2402
2403 causes all previous lines matching the current line to be removed from
2404 the history list before that line is saved.
2405 Any value not in the above list is ignored.
2406 If
2407 <FONT SIZE=-1><B>HISTCONTROL</B>
2408
2409 </FONT>
2410 is unset, or does not include a valid value,
2411 all lines read by the shell parser are saved on the history list,
2412 subject to the value of
2413 <FONT SIZE=-1><B>HISTIGNORE</B>.
2414
2415 </FONT>
2416 The second and subsequent lines of a multi-line compound command are
2417 not tested, and are added to the history regardless of the value of
2418 <FONT SIZE=-1><B>HISTCONTROL</B>.
2419
2420 </FONT>
2421 <DT><B>HISTFILE</B>
2422
2423 <DD>
2424 The name of the file in which command history is saved (see
2425 <FONT SIZE=-1><B>HISTORY</B>
2426
2427 </FONT>
2428 below).  The default value is <A HREF="file:~/.bash_history"><I>~/.bash_history</I></A>.  If unset, the
2429 command history is not saved when an interactive shell exits.
2430 <DT><B>HISTFILESIZE</B>
2431
2432 <DD>
2433 The maximum number of lines contained in the history file.  When this
2434 variable is assigned a value, the history file is truncated, if
2435 necessary, by removing the oldest entries,
2436 to contain no more than that number of lines.  The default
2437 value is 500.  The history file is also truncated to this size after
2438 writing it when an interactive shell exits.
2439 <DT><B>HISTIGNORE</B>
2440
2441 <DD>
2442 A colon-separated list of patterns used to decide which command lines
2443 should be saved on the history list.  Each pattern is anchored at the
2444 beginning of the line and must match the complete line (no implicit
2445 `<B>*</B>' is appended).  Each pattern is tested against the line
2446 after the checks specified by
2447 <FONT SIZE=-1><B>HISTCONTROL</B>
2448
2449 </FONT>
2450 are applied.
2451 In addition to the normal shell pattern matching characters, `<B>&amp;</B>'
2452 matches the previous history line.  `<B>&amp;</B>' may be escaped using a
2453 backslash; the backslash is removed before attempting a match.
2454 The second and subsequent lines of a multi-line compound command are
2455 not tested, and are added to the history regardless of the value of
2456 <FONT SIZE=-1><B>HISTIGNORE</B>.
2457
2458 </FONT>
2459 <DT><B>HISTSIZE</B>
2460
2461 <DD>
2462 The number of commands to remember in the command history (see
2463 <FONT SIZE=-1><B>HISTORY</B>
2464
2465 </FONT>
2466 below).  The default value is 500.
2467 <DT><B>HISTTIMEFORMAT</B>
2468
2469 <DD>
2470 If this variable is set and not null, its value is used as a format string
2471 for <I>strftime</I>(3) to print the time stamp associated with each history
2472 entry displayed by the <B>history</B> builtin.
2473 If this variable is set, time stamps are written to the history file so
2474 they may be preserved across shell sessions.
2475 This uses the history comment character to distinguish timestamps from
2476 other history lines.
2477 <DT><B>HOME</B>
2478
2479 <DD>
2480 The home directory of the current user; the default argument for the
2481 <B>cd</B> builtin command.
2482 The value of this variable is also used when performing tilde expansion.
2483 <DT><B>HOSTFILE</B>
2484
2485 <DD>
2486 Contains the name of a file in the same format as
2487
2488 <I>/etc/hosts</I>
2489
2490 that should be read when the shell needs to complete a
2491 hostname.
2492 The list of possible hostname completions may be changed while the
2493 shell is running;
2494 the next time hostname completion is attempted after the
2495 value is changed,
2496 <B>bash</B>
2497
2498 adds the contents of the new file to the existing list.
2499 If
2500 <FONT SIZE=-1><B>HOSTFILE</B>
2501
2502 </FONT>
2503 is set, but has no value, or does not name a readable file,
2504 <B>bash</B> attempts to read
2505
2506 <I>/etc/hosts</I>
2507
2508 to obtain the list of possible hostname completions.
2509 When
2510 <FONT SIZE=-1><B>HOSTFILE</B>
2511
2512 </FONT>
2513 is unset, the hostname list is cleared.
2514 <DT><B>IFS</B>
2515
2516 <DD>
2517 The
2518 <I>Internal Field Separator</I>
2519
2520 that is used
2521 for word splitting after expansion and to
2522 split lines into words with the
2523 <B>read</B>
2524
2525 builtin command.  The default value is
2526 ``&lt;space&gt;&lt;tab&gt;&lt;newline&gt;''.
2527 <DT><B>IGNOREEOF</B>
2528
2529 <DD>
2530 Controls the
2531 action of an interactive shell on receipt of an
2532 <FONT SIZE=-1><B>EOF</B>
2533
2534 </FONT>
2535 character as the sole input.  If set, the value is the number of
2536 consecutive
2537 <FONT SIZE=-1><B>EOF</B>
2538
2539 </FONT>
2540 characters which must be
2541 typed as the first characters on an input line before
2542 <B>bash</B>
2543
2544 exits.  If the variable exists but does not have a numeric value, or
2545 has no value, the default value is 10.  If it does not exist,
2546 <FONT SIZE=-1><B>EOF</B>
2547
2548 </FONT>
2549 signifies the end of input to the shell.
2550 <DT><B>INPUTRC</B>
2551
2552 <DD>
2553 The filename for the
2554 <B>readline</B>
2555
2556 startup file, overriding the default of
2557
2558 <A HREF="file:~/.inputrc"><I>~/.inputrc</I></A>
2559
2560 (see
2561 <FONT SIZE=-1><B>READLINE</B>
2562
2563 </FONT>
2564 below).
2565 <DT><B>LANG</B>
2566
2567 <DD>
2568 Used to determine the locale category for any category not specifically
2569 selected with a variable starting with <B>LC_</B>.
2570 <DT><B>LC_ALL</B>
2571
2572 <DD>
2573 This variable overrides the value of
2574 <FONT SIZE=-1><B>LANG</B>
2575
2576 </FONT>
2577 and any other
2578 <B>LC_</B> variable specifying a locale category.
2579 <DT><B>LC_COLLATE</B>
2580
2581 <DD>
2582 This variable determines the collation order used when sorting the
2583 results of pathname expansion, and determines the behavior of range
2584 expressions, equivalence classes, and collating sequences within
2585 pathname expansion and pattern matching.
2586 <DT><B>LC_CTYPE</B>
2587
2588 <DD>
2589 This variable determines the interpretation of characters and the
2590 behavior of character classes within pathname expansion and pattern
2591 matching.
2592 <DT><B>LC_MESSAGES</B>
2593
2594 <DD>
2595 This variable determines the locale used to translate double-quoted
2596 strings preceded by a <B>$</B>.
2597 <DT><B>LC_NUMERIC</B>
2598
2599 <DD>
2600 This variable determines the locale category used for number formatting.
2601 <DT><B>LINES</B>
2602
2603 <DD>
2604 Used by the <B>select</B> builtin command to determine the column length
2605 for printing selection lists.  Automatically set upon receipt of a
2606 <FONT SIZE=-1><B>SIGWINCH</B>.
2607
2608 </FONT>
2609 <DT><B>MAIL</B>
2610
2611 <DD>
2612 If this parameter is set to a file name and the
2613 <FONT SIZE=-1><B>MAILPATH</B>
2614
2615 </FONT>
2616 variable is not set,
2617 <B>bash</B>
2618
2619 informs the user of the arrival of mail in the specified file.
2620 <DT><B>MAILCHECK</B>
2621
2622 <DD>
2623 Specifies how
2624 often (in seconds)
2625 <B>bash</B>
2626
2627 checks for mail.  The default is 60 seconds.  When it is time to check
2628 for mail, the shell does so before displaying the primary prompt.
2629 If this variable is unset, or set to a value that is not a number
2630 greater than or equal to zero, the shell disables mail checking.
2631 <DT><B>MAILPATH</B>
2632
2633 <DD>
2634 A colon-separated list of file names to be checked for mail. 
2635 The message to be printed when mail arrives in a particular file
2636 may be specified by separating the file name from the message with a `?'.
2637 When used in the text of the message, <B>$_</B> expands to the name of
2638 the current mailfile. 
2639 Example:
2640 <DL COMPACT><DT><DD>
2641 <P>
2642
2643 <B>MAILPATH</B>=aq/var/mail/bfox?&quot;You have mail&quot;:~/shell-mail?&quot;$_ has mail!&quot;aq
2644 <P>
2645
2646 <B>Bash</B>
2647
2648 supplies a default value for this variable, but the location of the user
2649 mail files that it uses is system dependent (e.g., /var/mail/<B>$USER</B>).
2650 </DL>
2651
2652 <DT><B>OPTERR</B>
2653
2654 <DD>
2655 If set to the value 1,
2656 <B>bash</B>
2657
2658 displays error messages generated by the
2659 <B>getopts</B>
2660
2661 builtin command (see
2662 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
2663
2664 </FONT>
2665 below).
2666 <FONT SIZE=-1><B>OPTERR</B>
2667
2668 </FONT>
2669 is initialized to 1 each time the shell is invoked or a shell
2670 script is executed.
2671 <DT><B>PATH</B>
2672
2673 <DD>
2674 The search path for commands.  It
2675 is a colon-separated list of directories in which
2676 the shell looks for commands (see
2677 <FONT SIZE=-1><B>COMMAND EXECUTION</B>
2678
2679 </FONT>
2680 below).
2681 A zero-length (null) directory name in the value of
2682 <FONT SIZE=-1><B>PATH</B>
2683
2684 </FONT>
2685 indicates the current directory.
2686 A null directory name may appear as two adjacent colons, or as an initial
2687 or trailing colon.
2688 The default path is system-dependent,
2689 and is set by the administrator who installs
2690 <B>bash</B>.
2691
2692 A common value is
2693 <TT>/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin</TT>.
2694
2695 <DT><B>POSIXLY_CORRECT</B>
2696
2697 <DD>
2698 If this variable is in the environment when <B>bash</B> starts, the shell
2699 enters <I>posix mode</I> before reading the startup files, as if the
2700 <B>--posix</B>
2701
2702 invocation option had been supplied.  If it is set while the shell is
2703 running, <B>bash</B> enables <I>posix mode</I>, as if the command
2704 <TT>set -o posix</TT>
2705
2706 had been executed.
2707 <DT><B>PROMPT_COMMAND</B>
2708
2709 <DD>
2710 If set, the value is executed as a command prior to issuing each primary
2711 prompt.
2712 <DT><B>PROMPT_DIRTRIM</B>
2713
2714 <DD>
2715 If set to a number greater than zero, the value is used as the number of
2716 trailing directory components to retain when expanding the <B>\w</B> and
2717 <B>\W</B> prompt string escapes (see
2718 <FONT SIZE=-1><B>PROMPTING</B>
2719
2720 </FONT>
2721 below).  Characters removed are replaced with an ellipsis.
2722 <DT><B>PS1</B>
2723
2724 <DD>
2725 The value of this parameter is expanded (see
2726 <FONT SIZE=-1><B>PROMPTING</B>
2727
2728 </FONT>
2729 below) and used as the primary prompt string.  The default value is
2730 ``<B>\s-\v\$ </B>''.
2731 <DT><B>PS2</B>
2732
2733 <DD>
2734 The value of this parameter is expanded as with
2735 <FONT SIZE=-1><B>PS1</B>
2736
2737 </FONT>
2738 and used as the secondary prompt string.  The default is
2739 ``<B>&gt; </B>''.
2740 <DT><B>PS3</B>
2741
2742 <DD>
2743 The value of this parameter is used as the prompt for the
2744 <B>select</B>
2745
2746 command (see
2747 <FONT SIZE=-1><B>SHELL GRAMMAR</B>
2748
2749 </FONT>
2750 above).
2751 <DT><B>PS4</B>
2752
2753 <DD>
2754 The value of this parameter is expanded as with
2755 <FONT SIZE=-1><B>PS1</B>
2756
2757 </FONT>
2758 and the value is printed before each command
2759 <B>bash</B>
2760
2761 displays during an execution trace.  The first character of
2762 <FONT SIZE=-1><B>PS4</B>
2763
2764 </FONT>
2765 is replicated multiple times, as necessary, to indicate multiple
2766 levels of indirection.  The default is ``<B>+ </B>''.
2767 <DT><B>SHELL</B>
2768
2769 <DD>
2770 The full pathname to the shell is kept in this environment variable.
2771 If it is not set when the shell starts,
2772 <B>bash</B>
2773
2774 assigns to it the full pathname of the current user's login shell.
2775 <DT><B>TIMEFORMAT</B>
2776
2777 <DD>
2778 The value of this parameter is used as a format string specifying
2779 how the timing information for pipelines prefixed with the
2780 <B>time</B>
2781
2782 reserved word should be displayed.
2783 The <B>%</B> character introduces an escape sequence that is
2784 expanded to a time value or other information.
2785 The escape sequences and their meanings are as follows; the
2786 braces denote optional portions.
2787 <P>
2788 <DL COMPACT><DT><DD>
2789
2790 <DL COMPACT>
2791 <DT><B>%%</B>
2792
2793 <DD>
2794 A literal <B>%</B>.
2795 <DT><B>%[</B><I>p</I>][l]R
2796
2797 <DD>
2798 The elapsed time in seconds.
2799 <DT><B>%[</B><I>p</I>][l]U
2800
2801 <DD>
2802 The number of CPU seconds spent in user mode.
2803 <DT><B>%[</B><I>p</I>][l]S
2804
2805 <DD>
2806 The number of CPU seconds spent in system mode.
2807 <DT><B>%P</B>
2808
2809 <DD>
2810 The CPU percentage, computed as (%U + %S) / %R.
2811
2812 </DL></DL>
2813
2814 <DT><DD>
2815 The optional <I>p</I> is a digit specifying the <I>precision</I>,
2816 the number of fractional digits after a decimal point.
2817 A value of 0 causes no decimal point or fraction to be output.
2818 At most three places after the decimal point may be specified;
2819 values of <I>p</I> greater than 3 are changed to 3.
2820 If <I>p</I> is not specified, the value 3 is used.
2821 <DT><DD>
2822 The optional <B>l</B> specifies a longer format, including
2823 minutes, of the form <I>MM</I>m<I>SS</I>.<I>FF</I>s.
2824 The value of <I>p</I> determines whether or not the fraction is
2825 included.
2826 <DT><DD>
2827 If this variable is not set, <B>bash</B> acts as if it had the
2828 value <B>$aq\nreal\t%3lR\nuser\t%3lU\nsys       %3lSaq</B>.
2829 If the value is null, no timing information is displayed.
2830 A trailing newline is added when the format string is displayed.
2831 <DT><B>TMOUT</B>
2832
2833 <DD>
2834 If set to a value greater than zero,
2835 <FONT SIZE=-1><B>TMOUT</B>
2836
2837 </FONT>
2838 is treated as the
2839 default timeout for the <B>read</B> builtin.
2840 The <B>select</B> command terminates if input does not arrive
2841 after
2842 <FONT SIZE=-1><B>TMOUT</B>
2843
2844 </FONT>
2845 seconds when input is coming from a terminal.
2846 In an interactive shell, the value is interpreted as the
2847 number of seconds to wait for input after issuing the primary prompt.
2848 <B>Bash</B>
2849
2850 terminates after waiting for that number of seconds if input does
2851 not arrive.
2852 <DT><B>TMPDIR</B>
2853
2854 <DD>
2855 If set, <B>Bash</B> uses its value as the name of a directory in which
2856 <B>Bash</B> creates temporary files for the shell's use.
2857 <DT><B>auto_resume</B>
2858
2859 <DD>
2860 This variable controls how the shell interacts with the user and
2861 job control.  If this variable is set, single word simple
2862 commands without redirections are treated as candidates for resumption
2863 of an existing stopped job.  There is no ambiguity allowed; if there is
2864 more than one job beginning with the string typed, the job most recently
2865 accessed is selected.  The
2866 <I>name</I>
2867
2868 of a stopped job, in this context, is the command line used to
2869 start it.
2870 If set to the value
2871 <I>exact</I>,
2872
2873 the string supplied must match the name of a stopped job exactly;
2874 if set to
2875 <I>substring</I>,
2876
2877 the string supplied needs to match a substring of the name of a
2878 stopped job.  The
2879 <I>substring</I>
2880
2881 value provides functionality analogous to the
2882 <B>%?</B>
2883
2884 job identifier (see
2885 <FONT SIZE=-1><B>JOB CONTROL</B>
2886
2887 </FONT>
2888 below).  If set to any other value, the supplied string must
2889 be a prefix of a stopped job's name; this provides functionality
2890 analogous to the <B>%</B><I>string</I> job identifier.
2891 <DT><B>histchars</B>
2892
2893 <DD>
2894 The two or three characters which control history expansion
2895 and tokenization (see
2896 <FONT SIZE=-1><B>HISTORY EXPANSION</B>
2897
2898 </FONT>
2899 below).  The first character is the <I>history expansion</I> character,
2900 the character which signals the start of a history
2901 expansion, normally `<B>!</B>'.
2902 The second character is the <I>quick substitution</I>
2903 character, which is used as shorthand for re-running the previous
2904 command entered, substituting one string for another in the command.
2905 The default is `<B>^</B>'.
2906 The optional third character is the character
2907 which indicates that the remainder of the line is a comment when found
2908 as the first character of a word, normally `<B>#</B>'.  The history
2909 comment character causes history substitution to be skipped for the
2910 remaining words on the line.  It does not necessarily cause the shell
2911 parser to treat the rest of the line as a comment.
2912
2913 </DL>
2914 <A NAME="lbAX">&nbsp;</A>
2915 <H4>Arrays</H4>
2916
2917 <B>Bash</B>
2918
2919 provides one-dimensional indexed and associative array variables.
2920 Any variable may be used as an indexed array; the
2921 <B>declare</B>
2922
2923 builtin will explicitly declare an array.
2924 There is no maximum
2925 limit on the size of an array, nor any requirement that members
2926 be indexed or assigned contiguously.
2927 Indexed arrays are referenced using integers (including arithmetic
2928 expressions)  and are zero-based; associative arrays are referenced
2929 using arbitrary strings.
2930 <P>
2931
2932 An indexed array is created automatically if any variable is assigned to
2933 using the syntax <I>name</I>[<I>subscript</I>]=<I>value</I>.  The
2934 <I>subscript</I>
2935
2936 is treated as an arithmetic expression that must evaluate to a number
2937 greater than or equal to zero.  To explicitly declare an indexed array,
2938 use
2939 <B>declare -a </B><I>name</I>
2940
2941 (see
2942 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
2943
2944 </FONT>
2945 below).
2946 <B>declare -a </B><I>name</I>[<I>subscript</I>]
2947
2948 is also accepted; the <I>subscript</I> is ignored.
2949 <P>
2950
2951 Associative arrays are created using
2952 <B>declare -A </B><I>name</I>.
2953
2954 <P>
2955
2956 Attributes may be
2957 specified for an array variable using the
2958 <B>declare</B>
2959
2960 and
2961 <B>readonly</B>
2962
2963 builtins.  Each attribute applies to all members of an array.
2964 <P>
2965
2966 Arrays are assigned to using compound assignments of the form
2967 <I>name</I>=<B>(</B>value<I>1</I> ... value<I>n</I><B>)</B>, where each
2968 <I>value</I> is of the form [<I>subscript</I>]=<I>string</I>.
2969 Indexed array assignments do not require the bracket and subscript.
2970 When assigning to indexed arrays, if the optional brackets and subscript
2971 are supplied, that index is assigned to;
2972 otherwise the index of the element assigned is the last index assigned
2973 to by the statement plus one.  Indexing starts at zero.
2974 <P>
2975
2976 When assigning to an associative array, the subscript is required.
2977 <P>
2978
2979 This syntax is also accepted by the
2980 <B>declare</B>
2981
2982 builtin.  Individual array elements may be assigned to using the
2983 <I>name</I>[<I>subscript</I>]=<I>value</I> syntax introduced above.
2984 <P>
2985
2986 Any element of an array may be referenced using
2987 ${<I>name</I>[<I>subscript</I>]}.  The braces are required to avoid
2988 conflicts with pathname expansion.  If
2989 <I>subscript</I> is <B>@</B> or <B>*</B>, the word expands to
2990 all members of <I>name</I>.  These subscripts differ only when the
2991 word appears within double quotes.  If the word is double-quoted,
2992 ${<I>name</I>[*]} expands to a single
2993 word with the value of each array member separated by the first
2994 character of the
2995 <FONT SIZE=-1><B>IFS</B>
2996
2997 </FONT>
2998 special variable, and ${<I>name</I>[@]} expands each element of
2999 <I>name</I> to a separate word.  When there are no array members,
3000 ${<I>name</I>[@]} expands to nothing.
3001 If the double-quoted expansion occurs within a word, the expansion of
3002 the first parameter is joined with the beginning part of the original
3003 word, and the expansion of the last parameter is joined with the last
3004 part of the original word.
3005 This is analogous to the expansion
3006 of the special parameters <B>*</B> and <B>@</B> (see
3007 <B>Special Parameters</B>
3008
3009 above).  ${#<I>name</I>[<I>subscript</I>]} expands to the length of
3010 ${<I>name</I>[<I>subscript</I>]}.  If <I>subscript</I> is <B>*</B> or
3011 <B>@</B>, the expansion is the number of elements in the array.
3012 Referencing an array variable without a subscript is equivalent to
3013 referencing the array with a subscript of 0.
3014 <P>
3015
3016 An array variable is considered set if a subscript has been assigned a
3017 value.  The null string is a valid value.
3018 <P>
3019
3020 The
3021 <B>unset</B>
3022
3023 builtin is used to destroy arrays.  <B>unset</B> <I>name</I>[<I>subscript</I>]
3024 destroys the array element at index <I>subscript</I>.
3025 Care must be taken to avoid unwanted side effects caused by pathname
3026 expansion.
3027 <B>unset</B> <I>name</I>, where <I>name</I> is an array, or
3028 <B>unset</B> <I>name</I>[<I>subscript</I>], where
3029 <I>subscript</I> is <B>*</B> or <B>@</B>, removes the entire array.
3030 <P>
3031
3032 The
3033 <B>declare</B>,
3034
3035 <B>local</B>,
3036
3037 and
3038 <B>readonly</B>
3039
3040 builtins each accept a
3041 <B>-a</B>
3042
3043 option to specify an indexed array and a
3044 <B>-A</B>
3045
3046 option to specify an associative array.
3047 The
3048 <B>read</B>
3049
3050 builtin accepts a
3051 <B>-a</B>
3052
3053 option to assign a list of words read from the standard input
3054 to an array.  The
3055 <B>set</B>
3056
3057 and
3058 <B>declare</B>
3059
3060 builtins display array values in a way that allows them to be
3061 reused as assignments.
3062 <A NAME="lbAY">&nbsp;</A>
3063 <H3>EXPANSION</H3>
3064
3065 Expansion is performed on the command line after it has been split into
3066 words.  There are seven kinds of expansion performed:
3067 <I>brace expansion</I>,
3068
3069 <I>tilde expansion</I>,
3070
3071 <I>parameter and variable expansion</I>,
3072
3073 <I>command substitution</I>,
3074
3075 <I>arithmetic expansion</I>,
3076
3077 <I>word splitting</I>,
3078
3079 and
3080 <I>pathname expansion</I>.
3081
3082 <P>
3083
3084 The order of expansions is: brace expansion, tilde expansion,
3085 parameter, variable and arithmetic expansion and
3086 command substitution
3087 (done in a left-to-right fashion), word splitting, and pathname
3088 expansion.
3089 <P>
3090
3091 On systems that can support it, there is an additional expansion
3092 available: <I>process substitution</I>.
3093 <P>
3094
3095 Only brace expansion, word splitting, and pathname expansion
3096 can change the number of words of the expansion; other expansions
3097 expand a single word to a single word.
3098 The only exceptions to this are the expansions of
3099 &quot;<B>$@</B>&quot; and &quot;<B>${</B><I>name</I><B>[@]}</B>&quot;
3100 as explained above (see
3101 <FONT SIZE=-1><B>PARAMETERS</B>).
3102
3103 </FONT>
3104 <A NAME="lbAZ">&nbsp;</A>
3105 <H4>Brace Expansion</H4>
3106
3107 <P>
3108
3109 <I>Brace expansion</I>
3110
3111 is a mechanism by which arbitrary strings
3112 may be generated.  This mechanism is similar to
3113 <I>pathname expansion</I>, but the filenames generated
3114 need not exist.  Patterns to be brace expanded take
3115 the form of an optional
3116 <I>preamble</I>,
3117
3118 followed by either a series of comma-separated strings or
3119 a sequence expression between a pair of braces, followed by
3120 an optional
3121 <I>postscript</I>.
3122
3123 The preamble is prefixed to each string contained
3124 within the braces, and the postscript is then appended
3125 to each resulting string, expanding left to right.
3126 <P>
3127
3128 Brace expansions may be nested.  The results of each expanded
3129 string are not sorted; left to right order is preserved.
3130 For example, a<B>{</B>d,c,b<B>}</B>e expands into `ade ace abe'.
3131 <P>
3132
3133 A sequence expression takes the form
3134 <B>{</B><I>x</I><B>..</B><I>y</I><B>[..</B><I>incr</I><B>]}</B>,
3135 where <I>x</I> and <I>y</I> are either integers or single characters,
3136 and <I>incr</I>, an optional increment, is an integer.
3137 When integers are supplied, the expression expands to each number between
3138 <I>x</I> and <I>y</I>, inclusive.
3139 Supplied integers may be prefixed with <I>0</I> to force each term to have the
3140 same width.  When either <I>x</I> or y begins with a zero, the shell
3141 attempts to force all generated terms to contain the same number of digits,
3142 zero-padding where necessary.
3143 When characters are supplied, the expression expands to each character
3144 lexicographically between <I>x</I> and <I>y</I>, inclusive.  Note that
3145 both <I>x</I> and <I>y</I> must be of the same type.
3146 When the increment is supplied, it is used as the difference between
3147 each term.  The default increment is 1 or -1 as appropriate.
3148 <P>
3149
3150 Brace expansion is performed before any other expansions,
3151 and any characters special to other expansions are preserved
3152 in the result.  It is strictly textual.
3153 <B>Bash</B>
3154
3155 does not apply any syntactic interpretation to the context of the
3156 expansion or the text between the braces.
3157 <P>
3158
3159 A correctly-formed brace expansion must contain unquoted opening
3160 and closing braces, and at least one unquoted comma or a valid
3161 sequence expression.
3162 Any incorrectly formed brace expansion is left unchanged.
3163 A <B>{</B> or <B>,</B> may be quoted with a backslash to prevent its
3164 being considered part of a brace expression.
3165 To avoid conflicts with parameter expansion, the string <B>${</B>
3166 is not considered eligible for brace expansion.
3167 <P>
3168
3169 This construct is typically used as shorthand when the common
3170 prefix of the strings to be generated is longer than in the
3171 above example:
3172 <DL COMPACT><DT><DD>
3173 <P>
3174
3175 mkdir /usr/local/src/bash/{old,new,dist,bugs}
3176 </DL>
3177
3178 or
3179 <DL COMPACT><DT><DD>
3180 chown root /usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}}
3181 </DL>
3182
3183 <P>
3184
3185 Brace expansion introduces a slight incompatibility with
3186 historical versions of
3187 <B>sh</B>.
3188
3189 <B>sh</B>
3190
3191 does not treat opening or closing braces specially when they
3192 appear as part of a word, and preserves them in the output.
3193 <B>Bash</B>
3194
3195 removes braces from words as a consequence of brace
3196 expansion.  For example, a word entered to
3197 <B>sh</B>
3198
3199 as <I>file{1,2}</I>
3200 appears identically in the output.  The same word is
3201 output as
3202 <I>file1 file2</I>
3203
3204 after expansion by
3205 <B>bash</B>.
3206
3207 If strict compatibility with
3208 <B>sh</B>
3209
3210 is desired, start
3211 <B>bash</B>
3212
3213 with the
3214 <B>+B </B>
3215
3216 option or disable brace expansion with the
3217 <B>+B</B>
3218
3219 option to the
3220 <B>set</B>
3221
3222 command (see
3223 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
3224
3225 </FONT>
3226 below).
3227 <A NAME="lbBA">&nbsp;</A>
3228 <H4>Tilde Expansion</H4>
3229
3230 <P>
3231
3232 If a word begins with an unquoted tilde character (`<B>~</B>'), all of
3233 the characters preceding the first unquoted slash (or all characters,
3234 if there is no unquoted slash) are considered a <I>tilde-prefix</I>.
3235 If none of the characters in the tilde-prefix are quoted, the
3236 characters in the tilde-prefix following the tilde are treated as a
3237 possible <I>login name</I>.
3238 If this login name is the null string, the tilde is replaced with the
3239 value of the shell parameter
3240 <FONT SIZE=-1><B>HOME</B>.
3241
3242 </FONT>
3243 If
3244 <FONT SIZE=-1><B>HOME</B>
3245
3246 </FONT>
3247 is unset, the home directory of the user executing the shell is
3248 substituted instead.
3249 Otherwise, the tilde-prefix is replaced with the home directory
3250 associated with the specified login name.
3251 <P>
3252
3253 If the tilde-prefix is a `~+', the value of the shell variable
3254 <FONT SIZE=-1><B>PWD</B>
3255
3256 </FONT>
3257 replaces the tilde-prefix.
3258 If the tilde-prefix is a `~-', the value of the shell variable
3259 <FONT SIZE=-1><B>OLDPWD</B>,
3260
3261 </FONT>
3262 if it is set, is substituted.
3263 If the characters following the tilde in the tilde-prefix consist
3264 of a number <I>N</I>, optionally prefixed
3265 by a `+' or a `-', the tilde-prefix is replaced with the corresponding
3266 element from the directory stack, as it would be displayed by the
3267 <B>dirs</B>
3268
3269 builtin invoked with the tilde-prefix as an argument.
3270 If the characters following the tilde in the tilde-prefix consist of a
3271 number without a leading `+' or `-', `+' is assumed.
3272 <P>
3273
3274 If the login name is invalid, or the tilde expansion fails, the word
3275 is unchanged.
3276 <P>
3277
3278 Each variable assignment is checked for unquoted tilde-prefixes immediately
3279 following a
3280 <B>:</B>
3281
3282 or the first
3283 <B>=</B>.
3284
3285 In these cases, tilde expansion is also performed.
3286 Consequently, one may use file names with tildes in assignments to
3287 <FONT SIZE=-1><B>PATH</B>,
3288
3289 </FONT>
3290 <FONT SIZE=-1><B>MAILPATH</B>,
3291
3292 </FONT>
3293 and
3294 <FONT SIZE=-1><B>CDPATH</B>,
3295
3296 </FONT>
3297 and the shell assigns the expanded value.
3298 <A NAME="lbBB">&nbsp;</A>
3299 <H4>Parameter Expansion</H4>
3300
3301 <P>
3302
3303 The `<B>$</B>' character introduces parameter expansion,
3304 command substitution, or arithmetic expansion.  The parameter name
3305 or symbol to be expanded may be enclosed in braces, which
3306 are optional but serve to protect the variable to be expanded from
3307 characters immediately following it which could be
3308 interpreted as part of the name.
3309 <P>
3310
3311 When braces are used, the matching ending brace is the first `<B>}</B>'
3312 not escaped by a backslash or within a quoted string, and not within an
3313 embedded arithmetic expansion, command substitution, or parameter
3314 expansion.
3315 <P>
3316
3317
3318 <DL COMPACT>
3319 <DT>${<I>parameter</I>}<DD>
3320 The value of <I>parameter</I> is substituted.  The braces are required
3321 when
3322 <I>parameter</I>
3323
3324 is a positional parameter with more than one digit,
3325 or when
3326 <I>parameter</I>
3327
3328 is followed by a character which is not to be
3329 interpreted as part of its name.
3330
3331 </DL>
3332 <P>
3333
3334 If the first character of <I>parameter</I> is an exclamation point (<B>!</B>),
3335 a level of variable indirection is introduced.
3336 <B>Bash</B> uses the value of the variable formed from the rest of
3337 <I>parameter</I> as the name of the variable; this variable is then
3338 expanded and that value is used in the rest of the substitution, rather
3339 than the value of <I>parameter</I> itself.
3340 This is known as <I>indirect expansion</I>.
3341 The exceptions to this are the expansions of ${!<I>prefix</I>*} and
3342 ${<B>!</B><I>name</I>[<I>@</I>]} described below.
3343 The exclamation point must immediately follow the left brace in order to
3344 introduce indirection.
3345 <P>
3346
3347 In each of the cases below, <I>word</I> is subject to tilde expansion,
3348 parameter expansion, command substitution, and arithmetic expansion.
3349 <P>
3350
3351 When not performing substring expansion, using the forms documented below,
3352 <B>bash</B> tests for a parameter that is unset or null.  Omitting the colon
3353 results in a test only for a parameter that is unset.
3354 <P>
3355
3356
3357 <DL COMPACT>
3358 <DT>${<I>parameter</I><B>:-</B><I>word</I>}<DD>
3359 <B>Use Default Values</B>.  If
3360 <I>parameter</I>
3361
3362 is unset or null, the expansion of
3363 <I>word</I>
3364
3365 is substituted.  Otherwise, the value of
3366 <I>parameter</I>
3367
3368 is substituted.
3369 <DT>${<I>parameter</I><B>:=</B><I>word</I>}<DD>
3370 <B>Assign Default Values</B>.
3371 If
3372 <I>parameter</I>
3373
3374 is unset or null, the expansion of
3375 <I>word</I>
3376
3377 is assigned to
3378 <I>parameter</I>.
3379
3380 The value of
3381 <I>parameter</I>
3382
3383 is then substituted.  Positional parameters and special parameters may
3384 not be assigned to in this way.
3385 <DT>${<I>parameter</I><B>:?</B><I>word</I>}<DD>
3386 <B>Display Error if Null or Unset</B>.
3387 If
3388 <I>parameter</I>
3389
3390 is null or unset, the expansion of <I>word</I> (or a message to that effect
3391 if
3392 <I>word</I>
3393
3394 is not present) is written to the standard error and the shell, if it
3395 is not interactive, exits.  Otherwise, the value of <I>parameter</I> is
3396 substituted.
3397 <DT>${<I>parameter</I><B>:+</B><I>word</I>}<DD>
3398 <B>Use Alternate Value</B>.
3399 If
3400 <I>parameter</I>
3401
3402 is null or unset, nothing is substituted, otherwise the expansion of
3403 <I>word</I>
3404
3405 is substituted.
3406 <DT>${<I>parameter</I><B>:</B><I>offset</I>}<DD>
3407
3408 <DT>${<I>parameter</I><B>:</B><I>offset</I><B>:</B><I>length</I>}<DD>
3409
3410 <B>Substring Expansion.</B>
3411 Expands to up to <I>length</I> characters of <I>parameter</I>
3412 starting at the character specified by <I>offset</I>.
3413 If <I>length</I> is omitted, expands to the substring of
3414 <I>parameter</I> starting at the character specified by <I>offset</I>.
3415 <I>length</I> and <I>offset</I> are arithmetic expressions (see
3416 <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>
3417
3418 </FONT>
3419 below).
3420 <I>length</I> must evaluate to a number greater than or equal to zero.
3421 If <I>offset</I> evaluates to a number less than zero, the value
3422 is used as an offset from the end of the value of <I>parameter</I>.
3423 If <I>parameter</I> is <B>@</B>, the result is <I>length</I> positional
3424 parameters beginning at <I>offset</I>.
3425 If <I>parameter</I> is an indexed array name subscripted by @ or *,
3426 the result is the <I>length</I>
3427 members of the array beginning with ${<I>parameter</I>[<I>offset</I>]}.
3428 A negative <I>offset</I> is taken relative to one greater than the maximum
3429 index of the specified array.
3430 Substring expansion applied to an associative array produces undefined
3431 results.
3432 Note that a negative offset must be separated from the colon by at least
3433 one space to avoid being confused with the :- expansion.
3434 Substring indexing is zero-based unless the positional parameters 
3435 are used, in which case the indexing starts at 1 by default.
3436 If <I>offset</I> is 0, and the positional parameters are used, <B>$0</B> is
3437 prefixed to the list.
3438 <DT>${<B>!</B><I>prefix</I><B>*</B>}<DD>
3439
3440 <DT>${<B>!</B><I>prefix</I><B>@</B>}<DD>
3441
3442 <B>Names matching prefix.</B>
3443 Expands to the names of variables whose names begin with <I>prefix</I>,
3444 separated by the first character of the
3445 <FONT SIZE=-1><B>IFS</B>
3446
3447 </FONT>
3448 special variable.
3449 When <I>@</I> is used and the expansion appears within double quotes, each
3450 variable name expands to a separate word.
3451 <DT>${<B>!</B><I>name</I>[<I>@</I>]}<DD>
3452
3453 <DT>${<B>!</B><I>name</I>[<I>*</I>]}<DD>
3454
3455 <B>List of array keys.</B>
3456 If <I>name</I> is an array variable, expands to the list of array indices
3457 (keys) assigned in <I>name</I>.
3458 If <I>name</I> is not an array, expands to 0 if <I>name</I> is set and null
3459 otherwise.
3460 When <I>@</I> is used and the expansion appears within double quotes, each
3461 key expands to a separate word.
3462 <DT>${<B>#</B><I>parameter</I>}<DD>
3463 <B>Parameter length.</B>
3464 The length in characters of the value of <I>parameter</I> is substituted.
3465 If
3466 <I>parameter</I>
3467
3468 is
3469 <B>*</B>
3470
3471 or 
3472 <B>@</B>,
3473
3474 the value substituted is the number of positional parameters.
3475 If
3476 <I>parameter</I>
3477
3478 is an array name subscripted by
3479 <B>*</B>
3480
3481 or
3482 <B>@</B>,
3483
3484 the value substituted is the number of elements in the array.
3485 <DT>${<I>parameter</I><B>#</B><I>word</I>}<DD>
3486
3487 <DT>${<I>parameter</I><B>##</B><I>word</I>}<DD>
3488
3489 <B>Remove matching prefix pattern.</B>
3490 The 
3491 <I>word</I>
3492
3493 is expanded to produce a pattern just as in pathname
3494 expansion.  If the pattern matches the beginning of
3495 the value of
3496 <I>parameter</I>,
3497
3498 then the result of the expansion is the expanded value of
3499 <I>parameter</I>
3500
3501 with the shortest matching pattern (the ``<B>#</B>'' case) or the
3502 longest matching pattern (the ``<B>##</B>'' case) deleted.
3503 If
3504 <I>parameter</I>
3505
3506 is
3507 <B>@</B>
3508
3509 or
3510 <B>*</B>,
3511
3512 the pattern removal operation is applied to each positional
3513 parameter in turn, and the expansion is the resultant list.
3514 If
3515 <I>parameter</I>
3516
3517 is an array variable subscripted with
3518 <B>@</B>
3519
3520 or
3521 <B>*</B>,
3522
3523 the pattern removal operation is applied to each member of the
3524 array in turn, and the expansion is the resultant list.
3525 <DT>${<I>parameter</I><B>%</B><I>word</I>}<DD>
3526
3527 <DT>${<I>parameter</I><B>%%</B><I>word</I>}<DD>
3528
3529 <B>Remove matching suffix pattern.</B>
3530 The <I>word</I> is expanded to produce a pattern just as in
3531 pathname expansion.
3532 If the pattern matches a trailing portion of the expanded value of
3533 <I>parameter</I>,
3534
3535 then the result of the expansion is the expanded value of
3536 <I>parameter</I>
3537
3538 with the shortest matching pattern (the ``<B>%</B>'' case) or the
3539 longest matching pattern (the ``<B>%%</B>'' case) deleted.
3540 If
3541 <I>parameter</I>
3542
3543 is
3544 <B>@</B>
3545
3546 or
3547 <B>*</B>,
3548
3549 the pattern removal operation is applied to each positional
3550 parameter in turn, and the expansion is the resultant list.
3551 If
3552 <I>parameter</I>
3553
3554 is an array variable subscripted with
3555 <B>@</B>
3556
3557 or
3558 <B>*</B>,
3559
3560 the pattern removal operation is applied to each member of the
3561 array in turn, and the expansion is the resultant list.
3562 <DT>${<I>parameter</I><B>/</B><I>pattern</I><B>/</B><I>string</I>}<DD>
3563 <B>Pattern substitution.</B>
3564 The <I>pattern</I> is expanded to produce a pattern just as in
3565 pathname expansion.
3566 <I>Parameter</I> is expanded and the longest match of <I>pattern</I>
3567 against its value is replaced with <I>string</I>.
3568 If <I>pattern</I> begins with <B>/</B>, all matches of <I>pattern</I> are
3569 replaced with <I>string</I>.  Normally only the first match is replaced.
3570 If <I>pattern</I> begins with <B>#</B>, it must match at the beginning
3571 of the expanded value of <I>parameter</I>.
3572 If <I>pattern</I> begins with <B>%</B>, it must match at the end
3573 of the expanded value of <I>parameter</I>.
3574 If <I>string</I> is null, matches of <I>pattern</I> are deleted
3575 and the <B>/</B> following <I>pattern</I> may be omitted.
3576 If
3577 <I>parameter</I>
3578
3579 is
3580 <B>@</B>
3581
3582 or
3583 <B>*</B>,
3584
3585 the substitution operation is applied to each positional
3586 parameter in turn, and the expansion is the resultant list.
3587 If
3588 <I>parameter</I>
3589
3590 is an array variable subscripted with
3591 <B>@</B>
3592
3593 or
3594 <B>*</B>,
3595
3596 the substitution operation is applied to each member of the
3597 array in turn, and the expansion is the resultant list.
3598 <DT>${<I>parameter</I><B>^</B><I>pattern</I>}<DD>
3599
3600 <DT>${<I>parameter</I><B>^^</B><I>pattern</I>}<DD>
3601 <DT>${<I>parameter</I><B>,</B><I>pattern</I>}<DD>
3602 <DT>${<I>parameter</I><B>,,</B><I>pattern</I>}<DD>
3603
3604 <B>Case modification.</B>
3605 This expansion modifies the case of alphabetic characters in <I>parameter</I>.
3606 The <I>pattern</I> is expanded to produce a pattern just as in
3607 pathname expansion.
3608 The <B>^</B> operator converts lowercase letters matching <I>pattern</I>
3609 to uppercase; the <B>,</B> operator converts matching uppercase letters
3610 to lowercase.
3611 The <B>^^</B> and <B>,,</B> expansions convert each matched character in the
3612 expanded value; the <B>^</B> and <B>,</B> expansions match and convert only
3613 the first character in the expanded value..
3614 If <I>pattern</I> is omitted, it is treated like a <B>?</B>, which matches
3615 every character.
3616 If
3617 <I>parameter</I>
3618
3619 is
3620 <B>@</B>
3621
3622 or
3623 <B>*</B>,
3624
3625 the case modification operation is applied to each positional
3626 parameter in turn, and the expansion is the resultant list.
3627 If
3628 <I>parameter</I>
3629
3630 is an array variable subscripted with
3631 <B>@</B>
3632
3633 or
3634 <B>*</B>,
3635
3636 the case modification operation is applied to each member of the
3637 array in turn, and the expansion is the resultant list.
3638 </DL>
3639 <A NAME="lbBC">&nbsp;</A>
3640 <H4>Command Substitution</H4>
3641
3642 <P>
3643
3644 <I>Command substitution</I> allows the output of a command to replace
3645 the command name.  There are two forms:
3646 <P>
3647
3648 <DL COMPACT><DT><DD>
3649 <P>
3650
3651 <B>$(</B><I>command</I><B>)</B>
3652 </DL>
3653
3654 or
3655 <DL COMPACT><DT><DD>
3656 <B>`</B><I>command</I><B>`</B>
3657 </DL>
3658
3659 <P>
3660
3661 <B>Bash</B>
3662
3663 performs the expansion by executing <I>command</I> and
3664 replacing the command substitution with the standard output of the
3665 command, with any trailing newlines deleted.
3666 Embedded newlines are not deleted, but they may be removed during
3667 word splitting.
3668 The command substitution <B>$(cat </B><I>file</I>) can be replaced by
3669 the equivalent but faster <B>$(&lt; </B><I>file</I>).
3670 <P>
3671
3672 When the old-style backquote form of substitution is used,
3673 backslash retains its literal meaning except when followed by
3674 <B>$</B>,
3675
3676 <B>`</B>,
3677
3678 or
3679 <B>\</B>.
3680
3681 The first backquote not preceded by a backslash terminates the
3682 command substitution.
3683 When using the $(<I>command</I>) form, all characters between the
3684 parentheses make up the command; none are treated specially.
3685 <P>
3686
3687 Command substitutions may be nested.  To nest when using the backquoted form,
3688 escape the inner backquotes with backslashes.
3689 <P>
3690
3691 If the substitution appears within double quotes, word splitting and
3692 pathname expansion are not performed on the results.
3693 <A NAME="lbBD">&nbsp;</A>
3694 <H4>Arithmetic Expansion</H4>
3695
3696 <P>
3697
3698 Arithmetic expansion allows the evaluation of an arithmetic expression
3699 and the substitution of the result.  The format for arithmetic expansion is:
3700 <DL COMPACT><DT><DD>
3701 <P>
3702
3703 <B>$((</B><I>expression</I><B>))</B>
3704 </DL>
3705
3706 <P>
3707
3708 The
3709 <I>expression</I>
3710
3711 is treated as if it were within double quotes, but a double quote
3712 inside the parentheses is not treated specially.
3713 All tokens in the expression undergo parameter expansion, string
3714 expansion, command substitution, and quote removal.
3715 Arithmetic expansions may be nested.
3716 <P>
3717
3718 The evaluation is performed according to the rules listed below under
3719 <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>.
3720
3721 </FONT>
3722 If
3723 <I>expression</I>
3724
3725 is invalid,
3726 <B>bash</B>
3727
3728 prints a message indicating failure and no substitution occurs.
3729 <A NAME="lbBE">&nbsp;</A>
3730 <H4>Process Substitution</H4>
3731
3732 <P>
3733
3734 <I>Process substitution</I> is supported on systems that support named
3735 pipes (<I>FIFOs</I>) or the <B>/dev/fd</B> method of naming open files.
3736 It takes the form of
3737 <B>&lt;(</B><I>list</I><B>)</B>
3738 or
3739 <B>&gt;(</B><I>list</I><B>)</B>.
3740 The process <I>list</I> is run with its input or output connected to a
3741 <I>FIFO</I> or some file in <B>/dev/fd</B>.  The name of this file is
3742 passed as an argument to the current command as the result of the
3743 expansion.  If the <B>&gt;(</B><I>list</I><B>)</B> form is used, writing to
3744 the file will provide input for <I>list</I>.  If the
3745 <B>&lt;(</B><I>list</I><B>)</B> form is used, the file passed as an
3746 argument should be read to obtain the output of <I>list</I>.
3747 <P>
3748
3749 When available, process substitution is performed
3750 simultaneously with parameter and variable expansion, 
3751 command substitution,
3752 and arithmetic expansion.
3753 <A NAME="lbBF">&nbsp;</A>
3754 <H4>Word Splitting</H4>
3755
3756 <P>
3757
3758 The shell scans the results of
3759 parameter expansion,
3760 command substitution,
3761 and
3762 arithmetic expansion
3763 that did not occur within double quotes for
3764 <I>word splitting</I>.
3765
3766 <P>
3767
3768 The shell treats each character of
3769 <FONT SIZE=-1><B>IFS</B>
3770
3771 </FONT>
3772 as a delimiter, and splits the results of the other
3773 expansions into words on these characters.  If
3774 <FONT SIZE=-1><B>IFS</B>
3775
3776 </FONT>
3777 is unset, or its
3778 value is exactly
3779 <B>&lt;space&gt;&lt;tab&gt;&lt;newline&gt;</B>,
3780
3781 the default, then
3782 sequences of
3783 <B>&lt;space&gt;</B>,
3784
3785 <B>&lt;tab&gt;</B>,
3786
3787 and
3788 <B>&lt;newline&gt;</B>
3789
3790 at the beginning and end of the results of the previous
3791 expansions are ignored, and
3792 any sequence of
3793 <FONT SIZE=-1><B>IFS</B>
3794
3795 </FONT>
3796 characters not at the beginning or end serves to delimit words.
3797 If
3798 <FONT SIZE=-1><B>IFS</B>
3799
3800 </FONT>
3801 has a value other than the default, then sequences of
3802 the whitespace characters
3803 <B>space</B>
3804
3805 and
3806 <B>tab</B>
3807
3808 are ignored at the beginning and end of the
3809 word, as long as the whitespace character is in the
3810 value of
3811 <FONT SIZE=-1><B>IFS</B>
3812
3813 </FONT>
3814 (an
3815 <FONT SIZE=-1><B>IFS</B>
3816
3817 </FONT>
3818 whitespace character).
3819 Any character in
3820 <FONT SIZE=-1><B>IFS</B>
3821
3822 </FONT>
3823 that is not
3824 <FONT SIZE=-1><B>IFS</B>
3825
3826 </FONT>
3827 whitespace, along with any adjacent
3828 <FONT SIZE=-1><B>IFS</B>
3829
3830 </FONT>
3831 whitespace characters, delimits a field.
3832 A sequence of
3833 <FONT SIZE=-1><B>IFS</B>
3834
3835 </FONT>
3836 whitespace characters is also treated as a delimiter.
3837 If the value of
3838 <FONT SIZE=-1><B>IFS</B>
3839
3840 </FONT>
3841 is null, no word splitting occurs.
3842 <P>
3843
3844 Explicit null arguments (<B>&quot;&quot;</B> or <B>aqaq</B>) are retained.
3845 Unquoted implicit null arguments, resulting from the expansion of
3846 parameters that have no values, are removed.
3847 If a parameter with no value is expanded within double quotes, a
3848 null argument results and is retained.
3849 <P>
3850
3851 Note that if no expansion occurs, no splitting
3852 is performed.
3853 <A NAME="lbBG">&nbsp;</A>
3854 <H4>Pathname Expansion</H4>
3855
3856 <P>
3857
3858 After word splitting,
3859 unless the
3860 <B>-f</B>
3861
3862 option has been set,
3863 <B>bash</B>
3864
3865 scans each word for the characters
3866 <B>*</B>,
3867
3868 <B>?</B>,
3869
3870 and
3871 <B>[</B>.
3872
3873 If one of these characters appears, then the word is
3874 regarded as a
3875 <I>pattern</I>,
3876
3877 and replaced with an alphabetically sorted list of
3878 file names matching the pattern.
3879 If no matching file names are found,
3880 and the shell option
3881 <B>nullglob</B>
3882
3883 is not enabled, the word is left unchanged.
3884 If the 
3885 <B>nullglob</B>
3886
3887 option is set, and no matches are found,
3888 the word is removed.
3889 If the
3890 <B>failglob</B>
3891
3892 shell option is set, and no matches are found, an error message
3893 is printed and the command is not executed.
3894 If the shell option
3895 <B>nocaseglob</B>
3896
3897 is enabled, the match is performed without regard to the case
3898 of alphabetic characters.
3899 When a pattern is used for pathname expansion,
3900 the character
3901 <B>``.''</B>
3902
3903 at the start of a name or immediately following a slash
3904 must be matched explicitly, unless the shell option
3905 <B>dotglob</B>
3906
3907 is set.
3908 When matching a pathname, the slash character must always be
3909 matched explicitly.
3910 In other cases, the
3911 <B>``.''</B>
3912
3913 character is not treated specially.
3914 See the description of
3915 <B>shopt</B>
3916
3917 below under
3918 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
3919
3920 </FONT>
3921 for a description of the
3922 <B>nocaseglob</B>,
3923
3924 <B>nullglob</B>,
3925
3926 <B>failglob</B>,
3927
3928 and
3929 <B>dotglob</B>
3930
3931 shell options.
3932 <P>
3933
3934 The
3935 <FONT SIZE=-1><B>GLOBIGNORE</B>
3936
3937 </FONT>
3938 shell variable may be used to restrict the set of file names matching a
3939 <I>pattern</I>.
3940
3941 If
3942 <FONT SIZE=-1><B>GLOBIGNORE</B>
3943
3944 </FONT>
3945 is set, each matching file name that also matches one of the patterns in
3946 <FONT SIZE=-1><B>GLOBIGNORE</B>
3947
3948 </FONT>
3949 is removed from the list of matches.
3950 The file names
3951 <B>``.''</B>
3952
3953 and
3954 <B>``..''</B>
3955
3956 are always ignored when
3957 <FONT SIZE=-1><B>GLOBIGNORE</B>
3958
3959 </FONT>
3960 is set and not null.  However, setting
3961 <FONT SIZE=-1><B>GLOBIGNORE</B>
3962
3963 </FONT>
3964 to a non-null value has the effect of enabling the
3965 <B>dotglob</B>
3966
3967 shell option, so all other file names beginning with a
3968 <B>``.''</B>
3969
3970 will match.
3971 To get the old behavior of ignoring file names beginning with a
3972 <B>``.''</B>,
3973
3974 make
3975 <B>``.*''</B>
3976
3977 one of the patterns in
3978 <FONT SIZE=-1><B>GLOBIGNORE</B>.
3979
3980 </FONT>
3981 The
3982 <B>dotglob</B>
3983
3984 option is disabled when
3985 <FONT SIZE=-1><B>GLOBIGNORE</B>
3986
3987 </FONT>
3988 is unset.
3989 <P>
3990
3991 <B>Pattern Matching</B>
3992 <P>
3993
3994 Any character that appears in a pattern, other than the special pattern
3995 characters described below, matches itself.  The NUL character may not
3996 occur in a pattern.  A backslash escapes the following character; the
3997 escaping backslash is discarded when matching.
3998 The special pattern characters must be quoted if
3999 they are to be matched literally.
4000 <P>
4001
4002 The special pattern characters have the following meanings:
4003 <P>
4004
4005
4006 <DL COMPACT>
4007 <DT><B>*</B>
4008
4009 <DD>
4010 Matches any string, including the null string.
4011 When the <B>globstar</B> shell option is enabled, and <B>*</B> is used in
4012 a pathname expansion context, two adjacent <B>*</B>s used as a single
4013 pattern will match all files and zero or more directories and
4014 subdirectories.
4015 If followed by a <B>/</B>, two adjacent <B>*</B>s will match only directories
4016 and subdirectories.
4017 <DT><B>?</B>
4018
4019 <DD>
4020 Matches any single character.
4021 <DT><B>[...]</B>
4022
4023 <DD>
4024 Matches any one of the enclosed characters.  A pair of characters
4025 separated by a hyphen denotes a
4026 <I>range expression</I>;
4027 any character that sorts between those two characters, inclusive,
4028 using the current locale's collating sequence and character set,
4029 is matched.  If the first character following the
4030 <B>[</B>
4031
4032 is a
4033 <B>!</B>
4034
4035 or a
4036 <B>^</B>
4037
4038 then any character not enclosed is matched.
4039 The sorting order of characters in range expressions is determined by
4040 the current locale and the value of the
4041 <FONT SIZE=-1><B>LC_COLLATE</B>
4042
4043 </FONT>
4044 shell variable,
4045 if set.
4046
4047 <B>-</B>
4048
4049 may be matched by including it as the first or last character
4050 in the set.
4051 A
4052 <B>]</B>
4053
4054 may be matched by including it as the first character
4055 in the set.
4056 <BR>
4057
4058 <P>
4059
4060
4061 Within
4062 <B>[</B>
4063
4064 and
4065 <B>]</B>,
4066
4067 <I>character classes</I> can be specified using the syntax
4068 <B>[:</B><I>class</I><B>:]</B>, where <I>class</I> is one of the
4069 following classes defined in the POSIX standard:
4070 </DL>
4071 <P>
4072
4073 <DL COMPACT><DT><DD>
4074 <B>
4075 </B>
4076
4077 alnum   alpha   ascii   blank   cntrl   digit   graph   lower   print   punct   space   upper   word   xdigit
4078 <BR>
4079
4080 A character class matches any character belonging to that class.
4081 The <B>word</B> character class matches letters, digits, and the character _.
4082 <BR>
4083
4084 <P>
4085
4086
4087 Within
4088 <B>[</B>
4089
4090 and 
4091 <B>]</B>,
4092
4093 an <I>equivalence class</I> can be specified using the syntax
4094 <B>[=</B><I>c</I><B>=]</B>, which matches all characters with the
4095 same collation weight (as defined by the current locale) as
4096 the character <I>c</I>.
4097 <BR>
4098
4099 <P>
4100
4101
4102 Within
4103 <B>[</B>
4104
4105 and 
4106 <B>]</B>,
4107
4108 the syntax <B>[.</B><I>symbol</I><B>.]</B> matches the collating symbol
4109 <I>symbol</I>.
4110 </DL>
4111
4112
4113 <P>
4114
4115 If the <B>extglob</B> shell option is enabled using the <B>shopt</B>
4116 builtin, several extended pattern matching operators are recognized.
4117 In the following description, a <I>pattern-list</I> is a list of one
4118 or more patterns separated by a <B>|</B>.
4119 Composite patterns may be formed using one or more of the following
4120 sub-patterns:
4121 <P>
4122
4123 <DL COMPACT><DT><DD>
4124 <DL COMPACT>
4125 <DT><B>?(</B><I>pattern-list</I><B>)</B><DD>
4126 Matches zero or one occurrence of the given patterns
4127 <DT><B>*(</B><I>pattern-list</I><B>)</B><DD>
4128 Matches zero or more occurrences of the given patterns
4129 <DT><B>+(</B><I>pattern-list</I><B>)</B><DD>
4130 Matches one or more occurrences of the given patterns
4131 <DT><B>@(</B><I>pattern-list</I><B>)</B><DD>
4132 Matches one of the given patterns
4133 <DT><B>!(</B><I>pattern-list</I><B>)</B><DD>
4134 Matches anything except one of the given patterns
4135 </DL></DL>
4136
4137
4138 <A NAME="lbBH">&nbsp;</A>
4139 <H4>Quote Removal</H4>
4140
4141 <P>
4142
4143 After the preceding expansions, all unquoted occurrences of the
4144 characters
4145 <B>\</B>,
4146
4147 <B>aq</B>,
4148
4149 and <B>&quot;</B> that did not result from one of the above
4150 expansions are removed.
4151 <A NAME="lbBI">&nbsp;</A>
4152 <H3>REDIRECTION</H3>
4153
4154 Before a command is executed, its input and output
4155 may be
4156 <I>redirected</I>
4157
4158 using a special notation interpreted by the shell.
4159 Redirection may also be used to open and close files for the
4160 current shell execution environment.  The following redirection
4161 operators may precede or appear anywhere within a
4162 <I>simple command</I>
4163
4164 or may follow a
4165 <I>command</I>.
4166
4167 Redirections are processed in the order they appear, from
4168 left to right.
4169 <P>
4170
4171 Each redirection that may be preceded by a file descriptor number
4172 may instead be preceded by a word of the form {<I>varname</I>}.
4173 In this case, for each redirection operator except
4174 &gt;&amp;- and &lt;&amp;-, the shell will allocate a file descriptor greater
4175 than 10 and assign it to <I>varname</I>.  If &gt;&amp;- or &lt;&amp;- is preceded
4176 by {<I>varname</I>}, the value of <I>varname</I> defines the file
4177 descriptor to close.
4178 <P>
4179
4180 In the following descriptions, if the file descriptor number is
4181 omitted, and the first character of the redirection operator is
4182 <B>&lt;</B>,
4183
4184 the redirection refers to the standard input (file descriptor
4185 0).  If the first character of the redirection operator is
4186 <B>&gt;</B>,
4187
4188 the redirection refers to the standard output (file descriptor
4189 1).
4190 <P>
4191
4192 The word following the redirection operator in the following
4193 descriptions, unless otherwise noted, is subjected to brace expansion,
4194 tilde expansion, parameter expansion, command substitution, arithmetic
4195 expansion, quote removal, pathname expansion, and word splitting.
4196 If it expands to more than one word,
4197 <B>bash</B>
4198
4199 reports an error.
4200 <P>
4201
4202 Note that the order of redirections is significant.  For example, 
4203 the command
4204 <DL COMPACT><DT><DD>
4205 <P>
4206
4207 ls <B>&gt;</B> dirlist 2<B>&gt;&amp;</B>1
4208 </DL>
4209
4210 <P>
4211
4212 directs both standard output and standard error to the file 
4213 <I>dirlist</I>,
4214
4215 while the command
4216 <DL COMPACT><DT><DD>
4217 <P>
4218
4219 ls 2<B>&gt;&amp;</B>1 <B>&gt;</B> dirlist
4220 </DL>
4221
4222 <P>
4223
4224 directs only the standard output to file
4225 <I>dirlist</I>,
4226
4227 because the standard error was duplicated from the standard output
4228 before the standard output was redirected to
4229 <I>dirlist</I>.
4230
4231 <P>
4232
4233 <B>Bash</B> handles several filenames specially when they are used in
4234 redirections, as described in the following table:
4235 <DL COMPACT><DT><DD>
4236 <P>
4237
4238
4239 <DL COMPACT>
4240 <DT><B>/dev/fd/</B><I>fd</I>
4241
4242 <DD>
4243 If <I>fd</I> is a valid integer, file descriptor <I>fd</I> is duplicated.
4244 <DT><B>/dev/stdin</B>
4245
4246 <DD>
4247 File descriptor 0 is duplicated.
4248 <DT><B>/dev/stdout</B>
4249
4250 <DD>
4251 File descriptor 1 is duplicated.
4252 <DT><B>/dev/stderr</B>
4253
4254 <DD>
4255 File descriptor 2 is duplicated.
4256 <DT><B>/dev/tcp/</B><I>host</I>/<I>port</I>
4257
4258 <DD>
4259 If <I>host</I> is a valid hostname or Internet address, and <I>port</I>
4260 is an integer port number or service name, <B>bash</B> attempts to open
4261 a TCP connection to the corresponding socket.
4262 <DT><B>/dev/udp/</B><I>host</I>/<I>port</I>
4263
4264 <DD>
4265 If <I>host</I> is a valid hostname or Internet address, and <I>port</I>
4266 is an integer port number or service name, <B>bash</B> attempts to open
4267 a UDP connection to the corresponding socket.
4268
4269 </DL></DL>
4270
4271 <P>
4272
4273 A failure to open or create a file causes the redirection to fail.
4274 <P>
4275
4276 Redirections using file descriptors greater than 9 should be used with
4277 care, as they may conflict with file descriptors the shell uses
4278 internally.
4279 <A NAME="lbBJ">&nbsp;</A>
4280 <H4>Redirecting Input</H4>
4281
4282 <P>
4283
4284 Redirection of input causes the file whose name results from
4285 the expansion of
4286 <I>word</I>
4287
4288 to be opened for reading on file descriptor
4289 <I>n</I>,
4290
4291 or the standard input (file descriptor 0) if
4292 <I>n</I>
4293
4294 is not specified.
4295 <P>
4296
4297 The general format for redirecting input is:
4298 <DL COMPACT><DT><DD>
4299 <P>
4300
4301 [<I>n</I>]<B>&lt;</B><I>word</I>
4302 </DL>
4303
4304 <A NAME="lbBK">&nbsp;</A>
4305 <H4>Redirecting Output</H4>
4306
4307 <P>
4308
4309 Redirection of output causes the file whose name results from
4310 the expansion of
4311 <I>word</I>
4312
4313 to be opened for writing on file descriptor
4314 <I>n</I>,
4315
4316 or the standard output (file descriptor 1) if
4317 <I>n</I>
4318
4319 is not specified.  If the file does not exist it is created;
4320 if it does exist it is truncated to zero size.
4321 <P>
4322
4323 The general format for redirecting output is:
4324 <DL COMPACT><DT><DD>
4325 <P>
4326
4327 [<I>n</I>]<B>&gt;</B><I>word</I>
4328 </DL>
4329
4330 <P>
4331
4332 If the redirection operator is
4333 <B>&gt;</B>,
4334
4335 and the
4336 <B>noclobber</B>
4337
4338 option to the
4339 <B>set</B>
4340
4341 builtin has been enabled, the redirection will fail if the file
4342 whose name results from the expansion of <I>word</I> exists and is
4343 a regular file.
4344 If the redirection operator is
4345 <B>&gt;|</B>,
4346
4347 or the redirection operator is
4348 <B>&gt;</B>
4349
4350 and the
4351 <B>noclobber</B>
4352
4353 option to the
4354 <B>set</B>
4355
4356 builtin command is not enabled, the redirection is attempted even
4357 if the file named by <I>word</I> exists.
4358 <A NAME="lbBL">&nbsp;</A>
4359 <H4>Appending Redirected Output</H4>
4360
4361 <P>
4362
4363 Redirection of output in this fashion
4364 causes the file whose name results from
4365 the expansion of
4366 <I>word</I>
4367
4368 to be opened for appending on file descriptor
4369 <I>n</I>,
4370
4371 or the standard output (file descriptor 1) if
4372 <I>n</I>
4373
4374 is not specified.  If the file does not exist it is created.
4375 <P>
4376
4377 The general format for appending output is:
4378 <DL COMPACT><DT><DD>
4379 <P>
4380
4381 [<I>n</I>]<B>&gt;&gt;</B><I>word</I>
4382 </DL>
4383
4384 <P>
4385
4386 <A NAME="lbBM">&nbsp;</A>
4387 <H4>Redirecting Standard Output and Standard Error</H4>
4388
4389 <P>
4390
4391 This construct allows both the
4392 standard output (file descriptor 1) and
4393 the standard error output (file descriptor 2)
4394 to be redirected to the file whose name is the
4395 expansion of
4396 <I>word</I>.
4397
4398 <P>
4399
4400 There are two formats for redirecting standard output and
4401 standard error:
4402 <DL COMPACT><DT><DD>
4403 <P>
4404
4405 <B>&amp;&gt;</B><I>word</I>
4406 </DL>
4407
4408 and
4409 <DL COMPACT><DT><DD>
4410 <B>&gt;&amp;</B><I>word</I>
4411 </DL>
4412
4413 <P>
4414
4415 Of the two forms, the first is preferred.
4416 This is semantically equivalent to
4417 <DL COMPACT><DT><DD>
4418 <P>
4419
4420 <B>&gt;</B><I>word</I> 2<B>&gt;&amp;</B>1
4421 </DL>
4422
4423 <P>
4424
4425 <A NAME="lbBN">&nbsp;</A>
4426 <H4>Appending Standard Output and Standard Error</H4>
4427
4428 <P>
4429
4430 This construct allows both the
4431 standard output (file descriptor 1) and
4432 the standard error output (file descriptor 2)
4433 to be appended to the file whose name is the
4434 expansion of
4435 <I>word</I>.
4436
4437 <P>
4438
4439 The format for appending standard output and standard error is:
4440 <DL COMPACT><DT><DD>
4441 <P>
4442
4443 <B>&amp;&gt;&gt;</B><I>word</I>
4444 </DL>
4445
4446 <P>
4447
4448 This is semantically equivalent to
4449 <DL COMPACT><DT><DD>
4450 <P>
4451
4452 <B>&gt;&gt;</B><I>word</I> 2<B>&gt;&amp;</B>1
4453 </DL>
4454
4455 <A NAME="lbBO">&nbsp;</A>
4456 <H4>Here Documents</H4>
4457
4458 <P>
4459
4460 This type of redirection instructs the shell to read input from the
4461 current source until a line containing only
4462 <I>delimiter</I>
4463
4464 (with no trailing blanks)
4465 is seen.  All of
4466 the lines read up to that point are then used as the standard
4467 input for a command.
4468 <P>
4469
4470 The format of here-documents is:
4471 <DL COMPACT><DT><DD>
4472 <P>
4473
4474 <PRE>
4475 <B>&lt;&lt;</B>[<B>-</B>]<I>word</I>
4476         <I>here-document</I>
4477 <I>delimiter</I>
4478 </PRE>
4479
4480 </DL>
4481
4482 <P>
4483
4484 No parameter expansion, command substitution, arithmetic expansion,
4485 or pathname expansion is performed on
4486 <I>word</I>.
4487
4488 If any characters in
4489 <I>word</I>
4490
4491 are quoted, the
4492 <I>delimiter</I>
4493
4494 is the result of quote removal on
4495 <I>word</I>,
4496
4497 and the lines in the here-document are not expanded.
4498 If <I>word</I> is unquoted,
4499 all lines of the here-document are subjected to parameter expansion,
4500 command substitution, and arithmetic expansion.  In the latter
4501 case, the character sequence
4502 <B>\&lt;newline&gt;</B>
4503
4504 is ignored, and
4505 <B>\</B>
4506
4507 must be used to quote the characters
4508 <B>\</B>,
4509
4510 <B>$</B>,
4511
4512 and
4513 <B>`</B>.
4514
4515 <P>
4516
4517 If the redirection operator is
4518 <B>&lt;&lt;-</B>,
4519
4520 then all leading tab characters are stripped from input lines and the
4521 line containing
4522 <I>delimiter</I>.
4523
4524 This allows
4525 here-documents within shell scripts to be indented in a
4526 natural fashion.
4527 <A NAME="lbBP">&nbsp;</A>
4528 <H4>Here Strings</H4>
4529
4530 A variant of here documents, the format is:
4531 <DL COMPACT><DT><DD>
4532 <P>
4533
4534 <PRE>
4535 <B>&lt;&lt;&lt;</B><I>word</I>
4536 </PRE>
4537
4538 </DL>
4539
4540 <P>
4541
4542 The <I>word</I> is expanded and supplied to the command on its standard
4543 input.
4544 <A NAME="lbBQ">&nbsp;</A>
4545 <H4>Duplicating File Descriptors</H4>
4546
4547 <P>
4548
4549 The redirection operator
4550 <DL COMPACT><DT><DD>
4551 <P>
4552
4553 [<I>n</I>]<B>&lt;&amp;</B><I>word</I>
4554 </DL>
4555
4556 <P>
4557
4558 is used to duplicate input file descriptors.
4559 If
4560 <I>word</I>
4561
4562 expands to one or more digits, the file descriptor denoted by
4563 <I>n</I>
4564
4565 is made to be a copy of that file descriptor.
4566 If the digits in
4567 <I>word</I>
4568
4569 do not specify a file descriptor open for input, a redirection error occurs.
4570 If
4571 <I>word</I>
4572
4573 evaluates to
4574 <B>-</B>,
4575
4576 file descriptor
4577 <I>n</I>
4578
4579 is closed.  If
4580 <I>n</I>
4581
4582 is not specified, the standard input (file descriptor 0) is used.
4583 <P>
4584
4585 The operator
4586 <DL COMPACT><DT><DD>
4587 <P>
4588
4589 [<I>n</I>]<B>&gt;&amp;</B><I>word</I>
4590 </DL>
4591
4592 <P>
4593
4594 is used similarly to duplicate output file descriptors.  If
4595 <I>n</I>
4596
4597 is not specified, the standard output (file descriptor 1) is used.
4598 If the digits in
4599 <I>word</I>
4600
4601 do not specify a file descriptor open for output, a redirection error occurs.
4602 As a special case, if <I>n</I> is omitted, and <I>word</I> does not
4603 expand to one or more digits, the standard output and standard
4604 error are redirected as described previously.
4605 <A NAME="lbBR">&nbsp;</A>
4606 <H4>Moving File Descriptors</H4>
4607
4608 <P>
4609
4610 The redirection operator
4611 <DL COMPACT><DT><DD>
4612 <P>
4613
4614 [<I>n</I>]<B>&lt;&amp;</B><I>digit</I><B>-</B>
4615 </DL>
4616
4617 <P>
4618
4619 moves the file descriptor <I>digit</I> to file descriptor
4620 <I>n</I>,
4621
4622 or the standard input (file descriptor 0) if <I>n</I> is not specified.
4623 <I>digit</I> is closed after being duplicated to <I>n</I>.
4624 <P>
4625
4626 Similarly, the redirection operator
4627 <DL COMPACT><DT><DD>
4628 <P>
4629
4630 [<I>n</I>]<B>&gt;&amp;</B><I>digit</I><B>-</B>
4631 </DL>
4632
4633 <P>
4634
4635 moves the file descriptor <I>digit</I> to file descriptor
4636 <I>n</I>,
4637
4638 or the standard output (file descriptor 1) if <I>n</I> is not specified.
4639 <A NAME="lbBS">&nbsp;</A>
4640 <H4>Opening File Descriptors for Reading and Writing</H4>
4641
4642 <P>
4643
4644 The redirection operator
4645 <DL COMPACT><DT><DD>
4646 <P>
4647
4648 [<I>n</I>]<B>&lt;&gt;</B><I>word</I>
4649 </DL>
4650
4651 <P>
4652
4653 causes the file whose name is the expansion of
4654 <I>word</I>
4655
4656 to be opened for both reading and writing on file descriptor
4657 <I>n</I>,
4658
4659 or on file descriptor 0 if
4660 <I>n</I>
4661
4662 is not specified.  If the file does not exist, it is created.
4663 <A NAME="lbBT">&nbsp;</A>
4664 <H3>ALIASES</H3>
4665
4666 <I>Aliases</I> allow a string to be substituted for a word when it is used
4667 as the first word of a simple command.
4668 The shell maintains a list of aliases that may be set and unset with the
4669 <B>alias</B>
4670
4671 and
4672 <B>unalias</B>
4673
4674 builtin commands (see
4675 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
4676
4677 </FONT>
4678 below).
4679 The first word of each simple command, if unquoted,
4680 is checked to see if it has an
4681 alias.  If so, that word is replaced by the text of the alias.
4682 The characters <B>/</B>, <B>$</B>, <B>`</B>, and <B>=</B> and
4683 any of the shell <I>metacharacters</I> or quoting characters
4684 listed above may not appear in an alias name.
4685 The replacement text may contain any valid shell input,
4686 including shell metacharacters.
4687 The first word of the replacement text is tested
4688 for aliases, but a word that is identical to an alias being expanded
4689 is not expanded a second time.
4690 This means that one may alias
4691 <B>ls</B>
4692
4693 to
4694 <B>ls -F</B>,
4695
4696 for instance, and
4697 <B>bash</B>
4698
4699 does not try to recursively expand the replacement text.
4700 If the last character of the alias value is a
4701 <I>blank</I>,
4702
4703 then the next command
4704 word following the alias is also checked for alias expansion.
4705 <P>
4706
4707 Aliases are created and listed with the
4708 <B>alias</B>
4709
4710 command, and removed with the
4711 <B>unalias</B>
4712
4713 command.
4714 <P>
4715
4716 There is no mechanism for using arguments in the replacement text.
4717 If arguments are needed, a shell function should be used (see
4718 <FONT SIZE=-1><B>FUNCTIONS</B>
4719
4720 </FONT>
4721 below).
4722 <P>
4723
4724 Aliases are not expanded when the shell is not interactive, unless
4725 the
4726 <B>expand_aliases</B>
4727
4728 shell option is set using
4729 <B>shopt</B>
4730
4731 (see the description of
4732 <B>shopt</B>
4733
4734 under
4735 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B></FONT>
4736 below).
4737 <P>
4738
4739 The rules concerning the definition and use of aliases are
4740 somewhat confusing.
4741 <B>Bash</B>
4742
4743 always reads at least one complete line
4744 of input before executing any
4745 of the commands on that line.  Aliases are expanded when a
4746 command is read, not when it is executed.  Therefore, an
4747 alias definition appearing on the same line as another
4748 command does not take effect until the next line of input is read.
4749 The commands following the alias definition
4750 on that line are not affected by the new alias.
4751 This behavior is also an issue when functions are executed.
4752 Aliases are expanded when a function definition is read,
4753 not when the function is executed, because a function definition
4754 is itself a compound command.  As a consequence, aliases
4755 defined in a function are not available until after that
4756 function is executed.  To be safe, always put
4757 alias definitions on a separate line, and do not use
4758 <B>alias</B>
4759
4760 in compound commands.
4761 <P>
4762
4763 For almost every purpose, aliases are superseded by
4764 shell functions.
4765 <A NAME="lbBU">&nbsp;</A>
4766 <H3>FUNCTIONS</H3>
4767
4768 A shell function, defined as described above under
4769 <FONT SIZE=-1><B>SHELL GRAMMAR</B>,
4770
4771 </FONT>
4772 stores a series of commands for later execution.
4773 When the name of a shell function is used as a simple command name,
4774 the list of commands associated with that function name is executed.
4775 Functions are executed in the context of the
4776 current shell; no new process is created to interpret
4777 them (contrast this with the execution of a shell script).
4778 When a function is executed, the arguments to the
4779 function become the positional parameters
4780 during its execution.
4781 The special parameter
4782 <B>#</B>
4783
4784 is updated to reflect the change.  Special parameter 0
4785 is unchanged.
4786 The first element of the
4787 <FONT SIZE=-1><B>FUNCNAME</B>
4788
4789 </FONT>
4790 variable is set to the name of the function while the function
4791 is executing.
4792 <P>
4793
4794 All other aspects of the shell execution
4795 environment are identical between a function and its caller
4796 with these exceptions:  the
4797 <FONT SIZE=-1><B>DEBUG</B>
4798
4799 </FONT>
4800 and
4801 <B>RETURN</B>
4802
4803 traps (see the description of the
4804 <B>trap</B>
4805
4806 builtin under
4807 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
4808
4809 </FONT>
4810 below) are not inherited unless the function has been given the
4811 <B>trace</B> attribute (see the description of the
4812 <FONT SIZE=-1><B>declare</B>
4813
4814 </FONT>
4815 builtin below) or the
4816 <B>-o functrace</B> shell option has been enabled with
4817 the <B>set</B> builtin
4818 (in which case all functions inherit the <B>DEBUG</B> and <B>RETURN</B> traps),
4819 and the
4820 <FONT SIZE=-1><B>ERR</B>
4821
4822 </FONT>
4823 trap is not inherited unless the <B>-o errtrace</B> shell option has
4824 been enabled.
4825 <P>
4826
4827 Variables local to the function may be declared with the
4828 <B>local</B>
4829
4830 builtin command.  Ordinarily, variables and their values
4831 are shared between the function and its caller.
4832 <P>
4833
4834 If the builtin command
4835 <B>return</B>
4836
4837 is executed in a function, the function completes and
4838 execution resumes with the next command after the function
4839 call.
4840 Any command associated with the <B>RETURN</B> trap is executed
4841 before execution resumes.
4842 When a function completes, the values of the
4843 positional parameters and the special parameter
4844 <B>#</B>
4845
4846 are restored to the values they had prior to the function's
4847 execution.
4848 <P>
4849
4850 Function names and definitions may be listed with the
4851 <B>-f</B>
4852
4853 option to the
4854 <B>declare</B>
4855
4856 or
4857 <B>typeset</B>
4858
4859 builtin commands.  The
4860 <B>-F</B>
4861
4862 option to
4863 <B>declare</B>
4864
4865 or
4866 <B>typeset</B>
4867
4868 will list the function names only
4869 (and optionally the source file and line number, if the <B>extdebug</B>
4870 shell option is enabled).
4871 Functions may be exported so that subshells
4872 automatically have them defined with the
4873 <B>-f</B>
4874
4875 option to the 
4876 <B>export</B>
4877
4878 builtin.
4879 A function definition may be deleted using the <B>-f</B> option to
4880 the
4881 <B>unset</B>
4882
4883 builtin.
4884 Note that shell functions and variables with the same name may result
4885 in multiple identically-named entries in the environment passed to the
4886 shell's children.
4887 Care should be taken in cases where this may cause a problem.
4888 <P>
4889
4890 Functions may be recursive.  No limit is imposed on the number
4891 of recursive calls.
4892 <A NAME="lbBV">&nbsp;</A>
4893 <H3>ARITHMETIC EVALUATION</H3>
4894
4895 The shell allows arithmetic expressions to be evaluated, under
4896 certain circumstances (see the <B>let</B> and <B>declare</B> builtin
4897 commands and <B>Arithmetic Expansion</B>).
4898 Evaluation is done in fixed-width integers with no check for overflow,
4899 though division by 0 is trapped and flagged as an error.
4900 The operators and their precedence, associativity, and values
4901 are the same as in the C language.
4902 The following list of operators is grouped into levels of
4903 equal-precedence operators.
4904 The levels are listed in order of decreasing precedence.
4905 <P>
4906
4907
4908 <DL COMPACT>
4909 <DT><B></B><I>id</I>++ <I>id</I>--
4910
4911 <DD>
4912 variable post-increment and post-decrement
4913 <DT><B>++</B><I>id</I> --<I>id</I>
4914
4915 <DD>
4916 variable pre-increment and pre-decrement
4917 <DT><B>- +</B>
4918
4919 <DD>
4920 unary minus and plus
4921 <DT><B>! ~</B>
4922
4923 <DD>
4924 logical and bitwise negation
4925 <DT><B>**</B>
4926
4927 <DD>
4928 exponentiation
4929 <DT><B>* / %</B>
4930
4931 <DD>
4932 multiplication, division, remainder
4933 <DT><B>+ -</B>
4934
4935 <DD>
4936 addition, subtraction
4937 <DT><B>&lt;&lt; &gt;&gt;</B>
4938
4939 <DD>
4940 left and right bitwise shifts
4941 <DT><B>&lt;= &gt;= &lt; &gt;</B>
4942
4943 <DD>
4944 comparison
4945 <DT><B>== !=</B>
4946
4947 <DD>
4948 equality and inequality
4949 <DT><B>&amp;</B>
4950
4951 <DD>
4952 bitwise AND
4953 <DT><B>^</B>
4954
4955 <DD>
4956 bitwise exclusive OR
4957 <DT><B>|</B>
4958
4959 <DD>
4960 bitwise OR
4961 <DT><B>&amp;&amp;</B>
4962
4963 <DD>
4964 logical AND
4965 <DT><B>||</B>
4966
4967 <DD>
4968 logical OR
4969 <DT><B></B><I>expr</I>?<I>expr</I>:<I>expr</I>
4970
4971 <DD>
4972 conditional operator
4973 <DT><B>= *= /= %= += -= &lt;&lt;= &gt;&gt;= &amp;= ^= |=</B>
4974
4975 <DD>
4976 assignment
4977 <DT><B></B><I>expr1</I> , <I>expr2</I>
4978
4979 <DD>
4980 comma
4981
4982 </DL>
4983 <P>
4984
4985 Shell variables are allowed as operands; parameter expansion is
4986 performed before the expression is evaluated.
4987 Within an expression, shell variables may also be referenced by name
4988 without using the parameter expansion syntax.
4989 A shell variable that is null or unset evaluates to 0 when referenced
4990 by name without using the parameter expansion syntax.
4991 The value of a variable is evaluated as an arithmetic expression
4992 when it is referenced, or when a variable which has been given the
4993 <I>integer</I> attribute using <B>declare -i</B> is assigned a value.
4994 A null value evaluates to 0.
4995 A shell variable need not have its integer attribute
4996 turned on to be used in an expression.
4997 <P>
4998
4999 Constants with a leading 0 are interpreted as octal numbers.
5000 A leading 0x or 0X denotes hexadecimal.
5001 Otherwise, numbers take the form [<I>base#</I>]n, where <I>base</I>
5002 is a decimal number between 2 and 64 representing the arithmetic
5003 base, and <I>n</I> is a number in that base.
5004 If <I>base#</I> is omitted, then base 10 is used.
5005 The digits greater than 9 are represented by the lowercase letters,
5006 the uppercase letters, @, and _, in that order.
5007 If <I>base</I> is less than or equal to 36, lowercase and uppercase
5008 letters may be used interchangeably to represent numbers between 10
5009 and 35.
5010 <P>
5011
5012 Operators are evaluated in order of precedence.  Sub-expressions in
5013 parentheses are evaluated first and may override the precedence
5014 rules above.
5015 <A NAME="lbBW">&nbsp;</A>
5016 <H3>CONDITIONAL EXPRESSIONS</H3>
5017
5018 Conditional expressions are used by the <B>[[</B> compound command and
5019 the <B>test</B> and <B>[</B> builtin commands to test file attributes
5020 and perform string and arithmetic comparisons.
5021 Expressions are formed from the following unary or binary primaries.
5022 If any <I>file</I> argument to one of the primaries is of the form
5023 <I>/dev/fd/n</I>, then file descriptor <I>n</I> is checked.
5024 If the <I>file</I> argument to one of the primaries is one of
5025 <I>/dev/stdin</I>, <I>/dev/stdout</I>, or <I>/dev/stderr</I>, file
5026 descriptor 0, 1, or 2, respectively, is checked.
5027 <P>
5028
5029 Unless otherwise specified, primaries that operate on files follow symbolic
5030 links and operate on the target of the link, rather than the link itself.
5031 <P>
5032
5033
5034 When used with <B>[[</B>, The <B>&lt;</B> and <B>&gt;</B> operators sort
5035 lexicographically using the current locale.
5036 <P>
5037
5038 <DL COMPACT>
5039 <DT><B>-a </B><I>file</I>
5040
5041 <DD>
5042 True if <I>file</I> exists.
5043 <DT><B>-b </B><I>file</I>
5044
5045 <DD>
5046 True if <I>file</I> exists and is a block special file.
5047 <DT><B>-c </B><I>file</I>
5048
5049 <DD>
5050 True if <I>file</I> exists and is a character special file.
5051 <DT><B>-d </B><I>file</I>
5052
5053 <DD>
5054 True if <I>file</I> exists and is a directory.
5055 <DT><B>-e </B><I>file</I>
5056
5057 <DD>
5058 True if <I>file</I> exists.
5059 <DT><B>-f </B><I>file</I>
5060
5061 <DD>
5062 True if <I>file</I> exists and is a regular file.
5063 <DT><B>-g </B><I>file</I>
5064
5065 <DD>
5066 True if <I>file</I> exists and is set-group-id.
5067 <DT><B>-h </B><I>file</I>
5068
5069 <DD>
5070 True if <I>file</I> exists and is a symbolic link.
5071 <DT><B>-k </B><I>file</I>
5072
5073 <DD>
5074 True if <I>file</I> exists and its ``sticky'' bit is set.
5075 <DT><B>-p </B><I>file</I>
5076
5077 <DD>
5078 True if <I>file</I> exists and is a named pipe (FIFO).
5079 <DT><B>-r </B><I>file</I>
5080
5081 <DD>
5082 True if <I>file</I> exists and is readable.
5083 <DT><B>-s </B><I>file</I>
5084
5085 <DD>
5086 True if <I>file</I> exists and has a size greater than zero.
5087 <DT><B>-t </B><I>fd</I>
5088
5089 <DD>
5090 True if file descriptor
5091 <I>fd</I>
5092
5093 is open and refers to a terminal.
5094 <DT><B>-u </B><I>file</I>
5095
5096 <DD>
5097 True if <I>file</I> exists and its set-user-id bit is set.
5098 <DT><B>-w </B><I>file</I>
5099
5100 <DD>
5101 True if <I>file</I> exists and is writable.
5102 <DT><B>-x </B><I>file</I>
5103
5104 <DD>
5105 True if <I>file</I> exists and is executable.
5106 <DT><B>-O </B><I>file</I>
5107
5108 <DD>
5109 True if <I>file</I> exists and is owned by the effective user id.
5110 <DT><B>-G </B><I>file</I>
5111
5112 <DD>
5113 True if <I>file</I> exists and is owned by the effective group id.
5114 <DT><B>-L </B><I>file</I>
5115
5116 <DD>
5117 True if <I>file</I> exists and is a symbolic link.
5118 <DT><B>-S </B><I>file</I>
5119
5120 <DD>
5121 True if <I>file</I> exists and is a socket.
5122 <DT><B>-N </B><I>file</I>
5123
5124 <DD>
5125 True if <I>file</I> exists and has been modified since it was last read.
5126 <DT><I>file1</I> -<B>nt</B> <I>file2</I><DD>
5127 True if <I>file1</I> is newer (according to modification date) than <I>file2</I>,
5128 or if <I>file1</I> exists and file2 does not.
5129 <DT><I>file1</I> -<B>ot</B> <I>file2</I><DD>
5130 True if <I>file1</I> is older than <I>file2</I>, or if <I>file2</I> exists
5131 and <I>file1</I> does not.
5132 <DT><I>file1</I> <B>-ef</B> <I>file2</I><DD>
5133 True if <I>file1</I> and <I>file2</I> refer to the same device and
5134 inode numbers.
5135 <DT><B>-o </B><I>optname</I>
5136
5137 <DD>
5138 True if shell option
5139 <I>optname</I>
5140
5141 is enabled.
5142 See the list of options under the description of the
5143 <B>-o</B>
5144
5145 option to the
5146 <B>set</B>
5147
5148 builtin below.
5149 <DT><B>-z </B><I>string</I>
5150
5151 <DD>
5152 True if the length of <I>string</I> is zero.
5153 <DT><I>string</I><DD>
5154
5155 <DT><B>-n </B><I>string</I>
5156
5157 <DD>
5158
5159 True if the length of
5160 <I>string</I>
5161
5162 is non-zero.
5163 <DT><I>string1</I> <B>==</B> <I>string2</I><DD>
5164
5165 <DT><I>string1</I> <B>=</B> <I>string2</I><DD>
5166
5167 True if the strings are equal.  <B>=</B> should be used
5168 with the <B>test</B> command for POSIX conformance.
5169 <DT><I>string1</I> <B>!=</B> <I>string2</I><DD>
5170 True if the strings are not equal.
5171 <DT><I>string1</I> <B>&lt;</B> <I>string2</I><DD>
5172 True if <I>string1</I> sorts before <I>string2</I> lexicographically.
5173 <DT><I>string1</I> <B>&gt;</B> <I>string2</I><DD>
5174 True if <I>string1</I> sorts after <I>string2</I> lexicographically.
5175 <DT><I>arg1</I> <B>OP</B> <I>arg2</I>
5176
5177 <DD>
5178 <FONT SIZE=-1><B>OP</B>
5179
5180 </FONT>
5181 is one of
5182 <B>-eq</B>,
5183
5184 <B>-ne</B>,
5185
5186 <B>-lt</B>,
5187
5188 <B>-le</B>,
5189
5190 <B>-gt</B>,
5191
5192 or
5193 <B>-ge</B>.
5194
5195 These arithmetic binary operators return true if <I>arg1</I>
5196 is equal to, not equal to, less than, less than or equal to,
5197 greater than, or greater than or equal to <I>arg2</I>, respectively.
5198 <I>Arg1</I>
5199
5200 and
5201 <I>arg2</I>
5202
5203 may be positive or negative integers.
5204
5205 </DL>
5206 <A NAME="lbBX">&nbsp;</A>
5207 <H3>SIMPLE COMMAND EXPANSION</H3>
5208
5209 When a simple command is executed, the shell performs the following
5210 expansions, assignments, and redirections, from left to right.
5211 <DL COMPACT>
5212 <DT>1.<DD>
5213 The words that the parser has marked as variable assignments (those
5214 preceding the command name) and redirections are saved for later
5215 processing.
5216 <DT>2.<DD>
5217 The words that are not variable assignments or redirections are
5218 expanded.  If any words remain after expansion, the first word
5219 is taken to be the name of the command and the remaining words are
5220 the arguments.
5221 <DT>3.<DD>
5222 Redirections are performed as described above under
5223 <FONT SIZE=-1><B>REDIRECTION</B>.
5224
5225 </FONT>
5226 <DT>4.<DD>
5227 The text after the <B>=</B> in each variable assignment undergoes tilde
5228 expansion, parameter expansion, command substitution, arithmetic expansion,
5229 and quote removal before being assigned to the variable.
5230 </DL>
5231 <P>
5232
5233 If no command name results, the variable assignments affect the current
5234 shell environment.  Otherwise, the variables are added to the environment
5235 of the executed command and do not affect the current shell environment.
5236 If any of the assignments attempts to assign a value to a readonly variable,
5237 an error occurs, and the command exits with a non-zero status.
5238 <P>
5239
5240 If no command name results, redirections are performed, but do not
5241 affect the current shell environment.  A redirection error causes the
5242 command to exit with a non-zero status.
5243 <P>
5244
5245 If there is a command name left after expansion, execution proceeds as
5246 described below.  Otherwise, the command exits.  If one of the expansions
5247 contained a command substitution, the exit status of the command is
5248 the exit status of the last command substitution performed.  If there
5249 were no command substitutions, the command exits with a status of zero.
5250 <A NAME="lbBY">&nbsp;</A>
5251 <H3>COMMAND EXECUTION</H3>
5252
5253 After a command has been split into words, if it results in a
5254 simple command and an optional list of arguments, the following
5255 actions are taken.
5256 <P>
5257
5258 If the command name contains no slashes, the shell attempts to
5259 locate it.  If there exists a shell function by that name, that
5260 function is invoked as described above in
5261 <FONT SIZE=-1><B>FUNCTIONS</B>.
5262
5263 </FONT>
5264 If the name does not match a function, the shell searches for
5265 it in the list of shell builtins.  If a match is found, that
5266 builtin is invoked.
5267 <P>
5268
5269 If the name is neither a shell function nor a builtin,
5270 and contains no slashes,
5271 <B>bash</B>
5272
5273 searches each element of the
5274 <FONT SIZE=-1><B>PATH</B>
5275
5276 </FONT>
5277 for a directory containing an executable file by that name.
5278 <B>Bash</B>
5279
5280 uses a hash table to remember the full pathnames of executable
5281 files (see
5282 <B>hash</B>
5283
5284 under
5285 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
5286
5287 </FONT>
5288 below).
5289 A full search of the directories in
5290 <FONT SIZE=-1><B>PATH</B>
5291
5292 </FONT>
5293 is performed only if the command is not found in the hash table.
5294 If the search is unsuccessful, the shell searches for a defined shell
5295 function named <B>command_not_found_handle</B>.
5296 If that function exists, it is invoked with the original command and
5297 the original command's arguments as its arguments, and the function's
5298 exit status becomes the exit status of the shell.
5299 If that function is not defined, the shell prints an error
5300 message and returns an exit status of 127.
5301 <P>
5302
5303 If the search is successful, or if the command name contains
5304 one or more slashes, the shell executes the named program in a
5305 separate execution environment.
5306 Argument 0 is set to the name given, and the remaining arguments
5307 to the command are set to the arguments given, if any.
5308 <P>
5309
5310 If this execution fails because the file is not in executable
5311 format, and the file is not a directory, it is assumed to be
5312 a <I>shell script</I>, a file
5313 containing shell commands.  A subshell is spawned to execute
5314 it.  This subshell reinitializes itself, so
5315 that the effect is as if a new shell had been invoked
5316 to handle the script, with the exception that the locations of
5317 commands remembered by the parent (see
5318 <B>hash</B>
5319
5320 below under
5321 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>)</FONT>
5322 are retained by the child.
5323 <P>
5324
5325 If the program is a file beginning with
5326 <B>#!</B>,
5327
5328 the remainder of the first line specifies an interpreter
5329 for the program.  The shell executes the
5330 specified interpreter on operating systems that do not
5331 handle this executable format themselves.  The arguments to the 
5332 interpreter consist of a single optional argument following the
5333 interpreter name on the first line of the program, followed
5334 by the name of the program, followed by the command
5335 arguments, if any.
5336 <A NAME="lbBZ">&nbsp;</A>
5337 <H3>COMMAND EXECUTION ENVIRONMENT</H3>
5338
5339 The shell has an <I>execution environment</I>, which consists of the
5340 following:
5341
5342 <DL COMPACT>
5343 <DT>*<DD>
5344 open files inherited by the shell at invocation, as modified by
5345 redirections supplied to the <B>exec</B> builtin
5346 <DT>*<DD>
5347 the current working directory as set by <B>cd</B>, <B>pushd</B>, or
5348 <B>popd</B>, or inherited by the shell at invocation
5349 <DT>*<DD>
5350 the file creation mode mask as set by <B>umask</B> or inherited from
5351 the shell's parent
5352 <DT>*<DD>
5353 current traps set by <B>trap</B>
5354 <DT>*<DD>
5355 shell parameters that are set by variable assignment or with <B>set</B>
5356 or inherited from the shell's parent in the environment
5357 <DT>*<DD>
5358 shell functions defined during execution or inherited from the shell's
5359 parent in the environment
5360 <DT>*<DD>
5361 options enabled at invocation (either by default or with command-line
5362 arguments) or by <B>set</B>
5363 <DT>*<DD>
5364 options enabled by <B>shopt</B>
5365 <DT>*<DD>
5366 shell aliases defined with <B>alias</B>
5367 <DT>*<DD>
5368 various process IDs, including those of background jobs, the value
5369 of <B>$$</B>, and the value of
5370 <FONT SIZE=-1><B>PPID</B>
5371
5372 </FONT>
5373 </DL>
5374 <P>
5375
5376 When a simple command other than a builtin or shell function
5377 is to be executed, it
5378 is invoked in a separate execution environment that consists of
5379 the following.  Unless otherwise noted, the values are inherited
5380 from the shell.
5381
5382 <DL COMPACT>
5383 <DT>*<DD>
5384 the shell's open files, plus any modifications and additions specified
5385 by redirections to the command
5386 <DT>*<DD>
5387 the current working directory
5388 <DT>*<DD>
5389 the file creation mode mask
5390 <DT>*<DD>
5391 shell variables and functions marked for export, along with variables
5392 exported for the command, passed in the environment
5393 <DT>*<DD>
5394 traps caught by the shell are reset to the values inherited from the
5395 shell's parent, and traps ignored by the shell are ignored
5396 </DL>
5397 <P>
5398
5399 A command invoked in this separate environment cannot affect the
5400 shell's execution environment. 
5401 <P>
5402
5403 Command substitution, commands grouped with parentheses,
5404 and asynchronous commands are invoked in a
5405 subshell environment that is a duplicate of the shell environment,
5406 except that traps caught by the shell are reset to the values
5407 that the shell inherited from its parent at invocation.  Builtin
5408 commands that are invoked as part of a pipeline are also executed in a
5409 subshell environment.  Changes made to the subshell environment
5410 cannot affect the shell's execution environment.
5411 <P>
5412
5413 Subshells spawned to execute command substitutions inherit the value of
5414 the <B>-e</B> option from the parent shell.  When not in posix mode,
5415 Bash clears the <B>-e</B> option in such subshells.
5416 <P>
5417
5418 If a command is followed by a <B>&amp;</B> and job control is not active, the
5419 default standard input for the command is the empty file <I>/dev/null</I>.
5420 Otherwise, the invoked command inherits the file descriptors of the calling
5421 shell as modified by redirections.
5422 <A NAME="lbCA">&nbsp;</A>
5423 <H3>ENVIRONMENT</H3>
5424
5425 When a program is invoked it is given an array of strings
5426 called the
5427 <I>environment</I>.
5428
5429 This is a list of 
5430 <I>name</I>-<I>value</I> pairs, of the form
5431 <I>name</I>=value.
5432
5433 <P>
5434
5435 The shell provides several ways to manipulate the environment.
5436 On invocation, the shell scans its own environment and
5437 creates a parameter for each name found, automatically marking
5438 it for
5439 <I>export</I>
5440
5441 to child processes.  Executed commands inherit the environment.
5442 The
5443 <B>export</B>
5444
5445 and
5446 <B>declare -x</B>
5447
5448 commands allow parameters and functions to be added to and
5449 deleted from the environment.  If the value of a parameter
5450 in the environment is modified, the new value becomes part
5451 of the environment, replacing the old.  The environment
5452 inherited by any executed command consists of the shell's
5453 initial environment, whose values may be modified in the shell,
5454 less any pairs removed by the
5455 <B>unset</B>
5456
5457 command, plus any additions via the
5458 <B>export</B>
5459
5460 and
5461 <B>declare -x</B>
5462
5463 commands.
5464 <P>
5465
5466 The environment for any
5467 <I>simple command</I>
5468
5469 or function may be augmented temporarily by prefixing it with
5470 parameter assignments, as described above in
5471 <FONT SIZE=-1><B>PARAMETERS</B>.
5472
5473 </FONT>
5474 These assignment statements affect only the environment seen
5475 by that command.
5476 <P>
5477
5478 If the 
5479 <B>-k</B>
5480
5481 option is set (see the
5482 <B>set</B>
5483
5484 builtin command below), then
5485 <I>all</I>
5486
5487 parameter assignments are placed in the environment for a command,
5488 not just those that precede the command name.
5489 <P>
5490
5491 When
5492 <B>bash</B>
5493
5494 invokes an external command, the variable
5495 <B>_</B>
5496
5497 is set to the full file name of the command and passed to that
5498 command in its environment.
5499 <A NAME="lbCB">&nbsp;</A>
5500 <H3>EXIT STATUS</H3>
5501
5502 <P>
5503
5504 The exit status of an executed command is the value returned by the
5505 <I>waitpid</I> system call or equivalent function.  Exit statuses
5506 fall between 0 and 255, though, as explained below, the shell may
5507 use values above 125 specially.  Exit statuses from shell builtins and
5508 compound commands are also limited to this range. Under certain
5509 circumstances, the shell will use special values to indicate specific
5510 failure modes.
5511 <P>
5512
5513 For the shell's purposes, a command which exits with a 
5514 zero exit status has succeeded.  An exit status of zero
5515 indicates success.  A non-zero exit status indicates failure.
5516 When a command terminates on a fatal signal <I>N</I>, <B>bash</B> uses
5517 the value of 128+<I>N</I> as the exit status.
5518 <P>
5519
5520 If a command is not found, the child process created to
5521 execute it returns a status of 127.  If a command is found
5522 but is not executable, the return status is 126.
5523 <P>
5524
5525 If a command fails because of an error during expansion or redirection,
5526 the exit status is greater than zero.
5527 <P>
5528
5529 Shell builtin commands return a status of 0 (<I>true</I>) if
5530 successful, and non-zero (<I>false</I>) if an error occurs
5531 while they execute. 
5532 All builtins return an exit status of 2 to indicate incorrect usage.
5533 <P>
5534
5535 <B>Bash</B> itself returns the exit status of the last command
5536 executed, unless a syntax error occurs, in which case it exits
5537 with a non-zero value.  See also the <B>exit</B> builtin
5538 command below.
5539 <A NAME="lbCC">&nbsp;</A>
5540 <H3>SIGNALS</H3>
5541
5542 When <B>bash</B> is interactive, in the absence of any traps, it ignores
5543 <FONT SIZE=-1><B>SIGTERM</B>
5544
5545 </FONT>
5546 (so that <B>kill 0</B> does not kill an interactive shell),
5547 and
5548 <FONT SIZE=-1><B>SIGINT</B>
5549
5550 </FONT>
5551 is caught and handled (so that the <B>wait</B> builtin is interruptible).
5552 In all cases, <B>bash</B> ignores
5553 <FONT SIZE=-1><B>SIGQUIT</B>.
5554
5555 </FONT>
5556 If job control is in effect,
5557 <B>bash</B>
5558
5559 ignores
5560 <FONT SIZE=-1><B>SIGTTIN</B>,
5561
5562 </FONT>
5563 <FONT SIZE=-1><B>SIGTTOU</B>,
5564
5565 </FONT>
5566 and
5567 <FONT SIZE=-1><B>SIGTSTP</B>.
5568
5569 </FONT>
5570 <P>
5571
5572 Non-builtin commands run by <B>bash</B> have signal handlers
5573 set to the values inherited by the shell from its parent.
5574 When job control is not in effect, asynchronous commands
5575 ignore
5576 <FONT SIZE=-1><B>SIGINT</B>
5577
5578 </FONT>
5579 and
5580 <FONT SIZE=-1><B>SIGQUIT</B>
5581
5582 </FONT>
5583 in addition to these inherited handlers.
5584 Commands run as a result of command substitution ignore the
5585 keyboard-generated job control signals
5586 <FONT SIZE=-1><B>SIGTTIN</B>,
5587
5588 </FONT>
5589 <FONT SIZE=-1><B>SIGTTOU</B>,
5590
5591 </FONT>
5592 and
5593 <FONT SIZE=-1><B>SIGTSTP</B>.
5594
5595 </FONT>
5596 <P>
5597
5598 The shell exits by default upon receipt of a
5599 <FONT SIZE=-1><B>SIGHUP</B>.
5600
5601 </FONT>
5602 Before exiting, an interactive shell resends the
5603 <FONT SIZE=-1><B>SIGHUP</B>
5604
5605 </FONT>
5606 to all jobs, running or stopped.
5607 Stopped jobs are sent
5608 <FONT SIZE=-1><B>SIGCONT</B>
5609
5610 </FONT>
5611 to ensure that they receive the
5612 <FONT SIZE=-1><B>SIGHUP</B>.
5613
5614 </FONT>
5615 To prevent the shell from
5616 sending the signal to a particular job, it should be removed from the
5617 jobs table with the 
5618 <B>disown</B>
5619
5620 builtin (see
5621 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
5622
5623 </FONT>
5624 below) or marked 
5625 to not receive
5626 <FONT SIZE=-1><B>SIGHUP</B>
5627
5628 </FONT>
5629 using
5630 <B>disown -h</B>.
5631
5632 <P>
5633
5634 If the
5635 <B>huponexit</B>
5636
5637 shell option has been set with
5638 <B>shopt</B>,
5639
5640 <B>bash</B>
5641
5642 sends a 
5643 <FONT SIZE=-1><B>SIGHUP</B>
5644
5645 </FONT>
5646 to all jobs when an interactive login shell exits.
5647 <P>
5648
5649 If <B>bash</B> is waiting for a command to complete and receives a signal
5650 for which a trap has been set, the trap will not be executed until
5651 the command completes. 
5652 When <B>bash</B> is waiting for an asynchronous command via the <B>wait</B>
5653 builtin, the reception of a signal for which a trap has been set will
5654 cause the <B>wait</B> builtin to return immediately with an exit status
5655 greater than 128, immediately after which the trap is executed.
5656 <A NAME="lbCD">&nbsp;</A>
5657 <H3>JOB CONTROL</H3>
5658
5659 <I>Job control</I>
5660
5661 refers to the ability to selectively stop (<I>suspend</I>)
5662 the execution of processes and continue (<I>resume</I>)
5663 their execution at a later point.  A user typically employs
5664 this facility via an interactive interface supplied jointly
5665 by the operating system kernel's terminal driver and
5666 <B>bash</B>.
5667
5668 <P>
5669
5670 The shell associates a
5671 <I>job</I>
5672
5673 with each pipeline.  It keeps a table of currently executing
5674 jobs, which may be listed with the
5675 <B>jobs</B>
5676
5677 command.  When
5678 <B>bash</B>
5679
5680 starts a job asynchronously (in the
5681 <I>background</I>),
5682
5683 it prints a line that looks like:
5684 <DL COMPACT><DT><DD>
5685 <P>
5686
5687 [1] 25647
5688 </DL>
5689
5690 <P>
5691
5692 indicating that this job is job number 1 and that the process ID
5693 of the last process in the pipeline associated with this job is 25647.
5694 All of the processes in a single pipeline are members of the same job.
5695 <B>Bash</B>
5696
5697 uses the
5698 <I>job</I>
5699
5700 abstraction as the basis for job control.
5701 <P>
5702
5703 To facilitate the implementation of the user interface to job
5704 control, the operating system maintains the notion of a <I>current terminal
5705 process group ID</I>.  Members of this process group (processes whose
5706 process group ID is equal to the current terminal process group ID)
5707 receive keyboard-generated signals such as
5708 <FONT SIZE=-1><B>SIGINT</B>.
5709
5710 </FONT>
5711 These processes are said to be in the
5712 <I>foreground</I>.
5713
5714 <I>Background</I>
5715
5716 processes are those whose process group ID differs from the terminal's;
5717 such processes are immune to keyboard-generated signals.
5718 Only foreground processes are allowed to read from or, if the
5719 user so specifies with <TT>stty tostop</TT>, write to the
5720 terminal.
5721 Background processes which attempt to read from (write to when
5722 <TT>stty tostop</TT> is in effect) the
5723 terminal are sent a 
5724 <FONT SIZE=-1><B>SIGTTIN (SIGTTOU)</B>
5725
5726 </FONT>
5727 signal by the kernel's terminal driver, 
5728 which, unless caught, suspends the process.
5729 <P>
5730
5731 If the operating system on which
5732 <B>bash</B>
5733
5734 is running supports
5735 job control,
5736 <B>bash</B>
5737
5738 contains facilities to use it.
5739 Typing the
5740 <I>suspend</I>
5741
5742 character (typically
5743 <B>^Z</B>,
5744
5745 Control-Z) while a process is running
5746 causes that process to be stopped and returns control to 
5747 <B>bash</B>.
5748
5749 Typing the
5750 <I>delayed suspend</I>
5751
5752 character (typically
5753 <B>^Y</B>,
5754
5755 Control-Y) causes the process to be stopped when it
5756 attempts to read input from the terminal, and control to
5757 be returned to
5758 <B>bash</B>.
5759
5760 The user may then manipulate the state of this job, using the
5761 <B>bg</B>
5762
5763 command to continue it in the background, the
5764 <B>fg</B>
5765
5766 command to continue it in the foreground, or
5767 the
5768 <B>kill</B>
5769
5770 command to kill it.  A <B>^Z</B> takes effect immediately,
5771 and has the additional side effect of causing pending output
5772 and typeahead to be discarded.
5773 <P>
5774
5775 There are a number of ways to refer to a job in the shell.
5776 The character
5777 <B>%</B>
5778
5779 introduces a job specification (<I>jobspec</I>).  Job number
5780 <I>n</I>
5781
5782 may be referred to as
5783 <B>%n</B>.
5784
5785 A job may also be referred to using a prefix of the name used to
5786 start it, or using a substring that appears in its command line.
5787 For example,
5788 <B>%ce</B>
5789
5790 refers to a stopped
5791 <B>ce</B>
5792
5793 job.  If a prefix matches more than one job,
5794 <B>bash</B>
5795
5796 reports an error.  Using
5797 <B>%?ce</B>,
5798
5799 on the other hand, refers to any job containing the string
5800 <B>ce</B>
5801
5802 in its command line.  If the substring matches more than one job,
5803 <B>bash</B>
5804
5805 reports an error.  The symbols
5806 <B>%%</B>
5807
5808 and
5809 <B>%+</B>
5810
5811 refer to the shell's notion of the
5812 <I>current job</I>,
5813
5814 which is the last job stopped while it was in
5815 the foreground or started in the background.
5816 The 
5817 <I>previous job</I>
5818
5819 may be referenced using
5820 <B>%-</B>.
5821
5822 If there is only a single job, <B>%+</B> and <B>%-</B> can both be used
5823 to refer to that job.
5824 In output pertaining to jobs (e.g., the output of the
5825 <B>jobs</B>
5826
5827 command), the current job is always flagged with a
5828 <B>+</B>,
5829
5830 and the previous job with a
5831 <B>-</B>.
5832
5833 A single % (with no accompanying job specification) also refers to the
5834 current job.
5835 <P>
5836
5837 Simply naming a job can be used to bring it into the
5838 foreground:
5839 <B>%1</B>
5840
5841 is a synonym for
5842 <B>``fg %1''</B>,
5843 bringing job 1 from the background into the foreground.
5844 Similarly,
5845 <B>``%1 &amp;''</B>
5846
5847 resumes job 1 in the background, equivalent to
5848 <B>``bg %1''</B>.
5849 <P>
5850
5851 The shell learns immediately whenever a job changes state.
5852 Normally,
5853 <B>bash</B>
5854
5855 waits until it is about to print a prompt before reporting
5856 changes in a job's status so as to not interrupt
5857 any other output.  If the 
5858 <B>-b</B>
5859
5860 option to the
5861 <B>set</B>
5862
5863 builtin command
5864 is enabled,
5865 <B>bash</B>
5866
5867 reports such changes immediately.
5868 Any trap on
5869 <FONT SIZE=-1><B>SIGCHLD</B>
5870
5871 </FONT>
5872 is executed for each child that exits.
5873 <P>
5874
5875 If an attempt to exit
5876 <B>bash</B>
5877
5878 is made while jobs are stopped (or, if the <B>checkjobs</B> shell option has
5879 been enabled using the <B>shopt</B> builtin, running), the shell prints a
5880 warning message, and, if the <B>checkjobs</B> option is enabled, lists the
5881 jobs and their statuses.
5882 The
5883 <B>jobs</B>
5884
5885 command may then be used to inspect their status. 
5886 If a second attempt to exit is made without an intervening command,
5887 the shell does not print another warning, and any stopped
5888 jobs are terminated.
5889 <A NAME="lbCE">&nbsp;</A>
5890 <H3>PROMPTING</H3>
5891
5892 When executing interactively, 
5893 <B>bash</B>
5894
5895 displays the primary prompt
5896 <FONT SIZE=-1><B>PS1</B>
5897
5898 </FONT>
5899 when it is ready to read a command, and the secondary prompt
5900 <FONT SIZE=-1><B>PS2</B>
5901
5902 </FONT>
5903 when it needs more input to complete a command.
5904 <B>Bash</B>
5905
5906 allows these prompt strings to be customized by inserting a number of
5907 backslash-escaped special characters that are decoded as follows:
5908 <DL COMPACT><DT><DD>
5909
5910 <DL COMPACT>
5911 <DT><B>\a</B>
5912
5913 <DD>
5914 an ASCII bell character (07)
5915 <DT><B>\d</B>
5916
5917 <DD>
5918 the date in &quot;Weekday Month Date&quot; format (e.g., &quot;Tue May 26&quot;)
5919 <DT><B>\D{</B><I>format</I>}
5920
5921 <DD>
5922 the <I>format</I> is passed to <I>strftime</I>(3) and the result is inserted
5923 into the prompt string; an empty <I>format</I> results in a locale-specific
5924 time representation.  The braces are required
5925 <DT><B>\e</B>
5926
5927 <DD>
5928 an ASCII escape character (033)
5929 <DT><B>\h</B>
5930
5931 <DD>
5932 the hostname up to the first `.'
5933 <DT><B>\H</B>
5934
5935 <DD>
5936 the hostname
5937 <DT><B>\j</B>
5938
5939 <DD>
5940 the number of jobs currently managed by the shell
5941 <DT><B>\l</B>
5942
5943 <DD>
5944 the basename of the shell's terminal device name
5945 <DT><B>\n</B>
5946
5947 <DD>
5948 newline
5949 <DT><B>\r</B>
5950
5951 <DD>
5952 carriage return
5953 <DT><B>\s</B>
5954
5955 <DD>
5956 the name of the shell, the basename of
5957 <B>$0</B>
5958
5959 (the portion following the final slash)
5960 <DT><B>\t</B>
5961
5962 <DD>
5963 the current time in 24-hour HH:MM:SS format
5964 <DT><B>\T</B>
5965
5966 <DD>
5967 the current time in 12-hour HH:MM:SS format
5968 <DT><B>\@</B>
5969
5970 <DD>
5971 the current time in 12-hour am/pm format
5972 <DT><B>\A</B>
5973
5974 <DD>
5975 the current time in 24-hour HH:MM format
5976 <DT><B>\u</B>
5977
5978 <DD>
5979 the username of the current user
5980 <DT><B>\v</B>
5981
5982 <DD>
5983 the version of <B>bash</B> (e.g., 2.00)
5984 <DT><B>\V</B>
5985
5986 <DD>
5987 the release of <B>bash</B>, version + patch level (e.g., 2.00.0)
5988 <DT><B>\w</B>
5989
5990 <DD>
5991 the current working directory, with
5992 <FONT SIZE=-1><B>$HOME</B>
5993
5994 </FONT>
5995 abbreviated with a tilde
5996 (uses the value of the
5997 <FONT SIZE=-1><B>PROMPT_DIRTRIM</B>
5998
5999 </FONT>
6000 variable)
6001 <DT><B>\W</B>
6002
6003 <DD>
6004 the basename of the current working directory, with
6005 <FONT SIZE=-1><B>$HOME</B>
6006
6007 </FONT>
6008 abbreviated with a tilde
6009 <DT><B>\!</B>
6010
6011 <DD>
6012 the history number of this command
6013 <DT><B>\#</B>
6014
6015 <DD>
6016 the command number of this command
6017 <DT><B>\$</B>
6018
6019 <DD>
6020 if the effective UID is 0, a
6021 <B>#</B>,
6022
6023 otherwise a
6024 <B>$</B>
6025
6026 <DT><B>\</B><I>nnn</I>
6027
6028 <DD>
6029 the character corresponding to the octal number <I>nnn</I>
6030 <DT><B>\\</B>
6031
6032 <DD>
6033 a backslash
6034 <DT><B>\[</B>
6035
6036 <DD>
6037 begin a sequence of non-printing characters, which could be used to
6038 embed a terminal control sequence into the prompt
6039 <DT><B>\]</B>
6040
6041 <DD>
6042 end a sequence of non-printing characters
6043
6044 </DL></DL>
6045
6046 <P>
6047
6048 The command number and the history number are usually different:
6049 the history number of a command is its position in the history
6050 list, which may include commands restored from the history file
6051 (see
6052 <FONT SIZE=-1><B>HISTORY</B>
6053
6054 </FONT>
6055 below), while the command number is the position in the sequence
6056 of commands executed during the current shell session.
6057 After the string is decoded, it is expanded via
6058 parameter expansion, command substitution, arithmetic
6059 expansion, and quote removal, subject to the value of the
6060 <B>promptvars</B>
6061
6062 shell option (see the description of the
6063 <B>shopt</B>
6064
6065 command under
6066 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
6067
6068 </FONT>
6069 below).
6070 <A NAME="lbCF">&nbsp;</A>
6071 <H3>READLINE</H3>
6072
6073 This is the library that handles reading input when using an interactive
6074 shell, unless the
6075 <B>--noediting</B>
6076
6077 option is given at shell invocation.
6078 Line editing is also used when using the <B>-e</B> option to the
6079 <B>read</B> builtin.
6080 By default, the line editing commands are similar to those of emacs.
6081 A vi-style line editing interface is also available.
6082 Line editing can be enabled at any time using the
6083 <B>-o emacs</B>
6084
6085 or
6086 <B>-o vi</B>
6087
6088 options to the
6089 <B>set</B>
6090
6091 builtin (see
6092 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
6093
6094 </FONT>
6095 below).
6096 To turn off line editing after the shell is running, use the
6097 <B>+o emacs</B>
6098
6099 or
6100 <B>+o vi</B>
6101
6102 options to the
6103 <B>set</B>
6104
6105 builtin.
6106 <A NAME="lbCG">&nbsp;</A>
6107 <H4>Readline Notation</H4>
6108
6109 <P>
6110
6111 In this section, the emacs-style notation is used to denote
6112 keystrokes.  Control keys are denoted by C-<I>key</I>, e.g., C-n
6113 means Control-N.  Similarly, 
6114 <I>meta</I>
6115
6116 keys are denoted by M-<I>key</I>, so M-x means Meta-X.  (On keyboards
6117 without a 
6118 <I>meta</I>
6119
6120 key, M-<I>x</I> means ESC <I>x</I>, i.e., press the Escape key
6121 then the
6122 <I>x</I>
6123
6124 key.  This makes ESC the <I>meta prefix</I>.
6125 The combination M-C-<I>x</I> means ESC-Control-<I>x</I>,
6126 or press the Escape key
6127 then hold the Control key while pressing the
6128 <I>x</I>
6129
6130 key.)
6131 <P>
6132
6133 Readline commands may be given numeric
6134 <I>arguments</I>,
6135
6136 which normally act as a repeat count.
6137 Sometimes, however, it is the sign of the argument that is significant.
6138 Passing a negative argument to a command that acts in the forward
6139 direction (e.g., <B>kill-line</B>) causes that command to act in a
6140 backward direction. 
6141 Commands whose behavior with arguments deviates from this are noted
6142 below.
6143 <P>
6144
6145 When a command is described as <I>killing</I> text, the text
6146 deleted is saved for possible future retrieval
6147 (<I>yanking</I>).  The killed text is saved in a
6148 <I>kill ring</I>.  Consecutive kills cause the text to be
6149 accumulated into one unit, which can be yanked all at once. 
6150 Commands which do not kill text separate the chunks of text
6151 on the kill ring.
6152 <A NAME="lbCH">&nbsp;</A>
6153 <H4>Readline Initialization</H4>
6154
6155 <P>
6156
6157 Readline is customized by putting commands in an initialization
6158 file (the <I>inputrc</I> file).
6159 The name of this file is taken from the value of the
6160 <FONT SIZE=-1><B>INPUTRC</B>
6161
6162 </FONT>
6163 variable.  If that variable is unset, the default is
6164 <A HREF="file:~/.inputrc"><I>~/.inputrc</I></A>.
6165
6166 When a program which uses the readline library starts up, the
6167 initialization file is read, and the key bindings and variables
6168 are set.
6169 There are only a few basic constructs allowed in the
6170 readline initialization file.
6171 Blank lines are ignored.
6172 Lines beginning with a <B>#</B> are comments.
6173 Lines beginning with a <B>$</B> indicate conditional constructs.
6174 Other lines denote key bindings and variable settings.
6175 <P>
6176
6177 The default key-bindings may be changed with an
6178 <I>inputrc </I>
6179
6180 file.
6181 Other programs that use this library may add their own commands
6182 and bindings.
6183 <P>
6184
6185 For example, placing
6186 <DL COMPACT><DT><DD>
6187 <P>
6188
6189 M-Control-u: universal-argument
6190 </DL>
6191
6192 or
6193 <DL COMPACT><DT><DD>
6194 C-Meta-u: universal-argument
6195 </DL>
6196
6197 into the 
6198 <I>inputrc</I>
6199
6200 would make M-C-u execute the readline command
6201 <I>universal-argument</I>.
6202
6203 <P>
6204
6205 The following symbolic character names are recognized:
6206 <I>RUBOUT</I>,
6207
6208 <I>DEL</I>,
6209
6210 <I>ESC</I>,
6211
6212 <I>LFD</I>,
6213
6214 <I>NEWLINE</I>,
6215
6216 <I>RET</I>,
6217
6218 <I>RETURN</I>,
6219
6220 <I>SPC</I>,
6221
6222 <I>SPACE</I>,
6223
6224 and
6225 <I>TAB</I>.
6226
6227 <P>
6228
6229 In addition to command names, readline allows keys to be bound
6230 to a string that is inserted when the key is pressed (a <I>macro</I>).
6231 <A NAME="lbCI">&nbsp;</A>
6232 <H4>Readline Key Bindings</H4>
6233
6234 <P>
6235
6236 The syntax for controlling key bindings in the
6237 <I>inputrc</I>
6238
6239 file is simple.  All that is required is the name of the
6240 command or the text of a macro and a key sequence to which
6241 it should be bound. The name may be specified in one of two ways:
6242 as a symbolic key name, possibly with <I>Meta-</I> or <I>Control-</I>
6243 prefixes, or as a key sequence.
6244 <P>
6245
6246 When using the form <B>keyname</B>:<I>function-name</I> or <I>macro</I>,
6247 <I>keyname</I>
6248
6249 is the name of a key spelled out in English.  For example:
6250 <P>
6251 <DL COMPACT><DT><DD>
6252 Control-u: universal-argument
6253 <BR>
6254
6255 Meta-Rubout: backward-kill-word
6256 <BR>
6257
6258 Control-o: &quot;&gt; output&quot;
6259 </DL>
6260
6261 <P>
6262
6263 In the above example,
6264 <I>C-u</I>
6265
6266 is bound to the function
6267 <B>universal-argument</B>,
6268
6269 <I>M-DEL</I>
6270
6271 is bound to the function
6272 <B>backward-kill-word</B>,
6273
6274 and
6275 <I>C-o</I>
6276
6277 is bound to run the macro
6278 expressed on the right hand side (that is, to insert the text
6279 <TT>&gt; output</TT>
6280
6281 into the line).
6282 <P>
6283
6284 In the second form, <B>&quot;keyseq&quot;</B>:<I>function-name</I> or <I>macro</I>,
6285 <B>keyseq</B>
6286
6287 differs from
6288 <B>keyname</B>
6289
6290 above in that strings denoting
6291 an entire key sequence may be specified by placing the sequence
6292 within double quotes.  Some GNU Emacs style key escapes can be
6293 used, as in the following example, but the symbolic character names
6294 are not recognized.
6295 <P>
6296 <DL COMPACT><DT><DD>
6297 &quot;\C-u&quot;: universal-argument
6298 <BR>
6299
6300 &quot;\C-x\C-r&quot;: re-read-init-file
6301 <BR>
6302
6303 &quot;\e[11~&quot;: &quot;Function Key 1&quot;
6304 </DL>
6305
6306 <P>
6307
6308 In this example,
6309 <I>C-u</I>
6310
6311 is again bound to the function
6312 <B>universal-argument</B>.
6313
6314 <I>C-x C-r</I>
6315
6316 is bound to the function
6317 <B>re-read-init-file</B>,
6318
6319 and 
6320 <I>ESC [ 1 1 ~</I>
6321
6322 is bound to insert the text
6323 <TT>Function Key 1</TT>.
6324
6325 <P>
6326
6327 The full set of GNU Emacs style escape sequences is
6328 <DL COMPACT><DT><DD>
6329
6330 <DL COMPACT>
6331 <DT><B>\C-</B>
6332
6333 <DD>
6334 control prefix
6335 <DT><B>\M-</B>
6336
6337 <DD>
6338 meta prefix
6339 <DT><B>\e</B>
6340
6341 <DD>
6342 an escape character
6343 <DT><B>\\</B>
6344
6345 <DD>
6346 backslash
6347 <DT><B>\</B>
6348
6349 <DD>
6350 literal &quot;
6351 <DT><B>\aq</B>
6352
6353 <DD>
6354 literal aq
6355 </DL></DL>
6356
6357
6358 <P>
6359
6360 In addition to the GNU Emacs style escape sequences, a second
6361 set of backslash escapes is available:
6362 <DL COMPACT><DT><DD>
6363
6364 <DL COMPACT>
6365 <DT><B>\a</B>
6366
6367 <DD>
6368 alert (bell)
6369 <DT><B>\b</B>
6370
6371 <DD>
6372 backspace
6373 <DT><B>\d</B>
6374
6375 <DD>
6376 delete
6377 <DT><B>\f</B>
6378
6379 <DD>
6380 form feed
6381 <DT><B>\n</B>
6382
6383 <DD>
6384 newline
6385 <DT><B>\r</B>
6386
6387 <DD>
6388 carriage return
6389 <DT><B>\t</B>
6390
6391 <DD>
6392 horizontal tab
6393 <DT><B>\v</B>
6394
6395 <DD>
6396 vertical tab
6397 <DT><B>\</B><I>nnn</I>
6398
6399 <DD>
6400 the eight-bit character whose value is the octal value <I>nnn</I>
6401 (one to three digits)
6402 <DT><B>\x</B><I>HH</I>
6403
6404 <DD>
6405 the eight-bit character whose value is the hexadecimal value <I>HH</I>
6406 (one or two hex digits)
6407 </DL></DL>
6408
6409
6410 <P>
6411
6412 When entering the text of a macro, single or double quotes must
6413 be used to indicate a macro definition.
6414 Unquoted text is assumed to be a function name.
6415 In the macro body, the backslash escapes described above are expanded.
6416 Backslash will quote any other character in the macro text,
6417 including &quot; and aq.
6418 <P>
6419
6420 <B>Bash</B>
6421
6422 allows the current readline key bindings to be displayed or modified
6423 with the
6424 <B>bind</B>
6425
6426 builtin command.  The editing mode may be switched during interactive
6427 use by using the
6428 <B>-o</B>
6429
6430 option to the
6431 <B>set</B>
6432
6433 builtin command (see
6434 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
6435
6436 </FONT>
6437 below).
6438 <A NAME="lbCJ">&nbsp;</A>
6439 <H4>Readline Variables</H4>
6440
6441 <P>
6442
6443 Readline has variables that can be used to further customize its
6444 behavior.  A variable may be set in the
6445 <I>inputrc</I>
6446
6447 file with a statement of the form
6448 <DL COMPACT><DT><DD>
6449 <P>
6450
6451 <B>set</B> <I>variable-name</I> <I>value</I>
6452 </DL>
6453
6454 <P>
6455
6456 Except where noted, readline variables can take the values
6457 <B>On</B>
6458
6459 or
6460 <B>Off</B>
6461
6462 (without regard to case).
6463 Unrecognized variable names are ignored.
6464 When a variable value is read, empty or null values, &quot;on&quot; (case-insensitive),
6465 and &quot;1&quot; are equivalent to <B>On</B>.  All other values are equivalent to
6466 <B>Off</B>.
6467 The variables and their default values are:
6468 <P>
6469
6470
6471 <DL COMPACT>
6472 <DT><B>bell-style (audible)</B>
6473
6474 <DD>
6475 Controls what happens when readline wants to ring the terminal bell.
6476 If set to <B>none</B>, readline never rings the bell.  If set to
6477 <B>visible</B>, readline uses a visible bell if one is available.
6478 If set to <B>audible</B>, readline attempts to ring the terminal's bell.
6479 <DT><B>bind-tty-special-chars (On)</B>
6480
6481 <DD>
6482 If set to <B>On</B>, readline attempts to bind the control characters
6483 treated specially by the kernel's terminal driver to their readline
6484 equivalents.
6485 <DT><B>comment-begin (``#'')</B>
6486
6487 <DD>
6488 The string that is inserted when the readline
6489 <B>insert-comment</B>
6490
6491 command is executed.
6492 This command is bound to
6493 <B>M-#</B>
6494
6495 in emacs mode and to
6496 <B>#</B>
6497
6498 in vi command mode.
6499 <DT><B>completion-ignore-case (Off)</B>
6500
6501 <DD>
6502 If set to <B>On</B>, readline performs filename matching and completion
6503 in a case-insensitive fashion.
6504 <DT><B>completion-prefix-display-length (0)</B>
6505
6506 <DD>
6507 The length in characters of the common prefix of a list of possible
6508 completions that is displayed without modification.  When set to a
6509 value greater than zero, common prefixes longer than this value are
6510 replaced with an ellipsis when displaying possible completions.
6511 <DT><B>completion-query-items (100)</B>
6512
6513 <DD>
6514 This determines when the user is queried about viewing
6515 the number of possible completions
6516 generated by the <B>possible-completions</B> command.
6517 It may be set to any integer value greater than or equal to
6518 zero.  If the number of possible completions is greater than
6519 or equal to the value of this variable, the user is asked whether
6520 or not he wishes to view them; otherwise they are simply listed
6521 on the terminal.
6522 <DT><B>convert-meta (On)</B>
6523
6524 <DD>
6525 If set to <B>On</B>, readline will convert characters with the
6526 eighth bit set to an ASCII key sequence
6527 by stripping the eighth bit and prefixing an
6528 escape character (in effect, using escape as the <I>meta prefix</I>).
6529 <DT><B>disable-completion (Off)</B>
6530
6531 <DD>
6532 If set to <B>On</B>, readline will inhibit word completion.  Completion
6533 characters will be inserted into the line as if they had been
6534 mapped to <B>self-insert</B>.
6535 <DT><B>editing-mode (emacs)</B>
6536
6537 <DD>
6538 Controls whether readline begins with a set of key bindings similar
6539 to <I>emacs</I> or <I>vi</I>.
6540 <B>editing-mode</B>
6541
6542 can be set to either
6543 <B>emacs</B>
6544
6545 or
6546 <B>vi</B>.
6547
6548 <DT><B>echo-control-characters (On)</B>
6549
6550 <DD>
6551 When set to <B>On</B>, on operating systems that indicate they support it,
6552 readline echoes a character corresponding to a signal generated from the
6553 keyboard.
6554 <DT><B>enable-keypad (Off)</B>
6555
6556 <DD>
6557 When set to <B>On</B>, readline will try to enable the application
6558 keypad when it is called.  Some systems need this to enable the
6559 arrow keys.
6560 <DT><B>enable-meta-key (On)</B>
6561
6562 <DD>
6563 When set to <B>On</B>, readline will try to enable any meta modifier
6564 key the terminal claims to support when it is called.  On many terminals,
6565 the meta key is used to send eight-bit characters.
6566 <DT><B>expand-tilde (Off)</B>
6567
6568 <DD>
6569 If set to <B>on</B>, tilde expansion is performed when readline
6570 attempts word completion.
6571 <DT><B>history-preserve-point (Off)</B>
6572
6573 <DD>
6574 If set to <B>on</B>, the history code attempts to place point at the
6575 same location on each history line retrieved with <B>previous-history</B>
6576 or <B>next-history</B>.
6577 <DT><B>history-size (0)</B>
6578
6579 <DD>
6580 Set the maximum number of history entries saved in the history list.  If
6581 set to zero, the number of entries in the history list is not limited.
6582 <DT><B>horizontal-scroll-mode (Off)</B>
6583
6584 <DD>
6585 When set to <B>On</B>, makes readline use a single line for display,
6586 scrolling the input horizontally on a single screen line when it
6587 becomes longer than the screen width rather than wrapping to a new line.
6588 <DT><B>input-meta (Off)</B>
6589
6590 <DD>
6591 If set to <B>On</B>, readline will enable eight-bit input (that is,
6592 it will not strip the high bit from the characters it reads),
6593 regardless of what the terminal claims it can support.  The name
6594 <B>meta-flag</B>
6595
6596 is a synonym for this variable.
6597 <DT><B>isearch-terminators (``C-[C-J'')</B>
6598
6599 <DD>
6600 The string of characters that should terminate an incremental
6601 search without subsequently executing the character as a command.
6602 If this variable has not been given a value, the characters
6603 <I>ESC</I> and <I>C-J</I> will terminate an incremental search.
6604 <DT><B>keymap (emacs)</B>
6605
6606 <DD>
6607 Set the current readline keymap.  The set of valid keymap names is
6608 <I>emacs, emacs-standard, emacs-meta, emacs-ctlx, vi,
6609 vi-command</I>, and
6610 <I>vi-insert</I>.
6611
6612 <I>vi</I> is equivalent to <I>vi-command</I>; <I>emacs</I> is
6613 equivalent to <I>emacs-standard</I>.  The default value is
6614 <I>emacs</I>;
6615
6616 the value of
6617 <B>editing-mode</B>
6618
6619 also affects the default keymap.
6620 <DT><B>mark-directories (On)</B>
6621
6622 <DD>
6623 If set to <B>On</B>, completed directory names have a slash
6624 appended.
6625 <DT><B>mark-modified-lines (Off)</B>
6626
6627 <DD>
6628 If set to <B>On</B>, history lines that have been modified are displayed
6629 with a preceding asterisk (<B>*</B>).
6630 <DT><B>mark-symlinked-directories (Off)</B>
6631
6632 <DD>
6633 If set to <B>On</B>, completed names which are symbolic links to directories
6634 have a slash appended (subject to the value of
6635 <B>mark-directories</B>).
6636 <DT><B>match-hidden-files (On)</B>
6637
6638 <DD>
6639 This variable, when set to <B>On</B>, causes readline to match files whose
6640 names begin with a `.' (hidden files) when performing filename 
6641 completion, unless the leading `.' is
6642 supplied by the user in the filename to be completed.
6643 <DT><B>output-meta (Off)</B>
6644
6645 <DD>
6646 If set to <B>On</B>, readline will display characters with the
6647 eighth bit set directly rather than as a meta-prefixed escape
6648 sequence.
6649 <DT><B>page-completions (On)</B>
6650
6651 <DD>
6652 If set to <B>On</B>, readline uses an internal <I>more</I>-like pager
6653 to display a screenful of possible completions at a time.
6654 <DT><B>print-completions-horizontally (Off)</B>
6655
6656 <DD>
6657 If set to <B>On</B>, readline will display completions with matches
6658 sorted horizontally in alphabetical order, rather than down the screen.
6659 <DT><B>revert-all-at-newline (Off)</B>
6660
6661 <DD>
6662 If set to <B>on</B>, readline will undo all changes to history lines 
6663 before returning when <B>accept-line</B> is executed.  By default,
6664 history lines may be modified and retain individual undo lists across
6665 calls to <B>readline</B>.
6666 <DT><B>show-all-if-ambiguous (Off)</B>
6667
6668 <DD>
6669 This alters the default behavior of the completion functions.  If
6670 set to
6671 <B>on</B>,
6672
6673 words which have more than one possible completion cause the
6674 matches to be listed immediately instead of ringing the bell.
6675 <DT><B>show-all-if-unmodified (Off)</B>
6676
6677 <DD>
6678 This alters the default behavior of the completion functions in
6679 a fashion similar to <B>show-all-if-ambiguous</B>.
6680 If set to
6681 <B>on</B>,
6682
6683 words which have more than one possible completion without any
6684 possible partial completion (the possible completions don't share
6685 a common prefix) cause the matches to be listed immediately instead
6686 of ringing the bell.
6687 <DT><B>skip-completed-text (Off)</B>
6688
6689 <DD>
6690 If set to <B>On</B>, this alters the default completion behavior when
6691 inserting a single match into the line.  It's only active when
6692 performing completion in the middle of a word.  If enabled, readline
6693 does not insert characters from the completion that match characters
6694 after point in the word being completed, so portions of the word
6695 following the cursor are not duplicated.
6696 <DT><B>visible-stats (Off)</B>
6697
6698 <DD>
6699 If set to <B>On</B>, a character denoting a file's type as reported
6700 by <I>stat</I>(2) is appended to the filename when listing possible
6701 completions.
6702
6703 </DL>
6704 <A NAME="lbCK">&nbsp;</A>
6705 <H4>Readline Conditional Constructs</H4>
6706
6707 <P>
6708
6709 Readline implements a facility similar in spirit to the conditional
6710 compilation features of the C preprocessor which allows key
6711 bindings and variable settings to be performed as the result
6712 of tests.  There are four parser directives used.
6713 <DL COMPACT>
6714 <DT><B>$if</B><DD>
6715 The 
6716 <B>$if</B>
6717
6718 construct allows bindings to be made based on the
6719 editing mode, the terminal being used, or the application using
6720 readline.  The text of the test extends to the end of the line;
6721 no characters are required to isolate it.
6722 <DL COMPACT><DT><DD>
6723 <DL COMPACT>
6724 <DT><B>mode</B><DD>
6725 The <B>mode=</B> form of the <B>$if</B> directive is used to test
6726 whether readline is in emacs or vi mode.
6727 This may be used in conjunction
6728 with the <B>set keymap</B> command, for instance, to set bindings in
6729 the <I>emacs-standard</I> and <I>emacs-ctlx</I> keymaps only if
6730 readline is starting out in emacs mode.
6731 <DT><B>term</B><DD>
6732 The <B>term=</B> form may be used to include terminal-specific
6733 key bindings, perhaps to bind the key sequences output by the
6734 terminal's function keys.  The word on the right side of the
6735 <B>=</B>
6736
6737 is tested against the both full name of the terminal and the portion
6738 of the terminal name before the first <B>-</B>.  This allows
6739 <I>sun</I>
6740
6741 to match both
6742 <I>sun</I>
6743
6744 and
6745 <I>sun-cmd</I>,
6746
6747 for instance.
6748 <DT><B>application</B><DD>
6749 The <B>application</B> construct is used to include
6750 application-specific settings.  Each program using the readline
6751 library sets the <I>application name</I>, and an initialization
6752 file can test for a particular value.
6753 This could be used to bind key sequences to functions useful for
6754 a specific program.  For instance, the following command adds a
6755 key sequence that quotes the current or previous word in Bash:
6756 <P>
6757 <DL COMPACT><DT><DD>
6758 <PRE>
6759 <B>$if</B> Bash
6760 # Quote the current or previous word
6761 &quot;\C-xq&quot;: &quot;\eb\&quot;\ef\&quot;&quot;
6762 <B>$endif</B>
6763 </PRE>
6764
6765 </DL>
6766
6767 </DL></DL>
6768
6769 <DT><B>$endif</B><DD>
6770 This command, as seen in the previous example, terminates an
6771 <B>$if</B> command.
6772 <DT><B>$else</B><DD>
6773 Commands in this branch of the <B>$if</B> directive are executed if
6774 the test fails.
6775 <DT><B>$include</B><DD>
6776 This directive takes a single filename as an argument and reads commands
6777 and bindings from that file.  For example, the following directive
6778 would read <A HREF="file:/etc/inputrc"><I>/etc/inputrc</I></A>:
6779 <P>
6780 <DL COMPACT><DT><DD>
6781 <PRE>
6782 <B>$include</B>  <A HREF="file:/etc/inputrc"><I>/etc/inputrc</I></A>
6783 </PRE>
6784
6785 </DL>
6786
6787 </DL>
6788 <A NAME="lbCL">&nbsp;</A>
6789 <H4>Searching</H4>
6790
6791 <P>
6792
6793 Readline provides commands for searching through the command history
6794 (see
6795 <FONT SIZE=-1><B>HISTORY</B>
6796
6797 </FONT>
6798 below) for lines containing a specified string.
6799 There are two search modes:
6800 <I>incremental</I>
6801
6802 and
6803 <I>non-incremental</I>.
6804
6805 <P>
6806
6807 Incremental searches begin before the user has finished typing the
6808 search string.
6809 As each character of the search string is typed, readline displays
6810 the next entry from the history matching the string typed so far.
6811 An incremental search requires only as many characters as needed to
6812 find the desired history entry.
6813 The characters present in the value of the <B>isearch-terminators</B>
6814 variable are used to terminate an incremental search.
6815 If that variable has not been assigned a value the Escape and
6816 Control-J characters will terminate an incremental search.
6817 Control-G will abort an incremental search and restore the original
6818 line.
6819 When the search is terminated, the history entry containing the
6820 search string becomes the current line.
6821 <P>
6822
6823 To find other matching entries in the history list, type Control-S or
6824 Control-R as appropriate.
6825 This will search backward or forward in the history for the next
6826 entry matching the search string typed so far.
6827 Any other key sequence bound to a readline command will terminate
6828 the search and execute that command.
6829 For instance, a <I>newline</I> will terminate the search and accept
6830 the line, thereby executing the command from the history list.
6831 <P>
6832
6833 Readline remembers the last incremental search string.  If two
6834 Control-Rs are typed without any intervening characters defining a
6835 new search string, any remembered search string is used.
6836 <P>
6837
6838 Non-incremental searches read the entire search string before starting
6839 to search for matching history lines.  The search string may be
6840 typed by the user or be part of the contents of the current line.
6841 <A NAME="lbCM">&nbsp;</A>
6842 <H4>Readline Command Names</H4>
6843
6844 <P>
6845
6846 The following is a list of the names of the commands and the default
6847 key sequences to which they are bound.
6848 Command names without an accompanying key sequence are unbound by default.
6849 In the following descriptions, <I>point</I> refers to the current cursor
6850 position, and <I>mark</I> refers to a cursor position saved by the
6851 <B>set-mark</B> command.
6852 The text between the point and mark is referred to as the <I>region</I>.
6853 <A NAME="lbCN">&nbsp;</A>
6854 <H4>Commands for Moving</H4>
6855
6856 <P>
6857
6858
6859 <DL COMPACT>
6860 <DT><B>beginning-of-line (C-a)</B>
6861
6862 <DD>
6863 Move to the start of the current line.
6864 <DT><B>end-of-line (C-e)</B>
6865
6866 <DD>
6867 Move to the end of the line.
6868 <DT><B>forward-char (C-f)</B>
6869
6870 <DD>
6871 Move forward a character.
6872 <DT><B>backward-char (C-b)</B>
6873
6874 <DD>
6875 Move back a character.
6876 <DT><B>forward-word (M-f)</B>
6877
6878 <DD>
6879 Move forward to the end of the next word.  Words are composed of
6880 alphanumeric characters (letters and digits).
6881 <DT><B>backward-word (M-b)</B>
6882
6883 <DD>
6884 Move back to the start of the current or previous word.
6885 Words are composed of alphanumeric characters (letters and digits).
6886 <DT><B>shell-forward-word</B>
6887
6888 <DD>
6889 Move forward to the end of the next word.
6890 Words are delimited by non-quoted shell metacharacters.
6891 <DT><B>shell-backward-word</B>
6892
6893 <DD>
6894 Move back to the start of the current or previous word.
6895 Words are delimited by non-quoted shell metacharacters.
6896 <DT><B>clear-screen (C-l)</B>
6897
6898 <DD>
6899 Clear the screen leaving the current line at the top of the screen.
6900 With an argument, refresh the current line without clearing the
6901 screen.
6902 <DT><B>redraw-current-line</B>
6903
6904 <DD>
6905 Refresh the current line.
6906
6907 </DL>
6908 <A NAME="lbCO">&nbsp;</A>
6909 <H4>Commands for Manipulating the History</H4>
6910
6911 <P>
6912
6913
6914 <DL COMPACT>
6915 <DT><B>accept-line (Newline, Return)</B>
6916
6917 <DD>
6918 Accept the line regardless of where the cursor is.  If this line is
6919 non-empty, add it to the history list according to the state of the
6920 <FONT SIZE=-1><B>HISTCONTROL</B>
6921
6922 </FONT>
6923 variable.  If the line is a modified history
6924 line, then restore the history line to its original state.
6925 <DT><B>previous-history (C-p)</B>
6926
6927 <DD>
6928 Fetch the previous command from the history list, moving back in
6929 the list.
6930 <DT><B>next-history (C-n)</B>
6931
6932 <DD>
6933 Fetch the next command from the history list, moving forward in the
6934 list.
6935 <DT><B>beginning-of-history (M-&lt;)</B>
6936
6937 <DD>
6938 Move to the first line in the history.
6939 <DT><B>end-of-history (M-&gt;)</B>
6940
6941 <DD>
6942 Move to the end of the input history, i.e., the line currently being
6943 entered.
6944 <DT><B>reverse-search-history (C-r)</B>
6945
6946 <DD>
6947 Search backward starting at the current line and moving `up' through
6948 the history as necessary.  This is an incremental search.
6949 <DT><B>forward-search-history (C-s)</B>
6950
6951 <DD>
6952 Search forward starting at the current line and moving `down' through
6953 the history as necessary.  This is an incremental search.
6954 <DT><B>non-incremental-reverse-search-history (M-p)</B>
6955
6956 <DD>
6957 Search backward through the history starting at the current line
6958 using a non-incremental search for a string supplied by the user.
6959 <DT><B>non-incremental-forward-search-history (M-n)</B>
6960
6961 <DD>
6962 Search forward through the history using a non-incremental search for
6963 a string supplied by the user.
6964 <DT><B>history-search-forward</B>
6965
6966 <DD>
6967 Search forward through the history for the string of characters
6968 between the start of the current line and the point.
6969 This is a non-incremental search.
6970 <DT><B>history-search-backward</B>
6971
6972 <DD>
6973 Search backward through the history for the string of characters
6974 between the start of the current line and the point.
6975 This is a non-incremental search.
6976 <DT><B>yank-nth-arg (M-C-y)</B>
6977
6978 <DD>
6979 Insert the first argument to the previous command (usually
6980 the second word on the previous line) at point.
6981 With an argument
6982 <I>n</I>,
6983
6984 insert the <I>n</I>th word from the previous command (the words
6985 in the previous command begin with word 0).  A negative argument
6986 inserts the <I>n</I>th word from the end of the previous command.
6987 Once the argument <I>n</I> is computed, the argument is extracted
6988 as if the &quot;!<I>n</I>&quot; history expansion had been specified.
6989 <DT><B>yank-last-arg (M-., M-_)</B>
6990
6991 <DD>
6992 Insert the last argument to the previous command (the last word of
6993 the previous history entry).  With an argument,
6994 behave exactly like <B>yank-nth-arg</B>.
6995 Successive calls to <B>yank-last-arg</B> move back through the history
6996 list, inserting the last argument of each line in turn.
6997 The history expansion facilities are used to extract the last argument,
6998 as if the &quot;!$&quot; history expansion had been specified.
6999 <DT><B>shell-expand-line (M-C-e)</B>
7000
7001 <DD>
7002 Expand the line as the shell does.  This
7003 performs alias and history expansion as well as all of the shell
7004 word expansions.  See
7005 <FONT SIZE=-1><B>HISTORY EXPANSION</B>
7006
7007 </FONT>
7008 below for a description of history expansion.
7009 <DT><B>history-expand-line (M-^)</B>
7010
7011 <DD>
7012 Perform history expansion on the current line.
7013 See
7014 <FONT SIZE=-1><B>HISTORY EXPANSION</B>
7015
7016 </FONT>
7017 below for a description of history expansion.
7018 <DT><B>magic-space</B>
7019
7020 <DD>
7021 Perform history expansion on the current line and insert a space.
7022 See
7023 <FONT SIZE=-1><B>HISTORY EXPANSION</B>
7024
7025 </FONT>
7026 below for a description of history expansion.
7027 <DT><B>alias-expand-line</B>
7028
7029 <DD>
7030 Perform alias expansion on the current line.
7031 See
7032 <FONT SIZE=-1><B>ALIASES</B>
7033
7034 </FONT>
7035 above for a description of alias expansion.
7036 <DT><B>history-and-alias-expand-line</B>
7037
7038 <DD>
7039 Perform history and alias expansion on the current line.
7040 <DT><B>insert-last-argument (M-., M-_)</B>
7041
7042 <DD>
7043 A synonym for <B>yank-last-arg</B>.
7044 <DT><B>operate-and-get-next (C-o)</B>
7045
7046 <DD>
7047 Accept the current line for execution and fetch the next line
7048 relative to the current line from the history for editing.  Any
7049 argument is ignored.
7050 <DT><B>edit-and-execute-command (C-xC-e)</B>
7051
7052 <DD>
7053 Invoke an editor on the current command line, and execute the result as shell
7054 commands.
7055 <B>Bash</B> attempts to invoke
7056 <FONT SIZE=-1><B>$VISUAL</B>,
7057
7058 </FONT>
7059 <FONT SIZE=-1><B>$EDITOR</B>,
7060
7061 </FONT>
7062 and <I>emacs</I> as the editor, in that order.
7063
7064 </DL>
7065 <A NAME="lbCP">&nbsp;</A>
7066 <H4>Commands for Changing Text</H4>
7067
7068 <P>
7069
7070
7071 <DL COMPACT>
7072 <DT><B>delete-char (C-d)</B>
7073
7074 <DD>
7075 Delete the character at point.  If point is at the
7076 beginning of the line, there are no characters in the line, and
7077 the last character typed was not bound to <B>delete-char</B>,
7078 then return
7079 <FONT SIZE=-1><B>EOF</B>.
7080
7081 </FONT>
7082 <DT><B>backward-delete-char (Rubout)</B>
7083
7084 <DD>
7085 Delete the character behind the cursor.  When given a numeric argument,
7086 save the deleted text on the kill ring.
7087 <DT><B>forward-backward-delete-char</B>
7088
7089 <DD>
7090 Delete the character under the cursor, unless the cursor is at the
7091 end of the line, in which case the character behind the cursor is
7092 deleted.
7093 <DT><B>quoted-insert (C-q, C-v)</B>
7094
7095 <DD>
7096 Add the next character typed to the line verbatim.  This is
7097 how to insert characters like <B>C-q</B>, for example.
7098 <DT><B>tab-insert (C-v TAB)</B>
7099
7100 <DD>
7101 Insert a tab character.
7102 <DT><B>self-insert (a,&nbsp;b,&nbsp;A,&nbsp;1,&nbsp;!,&nbsp;...)</B>
7103
7104 <DD>
7105 Insert the character typed.
7106 <DT><B>transpose-chars (C-t)</B>
7107
7108 <DD>
7109 Drag the character before point forward over the character at point,
7110 moving point forward as well.
7111 If point is at the end of the line, then this transposes
7112 the two characters before point.
7113 Negative arguments have no effect.
7114 <DT><B>transpose-words (M-t)</B>
7115
7116 <DD>
7117 Drag the word before point past the word after point,
7118 moving point over that word as well.
7119 If point is at the end of the line, this transposes
7120 the last two words on the line.   
7121 <DT><B>upcase-word (M-u)</B>
7122
7123 <DD>
7124 Uppercase the current (or following) word.  With a negative argument,
7125 uppercase the previous word, but do not move point.
7126 <DT><B>downcase-word (M-l)</B>
7127
7128 <DD>
7129 Lowercase the current (or following) word.  With a negative argument,
7130 lowercase the previous word, but do not move point.
7131 <DT><B>capitalize-word (M-c)</B>
7132
7133 <DD>
7134 Capitalize the current (or following) word.  With a negative argument,
7135 capitalize the previous word, but do not move point.
7136 <DT><B>overwrite-mode</B>
7137
7138 <DD>
7139 Toggle overwrite mode.  With an explicit positive numeric argument,
7140 switches to overwrite mode.  With an explicit non-positive numeric
7141 argument, switches to insert mode.  This command affects only
7142 <B>emacs</B> mode; <B>vi</B> mode does overwrite differently.
7143 Each call to <I>readline()</I> starts in insert mode.
7144 In overwrite mode, characters bound to <B>self-insert</B> replace   
7145 the text at point rather than pushing the text to the right.
7146 Characters bound to <B>backward-delete-char</B> replace the character
7147 before point with a space.  By default, this command is unbound.
7148
7149 </DL>
7150 <A NAME="lbCQ">&nbsp;</A>
7151 <H4>Killing and Yanking</H4>
7152
7153 <P>
7154
7155
7156 <DL COMPACT>
7157 <DT><B>kill-line (C-k)</B>
7158
7159 <DD>
7160 Kill the text from point to the end of the line.
7161 <DT><B>backward-kill-line (C-x Rubout)</B>
7162
7163 <DD>
7164 Kill backward to the beginning of the line.
7165 <DT><B>unix-line-discard (C-u)</B>
7166
7167 <DD>
7168 Kill backward from point to the beginning of the line.
7169 The killed text is saved on the kill-ring.
7170
7171 <DT><B>kill-whole-line</B>
7172
7173 <DD>
7174 Kill all characters on the current line, no matter where point is.
7175 <DT><B>kill-word  (M-d)</B>
7176
7177 <DD>
7178 Kill from point to the end of the current word, or if between
7179 words, to the end of the next word.
7180 Word boundaries are the same as those used by <B>forward-word</B>.
7181 <DT><B>backward-kill-word (M-Rubout)</B>
7182
7183 <DD>
7184 Kill the word behind point.
7185 Word boundaries are the same as those used by <B>backward-word</B>.
7186 <DT><B>shell-kill-word  (M-d)</B>
7187
7188 <DD>
7189 Kill from point to the end of the current word, or if between
7190 words, to the end of the next word.
7191 Word boundaries are the same as those used by <B>shell-forward-word</B>.
7192 <DT><B>shell-backward-kill-word (M-Rubout)</B>
7193
7194 <DD>
7195 Kill the word behind point.
7196 Word boundaries are the same as those used by <B>shell-backward-word</B>.
7197 <DT><B>unix-word-rubout (C-w)</B>
7198
7199 <DD>
7200 Kill the word behind point, using white space as a word boundary.
7201 The killed text is saved on the kill-ring.
7202 <DT><B>unix-filename-rubout</B>
7203
7204 <DD>
7205 Kill the word behind point, using white space and the slash character
7206 as the word boundaries.
7207 The killed text is saved on the kill-ring.
7208 <DT><B>delete-horizontal-space (M-\)</B>
7209
7210 <DD>
7211 Delete all spaces and tabs around point.
7212 <DT><B>kill-region</B>
7213
7214 <DD>
7215 Kill the text in the current region.
7216 <DT><B>copy-region-as-kill</B>
7217
7218 <DD>
7219 Copy the text in the region to the kill buffer.
7220 <DT><B>copy-backward-word</B>
7221
7222 <DD>
7223 Copy the word before point to the kill buffer.
7224 The word boundaries are the same as <B>backward-word</B>.
7225 <DT><B>copy-forward-word</B>
7226
7227 <DD>
7228 Copy the word following point to the kill buffer.
7229 The word boundaries are the same as <B>forward-word</B>.
7230 <DT><B>yank (C-y)</B>
7231
7232 <DD>
7233 Yank the top of the kill ring into the buffer at point.
7234 <DT><B>yank-pop (M-y)</B>
7235
7236 <DD>
7237 Rotate the kill ring, and yank the new top.  Only works following
7238 <B>yank</B>
7239
7240 or
7241 <B>yank-pop</B>.
7242
7243
7244 </DL>
7245 <A NAME="lbCR">&nbsp;</A>
7246 <H4>Numeric Arguments</H4>
7247
7248 <P>
7249
7250
7251 <DL COMPACT>
7252 <DT><B>digit-argument (M-0, M-1, ..., M--)</B>
7253
7254 <DD>
7255 Add this digit to the argument already accumulating, or start a new
7256 argument.  M-- starts a negative argument.
7257 <DT><B>universal-argument</B>
7258
7259 <DD>
7260 This is another way to specify an argument.
7261 If this command is followed by one or more digits, optionally with a
7262 leading minus sign, those digits define the argument.
7263 If the command is followed by digits, executing
7264 <B>universal-argument</B>
7265
7266 again ends the numeric argument, but is otherwise ignored.
7267 As a special case, if this command is immediately followed by a
7268 character that is neither a digit or minus sign, the argument count
7269 for the next command is multiplied by four.
7270 The argument count is initially one, so executing this function the
7271 first time makes the argument count four, a second time makes the
7272 argument count sixteen, and so on.
7273
7274 </DL>
7275 <A NAME="lbCS">&nbsp;</A>
7276 <H4>Completing</H4>
7277
7278 <P>
7279
7280
7281 <DL COMPACT>
7282 <DT><B>complete (TAB)</B>
7283
7284 <DD>
7285 Attempt to perform completion on the text before point.
7286 <B>Bash</B>
7287
7288 attempts completion treating the text as a variable (if the
7289 text begins with <B>$</B>), username (if the text begins with
7290 <B>~</B>), hostname (if the text begins with <B>@</B>), or
7291 command (including aliases and functions) in turn.  If none
7292 of these produces a match, filename completion is attempted.
7293 <DT><B>possible-completions (M-?)</B>
7294
7295 <DD>
7296 List the possible completions of the text before point.
7297 <DT><B>insert-completions (M-*)</B>
7298
7299 <DD>
7300 Insert all completions of the text before point
7301 that would have been generated by
7302 <B>possible-completions</B>.
7303 <DT><B>menu-complete</B>
7304
7305 <DD>
7306 Similar to <B>complete</B>, but replaces the word to be completed
7307 with a single match from the list of possible completions.
7308 Repeated execution of <B>menu-complete</B> steps through the list
7309 of possible completions, inserting each match in turn.
7310 At the end of the list of completions, the bell is rung
7311 (subject to the setting of <B>bell-style</B>)
7312 and the original text is restored.
7313 An argument of <I>n</I> moves <I>n</I> positions forward in the list
7314 of matches; a negative argument may be used to move backward
7315 through the list.
7316 This command is intended to be bound to <B>TAB</B>, but is unbound
7317 by default.
7318 <DT><B>menu-complete-rd</B>
7319
7320 <DD>
7321 Identical to <B>menu-complete</B>, but moves backward through the list
7322 of possible completions, as if <B>menu-complete</B> had been given a
7323 negative argument.  This command is unbound by default.
7324 <DT><B>delete-char-or-list</B>
7325
7326 <DD>
7327 Deletes the character under the cursor if not at the beginning or
7328 end of the line (like <B>delete-char</B>).
7329 If at the end of the line, behaves identically to
7330 <B>possible-completions</B>.
7331 This command is unbound by default.
7332 <DT><B>complete-filename (M-/)</B>
7333
7334 <DD>
7335 Attempt filename completion on the text before point.
7336 <DT><B>possible-filename-completions (C-x /)</B>
7337
7338 <DD>
7339 List the possible completions of the text before point,
7340 treating it as a filename.
7341 <DT><B>complete-username (M-~)</B>
7342
7343 <DD>
7344 Attempt completion on the text before point, treating
7345 it as a username.
7346 <DT><B>possible-username-completions (C-x ~)</B>
7347
7348 <DD>
7349 List the possible completions of the text before point,
7350 treating it as a username.
7351 <DT><B>complete-variable (M-$)</B>
7352
7353 <DD>
7354 Attempt completion on the text before point, treating
7355 it as a shell variable.
7356 <DT><B>possible-variable-completions (C-x $)</B>
7357
7358 <DD>
7359 List the possible completions of the text before point,
7360 treating it as a shell variable.
7361 <DT><B>complete-hostname (M-@)</B>
7362
7363 <DD>
7364 Attempt completion on the text before point, treating
7365 it as a hostname.
7366 <DT><B>possible-hostname-completions (C-x @)</B>
7367
7368 <DD>
7369 List the possible completions of the text before point,
7370 treating it as a hostname.
7371 <DT><B>complete-command (M-!)</B>
7372
7373 <DD>
7374 Attempt completion on the text before point, treating
7375 it as a command name.  Command completion attempts to
7376 match the text against aliases, reserved words, shell
7377 functions, shell builtins, and finally executable filenames,
7378 in that order.
7379 <DT><B>possible-command-completions (C-x !)</B>
7380
7381 <DD>
7382 List the possible completions of the text before point,
7383 treating it as a command name.
7384 <DT><B>dynamic-complete-history (M-TAB)</B>
7385
7386 <DD>
7387 Attempt completion on the text before point, comparing
7388 the text against lines from the history list for possible
7389 completion matches.
7390 <DT><B>dabbrev-expand</B>
7391
7392 <DD>
7393 Attempt menu completion on the text before point, comparing
7394 the text against lines from the history list for possible
7395 completion matches.
7396 <DT><B>complete-into-braces (M-{)</B>
7397
7398 <DD>
7399 Perform filename completion and insert the list of possible completions
7400 enclosed within braces so the list is available to the shell (see
7401 <B>Brace Expansion</B>
7402
7403 above).
7404
7405 </DL>
7406 <A NAME="lbCT">&nbsp;</A>
7407 <H4>Keyboard Macros</H4>
7408
7409 <P>
7410
7411
7412 <DL COMPACT>
7413 <DT><B>start-kbd-macro (C-x ()</B>
7414
7415 <DD>
7416 Begin saving the characters typed into the current keyboard macro.
7417 <DT><B>end-kbd-macro (C-x ))</B>
7418
7419 <DD>
7420 Stop saving the characters typed into the current keyboard macro
7421 and store the definition.
7422 <DT><B>call-last-kbd-macro (C-x e)</B>
7423
7424 <DD>
7425 Re-execute the last keyboard macro defined, by making the characters
7426 in the macro appear as if typed at the keyboard.
7427
7428 </DL>
7429 <A NAME="lbCU">&nbsp;</A>
7430 <H4>Miscellaneous</H4>
7431
7432 <P>
7433
7434
7435 <DL COMPACT>
7436 <DT><B>re-read-init-file (C-x C-r)</B>
7437
7438 <DD>
7439 Read in the contents of the <I>inputrc</I> file, and incorporate
7440 any bindings or variable assignments found there.
7441 <DT><B>abort (C-g)</B>
7442
7443 <DD>
7444 Abort the current editing command and
7445 ring the terminal's bell (subject to the setting of
7446 <B>bell-style</B>).
7447
7448 <DT><B>do-uppercase-version (M-a, M-b, M-</B><I>x</I>, ...)
7449
7450 <DD>
7451 If the metafied character <I>x</I> is lowercase, run the command
7452 that is bound to the corresponding uppercase character.
7453 <DT><B>prefix-meta (ESC)</B>
7454
7455 <DD>
7456 Metafy the next character typed.
7457 <FONT SIZE=-1><B>ESC</B>
7458
7459 </FONT>
7460 <B>f</B>
7461
7462 is equivalent to
7463 <B>Meta-f</B>.
7464
7465 <DT><B>undo (C-_, C-x C-u)</B>
7466
7467 <DD>
7468 Incremental undo, separately remembered for each line.
7469 <DT><B>revert-line (M-r)</B>
7470
7471 <DD>
7472 Undo all changes made to this line.  This is like executing the
7473 <B>undo</B>
7474
7475 command enough times to return the line to its initial state.
7476 <DT><B>tilde-expand (M-&amp;)</B>
7477
7478 <DD>
7479 Perform tilde expansion on the current word.
7480 <DT><B>set-mark (C-@, M-&lt;space&gt;)</B>
7481
7482 <DD>
7483 Set the mark to the point.  If a
7484 numeric argument is supplied, the mark is set to that position.
7485 <DT><B>exchange-point-and-mark (C-x C-x)</B>
7486
7487 <DD>
7488 Swap the point with the mark.  The current cursor position is set to
7489 the saved position, and the old cursor position is saved as the mark.
7490 <DT><B>character-search (C-])</B>
7491
7492 <DD>
7493 A character is read and point is moved to the next occurrence of that
7494 character.  A negative count searches for previous occurrences.
7495 <DT><B>character-search-backward (M-C-])</B>
7496
7497 <DD>
7498 A character is read and point is moved to the previous occurrence of that
7499 character.  A negative count searches for subsequent occurrences.
7500 <DT><B>skip-csi-sequence ()</B>
7501
7502 <DD>
7503 Read enough characters to consume a multi-key sequence such as those
7504 defined for keys like Home and End.  Such sequences begin with a
7505 Control Sequence Indicator (CSI), usually ESC-[.  If this sequence is
7506 bound to &quot;\[&quot;, keys producing such sequences will have no effect
7507 unless explicitly bound to a readline command, instead of inserting
7508 stray characters into the editing buffer.  This is unbound by default,
7509 but usually bound to ESC-[.
7510 <DT><B>insert-comment (M-#)</B>
7511
7512 <DD>
7513 Without a numeric argument, the value of the readline
7514 <B>comment-begin</B>
7515
7516 variable is inserted at the beginning of the current line.
7517 If a numeric argument is supplied, this command acts as a toggle:  if
7518 the characters at the beginning of the line do not match the value
7519 of <B>comment-begin</B>, the value is inserted, otherwise
7520 the characters in <B>comment-begin</B> are deleted from the beginning of 
7521 the line.
7522 In either case, the line is accepted as if a newline had been typed.
7523 The default value of
7524 <B>comment-begin</B> causes this command to make the current line
7525 a shell comment.
7526 If a numeric argument causes the comment character to be removed, the line
7527 will be executed by the shell.
7528 <DT><B>glob-complete-word (M-g)</B>
7529
7530 <DD>
7531 The word before point is treated as a pattern for pathname expansion,
7532 with an asterisk implicitly appended.  This pattern is used to
7533 generate a list of matching file names for possible completions.
7534 <DT><B>glob-expand-word (C-x *)</B>
7535
7536 <DD>
7537 The word before point is treated as a pattern for pathname expansion,
7538 and the list of matching file names is inserted, replacing the word.
7539 If a numeric argument is supplied, an asterisk is appended before
7540 pathname expansion.
7541 <DT><B>glob-list-expansions (C-x g)</B>
7542
7543 <DD>
7544 The list of expansions that would have been generated by
7545 <B>glob-expand-word</B>
7546
7547 is displayed, and the line is redrawn.
7548 If a numeric argument is supplied, an asterisk is appended before
7549 pathname expansion.
7550 <DT><B>dump-functions</B>
7551
7552 <DD>
7553 Print all of the functions and their key bindings to the
7554 readline output stream.  If a numeric argument is supplied,
7555 the output is formatted in such a way that it can be made part
7556 of an <I>inputrc</I> file.
7557 <DT><B>dump-variables</B>
7558
7559 <DD>
7560 Print all of the settable readline variables and their values to the
7561 readline output stream.  If a numeric argument is supplied,
7562 the output is formatted in such a way that it can be made part
7563 of an <I>inputrc</I> file.
7564 <DT><B>dump-macros</B>
7565
7566 <DD>
7567 Print all of the readline key sequences bound to macros and the
7568 strings they output.  If a numeric argument is supplied,
7569 the output is formatted in such a way that it can be made part
7570 of an <I>inputrc</I> file.
7571 <DT><B>display-shell-version (C-x C-v)</B>
7572
7573 <DD>
7574 Display version information about the current instance of
7575 <B>bash</B>.
7576
7577
7578 </DL>
7579 <A NAME="lbCV">&nbsp;</A>
7580 <H4>Programmable Completion</H4>
7581
7582 <P>
7583
7584 When word completion is attempted for an argument to a command for
7585 which a completion specification (a <I>compspec</I>) has been defined
7586 using the <B>complete</B> builtin (see
7587 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
7588
7589 </FONT>
7590 below), the programmable completion facilities are invoked.
7591 <P>
7592
7593 First, the command name is identified.
7594 If the command word is the empty string (completion attempted at the
7595 beginning of an empty line), any compspec defined with
7596 the <B>-E</B> option to <B>complete</B> is used.
7597 If a compspec has been defined for that command, the
7598 compspec is used to generate the list of possible completions for the word.
7599 If the command word is a full pathname, a compspec for the full
7600 pathname is searched for first.
7601 If no compspec is found for the full pathname, an attempt is made to
7602 find a compspec for the portion following the final slash.
7603 If those searches to not result in a compspec, any compspec defined with
7604 the <B>-D</B> option to <B>complete</B> is used as the default.
7605 <P>
7606
7607 Once a compspec has been found, it is used to generate the list of
7608 matching words.
7609 If a compspec is not found, the default <B>bash</B> completion as
7610 described above under <B>Completing</B> is performed.
7611 <P>
7612
7613 First, the actions specified by the compspec are used.
7614 Only matches which are prefixed by the word being completed are
7615 returned.
7616 When the
7617 <B>-f</B>
7618
7619 or
7620 <B>-d</B>
7621
7622 option is used for filename or directory name completion, the shell
7623 variable
7624 <FONT SIZE=-1><B>FIGNORE</B>
7625
7626 </FONT>
7627 is used to filter the matches.
7628 <P>
7629
7630 Any completions specified by a pathname expansion pattern to the
7631 <B>-G</B> option are generated next.
7632 The words generated by the pattern need not match the word
7633 being completed.
7634 The
7635 <FONT SIZE=-1><B>GLOBIGNORE</B>
7636
7637 </FONT>
7638 shell variable is not used to filter the matches, but the
7639 <FONT SIZE=-1><B>FIGNORE</B>
7640
7641 </FONT>
7642 variable is used.
7643 <P>
7644
7645 Next, the string specified as the argument to the <B>-W</B> option
7646 is considered.
7647 The string is first split using the characters in the
7648 <FONT SIZE=-1><B>IFS</B>
7649
7650 </FONT>
7651 special variable as delimiters.
7652 Shell quoting is honored.
7653 Each word is then expanded using
7654 brace expansion, tilde expansion, parameter and variable expansion,
7655 command substitution, and arithmetic expansion,
7656 as described above under 
7657 <FONT SIZE=-1><B>EXPANSION</B>.
7658
7659 </FONT>
7660 The results are split using the rules described above under
7661 <B>Word Splitting</B>.
7662 The results of the expansion are prefix-matched against the word being
7663 completed, and the matching words become the possible completions.
7664 <P>
7665
7666 After these matches have been generated, any shell function or command
7667 specified with the <B>-F</B> and <B>-C</B> options is invoked.
7668 When the command or function is invoked, the
7669 <FONT SIZE=-1><B>COMP_LINE</B>,
7670
7671 </FONT>
7672 <FONT SIZE=-1><B>COMP_POINT</B>,
7673
7674 </FONT>
7675 <FONT SIZE=-1><B>COMP_KEY</B>,
7676
7677 </FONT>
7678 and
7679 <FONT SIZE=-1><B>COMP_TYPE</B>
7680
7681 </FONT>
7682 variables are assigned values as described above under
7683 <B>Shell Variables</B>.
7684 If a shell function is being invoked, the 
7685 <FONT SIZE=-1><B>COMP_WORDS</B>
7686
7687 </FONT>
7688 and
7689 <FONT SIZE=-1><B>COMP_CWORD</B>
7690
7691 </FONT>
7692 variables are also set.
7693 When the function or command is invoked, the first argument is the
7694 name of the command whose arguments are being completed, the
7695 second argument is the word being completed, and the third argument
7696 is the word preceding the word being completed on the current command line.
7697 No filtering of the generated completions against the word being completed
7698 is performed; the function or command has complete freedom in generating
7699 the matches.
7700 <P>
7701
7702 Any function specified with <B>-F</B> is invoked first.
7703 The function may use any of the shell facilities, including the
7704 <B>compgen</B> builtin described below, to generate the matches.
7705 It must put the possible completions in the
7706 <FONT SIZE=-1><B>COMPREPLY</B>
7707
7708 </FONT>
7709 array variable.
7710 <P>
7711
7712 Next, any command specified with the <B>-C</B> option is invoked
7713 in an environment equivalent to command substitution.
7714 It should print a list of completions, one per line, to the
7715 standard output.
7716 Backslash may be used to escape a newline, if necessary.
7717 <P>
7718
7719 After all of the possible completions are generated, any filter
7720 specified with the <B>-X</B> option is applied to the list.
7721 The filter is a pattern as used for pathname expansion; a <B>&amp;</B>
7722 in the pattern is replaced with the text of the word being completed.
7723 A literal <B>&amp;</B> may be escaped with a backslash; the backslash
7724 is removed before attempting a match.
7725 Any completion that matches the pattern will be removed from the list.
7726 A leading <B>!</B> negates the pattern; in this case any completion
7727 not matching the pattern will be removed.
7728 <P>
7729
7730 Finally, any prefix and suffix specified with the <B>-P</B> and <B>-S</B>
7731 options are added to each member of the completion list, and the result is
7732 returned to the readline completion code as the list of possible
7733 completions.
7734 <P>
7735
7736 If the previously-applied actions do not generate any matches, and the
7737 <B>-o dirnames</B> option was supplied to <B>complete</B> when the
7738 compspec was defined, directory name completion is attempted.
7739 <P>
7740
7741 If the <B>-o plusdirs</B> option was supplied to <B>complete</B> when the
7742 compspec was defined, directory name completion is attempted and any
7743 matches are added to the results of the other actions.
7744 <P>
7745
7746 By default, if a compspec is found, whatever it generates is returned
7747 to the completion code as the full set of possible completions.
7748 The default <B>bash</B> completions are not attempted, and the readline
7749 default of filename completion is disabled.
7750 If the <B>-o bashdefault</B> option was supplied to <B>complete</B> when
7751 the compspec was defined, the <B>bash</B> default completions are attempted
7752 if the compspec generates no matches.
7753 If the <B>-o default</B> option was supplied to <B>complete</B> when the
7754 compspec was defined, readline's default completion will be performed
7755 if the compspec (and, if attempted, the default <B>bash</B> completions)
7756 generate no matches.
7757 <P>
7758
7759 When a compspec indicates that directory name completion is desired,
7760 the programmable completion functions force readline to append a slash
7761 to completed names which are symbolic links to directories, subject to  
7762 the value of the <B>mark-directories</B> readline variable, regardless
7763 of the setting of the <B>mark-symlinked-directories</B> readline variable.
7764 <P>
7765
7766 There is some support for dynamically modifying completions.  This is
7767 most useful when used in combination with a default completion specified
7768 with <B>complete -D</B>.
7769 It's possible for shell functions executed as completion
7770 handlers to indicate that completion should be retried by returning an
7771 exit status of 124.  If a shell function returns 124, and changes
7772 the compspec associated with the command on which completion is being
7773 attempted (supplied as the first argument when the function is executed),
7774 programmable completion restarts from the beginning, with an
7775 attempt to find a compspec for that command.  This allows a set of
7776 completions to be built dynamically as completion is attempted, rather than
7777 being loaded all at once.
7778 <P>
7779
7780 For instance, assuming that there is a library of compspecs, each kept in a
7781 file corresponding to the name of the command, the following default
7782 completion function would load completions dynamically:
7783 <P>
7784
7785 <TT>_completion_loader()
7786 <BR>
7787
7788 {
7789 <BR>
7790
7791 <TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT>. &quot;/etc/bash_completion.d/$1.sh&quot; &gt;/dev/null 2&gt;&amp;1 &amp;&amp; return 124<BR>
7792 <BR>
7793
7794 }
7795 <BR>
7796
7797 complete -D -F _completion_loader
7798 <BR>
7799
7800 </TT>
7801 <A NAME="lbCW">&nbsp;</A>
7802 <H3>HISTORY</H3>
7803
7804 When the
7805 <B>-o history</B>
7806
7807 option to the
7808 <B>set</B>
7809
7810 builtin is enabled, the shell provides access to the
7811 <I>command history</I>,
7812 the list of commands previously typed.
7813 The value of the
7814 <FONT SIZE=-1><B>HISTSIZE</B>
7815
7816 </FONT>
7817 variable is used as the
7818 number of commands to save in a history list.
7819 The text of the last
7820 <FONT SIZE=-1><B>HISTSIZE</B>
7821
7822 </FONT>
7823 commands (default 500) is saved.  The shell
7824 stores each command in the history list prior to parameter and
7825 variable expansion (see
7826 <FONT SIZE=-1><B>EXPANSION</B>
7827
7828 </FONT>
7829 above) but after history expansion is performed, subject to the
7830 values of the shell variables
7831 <FONT SIZE=-1><B>HISTIGNORE</B>
7832
7833 </FONT>
7834 and
7835 <FONT SIZE=-1><B>HISTCONTROL</B>.
7836
7837 </FONT>
7838 <P>
7839
7840 On startup, the history is initialized from the file named by
7841 the variable
7842 <FONT SIZE=-1><B>HISTFILE</B>
7843
7844 </FONT>
7845 (default <A HREF="file:~/.bash_history"><I>~/.bash_history</I></A>).
7846 The file named by the value of
7847 <FONT SIZE=-1><B>HISTFILE</B>
7848
7849 </FONT>
7850 is truncated, if necessary, to contain no more than
7851 the number of lines specified by the value of
7852 <FONT SIZE=-1><B>HISTFILESIZE</B>.
7853
7854 </FONT>
7855 When the history file is read,
7856 lines beginning with the history comment character followed immediately
7857 by a digit are interpreted as timestamps for the preceding history line.
7858 These timestamps are optionally displayed depending on the value of the
7859 <FONT SIZE=-1><B>HISTTIMEFORMAT</B>
7860
7861 </FONT>
7862 variable.
7863 When an interactive shell exits, the last
7864 <FONT SIZE=-1><B>$HISTSIZE</B>
7865
7866 </FONT>
7867 lines are copied from the history list to
7868 <FONT SIZE=-1><B>$HISTFILE</B>.
7869
7870 </FONT>
7871 If the
7872 <B>histappend</B>
7873
7874 shell option is enabled
7875 (see the description of
7876 <B>shopt</B>
7877
7878 under
7879 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
7880
7881 </FONT>
7882 below), the lines are appended to the history file,
7883 otherwise the history file is overwritten.
7884 If
7885 <FONT SIZE=-1><B>HISTFILE</B>
7886
7887 </FONT>
7888 is unset, or if the history file is unwritable, the history is
7889 not saved.
7890 If the
7891 <FONT SIZE=-1><B>HISTTIMEFORMAT</B>
7892
7893 </FONT>
7894 variable is set, time stamps are written to the history file, marked
7895 with the history comment character, so
7896 they may be preserved across shell sessions.
7897 This uses the history comment character to distinguish timestamps from
7898 other history lines.
7899 After saving the history, the history file is truncated
7900 to contain no more than
7901 <FONT SIZE=-1><B>HISTFILESIZE</B>
7902
7903 </FONT>
7904 lines.  If
7905 <FONT SIZE=-1><B>HISTFILESIZE</B>
7906
7907 </FONT>
7908 is not set, no truncation is performed.
7909 <P>
7910
7911 The builtin command
7912 <B>fc</B>
7913
7914 (see
7915 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
7916
7917 </FONT>
7918 below) may be used to list or edit and re-execute a portion of
7919 the history list.
7920 The
7921 <B>history</B>
7922
7923 builtin may be used to display or modify the history list and
7924 manipulate the history file.
7925 When using command-line editing, search commands
7926 are available in each editing mode that provide access to the
7927 history list.
7928 <P>
7929
7930 The shell allows control over which commands are saved on the history
7931 list.  The
7932 <FONT SIZE=-1><B>HISTCONTROL</B>
7933
7934 </FONT>
7935 and
7936 <FONT SIZE=-1><B>HISTIGNORE</B>
7937
7938 </FONT>
7939 variables may be set to cause the shell to save only a subset of the
7940 commands entered.
7941 The
7942 <B>cmdhist</B>
7943
7944 shell option, if enabled, causes the shell to attempt to save each
7945 line of a multi-line command in the same history entry, adding
7946 semicolons where necessary to preserve syntactic correctness.
7947 The
7948 <B>lithist</B>
7949
7950 shell option causes the shell to save the command with embedded newlines
7951 instead of semicolons.  See the description of the
7952 <B>shopt</B>
7953
7954 builtin below under
7955 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
7956
7957 </FONT>
7958 for information on setting and unsetting shell options.
7959 <A NAME="lbCX">&nbsp;</A>
7960 <H3>HISTORY EXPANSION</H3>
7961
7962 <P>
7963
7964 The shell supports a history expansion feature that
7965 is similar to the history expansion in
7966 <B>csh.</B>
7967
7968 This section describes what syntax features are available.  This
7969 feature is enabled by default for interactive shells, and can be
7970 disabled using the
7971 <B>+H</B>
7972
7973 option to the
7974 <B>set</B>
7975
7976 builtin command (see
7977 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
7978
7979 </FONT>
7980 below).  Non-interactive shells do not perform history expansion
7981 by default.
7982 <P>
7983
7984 History expansions introduce words from the history list into
7985 the input stream, making it easy to repeat commands, insert the
7986 arguments to a previous command into the current input line, or
7987 fix errors in previous commands quickly.
7988 <P>
7989
7990 History expansion is performed immediately after a complete line
7991 is read, before the shell breaks it into words.
7992 It takes place in two parts.
7993 The first is to determine which line from the history list
7994 to use during substitution.
7995 The second is to select portions of that line for inclusion into
7996 the current one.
7997 The line selected from the history is the <I>event</I>,
7998 and the portions of that line that are acted upon are <I>words</I>.
7999 Various <I>modifiers</I> are available to manipulate the selected words.
8000 The line is broken into words in the same fashion as when reading input,
8001 so that several <I>metacharacter</I>-separated words surrounded by
8002 quotes are considered one word.
8003 History expansions are introduced by the appearance of the
8004 history expansion character, which is <B>!</B> by default.
8005 Only backslash (<B>\</B>) and single quotes can quote
8006 the history expansion character.
8007 <P>
8008
8009 Several characters inhibit history expansion if found immediately
8010 following the history expansion character, even if it is unquoted:
8011 space, tab, newline, carriage return, and <B>=</B>.
8012 If the <B>extglob</B> shell option is enabled, <B>(</B> will also
8013 inhibit expansion.
8014 <P>
8015
8016 Several shell options settable with the
8017 <B>shopt</B>
8018
8019 builtin may be used to tailor the behavior of history expansion.
8020 If the
8021 <B>histverify</B>
8022
8023 shell option is enabled (see the description of the
8024 <B>shopt</B>
8025
8026 builtin below), and
8027 <B>readline</B>
8028
8029 is being used, history substitutions are not immediately passed to
8030 the shell parser.
8031 Instead, the expanded line is reloaded into the
8032 <B>readline</B>
8033
8034 editing buffer for further modification.
8035 If
8036 <B>readline</B>
8037
8038 is being used, and the
8039 <B>histreedit</B>
8040
8041 shell option is enabled, a failed history substitution will be reloaded
8042 into the
8043 <B>readline</B>
8044
8045 editing buffer for correction.
8046 The
8047 <B>-p</B>
8048
8049 option to the
8050 <B>history</B>
8051
8052 builtin command may be used to see what a history expansion will
8053 do before using it.
8054 The
8055 <B>-s</B>
8056
8057 option to the
8058 <B>history</B>
8059
8060 builtin may be used to add commands to the end of the history list
8061 without actually executing them, so that they are available for
8062 subsequent recall.
8063 <P>
8064
8065 The shell allows control of the various characters used by the
8066 history expansion mechanism (see the description of
8067 <B>histchars</B>
8068
8069 above under
8070 <B>Shell Variables</B>).
8071
8072 The shell uses
8073 the history comment character to mark history timestamps when
8074 writing the history file.
8075 <A NAME="lbCY">&nbsp;</A>
8076 <H4>Event Designators</H4>
8077
8078 <P>
8079
8080 An event designator is a reference to a command line entry in the
8081 history list.
8082 <P>
8083
8084
8085 <DL COMPACT>
8086 <DT><B>!</B>
8087
8088 <DD>
8089 Start a history substitution, except when followed by a
8090 <B>blank</B>,
8091
8092 newline, carriage return, =
8093 or ( (when the <B>extglob</B> shell option is enabled using
8094 the <B>shopt</B> builtin).
8095 <DT><B>!</B><I>n</I>
8096
8097 <DD>
8098 Refer to command line
8099 <I>n</I>.
8100
8101 <DT><B>!-</B><I>n</I>
8102
8103 <DD>
8104 Refer to the current command line minus
8105 <I>n</I>.
8106
8107 <DT><B>!!</B>
8108
8109 <DD>
8110 Refer to the previous command.  This is a synonym for `!-1'.
8111 <DT><B>!</B><I>string</I>
8112
8113 <DD>
8114 Refer to the most recent command starting with 
8115 <I>string</I>.
8116
8117 <DT><B>!?</B><I>string</I><B>[?]</B>
8118
8119 <DD>
8120 Refer to the most recent command containing
8121 <I>string</I>.
8122
8123 The trailing <B>?</B> may be omitted if
8124 <I>string</I>
8125
8126 is followed immediately by a newline.
8127 <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>
8128
8129 <DD>
8130 Quick substitution.  Repeat the last command, replacing
8131 <I>string1</I>
8132
8133 with
8134 <I>string2</I>.
8135
8136 Equivalent to
8137 ``!!:s/<I>string1</I>/<I>string2</I>/''
8138 (see <B>Modifiers</B> below).
8139 <DT><B>!#</B>
8140
8141 <DD>
8142 The entire command line typed so far.
8143
8144 </DL>
8145 <A NAME="lbCZ">&nbsp;</A>
8146 <H4>Word Designators</H4>
8147
8148 <P>
8149
8150 Word designators are used to select desired words from the event.
8151
8152 <B>:</B>
8153
8154 separates the event specification from the word designator.
8155 It may be omitted if the word designator begins with a
8156 <B>^</B>,
8157
8158 <B>$</B>,
8159
8160 <B>*</B>,
8161
8162 <B>-</B>,
8163
8164 or
8165 <B>%</B>.
8166
8167 Words are numbered from the beginning of the line,
8168 with the first word being denoted by 0 (zero).
8169 Words are inserted into the current line separated by single spaces.
8170 <P>
8171
8172
8173 <DL COMPACT>
8174 <DT><B>0 (zero)</B>
8175
8176 <DD>
8177 The zeroth word.  For the shell, this is the command
8178 word.
8179 <DT><I>n</I>
8180
8181 <DD>
8182 The <I>n</I>th word.
8183 <DT><B>^</B>
8184
8185 <DD>
8186 The first argument.  That is, word 1.
8187 <DT><B>$</B>
8188
8189 <DD>
8190 The last argument.
8191 <DT><B>%</B>
8192
8193 <DD>
8194 The word matched by the most recent `?<I>string</I>?' search.
8195 <DT><I>x</I><B>-</B>y
8196
8197 <DD>
8198 A range of words; `-<I>y</I>' abbreviates `0-<I>y</I>'.
8199 <DT><B>*</B>
8200
8201 <DD>
8202 All of the words but the zeroth.  This is a synonym
8203 for `<I>1-$</I>'.  It is not an error to use
8204 <B>*</B>
8205
8206 if there is just one
8207 word in the event; the empty string is returned in that case.
8208 <DT><B>x*</B>
8209
8210 <DD>
8211 Abbreviates <I>x-$</I>.
8212 <DT><B>x-</B>
8213
8214 <DD>
8215 Abbreviates <I>x-$</I> like <B>x*</B>, but omits the last word.
8216
8217 </DL>
8218 <P>
8219
8220 If a word designator is supplied without an event specification, the
8221 previous command is used as the event.
8222 <A NAME="lbDA">&nbsp;</A>
8223 <H4>Modifiers</H4>
8224
8225 <P>
8226
8227 After the optional word designator, there may appear a sequence of
8228 one or more of the following modifiers, each preceded by a `:'.
8229 <P>
8230
8231
8232 <P>
8233
8234 <DL COMPACT>
8235 <DT><B>h</B>
8236
8237 <DD>
8238 Remove a trailing file name component, leaving only the head.
8239 <DT><B>t</B>
8240
8241 <DD>
8242 Remove all leading file name components, leaving the tail.
8243 <DT><B>r</B>
8244
8245 <DD>
8246 Remove a trailing suffix of the form <I>.xxx</I>, leaving the
8247 basename.
8248 <DT><B>e</B>
8249
8250 <DD>
8251 Remove all but the trailing suffix.
8252 <DT><B>p</B>
8253
8254 <DD>
8255 Print the new command but do not execute it.
8256 <DT><B>q</B>
8257
8258 <DD>
8259 Quote the substituted words, escaping further substitutions.
8260 <DT><B>x</B>
8261
8262 <DD>
8263 Quote the substituted words as with
8264 <B>q</B>,
8265
8266 but break into words at
8267 <B>blanks</B>
8268
8269 and newlines.
8270 <DT><B>s/</B><I>old</I>/<I>new</I>/
8271
8272 <DD>
8273 Substitute
8274 <I>new</I>
8275
8276 for the first occurrence of
8277 <I>old</I>
8278
8279 in the event line.  Any delimiter can be used in place of /.  The
8280 final delimiter is optional if it is the last character of the
8281 event line.  The delimiter may be quoted in
8282 <I>old</I>
8283
8284 and
8285 <I>new</I>
8286
8287 with a single backslash.  If &amp; appears in
8288 <I>new</I>,
8289
8290 it is replaced by
8291 <I>old</I>.
8292
8293 A single backslash will quote the &amp;.  If
8294 <I>old</I>
8295
8296 is null, it is set to the last
8297 <I>old</I>
8298
8299 substituted, or, if no previous history substitutions took place,
8300 the last
8301 <I>string</I>
8302
8303 in a
8304 <B>!?</B><I>string</I><B>[?]</B>
8305
8306 search.
8307 <DT><B>&amp;</B>
8308
8309 <DD>
8310 Repeat the previous substitution.
8311 <DT><B>g</B>
8312
8313 <DD>
8314 Cause changes to be applied over the entire event line.  This is
8315 used in conjunction with `<B>:s</B>' (e.g., `<B>:gs/</B><I>old</I>/<I>new</I>/')
8316 or `<B>:&amp;</B>'.  If used with
8317 `<B>:s</B>', any delimiter can be used
8318 in place of /, and the final delimiter is optional
8319 if it is the last character of the event line.
8320 An <B>a</B> may be used as a synonym for <B>g</B>.
8321 <DT><B>G</B>
8322
8323 <DD>
8324 Apply the following `<B>s</B>' modifier once to each word in the event line.
8325
8326 </DL>
8327 <A NAME="lbDB">&nbsp;</A>
8328 <H3>SHELL BUILTIN COMMANDS</H3>
8329
8330
8331
8332 <P>
8333
8334 Unless otherwise noted, each builtin command documented in this
8335 section as accepting options preceded by
8336 <B>-</B>
8337
8338 accepts
8339 <B>--</B>
8340
8341 to signify the end of the options.
8342 The <B>:</B>, <B>true</B>, <B>false</B>, and <B>test</B> builtins
8343 do not accept options and do not treat <B>--</B> specially.
8344 The <B>exit</B>, <B>logout</B>, <B>break</B>, <B>continue</B>, <B>let</B>,
8345 and <B>shift</B> builtins accept and process arguments beginning with
8346 <B>-</B> without requiring <B>--</B>.
8347 Other builtins that accept arguments but are not specified as accepting
8348 options interpret arguments beginning with <B>-</B> as invalid options and
8349 require <B>--</B> to prevent this interpretation.
8350 <P>
8351
8352 <DL COMPACT>
8353 <DT><B>:</B> [<I>arguments</I>]<DD>
8354
8355 No effect; the command does nothing beyond expanding
8356 <I>arguments</I>
8357
8358 and performing any specified
8359 redirections.  A zero exit code is returned.
8360 <DT><B> . </B> <I>filename</I> [<I>arguments</I>]<DD>
8361
8362 <DT><B>source</B> <I>filename</I> [<I>arguments</I>]<DD>
8363
8364 Read and execute commands from
8365 <I>filename</I>
8366
8367 in the current
8368 shell environment and return the exit status of the last command
8369 executed from
8370 <I>filename</I>.
8371
8372 If
8373 <I>filename</I>
8374
8375 does not contain a slash, file names in
8376 <FONT SIZE=-1><B>PATH</B>
8377
8378 </FONT>
8379 are used to find the directory containing
8380 <I>filename</I>.
8381
8382 The file searched for in
8383 <FONT SIZE=-1><B>PATH</B>
8384
8385 </FONT>
8386 need not be executable.
8387 When <B>bash</B> is not in <I>posix mode</I>, the current directory is
8388 searched if no file is found in
8389 <FONT SIZE=-1><B>PATH</B>.
8390
8391 </FONT>
8392 If the
8393 <B>sourcepath</B>
8394
8395 option to the
8396 <B>shopt</B>
8397
8398 builtin command is turned off, the
8399 <FONT SIZE=-1><B>PATH</B>
8400
8401 </FONT>
8402 is not searched.
8403 If any <I>arguments</I> are supplied, they become the positional
8404 parameters when <I>filename</I> is executed.  Otherwise the positional
8405 parameters are unchanged.
8406 The return status is the status of the last command exited within
8407 the script (0 if no commands are executed), and false if
8408 <I>filename</I>
8409
8410 is not found or cannot be read.
8411 <DT><B>alias</B> [<B>-p</B>] [<I>name</I>[=<I>value</I>] ...]<DD>
8412 <B>Alias</B> with no arguments or with the
8413 <B>-p</B>
8414
8415 option prints the list of aliases in the form
8416 <B>alias</B> <I>name</I>=<I>value</I> on standard output.
8417 When arguments are supplied, an alias is defined for
8418 each <I>name</I> whose <I>value</I> is given.
8419 A trailing space in  <I>value</I> causes the next word to be
8420 checked for alias substitution when the alias is expanded.
8421 For each <I>name</I> in the argument list for which no <I>value</I>
8422 is supplied, the name and value of the alias is printed.
8423 <B>Alias</B> returns true unless a <I>name</I> is given for which
8424 no alias has been defined.
8425 <DT><B>bg</B> [<I>jobspec</I> ...]<DD>
8426 Resume each suspended job <I>jobspec</I> in the background, as if it
8427 had been started with
8428 <B>&amp;</B>.
8429
8430 If
8431 <I>jobspec</I>
8432
8433 is not present, the shell's notion of the <I>current job</I> is used.
8434 <B>bg</B>
8435
8436 <I>jobspec</I>
8437
8438 returns 0 unless run when job control is disabled or, when run with
8439 job control enabled, any specified <I>jobspec</I> was not found
8440 or was started without job control.
8441 <DT><B>bind</B> [<B>-m</B> <I>keymap</I>] [<B>-lpsvPSV</B>]<DD>
8442
8443 <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>
8444 <DT><B>bind</B> [<B>-m</B> <I>keymap</I>] <B>-f</B> <I>filename</I><DD>
8445 <DT><B>bind</B> [<B>-m</B> <I>keymap</I>] <B>-x</B> <I>keyseq</I>:<I>shell-command</I><DD>
8446 <DT><B>bind</B> [<B>-m</B> <I>keymap</I>] <I>keyseq</I>:<I>function-name</I><DD>
8447 <DT><B>bind</B> <I>readline-command</I><DD>
8448
8449 Display current
8450 <B>readline</B>
8451
8452 key and function bindings, bind a key sequence to a
8453 <B>readline</B>
8454
8455 function or macro, or set a
8456 <B>readline</B>
8457
8458 variable.
8459 Each non-option argument is a command as it would appear in
8460 <I>.inputrc</I>,
8461
8462 but each binding or command must be passed as a separate argument;
8463 e.g., '&quot;\C-x\C-r&quot;: re-read-init-file'.
8464 Options, if supplied, have the following meanings:
8465 <DL COMPACT><DT><DD>
8466
8467 <DL COMPACT>
8468 <DT><B>-m </B><I>keymap</I>
8469
8470 <DD>
8471 Use
8472 <I>keymap</I>
8473
8474 as the keymap to be affected by the subsequent bindings.
8475 Acceptable
8476 <I>keymap</I>
8477
8478 names are
8479 <I>emacs, emacs-standard, emacs-meta, emacs-ctlx, vi,
8480 vi-move, vi-command</I>, and
8481 <I>vi-insert</I>.
8482
8483 <I>vi</I> is equivalent to <I>vi-command</I>; <I>emacs</I> is
8484 equivalent to <I>emacs-standard</I>.
8485 <DT><B>-l</B>
8486
8487 <DD>
8488 List the names of all <B>readline</B> functions.
8489 <DT><B>-p</B>
8490
8491 <DD>
8492 Display <B>readline</B> function names and bindings in such a way
8493 that they can be re-read.
8494 <DT><B>-P</B>
8495
8496 <DD>
8497 List current <B>readline</B> function names and bindings.
8498 <DT><B>-s</B>
8499
8500 <DD>
8501 Display <B>readline</B> key sequences bound to macros and the strings
8502 they output in such a way that they can be re-read.
8503 <DT><B>-S</B>
8504
8505 <DD>
8506 Display <B>readline</B> key sequences bound to macros and the strings
8507 they output.
8508 <DT><B>-v</B>
8509
8510 <DD>
8511 Display <B>readline</B> variable names and values in such a way that they
8512 can be re-read.
8513 <DT><B>-V</B>
8514
8515 <DD>
8516 List current <B>readline</B> variable names and values.
8517 <DT><B>-f </B><I>filename</I>
8518
8519 <DD>
8520 Read key bindings from <I>filename</I>.
8521 <DT><B>-q </B><I>function</I>
8522
8523 <DD>
8524 Query about which keys invoke the named <I>function</I>.
8525 <DT><B>-u </B><I>function</I>
8526
8527 <DD>
8528 Unbind all keys bound to the named <I>function</I>.
8529 <DT><B>-r </B><I>keyseq</I>
8530
8531 <DD>
8532 Remove any current binding for <I>keyseq</I>.
8533 <DT><B>-x </B><I>keyseq</I>:<I>shell-command</I>
8534
8535 <DD>
8536 Cause <I>shell-command</I> to be executed whenever <I>keyseq</I> is
8537 entered.
8538 When <I>shell-command</I> is executed, the shell sets the
8539 <FONT SIZE=-1><B>READLINE_LINE</B>
8540
8541 </FONT>
8542 variable to the contents of the <B>readline</B> line buffer and the
8543 <FONT SIZE=-1><B>READLINE_POINT</B>
8544
8545 </FONT>
8546 variable to the current location of the insertion point.
8547 If the executed command changes the value of
8548 <FONT SIZE=-1><B>READLINE_LINE</B>
8549
8550 </FONT>
8551 or
8552 <FONT SIZE=-1><B>READLINE_POINT</B>,
8553
8554 </FONT>
8555 those new values will be reflected in the editing state.
8556
8557 </DL>
8558 <P>
8559
8560 The return value is 0 unless an unrecognized option is given or an
8561 error occurred.
8562 </DL>
8563
8564 <DT><B>break</B> [<I>n</I>]<DD>
8565 Exit from within a
8566 <B>for</B>,
8567
8568 <B>while</B>,
8569
8570 <B>until</B>,
8571
8572 or
8573 <B>select</B>
8574
8575 loop.  If <I>n</I> is specified, break <I>n</I> levels.
8576 <I>n</I>
8577
8578 must be >= 1.  If
8579 <I>n</I>
8580
8581 is greater than the number of enclosing loops, all enclosing loops
8582 are exited.
8583 The return value is 0 unless <I>n</I> is not greater than or equal to 1.
8584 <DT><B>builtin</B> <I>shell-builtin</I> [<I>arguments</I>]<DD>
8585 Execute the specified shell builtin, passing it
8586 <I>arguments</I>,
8587
8588 and return its exit status.
8589 This is useful when defining a
8590 function whose name is the same as a shell builtin,
8591 retaining the functionality of the builtin within the function.
8592 The <B>cd</B> builtin is commonly redefined this way.
8593 The return status is false if
8594 <I>shell-builtin</I>
8595
8596 is not a shell builtin command.
8597 <DT><B>caller</B> [<I>expr</I>]<DD>
8598 Returns the context of any active subroutine call (a shell function or
8599 a script executed with the <B>.</B> or <B>source</B> builtins.
8600 Without <I>expr</I>, <B>caller</B> displays the line number and source
8601 filename of the current subroutine call.
8602 If a non-negative integer is supplied as <I>expr</I>, <B>caller</B> 
8603 displays the line number, subroutine name, and source file corresponding
8604 to that position in the current execution call stack.  This extra
8605 information may be used, for example, to print a stack trace.  The
8606 current frame is frame 0.
8607 The return value is 0 unless the shell is not executing a subroutine
8608 call or <I>expr</I> does not correspond to a valid position in the
8609 call stack.
8610 <DT><B>cd</B> [<B>-L|-P</B>] [<I>dir</I>]<DD>
8611 Change the current directory to <I>dir</I>.  The variable
8612 <FONT SIZE=-1><B>HOME</B>
8613
8614 </FONT>
8615 is the
8616 default
8617 <I>dir</I>.
8618
8619 The variable
8620 <FONT SIZE=-1><B>CDPATH</B>
8621
8622 </FONT>
8623 defines the search path for the directory containing
8624 <I>dir</I>.
8625
8626 Alternative directory names in
8627 <FONT SIZE=-1><B>CDPATH</B>
8628
8629 </FONT>
8630 are separated by a colon (:).  A null directory name in
8631 <FONT SIZE=-1><B>CDPATH</B>
8632
8633 </FONT>
8634 is the same as the current directory, i.e., ``<B>.</B>''.  If
8635 <I>dir</I>
8636
8637 begins with a slash (/),
8638 then
8639 <FONT SIZE=-1><B>CDPATH</B>
8640
8641 </FONT>
8642 is not used. The
8643 <B>-P</B>
8644
8645 option says to use the physical directory structure instead of
8646 following symbolic links (see also the
8647 <B>-P</B>
8648
8649 option to the
8650 <B>set</B>
8651
8652 builtin command); the
8653 <B>-L</B>
8654
8655 option forces symbolic links to be followed.  An argument of
8656 <B>-</B>
8657
8658 is equivalent to
8659 <FONT SIZE=-1><B>$OLDPWD</B>.
8660
8661 </FONT>
8662 If a non-empty directory name from
8663 <FONT SIZE=-1><B>CDPATH</B>
8664
8665 </FONT>
8666 is used, or if
8667 <B>-</B> is the first argument, and the directory change is
8668 successful, the absolute pathname of the new working directory is
8669 written to the standard output.
8670 The return value is true if the directory was successfully changed;
8671 false otherwise.
8672 <DT><B>command</B> [<B>-pVv</B>] <I>command</I> [<I>arg</I> ...]<DD>
8673 Run
8674 <I>command</I>
8675
8676 with
8677 <I>args</I>
8678
8679 suppressing the normal shell function lookup. Only builtin
8680 commands or commands found in the
8681 <FONT SIZE=-1><B>PATH</B>
8682
8683 </FONT>
8684 are executed.  If the
8685 <B>-p</B>
8686
8687 option is given, the search for
8688 <I>command</I>
8689
8690 is performed using a default value for
8691 <FONT SIZE=-1><B>PATH</B>
8692
8693 </FONT>
8694 that is guaranteed to find all of the standard utilities.
8695 If either the
8696 <B>-V</B>
8697
8698 or
8699 <B>-v</B>
8700
8701 option is supplied, a description of
8702 <I>command</I>
8703
8704 is printed.  The
8705 <B>-v</B>
8706
8707 option causes a single word indicating the command or file name
8708 used to invoke
8709 <I>command</I>
8710
8711 to be displayed; the
8712 <B>-V</B>
8713
8714 option produces a more verbose description.
8715 If the
8716 <B>-V</B>
8717
8718 or
8719 <B>-v</B>
8720
8721 option is supplied, the exit status is 0 if
8722 <I>command</I>
8723
8724 was found, and 1 if not.  If neither option is supplied and
8725 an error occurred or
8726 <I>command</I>
8727
8728 cannot be found, the exit status is 127.  Otherwise, the exit status of the
8729 <B>command</B>
8730
8731 builtin is the exit status of
8732 <I>command</I>.
8733
8734 <DT><B>compgen</B> [<I>option</I>] [<I>word</I>]<DD>
8735 Generate possible completion matches for <I>word</I> according to
8736 the <I>option</I>s, which may be any option accepted by the
8737 <B>complete</B>
8738
8739 builtin with the exception of <B>-p</B> and <B>-r</B>, and write
8740 the matches to the standard output.
8741 When using the <B>-F</B> or <B>-C</B> options, the various shell variables
8742 set by the programmable completion facilities, while available, will not
8743 have useful values.
8744 <P>
8745 The matches will be generated in the same way as if the programmable
8746 completion code had generated them directly from a completion specification
8747 with the same flags.
8748 If <I>word</I> is specified, only those completions matching <I>word</I>
8749 will be displayed.
8750 <P>
8751 The return value is true unless an invalid option is supplied, or no
8752 matches were generated.
8753 <DT><B>complete</B> [<B>-abcdefgjksuv</B>] [<B>-o</B> <I>comp-option</I>] [<B>-DE</B>] [<B>-A</B> <I>action</I>] [<B>-G</B> <I>globpat</I>] [<B>-W</B> <I>wordlist</I>] [<B>-F</B> <I>function</I>] [<B>-C</B> <I>command</I>]<DD>
8754 <BR>
8755
8756 [<B>-X</B> <I>filterpat</I>] [<B>-P</B> <I>prefix</I>] [<B>-S</B> <I>suffix</I>] <I>name</I> [<I>name ...</I>]
8757
8758 <DT><B>complete</B> <B>-pr</B> [<B>-DE</B>] [<I>name</I> ...]<DD>
8759
8760 Specify how arguments to each <I>name</I> should be completed.
8761 If the <B>-p</B> option is supplied, or if no options are supplied,
8762 existing completion specifications are printed in a way that allows
8763 them to be reused as input.
8764 The <B>-r</B> option removes a completion specification for
8765 each <I>name</I>, or, if no <I>name</I>s are supplied, all
8766 completion specifications.
8767 The <B>-D</B> option indicates that the remaining options and actions should
8768 apply to the ``default'' command completion; that is, completion attempted
8769 on a command for which no completion has previously been defined.
8770 The <B>-E</B> option indicates that the remaining options and actions should
8771 apply to ``empty'' command completion; that is, completion attempted on a
8772 blank line.
8773 <P>
8774 The process of applying these completion specifications when word completion
8775 is attempted is described above under <B>Programmable Completion</B>.
8776 <P>
8777 Other options, if specified, have the following meanings.
8778 The arguments to the <B>-G</B>, <B>-W</B>, and <B>-X</B> options
8779 (and, if necessary, the <B>-P</B> and <B>-S</B> options)
8780 should be quoted to protect them from expansion before the
8781 <B>complete</B>
8782
8783 builtin is invoked.
8784 <DL COMPACT><DT><DD>
8785
8786 <DL COMPACT>
8787 <DT><B>-o</B> <I>comp-option</I><DD>
8788 The <I>comp-option</I> controls several aspects of the compspec's behavior
8789 beyond the simple generation of completions.
8790 <I>comp-option</I> may be one of:
8791 <DL COMPACT><DT><DD>
8792 <DL COMPACT>
8793 <DT><B>bashdefault</B>
8794
8795 <DD>
8796 Perform the rest of the default <B>bash</B> completions if the compspec
8797 generates no matches.
8798 <DT><B>default</B>
8799
8800 <DD>
8801 Use readline's default filename completion if the compspec generates
8802 no matches.
8803 <DT><B>dirnames</B>
8804
8805 <DD>
8806 Perform directory name completion if the compspec generates no matches.
8807 <DT><B>filenames</B>
8808
8809 <DD>
8810 Tell readline that the compspec generates filenames, so it can perform any
8811 filename-specific processing (like adding a slash to directory names,
8812 quoting special characters, or suppressing trailing spaces).
8813 Intended to be used with shell functions.
8814 <DT><B>nospace</B>
8815
8816 <DD>
8817 Tell readline not to append a space (the default) to words completed at
8818 the end of the line.
8819 <DT><B>plusdirs</B>
8820
8821 <DD>
8822 After any matches defined by the compspec are generated, 
8823 directory name completion is attempted and any
8824 matches are added to the results of the other actions.
8825 </DL></DL>
8826
8827 <DT><B>-A</B> <I>action</I><DD>
8828 The <I>action</I> may be one of the following to generate a list of possible
8829 completions:
8830 <DL COMPACT><DT><DD>
8831 <DL COMPACT>
8832 <DT><B>alias</B>
8833
8834 <DD>
8835 Alias names.  May also be specified as <B>-a</B>.
8836 <DT><B>arrayvar</B>
8837
8838 <DD>
8839 Array variable names.
8840 <DT><B>binding</B>
8841
8842 <DD>
8843 <B>Readline</B> key binding names.
8844 <DT><B>builtin</B>
8845
8846 <DD>
8847 Names of shell builtin commands.  May also be specified as <B>-b</B>.
8848 <DT><B>command</B>
8849
8850 <DD>
8851 Command names.  May also be specified as <B>-c</B>.
8852 <DT><B>directory</B>
8853
8854 <DD>
8855 Directory names.  May also be specified as <B>-d</B>.
8856 <DT><B>disabled</B>
8857
8858 <DD>
8859 Names of disabled shell builtins.
8860 <DT><B>enabled</B>
8861
8862 <DD>
8863 Names of enabled shell builtins.
8864 <DT><B>export</B>
8865
8866 <DD>
8867 Names of exported shell variables.  May also be specified as <B>-e</B>.
8868 <DT><B>file</B>
8869
8870 <DD>
8871 File names.  May also be specified as <B>-f</B>.
8872 <DT><B>function</B>
8873
8874 <DD>
8875 Names of shell functions.
8876 <DT><B>group</B>
8877
8878 <DD>
8879 Group names.  May also be specified as <B>-g</B>.
8880 <DT><B>helptopic</B>
8881
8882 <DD>
8883 Help topics as accepted by the <B>help</B> builtin.
8884 <DT><B>hostname</B>
8885
8886 <DD>
8887 Hostnames, as taken from the file specified by the
8888 <FONT SIZE=-1><B>HOSTFILE</B>
8889
8890 </FONT>
8891 shell variable.
8892 <DT><B>job</B>
8893
8894 <DD>
8895 Job names, if job control is active.  May also be specified as <B>-j</B>.
8896 <DT><B>keyword</B>
8897
8898 <DD>
8899 Shell reserved words.  May also be specified as <B>-k</B>.
8900 <DT><B>running</B>
8901
8902 <DD>
8903 Names of running jobs, if job control is active.
8904 <DT><B>service</B>
8905
8906 <DD>
8907 Service names.  May also be specified as <B>-s</B>.
8908 <DT><B>setopt</B>
8909
8910 <DD>
8911 Valid arguments for the <B>-o</B> option to the <B>set</B> builtin.
8912 <DT><B>shopt</B>
8913
8914 <DD>
8915 Shell option names as accepted by the <B>shopt</B> builtin.
8916 <DT><B>signal</B>
8917
8918 <DD>
8919 Signal names.
8920 <DT><B>stopped</B>
8921
8922 <DD>
8923 Names of stopped jobs, if job control is active.
8924 <DT><B>user</B>
8925
8926 <DD>
8927 User names.  May also be specified as <B>-u</B>.
8928 <DT><B>variable</B>
8929
8930 <DD>
8931 Names of all shell variables.  May also be specified as <B>-v</B>.
8932 </DL></DL>
8933
8934 <DT><B>-G</B> <I>globpat</I><DD>
8935 The pathname expansion pattern <I>globpat</I> is expanded to generate
8936 the possible completions.
8937 <DT><B>-W</B> <I>wordlist</I><DD>
8938 The <I>wordlist</I> is split using the characters in the
8939 <FONT SIZE=-1><B>IFS</B>
8940
8941 </FONT>
8942 special variable as delimiters, and each resultant word is expanded.
8943 The possible completions are the members of the resultant list which
8944 match the word being completed.
8945 <DT><B>-C</B> <I>command</I><DD>
8946 <I>command</I> is executed in a subshell environment, and its output is
8947 used as the possible completions.
8948 <DT><B>-F</B> <I>function</I><DD>
8949 The shell function <I>function</I> is executed in the current shell
8950 environment.
8951 When it finishes, the possible completions are retrieved from the value
8952 of the
8953 <FONT SIZE=-1><B>COMPREPLY</B>
8954
8955 </FONT>
8956 array variable.
8957 <DT><B>-X</B> <I>filterpat</I><DD>
8958 <I>filterpat</I> is a pattern as used for pathname expansion.
8959 It is applied to the list of possible completions generated by the
8960 preceding options and arguments, and each completion matching
8961 <I>filterpat</I> is removed from the list.
8962 A leading <B>!</B> in <I>filterpat</I> negates the pattern; in this
8963 case, any completion not matching <I>filterpat</I> is removed.
8964 <DT><B>-P</B> <I>prefix</I><DD>
8965 <I>prefix</I> is added at the beginning of each possible completion
8966 after all other options have been applied.
8967 <DT><B>-S</B> <I>suffix</I><DD>
8968 <I>suffix</I> is appended to each possible completion
8969 after all other options have been applied.
8970
8971 </DL>
8972 <P>
8973
8974 The return value is true unless an invalid option is supplied, an option
8975 other than <B>-p</B> or <B>-r</B> is supplied without a <I>name</I>
8976 argument, an attempt is made to remove a completion specification for
8977 a <I>name</I> for which no specification exists, or
8978 an error occurs adding a completion specification.
8979 </DL>
8980
8981 <DT><B>compopt</B> [<B>-o</B> <I>option</I>] [<B>-DE</B>] [<B>+o</B> <I>option</I>] [<I>name</I>]<DD>
8982 Modify completion options for each <I>name</I> according to the
8983 <I>option</I>s, or for the
8984 currently-execution completion if no <I>name</I>s are supplied.
8985 If no <I>option</I>s are given, display the completion options for each
8986 <I>name</I> or the current completion.
8987 The possible values of <I>option</I> are those valid for the <B>complete</B>
8988 builtin described above.
8989 The <B>-D</B> option indicates that the remaining options should
8990 apply to the ``default'' command completion; that is, completion attempted
8991 on a command for which no completion has previously been defined.
8992 The <B>-E</B> option indicates that the remaining options should
8993 apply to ``empty'' command completion; that is, completion attempted on a
8994 blank line.
8995 </DL>
8996 <P>
8997
8998 The return value is true unless an invalid option is supplied, an attempt
8999 is made to modify the options for a <I>name</I> for which no completion
9000 specification exists, or an output error occurs.
9001 <DL COMPACT>
9002 <DT><B>continue</B> [<I>n</I>]<DD>
9003 Resume the next iteration of the enclosing
9004 <B>for</B>,
9005
9006 <B>while</B>,
9007
9008 <B>until</B>,
9009
9010 or
9011 <B>select</B>
9012
9013 loop.
9014 If
9015 <I>n</I>
9016
9017 is specified, resume at the <I>n</I>th enclosing loop.
9018 <I>n</I>
9019
9020 must be >= 1.  If
9021 <I>n</I>
9022
9023 is greater than the number of enclosing loops, the last enclosing loop
9024 (the ``top-level'' loop) is resumed.
9025 The return value is 0 unless <I>n</I> is not greater than or equal to 1.
9026 <DT><B>declare</B> [<B>-aAfFilrtux</B>] [<B>-p</B>] [<I>name</I>[=<I>value</I>] ...]<DD>
9027
9028 <DT><B>typeset</B> [<B>-aAfFilrtux</B>] [<B>-p</B>] [<I>name</I>[=<I>value</I>] ...]<DD>
9029
9030 Declare variables and/or give them attributes.
9031 If no <I>name</I>s are given then display the values of variables.
9032 The
9033 <B>-p</B>
9034
9035 option will display the attributes and values of each
9036 <I>name</I>.
9037
9038 When
9039 <B>-p</B>
9040
9041 is used with <I>name</I> arguments, additional options are ignored.
9042 When
9043 <B>-p</B>
9044
9045 is supplied without <I>name</I> arguments, it will display the attributes
9046 and values of all variables having the attributes specified by the
9047 additional options.
9048 If no other options are supplied with <B>-p</B>, <B>declare</B> will display
9049 the attributes and values of all shell variables.  The <B>-f</B> option
9050 will restrict the display to shell functions.
9051 The
9052 <B>-F</B>
9053
9054 option inhibits the display of function definitions; only the
9055 function name and attributes are printed.
9056 If the <B>extdebug</B> shell option is enabled using <B>shopt</B>,
9057 the source file name and line number where the function is defined
9058 are displayed as well.  The
9059 <B>-F</B>
9060
9061 option implies
9062 <B>-f</B>.
9063
9064 The following options can
9065 be used to restrict output to variables with the specified attribute or
9066 to give variables attributes:
9067 <DL COMPACT><DT><DD>
9068
9069 <DL COMPACT>
9070 <DT><B>-a</B>
9071
9072 <DD>
9073 Each <I>name</I> is an indexed array variable (see
9074 <B>Arrays</B>
9075
9076 above).
9077 <DT><B>-A</B>
9078
9079 <DD>
9080 Each <I>name</I> is an associative array variable (see
9081 <B>Arrays</B>
9082
9083 above).
9084 <DT><B>-f</B>
9085
9086 <DD>
9087 Use function names only.
9088 <DT><B>-i</B>
9089
9090 <DD>
9091 The variable is treated as an integer; arithmetic evaluation (see
9092 <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>
9093
9094 </FONT>
9095 above) is performed when the variable is assigned a value.
9096 <DT><B>-l</B>
9097
9098 <DD>
9099 When the variable is assigned a value, all upper-case characters are
9100 converted to lower-case.
9101 The upper-case attribute is disabled.
9102 <DT><B>-r</B>
9103
9104 <DD>
9105 Make <I>name</I>s readonly.  These names cannot then be assigned values
9106 by subsequent assignment statements or unset.
9107 <DT><B>-t</B>
9108
9109 <DD>
9110 Give each <I>name</I> the <I>trace</I> attribute.
9111 Traced functions inherit the <B>DEBUG</B> and <B>RETURN</B> traps from
9112 the calling shell.
9113 The trace attribute has no special meaning for variables.
9114 <DT><B>-u</B>
9115
9116 <DD>
9117 When the variable is assigned a value, all lower-case characters are
9118 converted to upper-case.
9119 The lower-case attribute is disabled.
9120 <DT><B>-x</B>
9121
9122 <DD>
9123 Mark <I>name</I>s for export to subsequent commands via the environment.
9124
9125 </DL>
9126 <P>
9127
9128 Using `+' instead of `-'
9129 turns off the attribute instead,
9130 with the exceptions that <B>+a</B>
9131 may not be used to destroy an array variable and <B>+r</B> will not
9132 remove the readonly attribute.
9133 When used in a function,
9134 makes each
9135 <I>name</I> local, as with the 
9136 <B>local</B>
9137
9138 command.
9139 If a variable name is followed by =<I>value</I>, the value of
9140 the variable is set to <I>value</I>.
9141 The return value is 0 unless an invalid option is encountered,
9142 an attempt is made to define a function using
9143
9144 <TT>-f foo=bar</TT>,
9145 an attempt is made to assign a value to a readonly variable,
9146 an attempt is made to assign a value to an array variable without
9147 using the compound assignment syntax (see
9148 <B>Arrays</B>
9149
9150 above), one of the <I>names</I> is not a valid shell variable name,
9151 an attempt is made to turn off readonly status for a readonly variable,
9152 an attempt is made to turn off array status for an array variable,
9153 or an attempt is made to display a non-existent function with <B>-f</B>.
9154 </DL>
9155
9156 <DT><B>dirs [+</B><I>n</I>] [-<I>n</I>] [<B>-cplv</B>]
9157
9158 <DD>
9159 Without options, displays the list of currently remembered directories.
9160 The default display is on a single line with directory names separated
9161 by spaces.
9162 Directories are added to the list with the 
9163 <B>pushd</B>
9164
9165 command; the
9166 <B>popd</B>
9167
9168 command removes entries from the list.
9169 <DL COMPACT><DT><DD>
9170
9171 <DL COMPACT>
9172 <DT><B>+</B><I>n</I><DD>
9173 Displays the <I>n</I>th entry counting from the left of the list
9174 shown by
9175 <B>dirs</B>
9176
9177 when invoked without options, starting with zero.
9178 <DT><B>-</B><I>n</I><DD>
9179 Displays the <I>n</I>th entry counting from the right of the list
9180 shown by
9181 <B>dirs</B>
9182
9183 when invoked without options, starting with zero.
9184 <DT><B>-c</B>
9185
9186 <DD>
9187 Clears the directory stack by deleting all of the entries.
9188 <DT><B>-l</B>
9189
9190 <DD>
9191 Produces a longer listing; the default listing format uses a 
9192 tilde to denote the home directory.
9193 <DT><B>-p</B>
9194
9195 <DD>
9196 Print the directory stack with one entry per line.
9197 <DT><B>-v</B>
9198
9199 <DD>
9200 Print the directory stack with one entry per line,
9201 prefixing each entry with its index in the stack.
9202
9203 </DL>
9204 <P>
9205
9206 The return value is 0 unless an
9207 invalid option is supplied or <I>n</I> indexes beyond the end
9208 of the directory stack.
9209 </DL>
9210
9211 <DT><B>disown</B> [<B>-ar</B>] [<B>-h</B>] [<I>jobspec</I> ...]<DD>
9212 Without options, each
9213 <I>jobspec</I>
9214
9215 is removed from the table of active jobs.
9216 If
9217 <I>jobspec</I>
9218
9219 is not present, and neither <B>-a</B> nor <B>-r</B> is supplied,
9220 the shell's notion of the <I>current job</I> is used.
9221 If the <B>-h</B> option is given, each
9222 <I>jobspec</I>
9223
9224 is not removed from the table, but is marked so that
9225 <FONT SIZE=-1><B>SIGHUP</B>
9226
9227 </FONT>
9228 is not sent to the job if the shell receives a
9229 <FONT SIZE=-1><B>SIGHUP</B>.
9230
9231 </FONT>
9232 If no
9233 <I>jobspec</I>
9234
9235 is present, and neither the
9236 <B>-a</B>
9237
9238 nor the
9239 <B>-r</B>
9240
9241 option is supplied, the <I>current job</I> is used.
9242 If no
9243 <I>jobspec</I>
9244
9245 is supplied, the
9246 <B>-a</B>
9247
9248 option means to remove or mark all jobs; the
9249 <B>-r</B>
9250
9251 option without a
9252 <I>jobspec</I>
9253
9254 argument restricts operation to running jobs.
9255 The return value is 0 unless a
9256 <I>jobspec</I>
9257
9258 does not specify a valid job.
9259 <DT><B>echo</B> [<B>-neE</B>] [<I>arg</I> ...]<DD>
9260 Output the <I>arg</I>s, separated by spaces, followed by a newline.
9261 The return status is always 0.
9262 If <B>-n</B> is specified, the trailing newline is
9263 suppressed.  If the <B>-e</B> option is given, interpretation of
9264 the following backslash-escaped characters is enabled.  The
9265 <B>-E</B>
9266
9267 option disables the interpretation of these escape characters,
9268 even on systems where they are interpreted by default.
9269 The <B>xpg_echo</B> shell option may be used to
9270 dynamically determine whether or not <B>echo</B> expands these
9271 escape characters by default.
9272 <B>echo</B>
9273
9274 does not interpret <B>--</B> to mean the end of options.
9275 <B>echo</B>
9276
9277 interprets the following escape sequences:
9278 <DL COMPACT><DT><DD>
9279
9280 <DL COMPACT>
9281 <DT><B>\a</B>
9282
9283 <DD>
9284 alert (bell)
9285 <DT><B>\b</B>
9286
9287 <DD>
9288 backspace
9289 <DT><B>\c</B>
9290
9291 <DD>
9292 suppress further output
9293 <DT><B>\e</B>
9294
9295 <DD>
9296 an escape character
9297 <DT><B>\f</B>
9298
9299 <DD>
9300 form feed
9301 <DT><B>\n</B>
9302
9303 <DD>
9304 new line
9305 <DT><B>\r</B>
9306
9307 <DD>
9308 carriage return
9309 <DT><B>\t</B>
9310
9311 <DD>
9312 horizontal tab
9313 <DT><B>\v</B>
9314
9315 <DD>
9316 vertical tab
9317 <DT><B>\\</B>
9318
9319 <DD>
9320 backslash
9321 <DT><B>\0</B><I>nnn</I>
9322
9323 <DD>
9324 the eight-bit character whose value is the octal value <I>nnn</I>
9325 (zero to three octal digits)
9326 <DT><B>\x</B><I>HH</I>
9327
9328 <DD>
9329 the eight-bit character whose value is the hexadecimal value <I>HH</I>
9330 (one or two hex digits)
9331
9332 </DL></DL>
9333
9334 <DT><B>enable</B> [<B>-a</B>] [<B>-dnps</B>] [<B>-f</B> <I>filename</I>] [<I>name</I> ...]<DD>
9335 Enable and disable builtin shell commands.
9336 Disabling a builtin allows a disk command which has the same name
9337 as a shell builtin to be executed without specifying a full pathname,
9338 even though the shell normally searches for builtins before disk commands.
9339 If <B>-n</B> is used, each <I>name</I>
9340 is disabled; otherwise,
9341 <I>names</I> are enabled.  For example, to use the
9342 <B>test</B>
9343
9344 binary found via the
9345 <FONT SIZE=-1><B>PATH</B>
9346
9347 </FONT>
9348 instead of the shell builtin version, run
9349 <TT>enable -n test</TT>.
9350
9351 The
9352 <B>-f</B>
9353
9354 option means to load the new builtin command
9355 <I>name</I>
9356
9357 from shared object
9358 <I>filename</I>,
9359
9360 on systems that support dynamic loading.  The
9361 <B>-d</B>
9362
9363 option will delete a builtin previously loaded with
9364 <B>-f</B>.
9365
9366 If no <I>name</I> arguments are given, or if the
9367 <B>-p</B>
9368
9369 option is supplied, a list of shell builtins is printed.
9370 With no other option arguments, the list consists of all enabled
9371 shell builtins.
9372 If <B>-n</B> is supplied, only disabled builtins are printed.
9373 If <B>-a</B> is supplied, the list printed includes all builtins, with an
9374 indication of whether or not each is enabled.
9375 If <B>-s</B> is supplied, the output is restricted to the POSIX
9376 <I>special</I> builtins.
9377 The return value is 0 unless a
9378 <I>name</I>
9379
9380 is not a shell builtin or there is an error loading a new builtin
9381 from a shared object.
9382 <DT><B>eval</B> [<I>arg</I> ...]<DD>
9383 The <I>arg</I>s are read and concatenated together into a single
9384 command.  This command is then read and executed by the shell, and
9385 its exit status is returned as the value of
9386 <B>eval</B>.
9387
9388 If there are no
9389 <I>args</I>,
9390
9391 or only null arguments,
9392 <B>eval</B>
9393
9394 returns 0.
9395 <DT><B>exec</B> [<B>-cl</B>] [<B>-a</B> <I>name</I>] [<I>command</I> [<I>arguments</I>]]<DD>
9396 If
9397 <I>command</I>
9398
9399 is specified, it replaces the shell.
9400 No new process is created.  The
9401 <I>arguments</I>
9402
9403 become the arguments to <I>command</I>.
9404 If the
9405 <B>-l</B>
9406
9407 option is supplied,
9408 the shell places a dash at the beginning of the zeroth argument passed to 
9409 <I>command</I>.
9410
9411 This is what
9412 <I>login</I>(1)
9413
9414 does.  The
9415 <B>-c</B>
9416
9417 option causes
9418 <I>command</I>
9419
9420 to be executed with an empty environment.  If
9421 <B>-a</B>
9422
9423 is supplied, the shell passes
9424 <I>name</I>
9425
9426 as the zeroth argument to the executed command.  If
9427 <I>command</I>
9428
9429 cannot be executed for some reason, a non-interactive shell exits,
9430 unless the shell option
9431 <B>execfail</B>
9432
9433 is enabled, in which case it returns failure.
9434 An interactive shell returns failure if the file cannot be executed.
9435 If
9436 <I>command</I>
9437
9438 is not specified, any redirections take effect in the current shell,
9439 and the return status is 0.  If there is a redirection error, the
9440 return status is 1.
9441 <DT><B>exit</B> [<I>n</I>]<DD>
9442 Cause the shell to exit
9443 with a status of <I>n</I>.  If
9444 <I>n</I>
9445
9446 is omitted, the exit status
9447 is that of the last command executed.
9448 A trap on
9449 <FONT SIZE=-1><B>EXIT</B>
9450
9451 </FONT>
9452 is executed before the shell terminates.
9453 <DT><B>export</B> [<B>-fn</B>] [<I>name</I>[=<I>word</I>]] ...<DD>
9454
9455 <DT><B>export -p</B>
9456
9457 <DD>
9458
9459 The supplied
9460 <I>names</I>
9461
9462 are marked for automatic export to the environment of
9463 subsequently executed commands.  If the 
9464 <B>-f</B>
9465
9466 option is given,
9467 the 
9468 <I>names</I>
9469
9470 refer to functions.
9471 If no
9472 <I>names</I>
9473
9474 are given, or if the
9475 <B>-p</B>
9476
9477 option is supplied, a list
9478 of all names that are exported in this shell is printed.
9479 The
9480 <B>-n</B>
9481
9482 option causes the export property to be removed from each
9483 <I>name</I>.
9484 If a variable name is followed by =<I>word</I>, the value of
9485 the variable is set to <I>word</I>.
9486 <B>export</B>
9487
9488 returns an exit status of 0 unless an invalid option is
9489 encountered,
9490 one of the <I>names</I> is not a valid shell variable name, or
9491 <B>-f</B>
9492
9493 is supplied with a
9494 <I>name</I>
9495
9496 that is not a function.
9497 <DT><B>fc</B> [<B>-e</B> <I>ename</I>] [<B>-lnr</B>] [<I>first</I>] [<I>last</I>]<DD>
9498
9499 <DT><B>fc</B> <B>-s</B> [<I>pat</I>=<I>rep</I>] [<I>cmd</I>]<DD>
9500
9501 Fix Command.  In the first form, a range of commands from
9502 <I>first</I>
9503
9504 to
9505 <I>last</I>
9506
9507 is selected from the history list.
9508 <I>First</I>
9509
9510 and
9511 <I>last</I>
9512
9513 may be specified as a string (to locate the last command beginning
9514 with that string) or as a number (an index into the history list,
9515 where a negative number is used as an offset from the current
9516 command number).  If 
9517 <I>last</I>
9518
9519 is not specified it is set to
9520 the current command for listing (so that
9521
9522 <TT>fc -l -10</TT>
9523 prints the last 10 commands) and to
9524 <I>first</I>
9525
9526 otherwise.
9527 If
9528 <I>first</I>
9529
9530 is not specified it is set to the previous
9531 command for editing and -16 for listing.
9532 <P>
9533 The
9534 <B>-n</B>
9535
9536 option suppresses
9537 the command numbers when listing.  The
9538 <B>-r</B>
9539
9540 option reverses the order of
9541 the commands.  If the
9542 <B>-l</B>
9543
9544 option is given,
9545 the commands are listed on
9546 standard output.  Otherwise, the editor given by
9547 <I>ename</I>
9548
9549 is invoked
9550 on a file containing those commands.  If
9551 <I>ename</I>
9552
9553 is not given, the
9554 value of the
9555 <FONT SIZE=-1><B>FCEDIT</B>
9556
9557 </FONT>
9558 variable is used, and
9559 the value of
9560 <FONT SIZE=-1><B>EDITOR</B>
9561
9562 </FONT>
9563 if
9564 <FONT SIZE=-1><B>FCEDIT</B>
9565
9566 </FONT>
9567 is not set.  If neither variable is set,
9568
9569 <I>vi</I>
9570
9571 is used.  When editing is complete, the edited commands are
9572 echoed and executed.
9573 <P>
9574 In the second form, <I>command</I> is re-executed after each instance
9575 of <I>pat</I> is replaced by <I>rep</I>.
9576 A useful alias to use with this is
9577
9578 <TT>r='fc -s'</TT>,
9579 so that typing
9580
9581 <TT>r cc</TT>
9582 runs the last command beginning with
9583
9584 <TT>cc</TT>
9585 and typing
9586
9587 <TT>r</TT>
9588 re-executes the last command.
9589 <P>
9590 If the first form is used, the return value is 0 unless an invalid
9591 option is encountered or
9592 <I>first</I>
9593
9594 or
9595 <I>last</I>
9596
9597 specify history lines out of range.
9598 If the
9599 <B>-e</B>
9600
9601 option is supplied, the return value is the value of the last
9602 command executed or failure if an error occurs with the temporary
9603 file of commands.  If the second form is used, the return status
9604 is that of the command re-executed, unless
9605 <I>cmd</I>
9606
9607 does not specify a valid history line, in which case
9608 <B>fc</B>
9609
9610 returns failure.
9611 <DT><B>fg</B> [<I>jobspec</I>]<DD>
9612 Resume
9613 <I>jobspec</I>
9614
9615 in the foreground, and make it the current job.
9616 If
9617 <I>jobspec</I>
9618
9619 is not present, the shell's notion of the <I>current job</I> is used.
9620 The return value is that of the command placed into the foreground,
9621 or failure if run when job control is disabled or, when run with
9622 job control enabled, if
9623 <I>jobspec</I>
9624
9625 does not specify a valid job or
9626 <I>jobspec</I>
9627
9628 specifies a job that was started without job control.
9629 <DT><B>getopts</B> <I>optstring</I> <I>name</I> [<I>args</I>]<DD>
9630 <B>getopts</B>
9631
9632 is used by shell procedures to parse positional parameters.
9633 <I>optstring</I>
9634
9635 contains the option characters to be recognized; if a character
9636 is followed by a colon, the option is expected to have an
9637 argument, which should be separated from it by white space.
9638 The colon and question mark characters may not be used as
9639 option characters.
9640 Each time it is invoked,
9641 <B>getopts</B>
9642
9643 places the next option in the shell variable
9644 <I>name</I>,
9645
9646 initializing
9647 <I>name</I>
9648
9649 if it does not exist,
9650 and the index of the next argument to be processed into the
9651 variable
9652 <FONT SIZE=-1><B>OPTIND</B>.
9653
9654 </FONT>
9655 <FONT SIZE=-1><B>OPTIND</B>
9656
9657 </FONT>
9658 is initialized to 1 each time the shell or a shell script
9659 is invoked.  When an option requires an argument,
9660 <B>getopts</B>
9661
9662 places that argument into the variable
9663 <FONT SIZE=-1><B>OPTARG</B>.
9664
9665 </FONT>
9666 The shell does not reset
9667 <FONT SIZE=-1><B>OPTIND</B>
9668
9669 </FONT>
9670 automatically; it must be manually reset between multiple
9671 calls to
9672 <B>getopts</B>
9673
9674 within the same shell invocation if a new set of parameters
9675 is to be used.
9676 <P>
9677 When the end of options is encountered, <B>getopts</B> exits with a
9678 return value greater than zero.
9679 <FONT SIZE=-1><B>OPTIND</B>
9680
9681 </FONT>
9682 is set to the index of the first non-option argument,
9683 and <B>name</B> is set to ?.
9684 <P>
9685 <B>getopts</B>
9686
9687 normally parses the positional parameters, but if more arguments are
9688 given in
9689 <I>args</I>,
9690
9691 <B>getopts</B>
9692
9693 parses those instead.
9694 <P>
9695 <B>getopts</B>
9696
9697 can report errors in two ways.  If the first character of
9698 <I>optstring</I>
9699
9700 is a colon,
9701 <I>silent</I>
9702
9703 error reporting is used.  In normal operation diagnostic messages
9704 are printed when invalid options or missing option arguments are
9705 encountered.
9706 If the variable
9707 <FONT SIZE=-1><B>OPTERR</B>
9708
9709 </FONT>
9710 is set to 0, no error messages will be displayed, even if the first
9711 character of 
9712 <I>optstring</I>
9713
9714 is not a colon.
9715 <P>
9716 If an invalid option is seen,
9717 <B>getopts</B>
9718
9719 places ? into
9720 <I>name</I>
9721
9722 and, if not silent,
9723 prints an error message and unsets
9724 <FONT SIZE=-1><B>OPTARG</B>.
9725
9726 </FONT>
9727 If
9728 <B>getopts</B>
9729
9730 is silent,
9731 the option character found is placed in
9732 <FONT SIZE=-1><B>OPTARG</B>
9733
9734 </FONT>
9735 and no diagnostic message is printed.
9736 <P>
9737 If a required argument is not found, and
9738 <B>getopts</B>
9739
9740 is not silent,
9741 a question mark (<B>?</B>) is placed in
9742 <I>name</I>,
9743
9744 <FONT SIZE=-1><B>OPTARG</B>
9745
9746 </FONT>
9747 is unset, and a diagnostic message is printed.
9748 If
9749 <B>getopts</B>
9750
9751 is silent, then a colon (<B>:</B>) is placed in
9752 <I>name</I>
9753
9754 and
9755 <FONT SIZE=-1><B>OPTARG</B>
9756
9757 </FONT>
9758 is set to the option character found.
9759 <P>
9760 <B>getopts</B>
9761
9762 returns true if an option, specified or unspecified, is found.
9763 It returns false if the end of options is encountered or an
9764 error occurs.
9765 <DT><B>hash</B> [<B>-lr</B>] [<B>-p</B> <I>filename</I>] [<B>-dt</B>] [<I>name</I>]<DD>
9766 For each
9767 <I>name</I>,
9768
9769 the full file name of the command is determined by searching
9770 the directories in
9771 <B>$PATH</B>
9772
9773 and remembered.
9774 If the
9775 <B>-p</B>
9776
9777 option is supplied, no path search is performed, and
9778 <I>filename</I>
9779
9780 is used as the full file name of the command.
9781 The
9782 <B>-r</B>
9783
9784 option causes the shell to forget all
9785 remembered locations.
9786 The
9787 <B>-d</B>
9788
9789 option causes the shell to forget the remembered location of each <I>name</I>.
9790 If the
9791 <B>-t</B>
9792
9793 option is supplied, the full pathname to which each <I>name</I> corresponds
9794 is printed.  If multiple <I>name</I> arguments are supplied with <B>-t</B>,
9795 the <I>name</I> is printed before the hashed full pathname.
9796 The
9797 <B>-l</B>
9798
9799 option causes output to be displayed in a format that may be reused as input.
9800 If no arguments are given, or if only <B>-l</B> is supplied,
9801 information about remembered commands is printed.
9802 The return status is true unless a
9803 <I>name</I>
9804
9805 is not found or an invalid option is supplied.
9806 <DT><B>help</B> [<B>-dms</B>] [<I>pattern</I>]<DD>
9807 Display helpful information about builtin commands.  If
9808 <I>pattern</I>
9809
9810 is specified,
9811 <B>help</B>
9812
9813 gives detailed help on all commands matching
9814 <I>pattern</I>;
9815
9816 otherwise help for all the builtins and shell control structures
9817 is printed.
9818 <DL COMPACT><DT><DD>
9819
9820 <DL COMPACT>
9821 <DT><B>-d</B>
9822
9823 <DD>
9824 Display a short description of each <I>pattern</I>
9825 <DT><B>-m</B>
9826
9827 <DD>
9828 Display the description of each <I>pattern</I> in a manpage-like format
9829 <DT><B>-s</B>
9830
9831 <DD>
9832 Display only a short usage synopsis for each <I>pattern</I>
9833
9834 </DL></DL>
9835
9836 The return status is 0 unless no command matches
9837 <I>pattern</I>.
9838
9839 <DT><B>history [</B><I>n</I>]<DD>
9840
9841 <DT><B>history</B> <B>-c</B><DD>
9842 <DT><B>history -d</B> <I>offset</I><DD>
9843 <DT><B>history</B> <B>-anrw</B> [<I>filename</I>]<DD>
9844 <DT><B>history</B> <B>-p</B> <I>arg</I> [<I>arg ...</I>]<DD>
9845 <DT><B>history</B> <B>-s</B> <I>arg</I> [<I>arg ...</I>]<DD>
9846
9847 With no options, display the command
9848 history list with line numbers.  Lines listed
9849 with a 
9850 <B>*</B>
9851
9852 have been modified.  An argument of
9853 <I>n</I>
9854
9855 lists only the last
9856 <I>n</I>
9857
9858 lines.
9859 If the shell variable
9860 <FONT SIZE=-1><B>HISTTIMEFORMAT</B>
9861
9862 </FONT>
9863 is set and not null,
9864 it is used as a format string for <I>strftime</I>(3) to display
9865 the time stamp associated with each displayed history entry.
9866 No intervening blank is printed between the formatted time stamp
9867 and the history line.
9868 If <I>filename</I> is supplied, it is used as the
9869 name of the history file; if not, the value of
9870 <FONT SIZE=-1><B>HISTFILE</B>
9871
9872 </FONT>
9873 is used.  Options, if supplied, have the following meanings:
9874 <DL COMPACT><DT><DD>
9875
9876 <DL COMPACT>
9877 <DT><B>-c</B>
9878
9879 <DD>
9880 Clear the history list by deleting all the entries.
9881 <DT><B>-d</B> <I>offset</I><DD>
9882 Delete the history entry at position <I>offset</I>.
9883 <DT><B>-a</B>
9884
9885 <DD>
9886 Append the ``new'' history lines (history lines entered since the
9887 beginning of the current <B>bash</B> session) to the history file.
9888 <DT><B>-n</B>
9889
9890 <DD>
9891 Read the history lines not already read from the history
9892 file into the current history list.  These are lines
9893 appended to the history file since the beginning of the
9894 current <B>bash</B> session.
9895 <DT><B>-r</B>
9896
9897 <DD>
9898 Read the contents of the history file
9899 and use them as the current history.
9900 <DT><B>-w</B>
9901
9902 <DD>
9903 Write the current history to the history file, overwriting the
9904 history file's contents.
9905 <DT><B>-p</B>
9906
9907 <DD>
9908 Perform history substitution on the following <I>args</I> and display
9909 the result on the standard output.
9910 Does not store the results in the history list.
9911 Each <I>arg</I> must be quoted to disable normal history expansion.
9912 <DT><B>-s</B>
9913
9914 <DD>
9915 Store the
9916 <I>args</I>
9917
9918 in the history list as a single entry.  The last command in the
9919 history list is removed before the
9920 <I>args</I>
9921
9922 are added.
9923
9924 </DL>
9925 <P>
9926
9927 If the
9928 <FONT SIZE=-1><B>HISTTIMEFORMAT</B>
9929
9930 </FONT>
9931 variable is set, the time stamp information
9932 associated with each history entry is written to the history file,
9933 marked with the history comment character.
9934 When the history file is read, lines beginning with the history
9935 comment character followed immediately by a digit are interpreted
9936 as timestamps for the previous history line.
9937 The return value is 0 unless an invalid option is encountered, an
9938 error occurs while reading or writing the history file, an invalid
9939 <I>offset</I> is supplied as an argument to <B>-d</B>, or the
9940 history expansion supplied as an argument to <B>-p</B> fails.
9941 </DL>
9942
9943 <DT><B>jobs</B> [<B>-lnprs</B>] [ <I>jobspec</I> ... ]<DD>
9944
9945 <DT><B>jobs</B> <B>-x</B> <I>command</I> [ <I>args</I> ... ]<DD>
9946
9947 The first form lists the active jobs.  The options have the following
9948 meanings:
9949 <DL COMPACT><DT><DD>
9950
9951 <DL COMPACT>
9952 <DT><B>-l</B>
9953
9954 <DD>
9955 List process IDs
9956 in addition to the normal information.
9957 <DT><B>-p</B>
9958
9959 <DD>
9960 List only the process ID of the job's process group
9961 leader.
9962 <DT><B>-n</B>
9963
9964 <DD>
9965 Display information only about jobs that have changed status since
9966 the user was last notified of their status.
9967 <DT><B>-r</B>
9968
9969 <DD>
9970 Restrict output to running jobs.
9971 <DT><B>-s</B>
9972
9973 <DD>
9974 Restrict output to stopped jobs.
9975
9976 </DL>
9977 <P>
9978
9979 If
9980 <I>jobspec</I>
9981
9982 is given, output is restricted to information about that job.
9983 The return status is 0 unless an invalid option is encountered
9984 or an invalid
9985 <I>jobspec</I>
9986
9987 is supplied.
9988 <P>
9989
9990 If the
9991 <B>-x</B>
9992
9993 option is supplied,
9994 <B>jobs</B>
9995
9996 replaces any
9997 <I>jobspec</I>
9998
9999 found in
10000 <I>command</I>
10001
10002 or
10003 <I>args</I>
10004
10005 with the corresponding process group ID, and executes
10006 <I>command</I>
10007
10008 passing it
10009 <I>args</I>,
10010
10011 returning its exit status.
10012 </DL>
10013
10014 <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>
10015
10016 <DT><B>kill</B> <B>-l</B> [<I>sigspec</I> | <I>exit_status</I>]<DD>
10017
10018 Send the signal named by
10019 <I>sigspec</I>
10020
10021 or
10022 <I>signum</I>
10023
10024 to the processes named by
10025 <I>pid</I>
10026
10027 or
10028 <I>jobspec</I>.
10029
10030 <I>sigspec</I>
10031
10032 is either a case-insensitive signal name such as
10033 <FONT SIZE=-1><B>SIGKILL</B>
10034
10035 </FONT>
10036 (with or without the
10037 <FONT SIZE=-1><B>SIG</B>
10038
10039 </FONT>
10040 prefix) or a signal number;
10041 <I>signum</I>
10042
10043 is a signal number.
10044 If
10045 <I>sigspec</I>
10046
10047 is not present, then
10048 <FONT SIZE=-1><B>SIGTERM</B>
10049
10050 </FONT>
10051 is assumed.
10052 An argument of
10053 <B>-l</B>
10054
10055 lists the signal names.
10056 If any arguments are supplied when
10057 <B>-l</B>
10058
10059 is given, the names of the signals corresponding to the arguments are
10060 listed, and the return status is 0.
10061 The <I>exit_status</I> argument to
10062 <B>-l</B>
10063
10064 is a number specifying either a signal number or the exit status of
10065 a process terminated by a signal.
10066 <B>kill</B>
10067
10068 returns true if at least one signal was successfully sent, or false
10069 if an error occurs or an invalid option is encountered.
10070 <DT><B>let</B> <I>arg</I> [<I>arg</I> ...]<DD>
10071 Each
10072 <I>arg</I>
10073
10074 is an arithmetic expression to be evaluated (see
10075 <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>
10076
10077 </FONT>
10078 above).
10079 If the last
10080 <I>arg</I>
10081
10082 evaluates to 0,
10083 <B>let</B>
10084
10085 returns 1; 0 is returned otherwise.
10086 <DT><B>local</B> [<I>option</I>] [<I>name</I>[=<I>value</I>] ...]<DD>
10087 For each argument, a local variable named
10088 <I>name </I>
10089
10090 is created, and assigned
10091 <I>value</I>.
10092
10093 The <I>option</I> can be any of the options accepted by <B>declare</B>.
10094 When
10095 <B>local</B>
10096
10097 is used within a function, it causes the variable
10098 <I>name</I>
10099
10100 to have a visible scope restricted to that function and its children.
10101 With no operands,
10102 <B>local</B>
10103
10104 writes a list of local variables to the standard output.  It is
10105 an error to use
10106 <B>local</B>
10107
10108 when not within a function.  The return status is 0 unless
10109 <B>local</B>
10110
10111 is used outside a function, an invalid
10112 <I>name</I>
10113
10114 is supplied, or
10115 <I>name</I> is a readonly variable.
10116 <DT><B>logout</B>
10117
10118 <DD>
10119 Exit a login shell.
10120 <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>
10121
10122 <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>
10123
10124 Read lines from the standard input into the indexed array variable
10125 <I>array</I>,
10126
10127 or from file descriptor 
10128 <I>fd</I>
10129
10130 if the 
10131 <B>-u</B>
10132
10133 option is supplied.
10134 The variable
10135 <FONT SIZE=-1><B>MAPFILE</B>
10136
10137 </FONT>
10138 is the default <I>array</I>.
10139 Options, if supplied, have the following meanings:
10140 <DL COMPACT><DT><DD>
10141
10142 <DL COMPACT>
10143 <DT><B>-n</B>
10144
10145 <DD>
10146 Copy at most
10147 <I>count</I>
10148
10149 lines.  If <I>count</I> is 0, all lines are copied.
10150 <DT><B>-O</B>
10151
10152 <DD>
10153 Begin assigning to
10154 <I>array</I>
10155
10156 at index
10157 <I>origin</I>.
10158
10159 The default index is 0.
10160 <DT><B>-s</B>
10161
10162 <DD>
10163 Discard the first <I>count</I> lines read.
10164 <DT><B>-t</B>
10165
10166 <DD>
10167 Remove a trailing newline from each line read.
10168 <DT><B>-u</B>
10169
10170 <DD>
10171 Read lines from file descriptor <I>fd</I> instead of the standard input.
10172 <DT><B>-C</B>
10173
10174 <DD>
10175 Evaluate
10176 <I>callback</I>
10177
10178 each time <I>quantum</I> lines are read.  The <B>-c</B> option specifies
10179 <I>quantum</I>.
10180
10181 <DT><B>-c</B>
10182
10183 <DD>
10184 Specify the number of lines read between each call to
10185 <I>callback</I>.
10186
10187
10188 </DL>
10189 <P>
10190
10191 If
10192 <B>-C</B>
10193
10194 is specified without 
10195 <B>-c</B>,
10196
10197 the default quantum is 5000.
10198 When <I>callback</I> is evaluated, it is supplied the index of the next
10199 array element to be assigned as an additional argument.
10200 <I>callback</I> is evaluated after the line is read but before the 
10201 array element is assigned.
10202 <P>
10203
10204 If not supplied with an explicit origin, <B>mapfile</B> will clear <I>array</I>
10205 before assigning to it.
10206 <P>
10207
10208 <B>mapfile</B> returns successfully unless an invalid option or option
10209 argument is supplied, <I>array</I> is invalid or unassignable, or if
10210 <I>array</I> is not an indexed array.
10211 </DL>
10212
10213 <DT><B>popd</B> [-<B>n</B>] [+<I>n</I>] [-<I>n</I>]<DD>
10214 Removes entries from the directory stack.  With no arguments,
10215 removes the top directory from the stack, and performs a
10216 <B>cd</B>
10217
10218 to the new top directory.
10219 Arguments, if supplied, have the following meanings:
10220 <DL COMPACT><DT><DD>
10221
10222 <DL COMPACT>
10223 <DT><B>-n</B>
10224
10225 <DD>
10226 Suppresses the normal change of directory when removing directories
10227 from the stack, so that only the stack is manipulated.
10228 <DT><B>+</B><I>n</I><DD>
10229 Removes the <I>n</I>th entry counting from the left of the list
10230 shown by
10231 <B>dirs</B>,
10232
10233 starting with zero.  For example:
10234
10235 <TT>popd +0</TT>
10236 removes the first directory,
10237
10238 <TT>popd +1</TT>
10239 the second.
10240 <DT><B>-</B><I>n</I><DD>
10241 Removes the <I>n</I>th entry counting from the right of the list
10242 shown by
10243 <B>dirs</B>,
10244
10245 starting with zero.  For example:
10246
10247 <TT>popd -0</TT>
10248 removes the last directory,
10249
10250 <TT>popd -1</TT>
10251 the next to last.
10252
10253 </DL>
10254 <P>
10255
10256 If the
10257 <B>popd</B>
10258
10259 command is successful, a 
10260 <B>dirs</B>
10261
10262 is performed as well, and the return status is 0.
10263 <B>popd</B>
10264
10265 returns false if an invalid option is encountered, the directory stack
10266 is empty, a non-existent directory stack entry is specified, or the
10267 directory change fails.
10268 </DL>
10269
10270 <DT><B>printf</B> [<B>-v</B> <I>var</I>] <I>format</I> [<I>arguments</I>]<DD>
10271 Write the formatted <I>arguments</I> to the standard output under the
10272 control of the <I>format</I>.
10273 The <I>format</I> is a character string which contains three types of objects:
10274 plain characters, which are simply copied to standard output, character
10275 escape sequences, which are converted and copied to the standard output, and
10276 format specifications, each of which causes printing of the next successive
10277 <I>argument</I>.
10278 In addition to the standard <I>printf</I>(1) formats, <B>%b</B> causes
10279 <B>printf</B> to expand backslash escape sequences in the corresponding
10280 <I>argument</I> (except that <B>\c</B> terminates output, backslashes in
10281 <B>\aq</B>, <B>\&quot;</B>, and <B>\?</B> are not removed, and octal escapes
10282 beginning with <B>\0</B> may contain up to four digits),
10283 and <B>%q</B> causes <B>printf</B> to output the corresponding
10284 <I>argument</I> in a format that can be reused as shell input.
10285 <P>
10286 The <B>-v</B> option causes the output to be assigned to the variable
10287 <I>var</I> rather than being printed to the standard output.
10288 <P>
10289 The <I>format</I> is reused as necessary to consume all of the <I>arguments</I>.
10290 If the <I>format</I> requires more <I>arguments</I> than are supplied, the
10291 extra format specifications behave as if a zero value or null string, as
10292 appropriate, had been supplied.  The return value is zero on success,
10293 non-zero on failure.
10294 <DT><B>pushd</B> [<B>-n</B>] [+<I>n</I>] [-<I>n</I>]<DD>
10295
10296 <DT><B>pushd</B> [<B>-n</B>] [<I>dir</I>]<DD>
10297
10298 Adds a directory to the top of the directory stack, or rotates
10299 the stack, making the new top of the stack the current working
10300 directory.  With no arguments, exchanges the top two directories
10301 and returns 0, unless the directory stack is empty.
10302 Arguments, if supplied, have the following meanings:
10303 <DL COMPACT><DT><DD>
10304
10305 <DL COMPACT>
10306 <DT><B>-n</B>
10307
10308 <DD>
10309 Suppresses the normal change of directory when adding directories
10310 to the stack, so that only the stack is manipulated.
10311 <DT><B>+</B><I>n</I><DD>
10312 Rotates the stack so that the <I>n</I>th directory
10313 (counting from the left of the list shown by
10314 <B>dirs</B>,
10315
10316 starting with zero)
10317 is at the top.
10318 <DT><B>-</B><I>n</I><DD>
10319 Rotates the stack so that the <I>n</I>th directory
10320 (counting from the right of the list shown by
10321 <B>dirs</B>,
10322
10323 starting with zero) is at the top.
10324 <DT><I>dir</I>
10325
10326 <DD>
10327 Adds
10328 <I>dir</I>
10329
10330 to the directory stack at the top, making it the
10331 new current working directory.
10332
10333 </DL>
10334 <P>
10335
10336 If the
10337 <B>pushd</B>
10338
10339 command is successful, a 
10340 <B>dirs</B>
10341
10342 is performed as well.
10343 If the first form is used,
10344 <B>pushd</B>
10345
10346 returns 0 unless the cd to
10347 <I>dir</I>
10348
10349 fails.  With the second form,
10350 <B>pushd</B>
10351
10352 returns 0 unless the directory stack is empty,
10353 a non-existent directory stack element is specified,
10354 or the directory change to the specified new current directory
10355 fails.
10356 </DL>
10357
10358 <DT><B>pwd</B> [<B>-LP</B>]<DD>
10359 Print the absolute pathname of the current working directory.
10360 The pathname printed contains no symbolic links if the
10361 <B>-P</B>
10362
10363 option is supplied or the 
10364 <B>-o physical</B>
10365
10366 option to the
10367 <B>set</B>
10368
10369 builtin command is enabled.
10370 If the
10371 <B>-L</B>
10372
10373 option is used, the pathname printed may contain symbolic links.
10374 The return status is 0 unless an error occurs while
10375 reading the name of the current directory or an
10376 invalid option is supplied.
10377 <DT><B>read</B> [<B>-ers</B>] [<B>-a</B> <I>aname</I>] [<B>-d</B> <I>delim</I>] [<B>-i</B> <I>text</I>] [<B>-n</B> <I>nchars</I>] [<B>-N</B> <I>nchars</I>] [<B>-p</B> <I>prompt</I>] [<B>-t</B> <I>timeout</I>] [<B>-u</B> <I>fd</I>] [<I>name</I> ...]<DD>
10378 One line is read from the standard input, or from the file descriptor
10379 <I>fd</I> supplied as an argument to the <B>-u</B> option, and the first word
10380 is assigned to the first
10381 <I>name</I>,
10382
10383 the second word to the second
10384 <I>name</I>,
10385
10386 and so on, with leftover words and their intervening separators assigned
10387 to the last
10388 <I>name</I>.
10389
10390 If there are fewer words read from the input stream than names,
10391 the remaining names are assigned empty values.
10392 The characters in 
10393 <FONT SIZE=-1><B>IFS</B>
10394
10395 </FONT>
10396 are used to split the line into words.
10397 The backslash character (<B>\</B>) may be used to remove any special
10398 meaning for the next character read and for line continuation.
10399 Options, if supplied, have the following meanings:
10400 <DL COMPACT><DT><DD>
10401
10402 <DL COMPACT>
10403 <DT><B>-a </B><I>aname</I>
10404
10405 <DD>
10406 The words are assigned to sequential indices
10407 of the array variable
10408 <I>aname</I>,
10409
10410 starting at 0.
10411 <I>aname</I>
10412
10413 is unset before any new values are assigned.
10414 Other <I>name</I> arguments are ignored.
10415 <DT><B>-d </B><I>delim</I>
10416
10417 <DD>
10418 The first character of <I>delim</I> is used to terminate the input line,
10419 rather than newline.
10420 <DT><B>-e</B>
10421
10422 <DD>
10423 If the standard input
10424 is coming from a terminal,
10425 <B>readline</B>
10426
10427 (see
10428 <FONT SIZE=-1><B>READLINE</B>
10429
10430 </FONT>
10431 above) is used to obtain the line.
10432 Readline uses the current (or default, if line editing was not previously
10433 active) editing settings.
10434 <DT><B>-i </B><I>text</I>
10435
10436 <DD>
10437 If
10438 <B>readline</B>
10439
10440 is being used to read the line, <I>text</I> is placed into the editing
10441 buffer before editing begins.
10442 <DT><B>-n </B><I>nchars</I>
10443
10444 <DD>
10445 <B>read</B> returns after reading <I>nchars</I> characters rather than
10446 waiting for a complete line of input, but honor a delimiter if fewer
10447 than <I>nchars</I> characters are read before the delimiter.
10448 <DT><B>-N </B><I>nchars</I>
10449
10450 <DD>
10451 <B>read</B> returns after reading exactly <I>nchars</I> characters rather
10452 than waiting for a complete line of input, unless EOF is encountered or
10453 <B>read</B> times out.
10454 Delimiter characters encountered in the input are
10455 not treated specially and do not cause <B>read</B> to return until
10456 <I>nchars</I> characters are read.
10457 <DT><B>-p </B><I>prompt</I>
10458
10459 <DD>
10460 Display <I>prompt</I> on standard error, without a
10461 trailing newline, before attempting to read any input.  The prompt
10462 is displayed only if input is coming from a terminal.
10463 <DT><B>-r</B>
10464
10465 <DD>
10466 Backslash does not act as an escape character.
10467 The backslash is considered to be part of the line.
10468 In particular, a backslash-newline pair may not be used as a line
10469 continuation.
10470 <DT><B>-s</B>
10471
10472 <DD>
10473 Silent mode.  If input is coming from a terminal, characters are
10474 not echoed.
10475 <DT><B>-t </B><I>timeout</I>
10476
10477 <DD>
10478 Cause <B>read</B> to time out and return failure if a complete line of
10479 input is not read within <I>timeout</I> seconds.
10480 <I>timeout</I> may be a decimal number with a fractional portion following
10481 the decimal point.
10482 This option is only effective if <B>read</B> is reading input from a
10483 terminal, pipe, or other special file; it has no effect when reading
10484 from regular files.
10485 If <I>timeout</I> is 0, <B>read</B> returns success if input is available on
10486 the specified file descriptor, failure otherwise.
10487 The exit status is greater than 128 if the timeout is exceeded.
10488 <DT><B>-u </B><I>fd</I>
10489
10490 <DD>
10491 Read input from file descriptor <I>fd</I>.
10492
10493 </DL>
10494 <P>
10495
10496 If no
10497 <I>names</I>
10498
10499 are supplied, the line read is assigned to the variable
10500 <FONT SIZE=-1><B>REPLY</B>.
10501
10502 </FONT>
10503 The return code is zero, unless end-of-file is encountered, <B>read</B>
10504 times out (in which case the return code is greater than 128), or an
10505 invalid file descriptor is supplied as the argument to <B>-u</B>.
10506 </DL>
10507
10508 <DT><B>readonly</B> [<B>-aApf</B>] [<I>name</I>[=<I>word</I>] ...]<DD>
10509
10510 The given
10511 <I>names</I> are marked readonly; the values of these
10512 <I>names</I>
10513
10514 may not be changed by subsequent assignment.
10515 If the
10516 <B>-f</B>
10517
10518 option is supplied, the functions corresponding to the
10519 <I>names</I> are so
10520 marked.
10521 The
10522 <B>-a</B>
10523
10524 option restricts the variables to indexed arrays; the
10525 <B>-A</B>
10526
10527 option restricts the variables to associative arrays.
10528 If no
10529 <I>name</I>
10530
10531 arguments are given, or if the
10532 <B>-p</B>
10533
10534 option is supplied, a list of all readonly names is printed.
10535 The
10536 <B>-p</B>
10537
10538 option causes output to be displayed in a format that
10539 may be reused as input.
10540 If a variable name is followed by =<I>word</I>, the value of
10541 the variable is set to <I>word</I>.
10542 The return status is 0 unless an invalid option is encountered,
10543 one of the
10544 <I>names</I>
10545
10546 is not a valid shell variable name, or
10547 <B>-f</B>
10548
10549 is supplied with a
10550 <I>name</I>
10551
10552 that is not a function.
10553 <DT><B>return</B> [<I>n</I>]<DD>
10554 Causes a function to exit with the return value specified by
10555 <I>n</I>.
10556
10557 If 
10558 <I>n</I>
10559
10560 is omitted, the return status is that of the last command
10561 executed in the function body.  If used outside a function,
10562 but during execution of a script by the 
10563 <B>.</B>
10564
10565 (<B>source</B>) command, it causes the shell to stop executing
10566 that script and return either
10567 <I>n</I>
10568
10569 or the exit status of the last command executed within the
10570 script as the exit status of the script.  If used outside a
10571 function and not during execution of a script by <B>.</B>,
10572 the return status is false.
10573 Any command associated with the <B>RETURN</B> trap is executed
10574 before execution resumes after the function or script.
10575 <DT><B>set</B> [<B>--abefhkmnptuvxBCEHPT</B>] [<B>-o</B> <I>option</I>] [<I>arg</I> ...]<DD>
10576
10577 <DT><B>set</B> [<B>+abefhkmnptuvxBCEHPT</B>] [<B>+o</B> <I>option</I>] [<I>arg</I> ...]<DD>
10578
10579 Without options, the name and value of each shell variable are displayed
10580 in a format that can be reused as input
10581 for setting or resetting the currently-set variables.
10582 Read-only variables cannot be reset.
10583 In <I>posix mode</I>, only shell variables are listed.
10584 The output is sorted according to the current locale.
10585 When options are specified, they set or unset shell attributes.
10586 Any arguments remaining after option processing are treated
10587 as values for the positional parameters and are assigned, in order, to 
10588 <B>$1</B>,
10589
10590 <B>$2</B>,
10591
10592 <B>...</B>
10593
10594 <B>$</B><I>n</I>.
10595
10596 Options, if specified, have the following meanings:
10597 <DL COMPACT><DT><DD>
10598
10599 <DL COMPACT>
10600 <DT><B>-a</B>
10601
10602 <DD>
10603 Automatically mark variables and functions which are modified or
10604 created for export to the environment of subsequent commands.
10605 <DT><B>-b</B>
10606
10607 <DD>
10608 Report the status of terminated background jobs
10609 immediately, rather than before the next primary prompt.  This is
10610 effective only when job control is enabled.
10611 <DT><B>-e</B>
10612
10613 <DD>
10614 Exit immediately if a <I>pipeline</I> (which may consist of a single
10615 <I>simple command</I>),  a <I>subshell</I> command enclosed in parentheses,
10616 or one of the commands executed as part of a command list enclosed
10617 by braces (see
10618 <FONT SIZE=-1><B>SHELL GRAMMAR</B>
10619
10620 </FONT>
10621 above) exits with a non-zero status.
10622 The shell does not exit if the
10623 command that fails is part of the command list immediately following a
10624 <B>while</B>
10625
10626 or
10627 <B>until</B>
10628
10629 keyword, 
10630 part of the test following the
10631 <B>if</B>
10632
10633 or
10634 <B>elif</B>
10635
10636 reserved words, part of any command executed in a
10637 <B>&amp;&amp;</B>
10638
10639 or
10640 <B>||</B>
10641
10642 list except the command following the final <B>&amp;&amp;</B> or <B>||</B>,
10643 any command in a pipeline but the last,
10644 or if the command's return value is
10645 being inverted with
10646 <B>!</B>.
10647
10648 A trap on <B>ERR</B>, if set, is executed before the shell exits.
10649 This option applies to the shell environment and each subshell environment
10650 separately (see
10651 <FONT SIZE=-1><B>COMMAND EXECUTION ENVIRONMENT</B>
10652
10653 </FONT>
10654 above), and may cause
10655 subshells to exit before executing all the commands in the subshell.
10656 <DT><B>-f</B>
10657
10658 <DD>
10659 Disable pathname expansion.
10660 <DT><B>-h</B>
10661
10662 <DD>
10663 Remember the location of commands as they are looked up for execution.
10664 This is enabled by default.
10665 <DT><B>-k</B>
10666
10667 <DD>
10668 All arguments in the form of assignment statements
10669 are placed in the environment for a command, not just
10670 those that precede the command name.
10671 <DT><B>-m</B>
10672
10673 <DD>
10674 Monitor mode.  Job control is enabled.  This option is on
10675 by default for interactive shells on systems that support
10676 it (see
10677 <FONT SIZE=-1><B>JOB CONTROL</B>
10678
10679 </FONT>
10680 above).  Background processes run in a separate process
10681 group and a line containing their exit status is printed
10682 upon their completion.
10683 <DT><B>-n</B>
10684
10685 <DD>
10686 Read commands but do not execute them.  This may be used to 
10687 check a shell script for syntax errors.  This is ignored by
10688 interactive shells.
10689 <DT><B>-o </B><I>option-name</I>
10690
10691 <DD>
10692 The <I>option-name</I> can be one of the following:
10693 <DL COMPACT><DT><DD>
10694 <DL COMPACT>
10695 <DT><B>allexport</B>
10696
10697 <DD>
10698 Same as
10699 <B>-a</B>.
10700
10701 <DT><B>braceexpand</B>
10702
10703 <DD>
10704 Same as
10705 <B>-B</B>.
10706
10707 <DT><B>emacs</B>
10708
10709 <DD>
10710 Use an emacs-style command line editing interface.  This is enabled
10711 by default when the shell is interactive, unless the shell is started
10712 with the
10713 <B>--noediting</B>
10714
10715 option.
10716 This also affects the editing interface used for <B>read -e</B>.
10717 <DT><B>errexit</B>
10718
10719 <DD>
10720 Same as
10721 <B>-e</B>.
10722
10723 <DT><B>errtrace</B>
10724
10725 <DD>
10726 Same as
10727 <B>-E</B>.
10728
10729 <DT><B>functrace</B>
10730
10731 <DD>
10732 Same as
10733 <B>-T</B>.
10734
10735 <DT><B>hashall</B>
10736
10737 <DD>
10738 Same as
10739 <B>-h</B>.
10740
10741 <DT><B>histexpand</B>
10742
10743 <DD>
10744 Same as
10745 <B>-H</B>.
10746
10747 <DT><B>history</B>
10748
10749 <DD>
10750 Enable command history, as described above under
10751 <FONT SIZE=-1><B>HISTORY</B>.
10752
10753 </FONT>
10754 This option is on by default in interactive shells.
10755 <DT><B>ignoreeof</B>
10756
10757 <DD>
10758 The effect is as if the shell command
10759 <TT>IGNOREEOF=10</TT>
10760
10761 had been executed
10762 (see
10763 <B>Shell Variables</B>
10764
10765 above).
10766 <DT><B>keyword</B>
10767
10768 <DD>
10769 Same as
10770 <B>-k</B>.
10771
10772 <DT><B>monitor</B>
10773
10774 <DD>
10775 Same as
10776 <B>-m</B>.
10777
10778 <DT><B>noclobber</B>
10779
10780 <DD>
10781 Same as
10782 <B>-C</B>.
10783
10784 <DT><B>noexec</B>
10785
10786 <DD>
10787 Same as
10788 <B>-n</B>.
10789
10790 <DT><B>noglob</B>
10791
10792 <DD>
10793 Same as
10794 <B>-f</B>.
10795
10796 <DT><B>nolog</B>
10797
10798 <DD>
10799 Currently ignored.
10800 <DT><B>notify</B>
10801
10802 <DD>
10803 Same as
10804 <B>-b</B>.
10805
10806 <DT><B>nounset</B>
10807
10808 <DD>
10809 Same as
10810 <B>-u</B>.
10811
10812 <DT><B>onecmd</B>
10813
10814 <DD>
10815 Same as
10816 <B>-t</B>.
10817
10818 <DT><B>physical</B>
10819
10820 <DD>
10821 Same as
10822 <B>-P</B>.
10823
10824 <DT><B>pipefail</B>
10825
10826 <DD>
10827 If set, the return value of a pipeline is the value of the last
10828 (rightmost) command to exit with a non-zero status, or zero if all
10829 commands in the pipeline exit successfully.
10830 This option is disabled by default.
10831 <DT><B>posix</B>
10832
10833 <DD>
10834 Change the behavior of
10835 <B>bash</B>
10836
10837 where the default operation differs
10838 from the POSIX standard to match the standard (<I>posix mode</I>).
10839 <DT><B>privileged</B>
10840
10841 <DD>
10842 Same as
10843 <B>-p</B>.
10844
10845 <DT><B>verbose</B>
10846
10847 <DD>
10848 Same as
10849 <B>-v</B>.
10850
10851 <DT><B>vi</B>
10852
10853 <DD>
10854 Use a vi-style command line editing interface.
10855 This also affects the editing interface used for <B>read -e</B>.
10856 <DT><B>xtrace</B>
10857
10858 <DD>
10859 Same as
10860 <B>-x</B>.
10861
10862 <P>
10863 </DL>
10864 <P>
10865
10866 If
10867 <B>-o</B>
10868
10869 is supplied with no <I>option-name</I>, the values of the current options are
10870 printed.
10871 If
10872 <B>+o</B>
10873
10874 is supplied with no <I>option-name</I>, a series of
10875 <B>set</B>
10876
10877 commands to recreate the current option settings is displayed on
10878 the standard output.
10879 </DL>
10880
10881 <DT><B>-p</B>
10882
10883 <DD>
10884 Turn on
10885 <I>privileged</I>
10886
10887 mode.  In this mode, the
10888 <FONT SIZE=-1><B>$ENV</B>
10889
10890 </FONT>
10891 and
10892 <FONT SIZE=-1><B>$BASH_ENV</B>
10893
10894 </FONT>
10895 files are not processed, shell functions are not inherited from the
10896 environment, and the
10897 <FONT SIZE=-1><B>SHELLOPTS</B>,
10898
10899 </FONT>
10900 <FONT SIZE=-1><B>BASHOPTS</B>,
10901
10902 </FONT>
10903 <FONT SIZE=-1><B>CDPATH</B>,
10904
10905 </FONT>
10906 and
10907 <FONT SIZE=-1><B>GLOBIGNORE</B>
10908
10909 </FONT>
10910 variables, if they appear in the environment, are ignored.
10911 If the shell is started with the effective user (group) id not equal to the
10912 real user (group) id, and the <B>-p</B> option is not supplied, these actions
10913 are taken and the effective user id is set to the real user id.
10914 If the <B>-p</B> option is supplied at startup, the effective user id is
10915 not reset.
10916 Turning this option off causes the effective user
10917 and group ids to be set to the real user and group ids.
10918 <DT><B>-t</B>
10919
10920 <DD>
10921 Exit after reading and executing one command.
10922 <DT><B>-u</B>
10923
10924 <DD>
10925 Treat unset variables and parameters other than the special
10926 parameters &quot;@&quot; and &quot;*&quot; as an error when performing
10927 parameter expansion.  If expansion is attempted on an
10928 unset variable or parameter, the shell prints an error message, and,
10929 if not interactive, exits with a non-zero status.
10930 <DT><B>-v</B>
10931
10932 <DD>
10933 Print shell input lines as they are read.
10934 <DT><B>-x</B>
10935
10936 <DD>
10937 After expanding each <I>simple command</I>,
10938 <B>for</B> command, <B>case</B> command, <B>select</B> command, or
10939 arithmetic <B>for</B> command, display the expanded value of
10940 <FONT SIZE=-1><B>PS4</B>,
10941
10942 </FONT>
10943 followed by the command and its expanded arguments
10944 or associated word list.
10945 <DT><B>-B</B>
10946
10947 <DD>
10948 The shell performs brace expansion (see
10949 <B>Brace Expansion</B>
10950
10951 above).  This is on by default.
10952 <DT><B>-C</B>
10953
10954 <DD>
10955 If set,
10956 <B>bash</B>
10957
10958 does not overwrite an existing file with the
10959 <B>&gt;</B>,
10960
10961 <B>&gt;&amp;</B>,
10962
10963 and
10964 <B>&lt;&gt;</B>
10965
10966 redirection operators.  This may be overridden when 
10967 creating output files by using the redirection operator
10968 <B>&gt;|</B>
10969
10970 instead of
10971 <B>&gt;</B>.
10972
10973 <DT><B>-E</B>
10974
10975 <DD>
10976 If set, any trap on <B>ERR</B> is inherited by shell functions, command
10977 substitutions, and commands executed in a subshell environment.
10978 The <B>ERR</B> trap is normally not inherited in such cases.
10979 <DT><B>-H</B>
10980
10981 <DD>
10982 Enable
10983 <B>!</B>
10984
10985 style history substitution.  This option is on by
10986 default when the shell is interactive.
10987 <DT><B>-P</B>
10988
10989 <DD>
10990 If set, the shell does not follow symbolic links when executing
10991 commands such as
10992 <B>cd</B>
10993
10994 that change the current working directory.  It uses the
10995 physical directory structure instead.  By default,
10996 <B>bash</B>
10997
10998 follows the logical chain of directories when performing commands
10999 which change the current directory.
11000 <DT><B>-T</B>
11001
11002 <DD>
11003 If set, any traps on <B>DEBUG</B> and <B>RETURN</B> are inherited by shell
11004 functions, command substitutions, and commands executed in a
11005 subshell environment.
11006 The <B>DEBUG</B> and <B>RETURN</B> traps are normally not inherited
11007 in such cases.
11008 <DT><B>--</B>
11009
11010 <DD>
11011 If no arguments follow this option, then the positional parameters are
11012 unset.  Otherwise, the positional parameters are set to the
11013 <I>arg</I>s, even if some of them begin with a
11014 <B>-</B>.
11015
11016 <DT><B>-</B>
11017
11018 <DD>
11019 Signal the end of options, cause all remaining <I>arg</I>s to be
11020 assigned to the positional parameters.  The
11021 <B>-x</B>
11022
11023 and
11024 <B>-v</B>
11025
11026 options are turned off.
11027 If there are no <I>arg</I>s,
11028 the positional parameters remain unchanged.
11029
11030 </DL>
11031 <P>
11032
11033 The options are off by default unless otherwise noted.
11034 Using + rather than - causes these options to be turned off.
11035 The options can also be specified as arguments to an invocation of
11036 the shell.
11037 The current set of options may be found in
11038 <B>$-</B>.
11039
11040 The return status is always true unless an invalid option is encountered.
11041 </DL>
11042
11043 <DT><B>shift</B> [<I>n</I>]<DD>
11044 The positional parameters from <I>n</I>+1 ... are renamed to
11045 <B>$1</B>
11046
11047 <B>....</B>
11048
11049 Parameters represented by the numbers <B>$#</B>
11050 down to <B>$#</B>-<I>n</I>+1 are unset.
11051 <I>n</I>
11052
11053 must be a non-negative number less than or equal to <B>$#</B>.
11054 If
11055 <I>n</I>
11056
11057 is 0, no parameters are changed.
11058 If
11059 <I>n </I>
11060
11061 is not given, it is assumed to be 1.
11062 If
11063 <I>n</I>
11064
11065 is greater than <B>$#</B>, the positional parameters are not changed.
11066 The return status is greater than zero if
11067 <I>n</I>
11068
11069 is greater than
11070 <B>$#</B>
11071
11072 or less than zero; otherwise 0.
11073 <DT><B>shopt</B> [<B>-pqsu</B>] [<B>-o</B>] [<I>optname</I> ...]<DD>
11074 Toggle the values of variables controlling optional shell behavior.
11075 With no options, or with the
11076 <B>-p</B>
11077
11078 option, a list of all settable options is displayed, with
11079 an indication of whether or not each is set.
11080 The <B>-p</B> option causes output to be displayed in a form that
11081 may be reused as input.
11082 Other options have the following meanings:
11083 <DL COMPACT><DT><DD>
11084
11085 <DL COMPACT>
11086 <DT><B>-s</B>
11087
11088 <DD>
11089 Enable (set) each <I>optname</I>.
11090 <DT><B>-u</B>
11091
11092 <DD>
11093 Disable (unset) each <I>optname</I>.
11094 <DT><B>-q</B>
11095
11096 <DD>
11097 Suppresses normal output (quiet mode); the return status indicates
11098 whether the <I>optname</I> is set or unset.
11099 If multiple <I>optname</I> arguments are given with
11100 <B>-q</B>,
11101
11102 the return status is zero if all <I>optnames</I> are enabled; non-zero
11103 otherwise.
11104 <DT><B>-o</B>
11105
11106 <DD>
11107 Restricts the values of <I>optname</I> to be those defined for the
11108 <B>-o</B>
11109
11110 option to the
11111 <B>set</B>
11112
11113 builtin.
11114
11115 </DL>
11116 <P>
11117
11118 If either
11119 <B>-s</B>
11120
11121 or
11122 <B>-u</B>
11123
11124 is used with no <I>optname</I> arguments, the display is limited to
11125 those options which are set or unset, respectively.
11126 Unless otherwise noted, the <B>shopt</B> options are disabled (unset)
11127 by default.
11128 <P>
11129
11130 The return status when listing options is zero if all <I>optnames</I>
11131 are enabled, non-zero otherwise.  When setting or unsetting options,
11132 the return status is zero unless an <I>optname</I> is not a valid shell
11133 option.
11134 <P>
11135
11136 The list of <B>shopt</B> options is:
11137 <P>
11138
11139
11140
11141 <DL COMPACT>
11142 <DT><B>autocd</B>
11143
11144 <DD>
11145 If set, a command name that is the name of a directory is executed as if
11146 it were the argument to the <B>cd</B> command.
11147 This option is only used by interactive shells.
11148 <DT><B>cdable_vars</B>
11149
11150 <DD>
11151 If set, an argument to the
11152 <B>cd</B>
11153
11154 builtin command that
11155 is not a directory is assumed to be the name of a variable whose
11156 value is the directory to change to.
11157 <DT><B>cdspell</B>
11158
11159 <DD>
11160 If set, minor errors in the spelling of a directory component in a
11161 <B>cd</B>
11162
11163 command will be corrected.
11164 The errors checked for are transposed characters,
11165 a missing character, and one character too many.
11166 If a correction is found, the corrected file name is printed,
11167 and the command proceeds.
11168 This option is only used by interactive shells.
11169 <DT><B>checkhash</B>
11170
11171 <DD>
11172 If set, <B>bash</B> checks that a command found in the hash
11173 table exists before trying to execute it.  If a hashed command no
11174 longer exists, a normal path search is performed.
11175 <DT><B>checkjobs</B>
11176
11177 <DD>
11178 If set, <B>bash</B> lists the status of any stopped and running jobs before
11179 exiting an interactive shell.  If any jobs are running, this causes
11180 the exit to be deferred until a second exit is attempted without an
11181 intervening command (see
11182 <FONT SIZE=-1><B>JOB CONTROL</B>
11183
11184 </FONT>
11185 above).  The shell always
11186 postpones exiting if any jobs are stopped.
11187 <DT><B>checkwinsize</B>
11188
11189 <DD>
11190 If set, <B>bash</B> checks the window size after each command
11191 and, if necessary, updates the values of
11192 <FONT SIZE=-1><B>LINES</B>
11193
11194 </FONT>
11195 and
11196 <FONT SIZE=-1><B>COLUMNS</B>.
11197
11198 </FONT>
11199 <DT><B>cmdhist</B>
11200
11201 <DD>
11202 If set,
11203 <B>bash</B>
11204
11205 attempts to save all lines of a multiple-line
11206 command in the same history entry.  This allows
11207 easy re-editing of multi-line commands.
11208 <DT><B>compat31</B>
11209
11210 <DD>
11211 If set,
11212 <B>bash</B>
11213
11214 changes its behavior to that of version 3.1 with respect to quoted
11215 arguments to the conditional command's =~ operator.
11216 <DT><B>compat32</B>
11217
11218 <DD>
11219 If set,
11220 <B>bash</B>
11221
11222 changes its behavior to that of version 3.2 with respect to locale-specific
11223 string comparison when using the conditional command's &lt; and &gt; operators.
11224 <DT><B>compat40</B>
11225
11226 <DD>
11227 If set,
11228 <B>bash</B>
11229
11230 changes its behavior to that of version 4.0 with respect to locale-specific
11231 string comparison when using the conditional command's &lt; and &gt; operators
11232 and the effect of interrupting a command list.
11233 <DT><B>dirspell</B>
11234
11235 <DD>
11236 If set,
11237 <B>bash</B>
11238
11239 attempts spelling correction on directory names during word completion
11240 if the directory name initially supplied does not exist.
11241 <DT><B>dotglob</B>
11242
11243 <DD>
11244 If set, 
11245 <B>bash</B>
11246
11247 includes filenames beginning with a `.' in the results of pathname
11248 expansion.
11249 <DT><B>execfail</B>
11250
11251 <DD>
11252 If set, a non-interactive shell will not exit if
11253 it cannot execute the file specified as an argument to the
11254 <B>exec</B>
11255
11256 builtin command.  An interactive shell does not exit if
11257 <B>exec</B>
11258
11259 fails.
11260 <DT><B>expand_aliases</B>
11261
11262 <DD>
11263 If set, aliases are expanded as described above under
11264 <FONT SIZE=-1><B>ALIASES</B>.
11265
11266 </FONT>
11267 This option is enabled by default for interactive shells.
11268 <DT><B>extdebug</B>
11269
11270 <DD>
11271 If set, behavior intended for use by debuggers is enabled:
11272 <DL COMPACT><DT><DD>
11273 <DL COMPACT>
11274 <DT><B>1.</B>
11275
11276 <DD>
11277 The <B>-F</B> option to the <B>declare</B> builtin displays the source
11278 file name and line number corresponding to each function name supplied
11279 as an argument.
11280 <DT><B>2.</B>
11281
11282 <DD>
11283 If the command run by the <B>DEBUG</B> trap returns a non-zero value, the
11284 next command is skipped and not executed.
11285 <DT><B>3.</B>
11286
11287 <DD>
11288 If the command run by the <B>DEBUG</B> trap returns a value of 2, and the
11289 shell is executing in a subroutine (a shell function or a shell script
11290 executed by the <B>.</B> or <B>source</B> builtins), a call to
11291 <B>return</B> is simulated.
11292 <DT><B>4.</B>
11293
11294 <DD>
11295 <FONT SIZE=-1><B>BASH_ARGC</B>
11296
11297 </FONT>
11298 and
11299 <FONT SIZE=-1><B>BASH_ARGV</B>
11300
11301 </FONT>
11302 are updated as described in their descriptions above.
11303 <DT><B>5.</B>
11304
11305 <DD>
11306 Function tracing is enabled:  command substitution, shell functions, and
11307 subshells invoked with <B>(</B> <I>command</I> <B>)</B> inherit the
11308 <B>DEBUG</B> and <B>RETURN</B> traps.
11309 <DT><B>6.</B>
11310
11311 <DD>
11312 Error tracing is enabled:  command substitution, shell functions, and
11313 subshells invoked with <B>(</B> <I>command</I> <B>)</B> inherit the
11314 <B>ERROR</B> trap.
11315 </DL></DL>
11316
11317 <DT><B>extglob</B>
11318
11319 <DD>
11320 If set, the extended pattern matching features described above under
11321 <B>Pathname Expansion</B> are enabled.
11322 <DT><B>extquote</B>
11323
11324 <DD>
11325 If set, <B>$</B>aq<I>string</I>aq and <B>$</B>&quot;<I>string</I>&quot; quoting is
11326 performed within <B>${</B><I>parameter</I><B>}</B> expansions
11327 enclosed in double quotes.  This option is enabled by default.
11328 <DT><B>failglob</B>
11329
11330 <DD>
11331 If set, patterns which fail to match filenames during pathname expansion
11332 result in an expansion error.
11333 <DT><B>force_fignore</B>
11334
11335 <DD>
11336 If set, the suffixes specified by the
11337 <FONT SIZE=-1><B>FIGNORE</B>
11338
11339 </FONT>
11340 shell variable
11341 cause words to be ignored when performing word completion even if
11342 the ignored words are the only possible completions.
11343 See
11344 <FONT SIZE=-1><B>SHELL VARIABLES</B></FONT>
11345 above for a description of
11346 <FONT SIZE=-1><B>FIGNORE</B>.
11347
11348 </FONT>
11349 This option is enabled by default.
11350 <DT><B>globstar</B>
11351
11352 <DD>
11353 If set, the pattern <B>**</B> used in a pathname expansion context will
11354 match a files and zero or more directories and subdirectories.
11355 If the pattern is followed by a <B>/</B>, only directories and
11356 subdirectories match.
11357 <DT><B>gnu_errfmt</B>
11358
11359 <DD>
11360 If set, shell error messages are written in the standard GNU error
11361 message format.
11362 <DT><B>histappend</B>
11363
11364 <DD>
11365 If set, the history list is appended to the file named by the value
11366 of the
11367 <FONT SIZE=-1><B>HISTFILE</B>
11368
11369 </FONT>
11370 variable when the shell exits, rather than overwriting the file.
11371 <DT><B>histreedit</B>
11372
11373 <DD>
11374 If set, and
11375 <B>readline</B>
11376
11377 is being used, a user is given the opportunity to re-edit a
11378 failed history substitution.
11379 <DT><B>histverify</B>
11380
11381 <DD>
11382 If set, and 
11383 <B>readline</B>
11384
11385 is being used, the results of history substitution are not immediately
11386 passed to the shell parser.  Instead, the resulting line is loaded into
11387 the <B>readline</B> editing buffer, allowing further modification.
11388 <DT><B>hostcomplete</B>
11389
11390 <DD>
11391 If set, and
11392 <B>readline</B>
11393
11394 is being used, <B>bash</B> will attempt to perform hostname completion when a
11395 word containing a <B>@</B> is being completed (see
11396 <B>Completing</B>
11397
11398 under
11399 <FONT SIZE=-1><B>READLINE</B>
11400
11401 </FONT>
11402 above).
11403 This is enabled by default.
11404 <DT><B>huponexit</B>
11405
11406 <DD>
11407 If set, <B>bash</B> will send
11408 <FONT SIZE=-1><B>SIGHUP</B>
11409
11410 </FONT>
11411 to all jobs when an interactive login shell exits.
11412 <DT><B>interactive_comments</B>
11413
11414 <DD>
11415 If set, allow a word beginning with
11416 <B>#</B>
11417
11418 to cause that word and all remaining characters on that
11419 line to be ignored in an interactive shell (see
11420 <FONT SIZE=-1><B>COMMENTS</B>
11421
11422 </FONT>
11423 above).  This option is enabled by default.
11424 <DT><B>lithist</B>
11425
11426 <DD>
11427 If set, and the
11428 <B>cmdhist</B>
11429
11430 option is enabled, multi-line commands are saved to the history with
11431 embedded newlines rather than using semicolon separators where possible.
11432 <DT><B>login_shell</B>
11433
11434 <DD>
11435 The shell sets this option if it is started as a login shell (see
11436 <FONT SIZE=-1><B>INVOCATION</B>
11437
11438 </FONT>
11439 above).
11440 The value may not be changed.
11441 <DT><B>mailwarn</B>
11442
11443 <DD>
11444 If set, and a file that <B>bash</B> is checking for mail has been  
11445 accessed since the last time it was checked, the message ``The mail in
11446 <I>mailfile</I> has been read'' is displayed.
11447 <DT><B>no_empty_cmd_completion</B>
11448
11449 <DD>
11450 If set, and
11451 <B>readline</B>
11452
11453 is being used,
11454 <B>bash</B>
11455
11456 will not attempt to search the
11457 <FONT SIZE=-1><B>PATH</B>
11458
11459 </FONT>
11460 for possible completions when
11461 completion is attempted on an empty line.
11462 <DT><B>nocaseglob</B>
11463
11464 <DD>
11465 If set,
11466 <B>bash</B>
11467
11468 matches filenames in a case-insensitive fashion when performing pathname
11469 expansion (see
11470 <B>Pathname Expansion</B>
11471
11472 above).
11473 <DT><B>nocasematch</B>
11474
11475 <DD>
11476 If set,
11477 <B>bash</B>
11478
11479 matches patterns in a case-insensitive fashion when performing matching
11480 while executing <B>case</B> or <B>[[</B> conditional commands.
11481 <DT><B>nullglob</B>
11482
11483 <DD>
11484 If set,
11485 <B>bash</B>
11486
11487 allows patterns which match no
11488 files (see
11489 <B>Pathname Expansion</B>
11490
11491 above)
11492 to expand to a null string, rather than themselves.
11493 <DT><B>progcomp</B>
11494
11495 <DD>
11496 If set, the programmable completion facilities (see
11497 <B>Programmable Completion</B> above) are enabled.
11498 This option is enabled by default.
11499 <DT><B>promptvars</B>
11500
11501 <DD>
11502 If set, prompt strings undergo
11503 parameter expansion, command substitution, arithmetic
11504 expansion, and quote removal after being expanded as described in
11505 <FONT SIZE=-1><B>PROMPTING</B>
11506
11507 </FONT>
11508 above.  This option is enabled by default.
11509 <DT><B>restricted_shell</B>
11510
11511 <DD>
11512 The shell sets this option if it is started in restricted mode (see
11513 <FONT SIZE=-1><B>RESTRICTED SHELL</B>
11514
11515 </FONT>
11516 below).
11517 The value may not be changed.
11518 This is not reset when the startup files are executed, allowing
11519 the startup files to discover whether or not a shell is restricted.
11520 <DT><B>shift_verbose</B>
11521
11522 <DD>
11523 If set, the
11524 <B>shift</B>
11525
11526 builtin prints an error message when the shift count exceeds the
11527 number of positional parameters.
11528 <DT><B>sourcepath</B>
11529
11530 <DD>
11531 If set, the
11532 <B>source</B> (<B>.</B>) builtin uses the value of
11533 <FONT SIZE=-1><B>PATH</B>
11534
11535 </FONT>
11536 to find the directory containing the file supplied as an argument.
11537 This option is enabled by default.
11538 <DT><B>xpg_echo</B>
11539
11540 <DD>
11541 If set, the <B>echo</B> builtin expands backslash-escape sequences
11542 by default.
11543 </DL></DL>
11544
11545 <DT><B>suspend</B> [<B>-f</B>]<DD>
11546 Suspend the execution of this shell until it receives a
11547 <FONT SIZE=-1><B>SIGCONT</B>
11548
11549 </FONT>
11550 signal.  A login shell cannot be suspended; the
11551 <B>-f</B>
11552
11553 option can be used to override this and force the suspension.
11554 The return status is 0 unless the shell is a login shell and
11555 <B>-f</B>
11556
11557 is not supplied, or if job control is not enabled.
11558 <DT><B>test</B> <I>expr</I><DD>
11559
11560 <DT><B>[</B> <I>expr</I> <B>]</B><DD>
11561 Return a status of 0 or 1 depending on
11562 the evaluation of the conditional expression
11563 <I>expr</I>.
11564
11565 Each operator and operand must be a separate argument.
11566 Expressions are composed of the primaries described above under
11567 <FONT SIZE=-1><B>CONDITIONAL EXPRESSIONS</B>.
11568
11569 </FONT>
11570 <B>test</B> does not accept any options, nor does it accept and ignore
11571 an argument of <B>--</B> as signifying the end of options.
11572 <P>
11573
11574
11575 Expressions may be combined using the following operators, listed
11576 in decreasing order of precedence.
11577 The evaluation depends on the number of arguments; see below.
11578 <DL COMPACT><DT><DD>
11579
11580 <DL COMPACT>
11581 <DT><B>! </B><I>expr</I>
11582
11583 <DD>
11584 True if
11585 <I>expr</I>
11586
11587 is false.
11588 <DT><B>( </B><I>expr</I> )
11589
11590 <DD>
11591 Returns the value of <I>expr</I>.
11592 This may be used to override the normal precedence of operators.
11593 <DT><I>expr1</I> -<B>a</B> <I>expr2</I><DD>
11594 True if both
11595 <I>expr1</I>
11596
11597 and
11598 <I>expr2</I>
11599
11600 are true.
11601 <DT><I>expr1</I> -<B>o</B> <I>expr2</I><DD>
11602 True if either
11603 <I>expr1</I>
11604
11605 or
11606 <I>expr2</I>
11607
11608 is true.
11609
11610 </DL>
11611 <P>
11612
11613 <B>test</B> and <B>[</B> evaluate conditional
11614 expressions using a set of rules based on the number of arguments.
11615 <P>
11616
11617
11618
11619 <DL COMPACT>
11620 <DT>0 arguments<DD>
11621 The expression is false.
11622 <DT>1 argument<DD>
11623 The expression is true if and only if the argument is not null.
11624 <DT>2 arguments<DD>
11625 If the first argument is <B>!</B>, the expression is true if and
11626 only if the second argument is null.
11627 If the first argument is one of the unary conditional operators listed above
11628 under
11629 <FONT SIZE=-1><B>CONDITIONAL EXPRESSIONS</B>,
11630
11631 </FONT>
11632 the expression is true if the unary test is true.
11633 If the first argument is not a valid unary conditional operator, the expression
11634 is false.
11635 <DT>3 arguments<DD>
11636 If the second argument is one of the binary conditional operators listed above
11637 under
11638 <FONT SIZE=-1><B>CONDITIONAL EXPRESSIONS</B>,
11639
11640 </FONT>
11641 the result of the expression is the result of the binary test using
11642 the first and third arguments as operands.
11643 The <B>-a</B> and <B>-o</B> operators are considered binary operators
11644 when there are three arguments.  
11645 If the first argument is <B>!</B>, the value is the negation of
11646 the two-argument test using the second and third arguments.
11647 If the first argument is exactly <B>(</B> and the third argument is
11648 exactly <B>)</B>, the result is the one-argument test of the second
11649 argument.
11650 Otherwise, the expression is false.
11651 <DT>4 arguments<DD>
11652 If the first argument is <B>!</B>, the result is the negation of
11653 the three-argument expression composed of the remaining arguments.
11654 Otherwise, the expression is parsed and evaluated according to 
11655 precedence using the rules listed above.
11656 <DT>5 or more arguments<DD>
11657 The expression is parsed and evaluated according to precedence
11658 using the rules listed above.
11659 </DL></DL>
11660
11661
11662 <DT><B>times</B>
11663
11664 <DD>
11665 Print the accumulated user and system times for the shell and
11666 for processes run from the shell.  The return status is 0.
11667 <DT><B>trap</B> [<B>-lp</B>] [[<I>arg</I>] <I>sigspec</I> ...]<DD>
11668 The command
11669 <I>arg</I>
11670
11671 is to be read and executed when the shell receives
11672 signal(s)
11673 <I>sigspec</I>.
11674
11675 If
11676 <I>arg</I>
11677
11678 is absent (and there is a single <I>sigspec</I>) or
11679 <B>-</B>,
11680
11681 each specified signal is
11682 reset to its original disposition (the value it had
11683 upon entrance to the shell).
11684 If 
11685 <I>arg</I>
11686
11687 is the null string the signal specified by each
11688 <I>sigspec</I>
11689
11690 is ignored by the shell and by the commands it invokes.
11691 If
11692 <I>arg</I>
11693
11694 is not present and
11695 <B>-p</B>
11696
11697 has been supplied, then the trap commands associated with each
11698 <I>sigspec</I>
11699
11700 are displayed.
11701 If no arguments are supplied or if only
11702 <B>-p</B>
11703
11704 is given,
11705 <B>trap</B>
11706
11707 prints the list of commands associated with each signal.
11708 The
11709 <B>-l</B>
11710
11711 option causes the shell to print a list of signal names and
11712 their corresponding numbers.
11713 Each
11714 <I>sigspec</I>
11715
11716 is either
11717 a signal name defined in &lt;<I>signal.h</I>&gt;, or a signal number.
11718 Signal names are case insensitive and the SIG prefix is optional.
11719 <P>
11720
11721
11722 If a
11723 <I>sigspec</I>
11724
11725 is
11726 <FONT SIZE=-1><B>EXIT</B>
11727
11728 </FONT>
11729 (0) the command
11730 <I>arg</I>
11731
11732 is executed on exit from the shell.
11733 If a
11734 <I>sigspec</I>
11735
11736 is
11737 <FONT SIZE=-1><B>DEBUG</B>,
11738
11739 </FONT>
11740 the command
11741 <I>arg</I>
11742
11743 is executed before every <I>simple command</I>, <I>for</I> command,
11744 <I>case</I> command, <I>select</I> command, every arithmetic <I>for</I>
11745 command, and before the first command executes in a shell function (see
11746 <FONT SIZE=-1><B>SHELL GRAMMAR</B>
11747
11748 </FONT>
11749 above).
11750 Refer to the description of the <B>extdebug</B> option to the
11751 <B>shopt</B> builtin for details of its effect on the <B>DEBUG</B> trap.
11752 If a
11753 <I>sigspec</I>
11754
11755 is
11756 <FONT SIZE=-1><B>RETURN</B>,
11757
11758 </FONT>
11759 the command
11760 <I>arg</I>
11761
11762 is executed each time a shell function or a script executed with the
11763 <B>.</B> or <B>source</B> builtins finishes executing.
11764 <P>
11765
11766
11767 If a
11768 <I>sigspec</I>
11769
11770 is
11771 <FONT SIZE=-1><B>ERR</B>,
11772
11773 </FONT>
11774 the command
11775 <I>arg</I>
11776
11777 is executed whenever a simple command has a non-zero exit status,
11778 subject to the following conditions.
11779 The
11780 <FONT SIZE=-1><B>ERR</B>
11781
11782 </FONT>
11783 trap is not executed if the failed
11784 command is part of the command list immediately following a
11785 <B>while</B>
11786
11787 or
11788 <B>until</B>
11789
11790 keyword, 
11791 part of the test in an
11792 <I>if</I>
11793
11794 statement, part of a command executed in a
11795 <B>&amp;&amp;</B>
11796
11797 or
11798 <B>||</B>
11799
11800 list, or if the command's return value is
11801 being inverted via
11802 <B>!</B>.
11803
11804 These are the same conditions obeyed by the <B>errexit</B> option.
11805 <P>
11806
11807
11808 Signals ignored upon entry to the shell cannot be trapped or reset.
11809 Trapped signals that are not being ignored are reset to their original
11810 values in a subshell or subshell environment when one is created.
11811 The return status is false if any
11812 <I>sigspec</I>
11813
11814 is invalid; otherwise
11815 <B>trap</B>
11816
11817 returns true.
11818 <DT><B>type</B> [<B>-aftpP</B>] <I>name</I> [<I>name</I> ...]<DD>
11819 With no options, 
11820 indicate how each
11821 <I>name</I>
11822
11823 would be interpreted if used as a command name.
11824 If the
11825 <B>-t</B>
11826
11827 option is used,
11828 <B>type</B>
11829
11830 prints a string which is one of
11831 <I>alias</I>,
11832
11833 <I>keyword</I>,
11834
11835 <I>function</I>,
11836
11837 <I>builtin</I>,
11838
11839 or
11840 <I>file </I>
11841
11842 if
11843 <I>name</I>
11844
11845 is an alias, shell reserved word, function, builtin, or disk file,
11846 respectively.
11847 If the
11848 <I>name</I>
11849
11850 is not found, then nothing is printed, and an exit status of false
11851 is returned.
11852 If the
11853 <B>-p</B>
11854
11855 option is used,
11856 <B>type</B>
11857
11858 either returns the name of the disk file
11859 that would be executed if
11860 <I>name</I>
11861
11862 were specified as a command name,
11863 or nothing if
11864 <TT>type -t name</TT>
11865
11866 would not return
11867 <I>file</I>.
11868
11869 The
11870 <B>-P</B>
11871
11872 option forces a
11873 <FONT SIZE=-1><B>PATH</B>
11874
11875 </FONT>
11876 search for each <I>name</I>, even if
11877 <TT>type -t name</TT>
11878
11879 would not return
11880 <I>file</I>.
11881
11882 If a command is hashed,
11883 <B>-p</B>
11884
11885 and
11886 <B>-P</B>
11887
11888 print the hashed value, not necessarily the file that appears
11889 first in 
11890 <FONT SIZE=-1><B>PATH</B>.
11891
11892 </FONT>
11893 If the
11894 <B>-a</B>
11895
11896 option is used, 
11897 <B>type</B>
11898
11899 prints all of the places that contain
11900 an executable named 
11901 <I>name</I>.
11902
11903 This includes aliases and functions,
11904 if and only if the 
11905 <B>-p</B>
11906
11907 option is not also used.
11908 The table of hashed commands is not consulted
11909 when using
11910 <B>-a</B>.
11911
11912 The
11913 <B>-f</B>
11914
11915 option suppresses shell function lookup, as with the <B>command</B> builtin.
11916 <B>type</B>
11917
11918 returns true if all of the arguments are found, false if
11919 any are not found.
11920 <DT><B>ulimit</B> [<B>-HSTabcdefilmnpqrstuvx</B> [<I>limit</I>]]<DD>
11921 Provides control over the resources available to the shell and to
11922 processes started by it, on systems that allow such control.
11923 The <B>-H</B> and <B>-S</B> options specify that the hard or soft limit is
11924 set for the given resource.
11925 A hard limit cannot be increased by a non-root user once it is set;
11926 a soft limit may be increased up to the value of the hard limit.
11927 If neither <B>-H</B> nor <B>-S</B> is specified, both the soft and hard
11928 limits are set.
11929 The value of
11930 <I>limit</I>
11931
11932 can be a number in the unit specified for the resource
11933 or one of the special values
11934 <B>hard</B>,
11935
11936 <B>soft</B>,
11937
11938 or
11939 <B>unlimited</B>,
11940
11941 which stand for the current hard limit, the current soft limit, and
11942 no limit, respectively.
11943 If
11944 <I>limit</I>
11945
11946 is omitted, the current value of the soft limit of the resource is
11947 printed, unless the <B>-H</B> option is given.  When more than one
11948 resource is specified, the limit name and unit are printed before the value.
11949 Other options are interpreted as follows:
11950 <DL COMPACT><DT><DD>
11951
11952 <DL COMPACT>
11953 <DT><B>-a</B>
11954
11955 <DD>
11956 All current limits are reported
11957 <DT><B>-b</B>
11958
11959 <DD>
11960 The maximum socket buffer size
11961 <DT><B>-c</B>
11962
11963 <DD>
11964 The maximum size of core files created
11965 <DT><B>-d</B>
11966
11967 <DD>
11968 The maximum size of a process's data segment
11969 <DT><B>-e</B>
11970
11971 <DD>
11972 The maximum scheduling priority (&quot;nice&quot;)
11973 <DT><B>-f</B>
11974
11975 <DD>
11976 The maximum size of files written by the shell and its children
11977 <DT><B>-i</B>
11978
11979 <DD>
11980 The maximum number of pending signals
11981 <DT><B>-l</B>
11982
11983 <DD>
11984 The maximum size that may be locked into memory
11985 <DT><B>-m</B>
11986
11987 <DD>
11988 The maximum resident set size (many systems do not honor this limit)
11989 <DT><B>-n</B>
11990
11991 <DD>
11992 The maximum number of open file descriptors (most systems do not
11993 allow this value to be set)
11994 <DT><B>-p</B>
11995
11996 <DD>
11997 The pipe size in 512-byte blocks (this may not be set)
11998 <DT><B>-q</B>
11999
12000 <DD>
12001 The maximum number of bytes in POSIX message queues
12002 <DT><B>-r</B>
12003
12004 <DD>
12005 The maximum real-time scheduling priority
12006 <DT><B>-s</B>
12007
12008 <DD>
12009 The maximum stack size
12010 <DT><B>-t</B>
12011
12012 <DD>
12013 The maximum amount of cpu time in seconds
12014 <DT><B>-u</B>
12015
12016 <DD>
12017 The maximum number of processes available to a single user
12018 <DT><B>-v</B>
12019
12020 <DD>
12021 The maximum amount of virtual memory available to the shell
12022 <DT><B>-x</B>
12023
12024 <DD>
12025 The maximum number of file locks
12026 <DT><B>-T</B>
12027
12028 <DD>
12029 The maximum number of threads
12030
12031 </DL>
12032 <P>
12033
12034 If
12035 <I>limit</I>
12036
12037 is given, it is the new value of the specified resource (the
12038 <B>-a</B>
12039
12040 option is display only).
12041 If no option is given, then
12042 <B>-f</B>
12043
12044 is assumed.  Values are in 1024-byte increments, except for
12045 <B>-t</B>,
12046
12047 which is in seconds,
12048 <B>-p</B>,
12049
12050 which is in units of 512-byte blocks,
12051 and
12052 <B>-T</B>,
12053
12054 <B>-b</B>,
12055
12056 <B>-n</B>,
12057
12058 and
12059 <B>-u</B>,
12060
12061 which are unscaled values.
12062 The return status is 0 unless an invalid option or argument is supplied,
12063 or an error occurs while setting a new limit.
12064 </DL>
12065
12066 <DT><B>umask</B> [<B>-p</B>] [<B>-S</B>] [<I>mode</I>]<DD>
12067 The user file-creation mask is set to 
12068 <I>mode</I>.
12069
12070 If
12071 <I>mode</I>
12072
12073 begins with a digit, it
12074 is interpreted as an octal number; otherwise
12075 it is interpreted as a symbolic mode mask similar
12076 to that accepted by
12077 <I>chmod</I>(1).
12078
12079 If
12080 <I>mode</I>
12081
12082 is omitted, the current value of the mask is printed.
12083 The
12084 <B>-S</B>
12085
12086 option causes the mask to be printed in symbolic form; the
12087 default output is an octal number.
12088 If the
12089 <B>-p</B>
12090
12091 option is supplied, and
12092 <I>mode</I>
12093
12094 is omitted, the output is in a form that may be reused as input.
12095 The return status is 0 if the mode was successfully changed or if
12096 no <I>mode</I> argument was supplied, and false otherwise.
12097 <DT><B>unalias</B> [-<B>a</B>] [<I>name</I> ...]<DD>
12098 Remove each <I>name</I> from the list of defined aliases.  If
12099 <B>-a</B>
12100
12101 is supplied, all alias definitions are removed.  The return
12102 value is true unless a supplied
12103 <I>name</I>
12104
12105 is not a defined alias.
12106 <DT><B>unset</B> [-<B>fv</B>] [<I>name</I> ...]<DD>
12107 For each
12108 <I>name</I>,
12109
12110 remove the corresponding variable or function.
12111 If no options are supplied, or the
12112 <B>-v</B>
12113
12114 option is given, each
12115 <I>name</I>
12116
12117 refers to a shell variable.
12118 Read-only variables may not be unset.
12119 If
12120 <B>-f</B>
12121
12122 is specified, each
12123 <I>name</I>
12124
12125 refers to a shell function, and the function definition
12126 is removed.
12127 Each unset variable or function is removed from the environment
12128 passed to subsequent commands.
12129 If any of
12130 <FONT SIZE=-1><B>COMP_WORDBREAKS</B>,
12131
12132 </FONT>
12133 <FONT SIZE=-1><B>RANDOM</B>,
12134
12135 </FONT>
12136 <FONT SIZE=-1><B>SECONDS</B>,
12137
12138 </FONT>
12139 <FONT SIZE=-1><B>LINENO</B>,
12140
12141 </FONT>
12142 <FONT SIZE=-1><B>HISTCMD</B>,
12143
12144 </FONT>
12145 <FONT SIZE=-1><B>FUNCNAME</B>,
12146
12147 </FONT>
12148 <FONT SIZE=-1><B>GROUPS</B>,
12149
12150 </FONT>
12151 or
12152 <FONT SIZE=-1><B>DIRSTACK</B>
12153
12154 </FONT>
12155 are unset, they lose their special properties, even if they are
12156 subsequently reset.  The exit status is true unless a
12157 <I>name</I>
12158
12159 is readonly.
12160 <DT><B>wait</B> [<I>n ...</I>]<DD>
12161 Wait for each specified process and return its termination status.
12162 Each
12163 <I>n</I>
12164
12165 may be a process
12166 ID or a job specification; if a job spec is given, all processes
12167 in that job's pipeline are waited for.  If
12168 <I>n</I>
12169
12170 is not given, all currently active child processes
12171 are waited for, and the return status is zero.  If
12172 <I>n</I>
12173
12174 specifies a non-existent process or job, the return status is
12175 127.  Otherwise, the return status is the exit status of the last
12176 process or job waited for.
12177
12178
12179 </DL>
12180 <A NAME="lbDC">&nbsp;</A>
12181 <H3>RESTRICTED SHELL</H3>
12182
12183
12184
12185 <P>
12186
12187 If
12188 <B>bash</B>
12189
12190 is started with the name
12191 <B>rbash</B>,
12192
12193 or the
12194 <B>-r</B>
12195
12196 option is supplied at invocation,
12197 the shell becomes restricted.
12198 A restricted shell is used to
12199 set up an environment more controlled than the standard shell.
12200 It behaves identically to
12201 <B>bash</B>
12202
12203 with the exception that the following are disallowed or not performed:
12204 <DL COMPACT>
12205 <DT>*<DD>
12206 changing directories with <B>cd</B>
12207 <DT>*<DD>
12208 setting or unsetting the values of
12209 <FONT SIZE=-1><B>SHELL</B>,
12210
12211 </FONT>
12212 <FONT SIZE=-1><B>PATH</B>,
12213
12214 </FONT>
12215 <FONT SIZE=-1><B>ENV</B>,
12216
12217 </FONT>
12218 or
12219 <FONT SIZE=-1><B>BASH_ENV</B>
12220
12221 </FONT>
12222 <DT>*<DD>
12223 specifying command names containing
12224 <B>/</B>
12225
12226 <DT>*<DD>
12227 specifying a file name containing a
12228 <B>/</B>
12229
12230 as an argument to the
12231 <B>.</B>
12232
12233 builtin command
12234 <DT>*<DD>
12235 Specifying a filename containing a slash as an argument to the
12236 <B>-p</B>
12237
12238 option to the
12239 <B>hash</B>
12240
12241 builtin command
12242 <DT>*<DD>
12243 importing function definitions from the shell environment at startup
12244 <DT>*<DD>
12245 parsing the value of
12246 <FONT SIZE=-1><B>SHELLOPTS</B>
12247
12248 </FONT>
12249 from the shell environment at startup
12250 <DT>*<DD>
12251 redirecting output using the &gt;, &gt;|, &lt;&gt;, &gt;&amp;, &amp;&gt;, and &gt;&gt; redirection operators
12252 <DT>*<DD>
12253 using the
12254 <B>exec</B>
12255
12256 builtin command to replace the shell with another command
12257 <DT>*<DD>
12258 adding or deleting builtin commands with the
12259 <B>-f</B>
12260
12261 and
12262 <B>-d</B>
12263
12264 options to the
12265 <B>enable</B>
12266
12267 builtin command
12268 <DT>*<DD>
12269 Using the <B>enable</B> builtin command to enable disabled shell builtins
12270 <DT>*<DD>
12271 specifying the
12272 <B>-p</B>
12273
12274 option to the
12275 <B>command</B>
12276
12277 builtin command
12278 <DT>*<DD>
12279 turning off restricted mode with
12280 <B>set +r</B> or <B>set +o restricted</B>.
12281 </DL>
12282 <P>
12283
12284 These restrictions are enforced after any startup files are read.
12285 <P>
12286
12287
12288  When a command that is found to be a shell script is executed
12289 (see
12290 <FONT SIZE=-1><B>COMMAND EXECUTION</B>
12291
12292 </FONT>
12293
12294 above),
12295
12296 <B>rbash</B>
12297
12298 turns off any restrictions in the shell spawned to execute the
12299 script.
12300
12301
12302 <A NAME="lbDD">&nbsp;</A>
12303 <H3>SEE ALSO</H3>
12304
12305
12306 <DL COMPACT>
12307 <DT><I>Bash Reference Manual</I>, Brian Fox and Chet Ramey<DD>
12308 <DT><I>The Gnu Readline Library</I>, Brian Fox and Chet Ramey<DD>
12309 <DT><I>The Gnu History Library</I>, Brian Fox and Chet Ramey<DD>
12310 <DT><I>Portable Operating System Interface (POSIX) Part 2: Shell and Utilities</I>, IEEE<DD>
12311 <DT><I>sh</I>(1), <I>ksh</I>(1), <I>csh</I>(1)<DD>
12312 <DT><I>emacs</I>(1), <I>vi</I>(1)<DD>
12313 <DT><I>readline</I>(3)<DD>
12314
12315 </DL>
12316 <A NAME="lbDE">&nbsp;</A>
12317 <H3>FILES</H3>
12318
12319
12320 <DL COMPACT>
12321 <DT>
12322 <A HREF="file:/bin/bash"><I>/bin/bash</I></A>
12323
12324 <DD>
12325 The <B>bash</B> executable
12326 <DT>
12327 <A HREF="file:/etc/profile"><I>/etc/profile</I></A>
12328
12329 <DD>
12330 The systemwide initialization file, executed for login shells
12331 <DT>
12332 <A HREF="file:~/.bash_profile"><I>~/.bash_profile</I></A>
12333
12334 <DD>
12335 The personal initialization file, executed for login shells
12336 <DT>
12337 <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>
12338
12339 <DD>
12340 The individual per-interactive-shell startup file
12341 <DT>
12342 <A HREF="file:~/.bash_logout"><I>~/.bash_logout</I></A>
12343
12344 <DD>
12345 The individual login shell cleanup file, executed when a login shell exits
12346 <DT>
12347 <A HREF="file:~/.inputrc"><I>~/.inputrc</I></A>
12348
12349 <DD>
12350 Individual <I>readline</I> initialization file
12351
12352 </DL>
12353 <A NAME="lbDF">&nbsp;</A>
12354 <H3>AUTHORS</H3>
12355
12356 Brian Fox, Free Software Foundation
12357 <BR>
12358
12359 <A HREF="mailto:bfox@gnu.org">bfox@gnu.org</A>
12360 <P>
12361
12362 Chet Ramey, Case Western Reserve University
12363 <BR>
12364
12365 <A HREF="mailto:chet.ramey@case.edu">chet.ramey@case.edu</A>
12366 <A NAME="lbDG">&nbsp;</A>
12367 <H3>BUG REPORTS</H3>
12368
12369 If you find a bug in
12370 <B>bash,</B>
12371
12372 you should report it.  But first, you should
12373 make sure that it really is a bug, and that it appears in the latest
12374 version of
12375 <B>bash</B>.
12376
12377 The latest version is always available from
12378 <I><A HREF="ftp://ftp.gnu.org/pub/bash/">ftp://ftp.gnu.org/pub/bash/</A></I>.
12379 <P>
12380
12381 Once you have determined that a bug actually exists, use the
12382 <I>bashbug</I>
12383
12384 command to submit a bug report.
12385 If you have a fix, you are encouraged to mail that as well!
12386 Suggestions and `philosophical' bug reports may be mailed
12387 to <I><A HREF="mailto:bug-bash@gnu.org">bug-bash@gnu.org</A></I> or posted to the Usenet
12388 newsgroup
12389 <A HREF="news:gnu.bash.bug">gnu.bash.bug</A>.
12390
12391 <P>
12392
12393 ALL bug reports should include:
12394 <P>
12395
12396
12397 <DL COMPACT>
12398 <DT>The version number of <B>bash</B><DD>
12399 <DT>The hardware and operating system<DD>
12400 <DT>The compiler used to compile<DD>
12401 <DT>A description of the bug behaviour<DD>
12402 <DT>A short script or `recipe' which exercises the bug<DD>
12403
12404 </DL>
12405 <P>
12406
12407 <I>bashbug</I>
12408
12409 inserts the first three items automatically into the template
12410 it provides for filing a bug report.
12411 <P>
12412
12413 Comments and bug reports concerning
12414 this manual page should be directed to
12415 <I><A HREF="mailto:chet@po.cwru.edu">chet@po.cwru.edu</A></I>.
12416
12417 <A NAME="lbDH">&nbsp;</A>
12418 <H3>BUGS</H3>
12419
12420 <P>
12421
12422 It's too big and too slow.
12423 <P>
12424
12425 There are some subtle differences between 
12426 <B>bash</B>
12427
12428 and traditional versions of
12429 <B>sh</B>,
12430
12431 mostly because of the
12432 <FONT SIZE=-1><B>POSIX</B>
12433
12434 </FONT>
12435 specification.
12436 <P>
12437
12438 Aliases are confusing in some uses.
12439 <P>
12440
12441 Shell builtin commands and functions are not stoppable/restartable.
12442 <P>
12443
12444 Compound commands and command sequences of the form `a ; b ; c'
12445 are not handled gracefully when process suspension is attempted.
12446 When a process is stopped, the shell immediately executes the next
12447 command in the sequence.
12448 It suffices to place the sequence of commands between
12449 parentheses to force it into a subshell, which may be stopped as
12450 a unit.
12451 <P>
12452
12453 Array variables may not (yet) be exported.
12454 <P>
12455
12456 There may be only one active coprocess at a time.
12457
12458
12459
12460 <HR>
12461 <TABLE WIDTH=100%>
12462 <TR>
12463 <TH ALIGN=LEFT width=33%>GNU Bash-4.1<TH ALIGN=CENTER width=33%>2009 December 29<TH ALIGN=RIGHT width=33%>BASH(1)
12464 </TR>
12465 </TABLE>
12466 <HR>
12467 <A NAME="index">&nbsp;</A><H2>Index</H2>
12468 <DL>
12469 <DT><A HREF="#lbAB">NAME</A><DD>
12470 <DT><A HREF="#lbAC">SYNOPSIS</A><DD>
12471 <DT><A HREF="#lbAD">COPYRIGHT</A><DD>
12472 <DT><A HREF="#lbAE">DESCRIPTION</A><DD>
12473 <DT><A HREF="#lbAF">OPTIONS</A><DD>
12474 <DT><A HREF="#lbAG">ARGUMENTS</A><DD>
12475 <DT><A HREF="#lbAH">INVOCATION</A><DD>
12476 <DT><A HREF="#lbAI">DEFINITIONS</A><DD>
12477 <DT><A HREF="#lbAJ">RESERVED WORDS</A><DD>
12478 <DT><A HREF="#lbAK">SHELL GRAMMAR</A><DD>
12479 <DL>
12480 <DT><A HREF="#lbAL">Simple Commands</A><DD>
12481 <DT><A HREF="#lbAM">Pipelines</A><DD>
12482 <DT><A HREF="#lbAN">Lists</A><DD>
12483 <DT><A HREF="#lbAO">Compound Commands</A><DD>
12484 <DT><A HREF="#lbAP">Coprocesses</A><DD>
12485 <DT><A HREF="#lbAQ">Shell Function Definitions</A><DD>
12486 </DL>
12487 <DT><A HREF="#lbAR">COMMENTS</A><DD>
12488 <DT><A HREF="#lbAS">QUOTING</A><DD>
12489 <DT><A HREF="#lbAT">PARAMETERS</A><DD>
12490 <DL>
12491 <DT><A HREF="#lbAU">Positional Parameters</A><DD>
12492 <DT><A HREF="#lbAV">Special Parameters</A><DD>
12493 <DT><A HREF="#lbAW">Shell Variables</A><DD>
12494 <DT><A HREF="#lbAX">Arrays</A><DD>
12495 </DL>
12496 <DT><A HREF="#lbAY">EXPANSION</A><DD>
12497 <DL>
12498 <DT><A HREF="#lbAZ">Brace Expansion</A><DD>
12499 <DT><A HREF="#lbBA">Tilde Expansion</A><DD>
12500 <DT><A HREF="#lbBB">Parameter Expansion</A><DD>
12501 <DT><A HREF="#lbBC">Command Substitution</A><DD>
12502 <DT><A HREF="#lbBD">Arithmetic Expansion</A><DD>
12503 <DT><A HREF="#lbBE">Process Substitution</A><DD>
12504 <DT><A HREF="#lbBF">Word Splitting</A><DD>
12505 <DT><A HREF="#lbBG">Pathname Expansion</A><DD>
12506 <DT><A HREF="#lbBH">Quote Removal</A><DD>
12507 </DL>
12508 <DT><A HREF="#lbBI">REDIRECTION</A><DD>
12509 <DL>
12510 <DT><A HREF="#lbBJ">Redirecting Input</A><DD>
12511 <DT><A HREF="#lbBK">Redirecting Output</A><DD>
12512 <DT><A HREF="#lbBL">Appending Redirected Output</A><DD>
12513 <DT><A HREF="#lbBM">Redirecting Standard Output and Standard Error</A><DD>
12514 <DT><A HREF="#lbBN">Appending Standard Output and Standard Error</A><DD>
12515 <DT><A HREF="#lbBO">Here Documents</A><DD>
12516 <DT><A HREF="#lbBP">Here Strings</A><DD>
12517 <DT><A HREF="#lbBQ">Duplicating File Descriptors</A><DD>
12518 <DT><A HREF="#lbBR">Moving File Descriptors</A><DD>
12519 <DT><A HREF="#lbBS">Opening File Descriptors for Reading and Writing</A><DD>
12520 </DL>
12521 <DT><A HREF="#lbBT">ALIASES</A><DD>
12522 <DT><A HREF="#lbBU">FUNCTIONS</A><DD>
12523 <DT><A HREF="#lbBV">ARITHMETIC EVALUATION</A><DD>
12524 <DT><A HREF="#lbBW">CONDITIONAL EXPRESSIONS</A><DD>
12525 <DT><A HREF="#lbBX">SIMPLE COMMAND EXPANSION</A><DD>
12526 <DT><A HREF="#lbBY">COMMAND EXECUTION</A><DD>
12527 <DT><A HREF="#lbBZ">COMMAND EXECUTION ENVIRONMENT</A><DD>
12528 <DT><A HREF="#lbCA">ENVIRONMENT</A><DD>
12529 <DT><A HREF="#lbCB">EXIT STATUS</A><DD>
12530 <DT><A HREF="#lbCC">SIGNALS</A><DD>
12531 <DT><A HREF="#lbCD">JOB CONTROL</A><DD>
12532 <DT><A HREF="#lbCE">PROMPTING</A><DD>
12533 <DT><A HREF="#lbCF">READLINE</A><DD>
12534 <DL>
12535 <DT><A HREF="#lbCG">Readline Notation</A><DD>
12536 <DT><A HREF="#lbCH">Readline Initialization</A><DD>
12537 <DT><A HREF="#lbCI">Readline Key Bindings</A><DD>
12538 <DT><A HREF="#lbCJ">Readline Variables</A><DD>
12539 <DT><A HREF="#lbCK">Readline Conditional Constructs</A><DD>
12540 <DT><A HREF="#lbCL">Searching</A><DD>
12541 <DT><A HREF="#lbCM">Readline Command Names</A><DD>
12542 <DT><A HREF="#lbCN">Commands for Moving</A><DD>
12543 <DT><A HREF="#lbCO">Commands for Manipulating the History</A><DD>
12544 <DT><A HREF="#lbCP">Commands for Changing Text</A><DD>
12545 <DT><A HREF="#lbCQ">Killing and Yanking</A><DD>
12546 <DT><A HREF="#lbCR">Numeric Arguments</A><DD>
12547 <DT><A HREF="#lbCS">Completing</A><DD>
12548 <DT><A HREF="#lbCT">Keyboard Macros</A><DD>
12549 <DT><A HREF="#lbCU">Miscellaneous</A><DD>
12550 <DT><A HREF="#lbCV">Programmable Completion</A><DD>
12551 </DL>
12552 <DT><A HREF="#lbCW">HISTORY</A><DD>
12553 <DT><A HREF="#lbCX">HISTORY EXPANSION</A><DD>
12554 <DL>
12555 <DT><A HREF="#lbCY">Event Designators</A><DD>
12556 <DT><A HREF="#lbCZ">Word Designators</A><DD>
12557 <DT><A HREF="#lbDA">Modifiers</A><DD>
12558 </DL>
12559 <DT><A HREF="#lbDB">SHELL BUILTIN COMMANDS</A><DD>
12560 <DT><A HREF="#lbDC">RESTRICTED SHELL</A><DD>
12561 <DT><A HREF="#lbDD">SEE ALSO</A><DD>
12562 <DT><A HREF="#lbDE">FILES</A><DD>
12563 <DT><A HREF="#lbDF">AUTHORS</A><DD>
12564 <DT><A HREF="#lbDG">BUG REPORTS</A><DD>
12565 <DT><A HREF="#lbDH">BUGS</A><DD>
12566 </DL>
12567 <HR>
12568 This document was created by man2html from bash.1.<BR>
12569 Time: 30 December 2009 13:07:38 EST
12570 </BODY>
12571 </HTML>