]> git.ipfire.org Git - thirdparty/bash.git/blob - doc/bash.html
commit bash-20100115 snapshot
[thirdparty/bash.git] / doc / bash.html
1 <HTML><HEAD>
2 <TITLE>BASH(1) Manual Page</TITLE>
3 </HEAD>
4 <BODY><TABLE WIDTH=100%>
5 <TR>
6 <TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2010 January 15<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 A
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>COPROC</B>
1999
2000 <DD>
2001 An array variable (see <B>Arrays</B> below) created to hold the file descriptors
2002 for output from and input to an unnamed coprocess (see <B>Coprocesses</B>
2003 above).
2004 <DT><B>DIRSTACK</B>
2005
2006 <DD>
2007 An array variable (see
2008 <B>Arrays</B>
2009
2010 below) containing the current contents of the directory stack.
2011 Directories appear in the stack in the order they are displayed by the
2012 <B>dirs</B>
2013
2014 builtin.
2015 Assigning to members of this array variable may be used to modify
2016 directories already in the stack, but the
2017 <B>pushd</B>
2018
2019 and
2020 <B>popd</B>
2021
2022 builtins must be used to add and remove directories.
2023 Assignment to this variable will not change the current directory.
2024 If
2025 <FONT SIZE=-1><B>DIRSTACK</B>
2026
2027 </FONT>
2028 is unset, it loses its special properties, even if it is
2029 subsequently reset.
2030 <DT><B>EUID</B>
2031
2032 <DD>
2033 Expands to the effective user ID of the current user, initialized at
2034 shell startup. This variable is readonly.
2035 <DT><B>FUNCNAME</B>
2036
2037 <DD>
2038 An array variable containing the names of all shell functions
2039 currently in the execution call stack.
2040 The element with index 0 is the name of any currently-executing
2041 shell function.
2042 The bottom-most element is
2043 <TT>&quot;main&quot;</TT>.
2044
2045 This variable exists only when a shell function is executing.
2046 Assignments to
2047 <FONT SIZE=-1><B>FUNCNAME</B>
2048
2049 </FONT>
2050 have no effect and return an error status.
2051 If
2052 <FONT SIZE=-1><B>FUNCNAME</B>
2053
2054 </FONT>
2055 is unset, it loses its special properties, even if it is
2056 subsequently reset.
2057 <DT><B>GROUPS</B>
2058
2059 <DD>
2060 An array variable containing the list of groups of which the current
2061 user is a member.
2062 Assignments to
2063 <FONT SIZE=-1><B>GROUPS</B>
2064
2065 </FONT>
2066 have no effect and return an error status.
2067 If
2068 <FONT SIZE=-1><B>GROUPS</B>
2069
2070 </FONT>
2071 is unset, it loses its special properties, even if it is
2072 subsequently reset.
2073 <DT><B>HISTCMD</B>
2074
2075 <DD>
2076 The history number, or index in the history list, of the current
2077 command.
2078 If
2079 <FONT SIZE=-1><B>HISTCMD</B>
2080
2081 </FONT>
2082 is unset, it loses its special properties, even if it is
2083 subsequently reset.
2084 <DT><B>HOSTNAME</B>
2085
2086 <DD>
2087 Automatically set to the name of the current host.
2088 <DT><B>HOSTTYPE</B>
2089
2090 <DD>
2091 Automatically set to a string that uniquely
2092 describes the type of machine on which
2093 <B>bash</B>
2094
2095 is executing.
2096 The default is system-dependent.
2097 <DT><B>LINENO</B>
2098
2099 <DD>
2100 Each time this parameter is referenced, the shell substitutes
2101 a decimal number representing the current sequential line number
2102 (starting with 1) within a script or function. When not in a
2103 script or function, the value substituted is not guaranteed to
2104 be meaningful.
2105 If
2106 <FONT SIZE=-1><B>LINENO</B>
2107
2108 </FONT>
2109 is unset, it loses its special properties, even if it is
2110 subsequently reset.
2111 <DT><B>MACHTYPE</B>
2112
2113 <DD>
2114 Automatically set to a string that fully describes the system
2115 type on which
2116 <B>bash</B>
2117
2118 is executing, in the standard GNU <I>cpu-company-system</I> format.
2119 The default is system-dependent.
2120 <DT><B>MAPFILE</B>
2121
2122 <DD>
2123 An array variable (see <B>Arrays</B> below) created to hold the text
2124 read by the <B>mapfile</B> builtin when no variable name is supplied.
2125 <DT><B>OLDPWD</B>
2126
2127 <DD>
2128 The previous working directory as set by the
2129 <B>cd</B>
2130
2131 command.
2132 <DT><B>OPTARG</B>
2133
2134 <DD>
2135 The value of the last option argument 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>OPTIND</B>
2144
2145 <DD>
2146 The index of the next argument to be processed by the
2147 <B>getopts</B>
2148
2149 builtin command (see
2150 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
2151
2152 </FONT>
2153 below).
2154 <DT><B>OSTYPE</B>
2155
2156 <DD>
2157 Automatically set to a string that
2158 describes the operating system on which
2159 <B>bash</B>
2160
2161 is executing.
2162 The default is system-dependent.
2163 <DT><B>PIPESTATUS</B>
2164
2165 <DD>
2166 An array variable (see
2167 <B>Arrays</B>
2168
2169 below) containing a list of exit status values from the processes
2170 in the most-recently-executed foreground pipeline (which may
2171 contain only a single command).
2172 <DT><B>PPID</B>
2173
2174 <DD>
2175 The process ID of the shell's parent. This variable is readonly.
2176 <DT><B>PWD</B>
2177
2178 <DD>
2179 The current working directory as set by the
2180 <B>cd</B>
2181
2182 command.
2183 <DT><B>RANDOM</B>
2184
2185 <DD>
2186 Each time this parameter is referenced, a random integer between
2187 0 and 32767 is
2188 generated. The sequence of random numbers may be initialized by assigning
2189 a value to
2190 <FONT SIZE=-1><B>RANDOM</B>.
2191
2192 </FONT>
2193 If
2194 <FONT SIZE=-1><B>RANDOM</B>
2195
2196 </FONT>
2197 is unset, it loses its special properties, even if it is
2198 subsequently reset.
2199 <DT><B>READLINE_LINE</B>
2200
2201 <DD>
2202 The contents of the
2203 <B>readline</B>
2204
2205 line buffer, for use with
2206 <TT>bind -x</TT>
2207
2208 (see
2209 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
2210
2211 </FONT>
2212 below).
2213 <DT><B>READLINE_POINT</B>
2214
2215 <DD>
2216 The position of the insertion point in the
2217 <B>readline</B>
2218
2219 line buffer, for use with
2220 <TT>bind -x</TT>
2221
2222 (see
2223 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
2224
2225 </FONT>
2226 below).
2227 <DT><B>REPLY</B>
2228
2229 <DD>
2230 Set to the line of input read by the
2231 <B>read</B>
2232
2233 builtin command when no arguments are supplied.
2234 <DT><B>SECONDS</B>
2235
2236 <DD>
2237 Each time this parameter is
2238 referenced, the number of seconds since shell invocation is returned. If a
2239 value is assigned to
2240 <FONT SIZE=-1><B>SECONDS</B>,
2241
2242 </FONT>
2243 the value returned upon subsequent
2244 references is
2245 the number of seconds since the assignment plus the value assigned.
2246 If
2247 <FONT SIZE=-1><B>SECONDS</B>
2248
2249 </FONT>
2250 is unset, it loses its special properties, even if it is
2251 subsequently reset.
2252 <DT><B>SHELLOPTS</B>
2253
2254 <DD>
2255 A colon-separated list of enabled shell options. Each word in
2256 the list is a valid argument for the
2257 <B>-o</B>
2258
2259 option to the
2260 <B>set</B>
2261
2262 builtin command (see
2263 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
2264
2265 </FONT>
2266 below). The options appearing in
2267 <FONT SIZE=-1><B>SHELLOPTS</B>
2268
2269 </FONT>
2270 are those reported as
2271 <I>on</I>
2272
2273 by <B>set -o</B>.
2274 If this variable is in the environment when
2275 <B>bash</B>
2276
2277 starts up, each shell option in the list will be enabled before
2278 reading any startup files.
2279 This variable is read-only.
2280 <DT><B>SHLVL</B>
2281
2282 <DD>
2283 Incremented by one each time an instance of
2284 <B>bash</B>
2285
2286 is started.
2287 <DT><B>UID</B>
2288
2289 <DD>
2290 Expands to the user ID of the current user, initialized at shell startup.
2291 This variable is readonly.
2292
2293 </DL>
2294 <P>
2295
2296 The following variables are used by the shell. In some cases,
2297 <B>bash</B>
2298
2299 assigns a default value to a variable; these cases are noted
2300 below.
2301 <P>
2302
2303
2304 <DL COMPACT>
2305 <DT><B>BASH_ENV</B>
2306
2307 <DD>
2308 If this parameter is set when <B>bash</B> is executing a shell script,
2309 its value is interpreted as a filename containing commands to
2310 initialize the shell, as in
2311 <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>.
2312
2313 The value of
2314 <FONT SIZE=-1><B>BASH_ENV</B>
2315
2316 </FONT>
2317 is subjected to parameter expansion, command substitution, and arithmetic
2318 expansion before being interpreted as a file name.
2319 <FONT SIZE=-1><B>PATH</B>
2320
2321 </FONT>
2322 is not used to search for the resultant file name.
2323 <DT><B>BASH_XTRACEFD</B>
2324
2325 <DD>
2326 If set to an integer corresponding to a valid file descriptor, <B>bash</B>
2327 will write the trace output generated when
2328 <TT>set -x</TT>
2329
2330 is enabled to that file descriptor.
2331 The file descriptor is closed when
2332 <FONT SIZE=-1><B>BASH_XTRACEFD</B>
2333
2334 </FONT>
2335 is unset or assigned a new value.
2336 Unsetting
2337 <FONT SIZE=-1><B>BASH_XTRACEFD</B>
2338
2339 </FONT>
2340 or assigning it the empty string causes the
2341 trace output to be sent to the standard error.
2342 Note that setting
2343 <FONT SIZE=-1><B>BASH_XTRACEFD</B>
2344
2345 </FONT>
2346 to 2 (the standard error file
2347 descriptor) and then unsetting it will result in the standard error
2348 being closed.
2349 <DT><B>CDPATH</B>
2350
2351 <DD>
2352 The search path for the
2353 <B>cd</B>
2354
2355 command.
2356 This is a colon-separated list of directories in which the shell looks
2357 for destination directories specified by the
2358 <B>cd</B>
2359
2360 command.
2361 A sample value is
2362 <TT>&quot;.:~:/usr&quot;</TT>.
2363
2364 <DT><B>COLUMNS</B>
2365
2366 <DD>
2367 Used by the <B>select</B> builtin command to determine the terminal width
2368 when printing selection lists. Automatically set upon receipt of a
2369 <FONT SIZE=-1><B>SIGWINCH</B>.
2370
2371 </FONT>
2372 <DT><B>COMPREPLY</B>
2373
2374 <DD>
2375 An array variable from which <B>bash</B> reads the possible completions
2376 generated by a shell function invoked by the programmable completion
2377 facility (see <B>Programmable Completion</B> below).
2378 <DT><B>EMACS</B>
2379
2380 <DD>
2381 If <B>bash</B> finds this variable in the environment when the shell starts
2382 with value
2383 <TT>t</TT>,
2384
2385 it assumes that the shell is running in an emacs shell buffer and disables
2386 line editing.
2387 <DT><B>ENV</B>
2388
2389 <DD>
2390 Similar to
2391 <FONT SIZE=-1><B>BASH_ENV</B>;
2392
2393 </FONT>
2394 used when the shell is invoked in POSIX mode.
2395 <DT><B>FCEDIT</B>
2396
2397 <DD>
2398 The default editor for the
2399 <B>fc</B>
2400
2401 builtin command.
2402 <DT><B>FIGNORE</B>
2403
2404 <DD>
2405 A colon-separated list of suffixes to ignore when performing
2406 filename completion (see
2407 <FONT SIZE=-1><B>READLINE</B>
2408
2409 </FONT>
2410 below).
2411 A filename whose suffix matches one of the entries in
2412 <FONT SIZE=-1><B>FIGNORE</B>
2413
2414 </FONT>
2415 is excluded from the list of matched filenames.
2416 A sample value is
2417 <TT>&quot;.o:~&quot;</TT>.
2418
2419 <DT><B>GLOBIGNORE</B>
2420
2421 <DD>
2422 A colon-separated list of patterns defining the set of filenames to
2423 be ignored by pathname expansion.
2424 If a filename matched by a pathname expansion pattern also matches one
2425 of the patterns in
2426 <FONT SIZE=-1><B>GLOBIGNORE</B>,
2427
2428 </FONT>
2429 it is removed from the list of matches.
2430 <DT><B>HISTCONTROL</B>
2431
2432 <DD>
2433 A colon-separated list of values controlling how commands are saved on
2434 the history list.
2435 If the list of values includes
2436 <I>ignorespace</I>,
2437
2438 lines which begin with a
2439 <B>space</B>
2440
2441 character are not saved in the history list.
2442 A value of
2443 <I>ignoredups</I>
2444
2445 causes lines matching the previous history entry to not be saved.
2446 A value of
2447 <I>ignoreboth</I>
2448
2449 is shorthand for <I>ignorespace</I> and <I>ignoredups</I>.
2450 A value of
2451 <I>erasedups</I>
2452
2453 causes all previous lines matching the current line to be removed from
2454 the history list before that line is saved.
2455 Any value not in the above list is ignored.
2456 If
2457 <FONT SIZE=-1><B>HISTCONTROL</B>
2458
2459 </FONT>
2460 is unset, or does not include a valid value,
2461 all lines read by the shell parser are saved on the history list,
2462 subject to the value of
2463 <FONT SIZE=-1><B>HISTIGNORE</B>.
2464
2465 </FONT>
2466 The second and subsequent lines of a multi-line compound command are
2467 not tested, and are added to the history regardless of the value of
2468 <FONT SIZE=-1><B>HISTCONTROL</B>.
2469
2470 </FONT>
2471 <DT><B>HISTFILE</B>
2472
2473 <DD>
2474 The name of the file in which command history is saved (see
2475 <FONT SIZE=-1><B>HISTORY</B>
2476
2477 </FONT>
2478 below). The default value is <A HREF="file:~/.bash_history"><I>~/.bash_history</I></A>. If unset, the
2479 command history is not saved when an interactive shell exits.
2480 <DT><B>HISTFILESIZE</B>
2481
2482 <DD>
2483 The maximum number of lines contained in the history file. When this
2484 variable is assigned a value, the history file is truncated, if
2485 necessary, by removing the oldest entries,
2486 to contain no more than that number of lines. The default
2487 value is 500. The history file is also truncated to this size after
2488 writing it when an interactive shell exits.
2489 <DT><B>HISTIGNORE</B>
2490
2491 <DD>
2492 A colon-separated list of patterns used to decide which command lines
2493 should be saved on the history list. Each pattern is anchored at the
2494 beginning of the line and must match the complete line (no implicit
2495 `<B>*</B>' is appended). Each pattern is tested against the line
2496 after the checks specified by
2497 <FONT SIZE=-1><B>HISTCONTROL</B>
2498
2499 </FONT>
2500 are applied.
2501 In addition to the normal shell pattern matching characters, `<B>&amp;</B>'
2502 matches the previous history line. `<B>&amp;</B>' may be escaped using a
2503 backslash; the backslash is removed before attempting a match.
2504 The second and subsequent lines of a multi-line compound command are
2505 not tested, and are added to the history regardless of the value of
2506 <FONT SIZE=-1><B>HISTIGNORE</B>.
2507
2508 </FONT>
2509 <DT><B>HISTSIZE</B>
2510
2511 <DD>
2512 The number of commands to remember in the command history (see
2513 <FONT SIZE=-1><B>HISTORY</B>
2514
2515 </FONT>
2516 below). The default value is 500.
2517 <DT><B>HISTTIMEFORMAT</B>
2518
2519 <DD>
2520 If this variable is set and not null, its value is used as a format string
2521 for <I>strftime</I>(3) to print the time stamp associated with each history
2522 entry displayed by the <B>history</B> builtin.
2523 If this variable is set, time stamps are written to the history file so
2524 they may be preserved across shell sessions.
2525 This uses the history comment character to distinguish timestamps from
2526 other history lines.
2527 <DT><B>HOME</B>
2528
2529 <DD>
2530 The home directory of the current user; the default argument for the
2531 <B>cd</B> builtin command.
2532 The value of this variable is also used when performing tilde expansion.
2533 <DT><B>HOSTFILE</B>
2534
2535 <DD>
2536 Contains the name of a file in the same format as
2537
2538 <I>/etc/hosts</I>
2539
2540 that should be read when the shell needs to complete a
2541 hostname.
2542 The list of possible hostname completions may be changed while the
2543 shell is running;
2544 the next time hostname completion is attempted after the
2545 value is changed,
2546 <B>bash</B>
2547
2548 adds the contents of the new file to the existing list.
2549 If
2550 <FONT SIZE=-1><B>HOSTFILE</B>
2551
2552 </FONT>
2553 is set, but has no value, or does not name a readable file,
2554 <B>bash</B> attempts to read
2555
2556 <I>/etc/hosts</I>
2557
2558 to obtain the list of possible hostname completions.
2559 When
2560 <FONT SIZE=-1><B>HOSTFILE</B>
2561
2562 </FONT>
2563 is unset, the hostname list is cleared.
2564 <DT><B>IFS</B>
2565
2566 <DD>
2567 The
2568 <I>Internal Field Separator</I>
2569
2570 that is used
2571 for word splitting after expansion and to
2572 split lines into words with the
2573 <B>read</B>
2574
2575 builtin command. The default value is
2576 ``&lt;space&gt;&lt;tab&gt;&lt;newline&gt;''.
2577 <DT><B>IGNOREEOF</B>
2578
2579 <DD>
2580 Controls the
2581 action of an interactive shell on receipt of an
2582 <FONT SIZE=-1><B>EOF</B>
2583
2584 </FONT>
2585 character as the sole input. If set, the value is the number of
2586 consecutive
2587 <FONT SIZE=-1><B>EOF</B>
2588
2589 </FONT>
2590 characters which must be
2591 typed as the first characters on an input line before
2592 <B>bash</B>
2593
2594 exits. If the variable exists but does not have a numeric value, or
2595 has no value, the default value is 10. If it does not exist,
2596 <FONT SIZE=-1><B>EOF</B>
2597
2598 </FONT>
2599 signifies the end of input to the shell.
2600 <DT><B>INPUTRC</B>
2601
2602 <DD>
2603 The filename for the
2604 <B>readline</B>
2605
2606 startup file, overriding the default of
2607
2608 <A HREF="file:~/.inputrc"><I>~/.inputrc</I></A>
2609
2610 (see
2611 <FONT SIZE=-1><B>READLINE</B>
2612
2613 </FONT>
2614 below).
2615 <DT><B>LANG</B>
2616
2617 <DD>
2618 Used to determine the locale category for any category not specifically
2619 selected with a variable starting with <B>LC_</B>.
2620 <DT><B>LC_ALL</B>
2621
2622 <DD>
2623 This variable overrides the value of
2624 <FONT SIZE=-1><B>LANG</B>
2625
2626 </FONT>
2627 and any other
2628 <B>LC_</B> variable specifying a locale category.
2629 <DT><B>LC_COLLATE</B>
2630
2631 <DD>
2632 This variable determines the collation order used when sorting the
2633 results of pathname expansion, and determines the behavior of range
2634 expressions, equivalence classes, and collating sequences within
2635 pathname expansion and pattern matching.
2636 <DT><B>LC_CTYPE</B>
2637
2638 <DD>
2639 This variable determines the interpretation of characters and the
2640 behavior of character classes within pathname expansion and pattern
2641 matching.
2642 <DT><B>LC_MESSAGES</B>
2643
2644 <DD>
2645 This variable determines the locale used to translate double-quoted
2646 strings preceded by a <B>$</B>.
2647 <DT><B>LC_NUMERIC</B>
2648
2649 <DD>
2650 This variable determines the locale category used for number formatting.
2651 <DT><B>LINES</B>
2652
2653 <DD>
2654 Used by the <B>select</B> builtin command to determine the column length
2655 for printing selection lists. Automatically set upon receipt of a
2656 <FONT SIZE=-1><B>SIGWINCH</B>.
2657
2658 </FONT>
2659 <DT><B>MAIL</B>
2660
2661 <DD>
2662 If this parameter is set to a file name and the
2663 <FONT SIZE=-1><B>MAILPATH</B>
2664
2665 </FONT>
2666 variable is not set,
2667 <B>bash</B>
2668
2669 informs the user of the arrival of mail in the specified file.
2670 <DT><B>MAILCHECK</B>
2671
2672 <DD>
2673 Specifies how
2674 often (in seconds)
2675 <B>bash</B>
2676
2677 checks for mail. The default is 60 seconds. When it is time to check
2678 for mail, the shell does so before displaying the primary prompt.
2679 If this variable is unset, or set to a value that is not a number
2680 greater than or equal to zero, the shell disables mail checking.
2681 <DT><B>MAILPATH</B>
2682
2683 <DD>
2684 A colon-separated list of file names to be checked for mail.
2685 The message to be printed when mail arrives in a particular file
2686 may be specified by separating the file name from the message with a `?'.
2687 When used in the text of the message, <B>$_</B> expands to the name of
2688 the current mailfile.
2689 Example:
2690 <DL COMPACT><DT><DD>
2691 <P>
2692
2693 <B>MAILPATH</B>=aq/var/mail/bfox?&quot;You have mail&quot;:~/shell-mail?&quot;$_ has mail!&quot;aq
2694 <P>
2695
2696 <B>Bash</B>
2697
2698 supplies a default value for this variable, but the location of the user
2699 mail files that it uses is system dependent (e.g., /var/mail/<B>$USER</B>).
2700 </DL>
2701
2702 <DT><B>OPTERR</B>
2703
2704 <DD>
2705 If set to the value 1,
2706 <B>bash</B>
2707
2708 displays error messages generated by the
2709 <B>getopts</B>
2710
2711 builtin command (see
2712 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
2713
2714 </FONT>
2715 below).
2716 <FONT SIZE=-1><B>OPTERR</B>
2717
2718 </FONT>
2719 is initialized to 1 each time the shell is invoked or a shell
2720 script is executed.
2721 <DT><B>PATH</B>
2722
2723 <DD>
2724 The search path for commands. It
2725 is a colon-separated list of directories in which
2726 the shell looks for commands (see
2727 <FONT SIZE=-1><B>COMMAND EXECUTION</B>
2728
2729 </FONT>
2730 below).
2731 A zero-length (null) directory name in the value of
2732 <FONT SIZE=-1><B>PATH</B>
2733
2734 </FONT>
2735 indicates the current directory.
2736 A null directory name may appear as two adjacent colons, or as an initial
2737 or trailing colon.
2738 The default path is system-dependent,
2739 and is set by the administrator who installs
2740 <B>bash</B>.
2741
2742 A common value is
2743 <TT>/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin</TT>.
2744
2745 <DT><B>POSIXLY_CORRECT</B>
2746
2747 <DD>
2748 If this variable is in the environment when <B>bash</B> starts, the shell
2749 enters <I>posix mode</I> before reading the startup files, as if the
2750 <B>--posix</B>
2751
2752 invocation option had been supplied. If it is set while the shell is
2753 running, <B>bash</B> enables <I>posix mode</I>, as if the command
2754 <TT>set -o posix</TT>
2755
2756 had been executed.
2757 <DT><B>PROMPT_COMMAND</B>
2758
2759 <DD>
2760 If set, the value is executed as a command prior to issuing each primary
2761 prompt.
2762 <DT><B>PROMPT_DIRTRIM</B>
2763
2764 <DD>
2765 If set to a number greater than zero, the value is used as the number of
2766 trailing directory components to retain when expanding the <B>\w</B> and
2767 <B>\W</B> prompt string escapes (see
2768 <FONT SIZE=-1><B>PROMPTING</B>
2769
2770 </FONT>
2771 below). Characters removed are replaced with an ellipsis.
2772 <DT><B>PS1</B>
2773
2774 <DD>
2775 The value of this parameter is expanded (see
2776 <FONT SIZE=-1><B>PROMPTING</B>
2777
2778 </FONT>
2779 below) and used as the primary prompt string. The default value is
2780 ``<B>\s-\v\$ </B>''.
2781 <DT><B>PS2</B>
2782
2783 <DD>
2784 The value of this parameter is expanded as with
2785 <FONT SIZE=-1><B>PS1</B>
2786
2787 </FONT>
2788 and used as the secondary prompt string. The default is
2789 ``<B>&gt; </B>''.
2790 <DT><B>PS3</B>
2791
2792 <DD>
2793 The value of this parameter is used as the prompt for the
2794 <B>select</B>
2795
2796 command (see
2797 <FONT SIZE=-1><B>SHELL GRAMMAR</B>
2798
2799 </FONT>
2800 above).
2801 <DT><B>PS4</B>
2802
2803 <DD>
2804 The value of this parameter is expanded as with
2805 <FONT SIZE=-1><B>PS1</B>
2806
2807 </FONT>
2808 and the value is printed before each command
2809 <B>bash</B>
2810
2811 displays during an execution trace. The first character of
2812 <FONT SIZE=-1><B>PS4</B>
2813
2814 </FONT>
2815 is replicated multiple times, as necessary, to indicate multiple
2816 levels of indirection. The default is ``<B>+ </B>''.
2817 <DT><B>SHELL</B>
2818
2819 <DD>
2820 The full pathname to the shell is kept in this environment variable.
2821 If it is not set when the shell starts,
2822 <B>bash</B>
2823
2824 assigns to it the full pathname of the current user's login shell.
2825 <DT><B>TIMEFORMAT</B>
2826
2827 <DD>
2828 The value of this parameter is used as a format string specifying
2829 how the timing information for pipelines prefixed with the
2830 <B>time</B>
2831
2832 reserved word should be displayed.
2833 The <B>%</B> character introduces an escape sequence that is
2834 expanded to a time value or other information.
2835 The escape sequences and their meanings are as follows; the
2836 braces denote optional portions.
2837 <P>
2838 <DL COMPACT><DT><DD>
2839
2840 <DL COMPACT>
2841 <DT><B>%%</B>
2842
2843 <DD>
2844 A literal <B>%</B>.
2845 <DT><B>%[</B><I>p</I>][l]R
2846
2847 <DD>
2848 The elapsed time in seconds.
2849 <DT><B>%[</B><I>p</I>][l]U
2850
2851 <DD>
2852 The number of CPU seconds spent in user mode.
2853 <DT><B>%[</B><I>p</I>][l]S
2854
2855 <DD>
2856 The number of CPU seconds spent in system mode.
2857 <DT><B>%P</B>
2858
2859 <DD>
2860 The CPU percentage, computed as (%U + %S) / %R.
2861
2862 </DL></DL>
2863
2864 <DT><DD>
2865 The optional <I>p</I> is a digit specifying the <I>precision</I>,
2866 the number of fractional digits after a decimal point.
2867 A value of 0 causes no decimal point or fraction to be output.
2868 At most three places after the decimal point may be specified;
2869 values of <I>p</I> greater than 3 are changed to 3.
2870 If <I>p</I> is not specified, the value 3 is used.
2871 <DT><DD>
2872 The optional <B>l</B> specifies a longer format, including
2873 minutes, of the form <I>MM</I>m<I>SS</I>.<I>FF</I>s.
2874 The value of <I>p</I> determines whether or not the fraction is
2875 included.
2876 <DT><DD>
2877 If this variable is not set, <B>bash</B> acts as if it had the
2878 value <B>$aq\nreal\t%3lR\nuser\t%3lU\nsys %3lSaq</B>.
2879 If the value is null, no timing information is displayed.
2880 A trailing newline is added when the format string is displayed.
2881 <DT><B>TMOUT</B>
2882
2883 <DD>
2884 If set to a value greater than zero,
2885 <FONT SIZE=-1><B>TMOUT</B>
2886
2887 </FONT>
2888 is treated as the
2889 default timeout for the <B>read</B> builtin.
2890 The <B>select</B> command terminates if input does not arrive
2891 after
2892 <FONT SIZE=-1><B>TMOUT</B>
2893
2894 </FONT>
2895 seconds when input is coming from a terminal.
2896 In an interactive shell, the value is interpreted as the
2897 number of seconds to wait for input after issuing the primary prompt.
2898 <B>Bash</B>
2899
2900 terminates after waiting for that number of seconds if input does
2901 not arrive.
2902 <DT><B>TMPDIR</B>
2903
2904 <DD>
2905 If set, <B>Bash</B> uses its value as the name of a directory in which
2906 <B>Bash</B> creates temporary files for the shell's use.
2907 <DT><B>auto_resume</B>
2908
2909 <DD>
2910 This variable controls how the shell interacts with the user and
2911 job control. If this variable is set, single word simple
2912 commands without redirections are treated as candidates for resumption
2913 of an existing stopped job. There is no ambiguity allowed; if there is
2914 more than one job beginning with the string typed, the job most recently
2915 accessed is selected. The
2916 <I>name</I>
2917
2918 of a stopped job, in this context, is the command line used to
2919 start it.
2920 If set to the value
2921 <I>exact</I>,
2922
2923 the string supplied must match the name of a stopped job exactly;
2924 if set to
2925 <I>substring</I>,
2926
2927 the string supplied needs to match a substring of the name of a
2928 stopped job. The
2929 <I>substring</I>
2930
2931 value provides functionality analogous to the
2932 <B>%?</B>
2933
2934 job identifier (see
2935 <FONT SIZE=-1><B>JOB CONTROL</B>
2936
2937 </FONT>
2938 below). If set to any other value, the supplied string must
2939 be a prefix of a stopped job's name; this provides functionality
2940 analogous to the <B>%</B><I>string</I> job identifier.
2941 <DT><B>histchars</B>
2942
2943 <DD>
2944 The two or three characters which control history expansion
2945 and tokenization (see
2946 <FONT SIZE=-1><B>HISTORY EXPANSION</B>
2947
2948 </FONT>
2949 below). The first character is the <I>history expansion</I> character,
2950 the character which signals the start of a history
2951 expansion, normally `<B>!</B>'.
2952 The second character is the <I>quick substitution</I>
2953 character, which is used as shorthand for re-running the previous
2954 command entered, substituting one string for another in the command.
2955 The default is `<B>^</B>'.
2956 The optional third character is the character
2957 which indicates that the remainder of the line is a comment when found
2958 as the first character of a word, normally `<B>#</B>'. The history
2959 comment character causes history substitution to be skipped for the
2960 remaining words on the line. It does not necessarily cause the shell
2961 parser to treat the rest of the line as a comment.
2962
2963 </DL>
2964 <A NAME="lbAX">&nbsp;</A>
2965 <H4>Arrays</H4>
2966
2967 <B>Bash</B>
2968
2969 provides one-dimensional indexed and associative array variables.
2970 Any variable may be used as an indexed array; the
2971 <B>declare</B>
2972
2973 builtin will explicitly declare an array.
2974 There is no maximum
2975 limit on the size of an array, nor any requirement that members
2976 be indexed or assigned contiguously.
2977 Indexed arrays are referenced using integers (including arithmetic
2978 expressions) and are zero-based; associative arrays are referenced
2979 using arbitrary strings.
2980 <P>
2981
2982 An indexed array is created automatically if any variable is assigned to
2983 using the syntax <I>name</I>[<I>subscript</I>]=<I>value</I>. The
2984 <I>subscript</I>
2985
2986 is treated as an arithmetic expression that must evaluate to a number
2987 greater than or equal to zero. To explicitly declare an indexed array,
2988 use
2989 <B>declare -a </B><I>name</I>
2990
2991 (see
2992 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
2993
2994 </FONT>
2995 below).
2996 <B>declare -a </B><I>name</I>[<I>subscript</I>]
2997
2998 is also accepted; the <I>subscript</I> is ignored.
2999 <P>
3000
3001 Associative arrays are created using
3002 <B>declare -A </B><I>name</I>.
3003
3004 <P>
3005
3006 Attributes may be
3007 specified for an array variable using the
3008 <B>declare</B>
3009
3010 and
3011 <B>readonly</B>
3012
3013 builtins. Each attribute applies to all members of an array.
3014 <P>
3015
3016 Arrays are assigned to using compound assignments of the form
3017 <I>name</I>=<B>(</B>value<I>1</I> ... value<I>n</I><B>)</B>, where each
3018 <I>value</I> is of the form [<I>subscript</I>]=<I>string</I>.
3019 Indexed array assignments do not require the bracket and subscript.
3020 When assigning to indexed arrays, if the optional brackets and subscript
3021 are supplied, that index is assigned to;
3022 otherwise the index of the element assigned is the last index assigned
3023 to by the statement plus one. Indexing starts at zero.
3024 <P>
3025
3026 When assigning to an associative array, the subscript is required.
3027 <P>
3028
3029 This syntax is also accepted by the
3030 <B>declare</B>
3031
3032 builtin. Individual array elements may be assigned to using the
3033 <I>name</I>[<I>subscript</I>]=<I>value</I> syntax introduced above.
3034 <P>
3035
3036 Any element of an array may be referenced using
3037 ${<I>name</I>[<I>subscript</I>]}. The braces are required to avoid
3038 conflicts with pathname expansion. If
3039 <I>subscript</I> is <B>@</B> or <B>*</B>, the word expands to
3040 all members of <I>name</I>. These subscripts differ only when the
3041 word appears within double quotes. If the word is double-quoted,
3042 ${<I>name</I>[*]} expands to a single
3043 word with the value of each array member separated by the first
3044 character of the
3045 <FONT SIZE=-1><B>IFS</B>
3046
3047 </FONT>
3048 special variable, and ${<I>name</I>[@]} expands each element of
3049 <I>name</I> to a separate word. When there are no array members,
3050 ${<I>name</I>[@]} expands to nothing.
3051 If the double-quoted expansion occurs within a word, the expansion of
3052 the first parameter is joined with the beginning part of the original
3053 word, and the expansion of the last parameter is joined with the last
3054 part of the original word.
3055 This is analogous to the expansion
3056 of the special parameters <B>*</B> and <B>@</B> (see
3057 <B>Special Parameters</B>
3058
3059 above). ${#<I>name</I>[<I>subscript</I>]} expands to the length of
3060 ${<I>name</I>[<I>subscript</I>]}. If <I>subscript</I> is <B>*</B> or
3061 <B>@</B>, the expansion is the number of elements in the array.
3062 Referencing an array variable without a subscript is equivalent to
3063 referencing the array with a subscript of 0.
3064 <P>
3065
3066 An array variable is considered set if a subscript has been assigned a
3067 value. The null string is a valid value.
3068 <P>
3069
3070 The
3071 <B>unset</B>
3072
3073 builtin is used to destroy arrays. <B>unset</B> <I>name</I>[<I>subscript</I>]
3074 destroys the array element at index <I>subscript</I>.
3075 Care must be taken to avoid unwanted side effects caused by pathname
3076 expansion.
3077 <B>unset</B> <I>name</I>, where <I>name</I> is an array, or
3078 <B>unset</B> <I>name</I>[<I>subscript</I>], where
3079 <I>subscript</I> is <B>*</B> or <B>@</B>, removes the entire array.
3080 <P>
3081
3082 The
3083 <B>declare</B>,
3084
3085 <B>local</B>,
3086
3087 and
3088 <B>readonly</B>
3089
3090 builtins each accept a
3091 <B>-a</B>
3092
3093 option to specify an indexed array and a
3094 <B>-A</B>
3095
3096 option to specify an associative array.
3097 The
3098 <B>read</B>
3099
3100 builtin accepts a
3101 <B>-a</B>
3102
3103 option to assign a list of words read from the standard input
3104 to an array. The
3105 <B>set</B>
3106
3107 and
3108 <B>declare</B>
3109
3110 builtins display array values in a way that allows them to be
3111 reused as assignments.
3112 <A NAME="lbAY">&nbsp;</A>
3113 <H3>EXPANSION</H3>
3114
3115 Expansion is performed on the command line after it has been split into
3116 words. There are seven kinds of expansion performed:
3117 <I>brace expansion</I>,
3118
3119 <I>tilde expansion</I>,
3120
3121 <I>parameter and variable expansion</I>,
3122
3123 <I>command substitution</I>,
3124
3125 <I>arithmetic expansion</I>,
3126
3127 <I>word splitting</I>,
3128
3129 and
3130 <I>pathname expansion</I>.
3131
3132 <P>
3133
3134 The order of expansions is: brace expansion, tilde expansion,
3135 parameter, variable and arithmetic expansion and
3136 command substitution
3137 (done in a left-to-right fashion), word splitting, and pathname
3138 expansion.
3139 <P>
3140
3141 On systems that can support it, there is an additional expansion
3142 available: <I>process substitution</I>.
3143 <P>
3144
3145 Only brace expansion, word splitting, and pathname expansion
3146 can change the number of words of the expansion; other expansions
3147 expand a single word to a single word.
3148 The only exceptions to this are the expansions of
3149 &quot;<B>$@</B>&quot; and &quot;<B>${</B><I>name</I><B>[@]}</B>&quot;
3150 as explained above (see
3151 <FONT SIZE=-1><B>PARAMETERS</B>).
3152
3153 </FONT>
3154 <A NAME="lbAZ">&nbsp;</A>
3155 <H4>Brace Expansion</H4>
3156
3157 <P>
3158
3159 <I>Brace expansion</I>
3160
3161 is a mechanism by which arbitrary strings
3162 may be generated. This mechanism is similar to
3163 <I>pathname expansion</I>, but the filenames generated
3164 need not exist. Patterns to be brace expanded take
3165 the form of an optional
3166 <I>preamble</I>,
3167
3168 followed by either a series of comma-separated strings or
3169 a sequence expression between a pair of braces, followed by
3170 an optional
3171 <I>postscript</I>.
3172
3173 The preamble is prefixed to each string contained
3174 within the braces, and the postscript is then appended
3175 to each resulting string, expanding left to right.
3176 <P>
3177
3178 Brace expansions may be nested. The results of each expanded
3179 string are not sorted; left to right order is preserved.
3180 For example, a<B>{</B>d,c,b<B>}</B>e expands into `ade ace abe'.
3181 <P>
3182
3183 A sequence expression takes the form
3184 <B>{</B><I>x</I><B>..</B><I>y</I><B>[..</B><I>incr</I><B>]}</B>,
3185 where <I>x</I> and <I>y</I> are either integers or single characters,
3186 and <I>incr</I>, an optional increment, is an integer.
3187 When integers are supplied, the expression expands to each number between
3188 <I>x</I> and <I>y</I>, inclusive.
3189 Supplied integers may be prefixed with <I>0</I> to force each term to have the
3190 same width. When either <I>x</I> or y begins with a zero, the shell
3191 attempts to force all generated terms to contain the same number of digits,
3192 zero-padding where necessary.
3193 When characters are supplied, the expression expands to each character
3194 lexicographically between <I>x</I> and <I>y</I>, inclusive. Note that
3195 both <I>x</I> and <I>y</I> must be of the same type.
3196 When the increment is supplied, it is used as the difference between
3197 each term. The default increment is 1 or -1 as appropriate.
3198 <P>
3199
3200 Brace expansion is performed before any other expansions,
3201 and any characters special to other expansions are preserved
3202 in the result. It is strictly textual.
3203 <B>Bash</B>
3204
3205 does not apply any syntactic interpretation to the context of the
3206 expansion or the text between the braces.
3207 <P>
3208
3209 A correctly-formed brace expansion must contain unquoted opening
3210 and closing braces, and at least one unquoted comma or a valid
3211 sequence expression.
3212 Any incorrectly formed brace expansion is left unchanged.
3213 A <B>{</B> or <B>,</B> may be quoted with a backslash to prevent its
3214 being considered part of a brace expression.
3215 To avoid conflicts with parameter expansion, the string <B>${</B>
3216 is not considered eligible for brace expansion.
3217 <P>
3218
3219 This construct is typically used as shorthand when the common
3220 prefix of the strings to be generated is longer than in the
3221 above example:
3222 <DL COMPACT><DT><DD>
3223 <P>
3224
3225 mkdir /usr/local/src/bash/{old,new,dist,bugs}
3226 </DL>
3227
3228 or
3229 <DL COMPACT><DT><DD>
3230 chown root /usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}}
3231 </DL>
3232
3233 <P>
3234
3235 Brace expansion introduces a slight incompatibility with
3236 historical versions of
3237 <B>sh</B>.
3238
3239 <B>sh</B>
3240
3241 does not treat opening or closing braces specially when they
3242 appear as part of a word, and preserves them in the output.
3243 <B>Bash</B>
3244
3245 removes braces from words as a consequence of brace
3246 expansion. For example, a word entered to
3247 <B>sh</B>
3248
3249 as <I>file{1,2}</I>
3250 appears identically in the output. The same word is
3251 output as
3252 <I>file1 file2</I>
3253
3254 after expansion by
3255 <B>bash</B>.
3256
3257 If strict compatibility with
3258 <B>sh</B>
3259
3260 is desired, start
3261 <B>bash</B>
3262
3263 with the
3264 <B>+B </B>
3265
3266 option or disable brace expansion with the
3267 <B>+B</B>
3268
3269 option to the
3270 <B>set</B>
3271
3272 command (see
3273 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
3274
3275 </FONT>
3276 below).
3277 <A NAME="lbBA">&nbsp;</A>
3278 <H4>Tilde Expansion</H4>
3279
3280 <P>
3281
3282 If a word begins with an unquoted tilde character (`<B>~</B>'), all of
3283 the characters preceding the first unquoted slash (or all characters,
3284 if there is no unquoted slash) are considered a <I>tilde-prefix</I>.
3285 If none of the characters in the tilde-prefix are quoted, the
3286 characters in the tilde-prefix following the tilde are treated as a
3287 possible <I>login name</I>.
3288 If this login name is the null string, the tilde is replaced with the
3289 value of the shell parameter
3290 <FONT SIZE=-1><B>HOME</B>.
3291
3292 </FONT>
3293 If
3294 <FONT SIZE=-1><B>HOME</B>
3295
3296 </FONT>
3297 is unset, the home directory of the user executing the shell is
3298 substituted instead.
3299 Otherwise, the tilde-prefix is replaced with the home directory
3300 associated with the specified login name.
3301 <P>
3302
3303 If the tilde-prefix is a `~+', the value of the shell variable
3304 <FONT SIZE=-1><B>PWD</B>
3305
3306 </FONT>
3307 replaces the tilde-prefix.
3308 If the tilde-prefix is a `~-', the value of the shell variable
3309 <FONT SIZE=-1><B>OLDPWD</B>,
3310
3311 </FONT>
3312 if it is set, is substituted.
3313 If the characters following the tilde in the tilde-prefix consist
3314 of a number <I>N</I>, optionally prefixed
3315 by a `+' or a `-', the tilde-prefix is replaced with the corresponding
3316 element from the directory stack, as it would be displayed by the
3317 <B>dirs</B>
3318
3319 builtin invoked with the tilde-prefix as an argument.
3320 If the characters following the tilde in the tilde-prefix consist of a
3321 number without a leading `+' or `-', `+' is assumed.
3322 <P>
3323
3324 If the login name is invalid, or the tilde expansion fails, the word
3325 is unchanged.
3326 <P>
3327
3328 Each variable assignment is checked for unquoted tilde-prefixes immediately
3329 following a
3330 <B>:</B>
3331
3332 or the first
3333 <B>=</B>.
3334
3335 In these cases, tilde expansion is also performed.
3336 Consequently, one may use file names with tildes in assignments to
3337 <FONT SIZE=-1><B>PATH</B>,
3338
3339 </FONT>
3340 <FONT SIZE=-1><B>MAILPATH</B>,
3341
3342 </FONT>
3343 and
3344 <FONT SIZE=-1><B>CDPATH</B>,
3345
3346 </FONT>
3347 and the shell assigns the expanded value.
3348 <A NAME="lbBB">&nbsp;</A>
3349 <H4>Parameter Expansion</H4>
3350
3351 <P>
3352
3353 The `<B>$</B>' character introduces parameter expansion,
3354 command substitution, or arithmetic expansion. The parameter name
3355 or symbol to be expanded may be enclosed in braces, which
3356 are optional but serve to protect the variable to be expanded from
3357 characters immediately following it which could be
3358 interpreted as part of the name.
3359 <P>
3360
3361 When braces are used, the matching ending brace is the first `<B>}</B>'
3362 not escaped by a backslash or within a quoted string, and not within an
3363 embedded arithmetic expansion, command substitution, or parameter
3364 expansion.
3365 <P>
3366
3367
3368 <DL COMPACT>
3369 <DT>${<I>parameter</I>}<DD>
3370 The value of <I>parameter</I> is substituted. The braces are required
3371 when
3372 <I>parameter</I>
3373
3374 is a positional parameter with more than one digit,
3375 or when
3376 <I>parameter</I>
3377
3378 is followed by a character which is not to be
3379 interpreted as part of its name.
3380
3381 </DL>
3382 <P>
3383
3384 If the first character of <I>parameter</I> is an exclamation point (<B>!</B>),
3385 a level of variable indirection is introduced.
3386 <B>Bash</B> uses the value of the variable formed from the rest of
3387 <I>parameter</I> as the name of the variable; this variable is then
3388 expanded and that value is used in the rest of the substitution, rather
3389 than the value of <I>parameter</I> itself.
3390 This is known as <I>indirect expansion</I>.
3391 The exceptions to this are the expansions of ${!<I>prefix</I>*} and
3392 ${<B>!</B><I>name</I>[<I>@</I>]} described below.
3393 The exclamation point must immediately follow the left brace in order to
3394 introduce indirection.
3395 <P>
3396
3397 In each of the cases below, <I>word</I> is subject to tilde expansion,
3398 parameter expansion, command substitution, and arithmetic expansion.
3399 <P>
3400
3401 When not performing substring expansion, using the forms documented below,
3402 <B>bash</B> tests for a parameter that is unset or null. Omitting the colon
3403 results in a test only for a parameter that is unset.
3404 <P>
3405
3406
3407 <DL COMPACT>
3408 <DT>${<I>parameter</I><B>:-</B><I>word</I>}<DD>
3409 <B>Use Default Values</B>. If
3410 <I>parameter</I>
3411
3412 is unset or null, the expansion of
3413 <I>word</I>
3414
3415 is substituted. Otherwise, the value of
3416 <I>parameter</I>
3417
3418 is substituted.
3419 <DT>${<I>parameter</I><B>:=</B><I>word</I>}<DD>
3420 <B>Assign Default Values</B>.
3421 If
3422 <I>parameter</I>
3423
3424 is unset or null, the expansion of
3425 <I>word</I>
3426
3427 is assigned to
3428 <I>parameter</I>.
3429
3430 The value of
3431 <I>parameter</I>
3432
3433 is then substituted. Positional parameters and special parameters may
3434 not be assigned to in this way.
3435 <DT>${<I>parameter</I><B>:?</B><I>word</I>}<DD>
3436 <B>Display Error if Null or Unset</B>.
3437 If
3438 <I>parameter</I>
3439
3440 is null or unset, the expansion of <I>word</I> (or a message to that effect
3441 if
3442 <I>word</I>
3443
3444 is not present) is written to the standard error and the shell, if it
3445 is not interactive, exits. Otherwise, the value of <I>parameter</I> is
3446 substituted.
3447 <DT>${<I>parameter</I><B>:+</B><I>word</I>}<DD>
3448 <B>Use Alternate Value</B>.
3449 If
3450 <I>parameter</I>
3451
3452 is null or unset, nothing is substituted, otherwise the expansion of
3453 <I>word</I>
3454
3455 is substituted.
3456 <DT>${<I>parameter</I><B>:</B><I>offset</I>}<DD>
3457
3458 <DT>${<I>parameter</I><B>:</B><I>offset</I><B>:</B><I>length</I>}<DD>
3459
3460 <B>Substring Expansion.</B>
3461 Expands to up to <I>length</I> characters of <I>parameter</I>
3462 starting at the character specified by <I>offset</I>.
3463 If <I>length</I> is omitted, expands to the substring of
3464 <I>parameter</I> starting at the character specified by <I>offset</I>.
3465 <I>length</I> and <I>offset</I> are arithmetic expressions (see
3466 <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>
3467
3468 </FONT>
3469 below).
3470 <I>length</I> must evaluate to a number greater than or equal to zero.
3471 If <I>offset</I> evaluates to a number less than zero, the value
3472 is used as an offset from the end of the value of <I>parameter</I>.
3473 If <I>parameter</I> is <B>@</B>, the result is <I>length</I> positional
3474 parameters beginning at <I>offset</I>.
3475 If <I>parameter</I> is an indexed array name subscripted by @ or *,
3476 the result is the <I>length</I>
3477 members of the array beginning with ${<I>parameter</I>[<I>offset</I>]}.
3478 A negative <I>offset</I> is taken relative to one greater than the maximum
3479 index of the specified array.
3480 Substring expansion applied to an associative array produces undefined
3481 results.
3482 Note that a negative offset must be separated from the colon by at least
3483 one space to avoid being confused with the :- expansion.
3484 Substring indexing is zero-based unless the positional parameters
3485 are used, in which case the indexing starts at 1 by default.
3486 If <I>offset</I> is 0, and the positional parameters are used, <B>$0</B> is
3487 prefixed to the list.
3488 <DT>${<B>!</B><I>prefix</I><B>*</B>}<DD>
3489
3490 <DT>${<B>!</B><I>prefix</I><B>@</B>}<DD>
3491
3492 <B>Names matching prefix.</B>
3493 Expands to the names of variables whose names begin with <I>prefix</I>,
3494 separated by the first character of the
3495 <FONT SIZE=-1><B>IFS</B>
3496
3497 </FONT>
3498 special variable.
3499 When <I>@</I> is used and the expansion appears within double quotes, each
3500 variable name expands to a separate word.
3501 <DT>${<B>!</B><I>name</I>[<I>@</I>]}<DD>
3502
3503 <DT>${<B>!</B><I>name</I>[<I>*</I>]}<DD>
3504
3505 <B>List of array keys.</B>
3506 If <I>name</I> is an array variable, expands to the list of array indices
3507 (keys) assigned in <I>name</I>.
3508 If <I>name</I> is not an array, expands to 0 if <I>name</I> is set and null
3509 otherwise.
3510 When <I>@</I> is used and the expansion appears within double quotes, each
3511 key expands to a separate word.
3512 <DT>${<B>#</B><I>parameter</I>}<DD>
3513 <B>Parameter length.</B>
3514 The length in characters of the value of <I>parameter</I> is substituted.
3515 If
3516 <I>parameter</I>
3517
3518 is
3519 <B>*</B>
3520
3521 or
3522 <B>@</B>,
3523
3524 the value substituted is the number of positional parameters.
3525 If
3526 <I>parameter</I>
3527
3528 is an array name subscripted by
3529 <B>*</B>
3530
3531 or
3532 <B>@</B>,
3533
3534 the value substituted is the number of elements in the array.
3535 <DT>${<I>parameter</I><B>#</B><I>word</I>}<DD>
3536
3537 <DT>${<I>parameter</I><B>##</B><I>word</I>}<DD>
3538
3539 <B>Remove matching prefix pattern.</B>
3540 The
3541 <I>word</I>
3542
3543 is expanded to produce a pattern just as in pathname
3544 expansion. If the pattern matches the beginning of
3545 the value of
3546 <I>parameter</I>,
3547
3548 then the result of the expansion is the expanded value of
3549 <I>parameter</I>
3550
3551 with the shortest matching pattern (the ``<B>#</B>'' case) or the
3552 longest matching pattern (the ``<B>##</B>'' case) deleted.
3553 If
3554 <I>parameter</I>
3555
3556 is
3557 <B>@</B>
3558
3559 or
3560 <B>*</B>,
3561
3562 the pattern removal operation is applied to each positional
3563 parameter in turn, and the expansion is the resultant list.
3564 If
3565 <I>parameter</I>
3566
3567 is an array variable subscripted with
3568 <B>@</B>
3569
3570 or
3571 <B>*</B>,
3572
3573 the pattern removal operation is applied to each member of the
3574 array in turn, and the expansion is the resultant list.
3575 <DT>${<I>parameter</I><B>%</B><I>word</I>}<DD>
3576
3577 <DT>${<I>parameter</I><B>%%</B><I>word</I>}<DD>
3578
3579 <B>Remove matching suffix pattern.</B>
3580 The <I>word</I> is expanded to produce a pattern just as in
3581 pathname expansion.
3582 If the pattern matches a trailing portion of the expanded value of
3583 <I>parameter</I>,
3584
3585 then the result of the expansion is the expanded value of
3586 <I>parameter</I>
3587
3588 with the shortest matching pattern (the ``<B>%</B>'' case) or the
3589 longest matching pattern (the ``<B>%%</B>'' case) deleted.
3590 If
3591 <I>parameter</I>
3592
3593 is
3594 <B>@</B>
3595
3596 or
3597 <B>*</B>,
3598
3599 the pattern removal operation is applied to each positional
3600 parameter in turn, and the expansion is the resultant list.
3601 If
3602 <I>parameter</I>
3603
3604 is an array variable subscripted with
3605 <B>@</B>
3606
3607 or
3608 <B>*</B>,
3609
3610 the pattern removal operation is applied to each member of the
3611 array in turn, and the expansion is the resultant list.
3612 <DT>${<I>parameter</I><B>/</B><I>pattern</I><B>/</B><I>string</I>}<DD>
3613 <B>Pattern substitution.</B>
3614 The <I>pattern</I> is expanded to produce a pattern just as in
3615 pathname expansion.
3616 <I>Parameter</I> is expanded and the longest match of <I>pattern</I>
3617 against its value is replaced with <I>string</I>.
3618 If <I>pattern</I> begins with <B>/</B>, all matches of <I>pattern</I> are
3619 replaced with <I>string</I>. Normally only the first match is replaced.
3620 If <I>pattern</I> begins with <B>#</B>, it must match at the beginning
3621 of the expanded value of <I>parameter</I>.
3622 If <I>pattern</I> begins with <B>%</B>, it must match at the end
3623 of the expanded value of <I>parameter</I>.
3624 If <I>string</I> is null, matches of <I>pattern</I> are deleted
3625 and the <B>/</B> following <I>pattern</I> may be omitted.
3626 If
3627 <I>parameter</I>
3628
3629 is
3630 <B>@</B>
3631
3632 or
3633 <B>*</B>,
3634
3635 the substitution operation is applied to each positional
3636 parameter in turn, and the expansion is the resultant list.
3637 If
3638 <I>parameter</I>
3639
3640 is an array variable subscripted with
3641 <B>@</B>
3642
3643 or
3644 <B>*</B>,
3645
3646 the substitution operation is applied to each member of the
3647 array in turn, and the expansion is the resultant list.
3648 <DT>${<I>parameter</I><B>^</B><I>pattern</I>}<DD>
3649
3650 <DT>${<I>parameter</I><B>^^</B><I>pattern</I>}<DD>
3651 <DT>${<I>parameter</I><B>,</B><I>pattern</I>}<DD>
3652 <DT>${<I>parameter</I><B>,,</B><I>pattern</I>}<DD>
3653
3654 <B>Case modification.</B>
3655 This expansion modifies the case of alphabetic characters in <I>parameter</I>.
3656 The <I>pattern</I> is expanded to produce a pattern just as in
3657 pathname expansion.
3658 The <B>^</B> operator converts lowercase letters matching <I>pattern</I>
3659 to uppercase; the <B>,</B> operator converts matching uppercase letters
3660 to lowercase.
3661 The <B>^^</B> and <B>,,</B> expansions convert each matched character in the
3662 expanded value; the <B>^</B> and <B>,</B> expansions match and convert only
3663 the first character in the expanded value.
3664 If <I>pattern</I> is omitted, it is treated like a <B>?</B>, which matches
3665 every character.
3666 If
3667 <I>parameter</I>
3668
3669 is
3670 <B>@</B>
3671
3672 or
3673 <B>*</B>,
3674
3675 the case modification operation is applied to each positional
3676 parameter in turn, and the expansion is the resultant list.
3677 If
3678 <I>parameter</I>
3679
3680 is an array variable subscripted with
3681 <B>@</B>
3682
3683 or
3684 <B>*</B>,
3685
3686 the case modification operation is applied to each member of the
3687 array in turn, and the expansion is the resultant list.
3688 </DL>
3689 <A NAME="lbBC">&nbsp;</A>
3690 <H4>Command Substitution</H4>
3691
3692 <P>
3693
3694 <I>Command substitution</I> allows the output of a command to replace
3695 the command name. There are two forms:
3696 <P>
3697
3698 <DL COMPACT><DT><DD>
3699 <P>
3700
3701 <B>$(</B><I>command</I><B>)</B>
3702 </DL>
3703
3704 or
3705 <DL COMPACT><DT><DD>
3706 <B>`</B><I>command</I><B>`</B>
3707 </DL>
3708
3709 <P>
3710
3711 <B>Bash</B>
3712
3713 performs the expansion by executing <I>command</I> and
3714 replacing the command substitution with the standard output of the
3715 command, with any trailing newlines deleted.
3716 Embedded newlines are not deleted, but they may be removed during
3717 word splitting.
3718 The command substitution <B>$(cat </B><I>file</I>) can be replaced by
3719 the equivalent but faster <B>$(&lt; </B><I>file</I>).
3720 <P>
3721
3722 When the old-style backquote form of substitution is used,
3723 backslash retains its literal meaning except when followed by
3724 <B>$</B>,
3725
3726 <B>`</B>,
3727
3728 or
3729 <B>\</B>.
3730
3731 The first backquote not preceded by a backslash terminates the
3732 command substitution.
3733 When using the $(<I>command</I>) form, all characters between the
3734 parentheses make up the command; none are treated specially.
3735 <P>
3736
3737 Command substitutions may be nested. To nest when using the backquoted form,
3738 escape the inner backquotes with backslashes.
3739 <P>
3740
3741 If the substitution appears within double quotes, word splitting and
3742 pathname expansion are not performed on the results.
3743 <A NAME="lbBD">&nbsp;</A>
3744 <H4>Arithmetic Expansion</H4>
3745
3746 <P>
3747
3748 Arithmetic expansion allows the evaluation of an arithmetic expression
3749 and the substitution of the result. The format for arithmetic expansion is:
3750 <DL COMPACT><DT><DD>
3751 <P>
3752
3753 <B>$((</B><I>expression</I><B>))</B>
3754 </DL>
3755
3756 <P>
3757
3758 The
3759 <I>expression</I>
3760
3761 is treated as if it were within double quotes, but a double quote
3762 inside the parentheses is not treated specially.
3763 All tokens in the expression undergo parameter expansion, string
3764 expansion, command substitution, and quote removal.
3765 Arithmetic expansions may be nested.
3766 <P>
3767
3768 The evaluation is performed according to the rules listed below under
3769 <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>.
3770
3771 </FONT>
3772 If
3773 <I>expression</I>
3774
3775 is invalid,
3776 <B>bash</B>
3777
3778 prints a message indicating failure and no substitution occurs.
3779 <A NAME="lbBE">&nbsp;</A>
3780 <H4>Process Substitution</H4>
3781
3782 <P>
3783
3784 <I>Process substitution</I> is supported on systems that support named
3785 pipes (<I>FIFOs</I>) or the <B>/dev/fd</B> method of naming open files.
3786 It takes the form of
3787 <B>&lt;(</B><I>list</I><B>)</B>
3788 or
3789 <B>&gt;(</B><I>list</I><B>)</B>.
3790 The process <I>list</I> is run with its input or output connected to a
3791 <I>FIFO</I> or some file in <B>/dev/fd</B>. The name of this file is
3792 passed as an argument to the current command as the result of the
3793 expansion. If the <B>&gt;(</B><I>list</I><B>)</B> form is used, writing to
3794 the file will provide input for <I>list</I>. If the
3795 <B>&lt;(</B><I>list</I><B>)</B> form is used, the file passed as an
3796 argument should be read to obtain the output of <I>list</I>.
3797 <P>
3798
3799 When available, process substitution is performed
3800 simultaneously with parameter and variable expansion,
3801 command substitution,
3802 and arithmetic expansion.
3803 <A NAME="lbBF">&nbsp;</A>
3804 <H4>Word Splitting</H4>
3805
3806 <P>
3807
3808 The shell scans the results of
3809 parameter expansion,
3810 command substitution,
3811 and
3812 arithmetic expansion
3813 that did not occur within double quotes for
3814 <I>word splitting</I>.
3815
3816 <P>
3817
3818 The shell treats each character of
3819 <FONT SIZE=-1><B>IFS</B>
3820
3821 </FONT>
3822 as a delimiter, and splits the results of the other
3823 expansions into words on these characters. If
3824 <FONT SIZE=-1><B>IFS</B>
3825
3826 </FONT>
3827 is unset, or its
3828 value is exactly
3829 <B>&lt;space&gt;&lt;tab&gt;&lt;newline&gt;</B>,
3830
3831 the default, then
3832 sequences of
3833 <B>&lt;space&gt;</B>,
3834
3835 <B>&lt;tab&gt;</B>,
3836
3837 and
3838 <B>&lt;newline&gt;</B>
3839
3840 at the beginning and end of the results of the previous
3841 expansions are ignored, and
3842 any sequence of
3843 <FONT SIZE=-1><B>IFS</B>
3844
3845 </FONT>
3846 characters not at the beginning or end serves to delimit words.
3847 If
3848 <FONT SIZE=-1><B>IFS</B>
3849
3850 </FONT>
3851 has a value other than the default, then sequences of
3852 the whitespace characters
3853 <B>space</B>
3854
3855 and
3856 <B>tab</B>
3857
3858 are ignored at the beginning and end of the
3859 word, as long as the whitespace character is in the
3860 value of
3861 <FONT SIZE=-1><B>IFS</B>
3862
3863 </FONT>
3864 (an
3865 <FONT SIZE=-1><B>IFS</B>
3866
3867 </FONT>
3868 whitespace character).
3869 Any character in
3870 <FONT SIZE=-1><B>IFS</B>
3871
3872 </FONT>
3873 that is not
3874 <FONT SIZE=-1><B>IFS</B>
3875
3876 </FONT>
3877 whitespace, along with any adjacent
3878 <FONT SIZE=-1><B>IFS</B>
3879
3880 </FONT>
3881 whitespace characters, delimits a field.
3882 A sequence of
3883 <FONT SIZE=-1><B>IFS</B>
3884
3885 </FONT>
3886 whitespace characters is also treated as a delimiter.
3887 If the value of
3888 <FONT SIZE=-1><B>IFS</B>
3889
3890 </FONT>
3891 is null, no word splitting occurs.
3892 <P>
3893
3894 Explicit null arguments (<B>&quot;&quot;</B> or <B>aqaq</B>) are retained.
3895 Unquoted implicit null arguments, resulting from the expansion of
3896 parameters that have no values, are removed.
3897 If a parameter with no value is expanded within double quotes, a
3898 null argument results and is retained.
3899 <P>
3900
3901 Note that if no expansion occurs, no splitting
3902 is performed.
3903 <A NAME="lbBG">&nbsp;</A>
3904 <H4>Pathname Expansion</H4>
3905
3906 <P>
3907
3908 After word splitting,
3909 unless the
3910 <B>-f</B>
3911
3912 option has been set,
3913 <B>bash</B>
3914
3915 scans each word for the characters
3916 <B>*</B>,
3917
3918 <B>?</B>,
3919
3920 and
3921 <B>[</B>.
3922
3923 If one of these characters appears, then the word is
3924 regarded as a
3925 <I>pattern</I>,
3926
3927 and replaced with an alphabetically sorted list of
3928 file names matching the pattern.
3929 If no matching file names are found,
3930 and the shell option
3931 <B>nullglob</B>
3932
3933 is not enabled, the word is left unchanged.
3934 If the
3935 <B>nullglob</B>
3936
3937 option is set, and no matches are found,
3938 the word is removed.
3939 If the
3940 <B>failglob</B>
3941
3942 shell option is set, and no matches are found, an error message
3943 is printed and the command is not executed.
3944 If the shell option
3945 <B>nocaseglob</B>
3946
3947 is enabled, the match is performed without regard to the case
3948 of alphabetic characters.
3949 When a pattern is used for pathname expansion,
3950 the character
3951 <B>``.''</B>
3952
3953 at the start of a name or immediately following a slash
3954 must be matched explicitly, unless the shell option
3955 <B>dotglob</B>
3956
3957 is set.
3958 When matching a pathname, the slash character must always be
3959 matched explicitly.
3960 In other cases, the
3961 <B>``.''</B>
3962
3963 character is not treated specially.
3964 See the description of
3965 <B>shopt</B>
3966
3967 below under
3968 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
3969
3970 </FONT>
3971 for a description of the
3972 <B>nocaseglob</B>,
3973
3974 <B>nullglob</B>,
3975
3976 <B>failglob</B>,
3977
3978 and
3979 <B>dotglob</B>
3980
3981 shell options.
3982 <P>
3983
3984 The
3985 <FONT SIZE=-1><B>GLOBIGNORE</B>
3986
3987 </FONT>
3988 shell variable may be used to restrict the set of file names matching a
3989 <I>pattern</I>.
3990
3991 If
3992 <FONT SIZE=-1><B>GLOBIGNORE</B>
3993
3994 </FONT>
3995 is set, each matching file name that also matches one of the patterns in
3996 <FONT SIZE=-1><B>GLOBIGNORE</B>
3997
3998 </FONT>
3999 is removed from the list of matches.
4000 The file names
4001 <B>``.''</B>
4002
4003 and
4004 <B>``..''</B>
4005
4006 are always ignored when
4007 <FONT SIZE=-1><B>GLOBIGNORE</B>
4008
4009 </FONT>
4010 is set and not null. However, setting
4011 <FONT SIZE=-1><B>GLOBIGNORE</B>
4012
4013 </FONT>
4014 to a non-null value has the effect of enabling the
4015 <B>dotglob</B>
4016
4017 shell option, so all other file names beginning with a
4018 <B>``.''</B>
4019
4020 will match.
4021 To get the old behavior of ignoring file names beginning with a
4022 <B>``.''</B>,
4023
4024 make
4025 <B>``.*''</B>
4026
4027 one of the patterns in
4028 <FONT SIZE=-1><B>GLOBIGNORE</B>.
4029
4030 </FONT>
4031 The
4032 <B>dotglob</B>
4033
4034 option is disabled when
4035 <FONT SIZE=-1><B>GLOBIGNORE</B>
4036
4037 </FONT>
4038 is unset.
4039 <P>
4040
4041 <B>Pattern Matching</B>
4042 <P>
4043
4044 Any character that appears in a pattern, other than the special pattern
4045 characters described below, matches itself. The NUL character may not
4046 occur in a pattern. A backslash escapes the following character; the
4047 escaping backslash is discarded when matching.
4048 The special pattern characters must be quoted if
4049 they are to be matched literally.
4050 <P>
4051
4052 The special pattern characters have the following meanings:
4053 <P>
4054
4055
4056 <DL COMPACT>
4057 <DT><B>*</B>
4058
4059 <DD>
4060 Matches any string, including the null string.
4061 When the <B>globstar</B> shell option is enabled, and <B>*</B> is used in
4062 a pathname expansion context, two adjacent <B>*</B>s used as a single
4063 pattern will match all files and zero or more directories and
4064 subdirectories.
4065 If followed by a <B>/</B>, two adjacent <B>*</B>s will match only directories
4066 and subdirectories.
4067 <DT><B>?</B>
4068
4069 <DD>
4070 Matches any single character.
4071 <DT><B>[...]</B>
4072
4073 <DD>
4074 Matches any one of the enclosed characters. A pair of characters
4075 separated by a hyphen denotes a
4076 <I>range expression</I>;
4077 any character that sorts between those two characters, inclusive,
4078 using the current locale's collating sequence and character set,
4079 is matched. If the first character following the
4080 <B>[</B>
4081
4082 is a
4083 <B>!</B>
4084
4085 or a
4086 <B>^</B>
4087
4088 then any character not enclosed is matched.
4089 The sorting order of characters in range expressions is determined by
4090 the current locale and the value of the
4091 <FONT SIZE=-1><B>LC_COLLATE</B>
4092
4093 </FONT>
4094 shell variable,
4095 if set.
4096 A
4097 <B>-</B>
4098
4099 may be matched by including it as the first or last character
4100 in the set.
4101 A
4102 <B>]</B>
4103
4104 may be matched by including it as the first character
4105 in the set.
4106 <BR>
4107
4108 <P>
4109
4110
4111 Within
4112 <B>[</B>
4113
4114 and
4115 <B>]</B>,
4116
4117 <I>character classes</I> can be specified using the syntax
4118 <B>[:</B><I>class</I><B>:]</B>, where <I>class</I> is one of the
4119 following classes defined in the POSIX standard:
4120 </DL>
4121 <P>
4122
4123 <DL COMPACT><DT><DD>
4124 <B>
4125 </B>
4126
4127 alnum alpha ascii blank cntrl digit graph lower print punct space upper word xdigit
4128 <BR>
4129
4130 A character class matches any character belonging to that class.
4131 The <B>word</B> character class matches letters, digits, and the character _.
4132 <BR>
4133
4134 <P>
4135
4136
4137 Within
4138 <B>[</B>
4139
4140 and
4141 <B>]</B>,
4142
4143 an <I>equivalence class</I> can be specified using the syntax
4144 <B>[=</B><I>c</I><B>=]</B>, which matches all characters with the
4145 same collation weight (as defined by the current locale) as
4146 the character <I>c</I>.
4147 <BR>
4148
4149 <P>
4150
4151
4152 Within
4153 <B>[</B>
4154
4155 and
4156 <B>]</B>,
4157
4158 the syntax <B>[.</B><I>symbol</I><B>.]</B> matches the collating symbol
4159 <I>symbol</I>.
4160 </DL>
4161
4162
4163 <P>
4164
4165 If the <B>extglob</B> shell option is enabled using the <B>shopt</B>
4166 builtin, several extended pattern matching operators are recognized.
4167 In the following description, a <I>pattern-list</I> is a list of one
4168 or more patterns separated by a <B>|</B>.
4169 Composite patterns may be formed using one or more of the following
4170 sub-patterns:
4171 <P>
4172
4173 <DL COMPACT><DT><DD>
4174 <DL COMPACT>
4175 <DT><B>?(</B><I>pattern-list</I><B>)</B><DD>
4176 Matches zero or one occurrence of the given patterns
4177 <DT><B>*(</B><I>pattern-list</I><B>)</B><DD>
4178 Matches zero or more occurrences of the given patterns
4179 <DT><B>+(</B><I>pattern-list</I><B>)</B><DD>
4180 Matches one or more occurrences of the given patterns
4181 <DT><B>@(</B><I>pattern-list</I><B>)</B><DD>
4182 Matches one of the given patterns
4183 <DT><B>!(</B><I>pattern-list</I><B>)</B><DD>
4184 Matches anything except one of the given patterns
4185 </DL></DL>
4186
4187
4188 <A NAME="lbBH">&nbsp;</A>
4189 <H4>Quote Removal</H4>
4190
4191 <P>
4192
4193 After the preceding expansions, all unquoted occurrences of the
4194 characters
4195 <B>\</B>,
4196
4197 <B>aq</B>,
4198
4199 and <B>&quot;</B> that did not result from one of the above
4200 expansions are removed.
4201 <A NAME="lbBI">&nbsp;</A>
4202 <H3>REDIRECTION</H3>
4203
4204 Before a command is executed, its input and output
4205 may be
4206 <I>redirected</I>
4207
4208 using a special notation interpreted by the shell.
4209 Redirection may also be used to open and close files for the
4210 current shell execution environment. The following redirection
4211 operators may precede or appear anywhere within a
4212 <I>simple command</I>
4213
4214 or may follow a
4215 <I>command</I>.
4216
4217 Redirections are processed in the order they appear, from
4218 left to right.
4219 <P>
4220
4221 Each redirection that may be preceded by a file descriptor number
4222 may instead be preceded by a word of the form {<I>varname</I>}.
4223 In this case, for each redirection operator except
4224 &gt;&amp;- and &lt;&amp;-, the shell will allocate a file descriptor greater
4225 than 10 and assign it to <I>varname</I>. If &gt;&amp;- or &lt;&amp;- is preceded
4226 by {<I>varname</I>}, the value of <I>varname</I> defines the file
4227 descriptor to close.
4228 <P>
4229
4230 In the following descriptions, if the file descriptor number is
4231 omitted, and the first character of the redirection operator is
4232 <B>&lt;</B>,
4233
4234 the redirection refers to the standard input (file descriptor
4235 0). If the first character of the redirection operator is
4236 <B>&gt;</B>,
4237
4238 the redirection refers to the standard output (file descriptor
4239 1).
4240 <P>
4241
4242 The word following the redirection operator in the following
4243 descriptions, unless otherwise noted, is subjected to brace expansion,
4244 tilde expansion, parameter expansion, command substitution, arithmetic
4245 expansion, quote removal, pathname expansion, and word splitting.
4246 If it expands to more than one word,
4247 <B>bash</B>
4248
4249 reports an error.
4250 <P>
4251
4252 Note that the order of redirections is significant. For example,
4253 the command
4254 <DL COMPACT><DT><DD>
4255 <P>
4256
4257 ls <B>&gt;</B> dirlist 2<B>&gt;&amp;</B>1
4258 </DL>
4259
4260 <P>
4261
4262 directs both standard output and standard error to the file
4263 <I>dirlist</I>,
4264
4265 while the command
4266 <DL COMPACT><DT><DD>
4267 <P>
4268
4269 ls 2<B>&gt;&amp;</B>1 <B>&gt;</B> dirlist
4270 </DL>
4271
4272 <P>
4273
4274 directs only the standard output to file
4275 <I>dirlist</I>,
4276
4277 because the standard error was duplicated from the standard output
4278 before the standard output was redirected to
4279 <I>dirlist</I>.
4280
4281 <P>
4282
4283 <B>Bash</B> handles several filenames specially when they are used in
4284 redirections, as described in the following table:
4285 <DL COMPACT><DT><DD>
4286 <P>
4287
4288
4289 <DL COMPACT>
4290 <DT><B>/dev/fd/</B><I>fd</I>
4291
4292 <DD>
4293 If <I>fd</I> is a valid integer, file descriptor <I>fd</I> is duplicated.
4294 <DT><B>/dev/stdin</B>
4295
4296 <DD>
4297 File descriptor 0 is duplicated.
4298 <DT><B>/dev/stdout</B>
4299
4300 <DD>
4301 File descriptor 1 is duplicated.
4302 <DT><B>/dev/stderr</B>
4303
4304 <DD>
4305 File descriptor 2 is duplicated.
4306 <DT><B>/dev/tcp/</B><I>host</I>/<I>port</I>
4307
4308 <DD>
4309 If <I>host</I> is a valid hostname or Internet address, and <I>port</I>
4310 is an integer port number or service name, <B>bash</B> attempts to open
4311 a TCP connection to the corresponding socket.
4312 <DT><B>/dev/udp/</B><I>host</I>/<I>port</I>
4313
4314 <DD>
4315 If <I>host</I> is a valid hostname or Internet address, and <I>port</I>
4316 is an integer port number or service name, <B>bash</B> attempts to open
4317 a UDP connection to the corresponding socket.
4318
4319 </DL></DL>
4320
4321 <P>
4322
4323 A failure to open or create a file causes the redirection to fail.
4324 <P>
4325
4326 Redirections using file descriptors greater than 9 should be used with
4327 care, as they may conflict with file descriptors the shell uses
4328 internally.
4329 <A NAME="lbBJ">&nbsp;</A>
4330 <H4>Redirecting Input</H4>
4331
4332 <P>
4333
4334 Redirection of input causes the file whose name results from
4335 the expansion of
4336 <I>word</I>
4337
4338 to be opened for reading on file descriptor
4339 <I>n</I>,
4340
4341 or the standard input (file descriptor 0) if
4342 <I>n</I>
4343
4344 is not specified.
4345 <P>
4346
4347 The general format for redirecting input is:
4348 <DL COMPACT><DT><DD>
4349 <P>
4350
4351 [<I>n</I>]<B>&lt;</B><I>word</I>
4352 </DL>
4353
4354 <A NAME="lbBK">&nbsp;</A>
4355 <H4>Redirecting Output</H4>
4356
4357 <P>
4358
4359 Redirection of output causes the file whose name results from
4360 the expansion of
4361 <I>word</I>
4362
4363 to be opened for writing on file descriptor
4364 <I>n</I>,
4365
4366 or the standard output (file descriptor 1) if
4367 <I>n</I>
4368
4369 is not specified. If the file does not exist it is created;
4370 if it does exist it is truncated to zero size.
4371 <P>
4372
4373 The general format for redirecting output is:
4374 <DL COMPACT><DT><DD>
4375 <P>
4376
4377 [<I>n</I>]<B>&gt;</B><I>word</I>
4378 </DL>
4379
4380 <P>
4381
4382 If the redirection operator is
4383 <B>&gt;</B>,
4384
4385 and the
4386 <B>noclobber</B>
4387
4388 option to the
4389 <B>set</B>
4390
4391 builtin has been enabled, the redirection will fail if the file
4392 whose name results from the expansion of <I>word</I> exists and is
4393 a regular file.
4394 If the redirection operator is
4395 <B>&gt;|</B>,
4396
4397 or the redirection operator is
4398 <B>&gt;</B>
4399
4400 and the
4401 <B>noclobber</B>
4402
4403 option to the
4404 <B>set</B>
4405
4406 builtin command is not enabled, the redirection is attempted even
4407 if the file named by <I>word</I> exists.
4408 <A NAME="lbBL">&nbsp;</A>
4409 <H4>Appending Redirected Output</H4>
4410
4411 <P>
4412
4413 Redirection of output in this fashion
4414 causes the file whose name results from
4415 the expansion of
4416 <I>word</I>
4417
4418 to be opened for appending on file descriptor
4419 <I>n</I>,
4420
4421 or the standard output (file descriptor 1) if
4422 <I>n</I>
4423
4424 is not specified. If the file does not exist it is created.
4425 <P>
4426
4427 The general format for appending output is:
4428 <DL COMPACT><DT><DD>
4429 <P>
4430
4431 [<I>n</I>]<B>&gt;&gt;</B><I>word</I>
4432 </DL>
4433
4434 <P>
4435
4436 <A NAME="lbBM">&nbsp;</A>
4437 <H4>Redirecting Standard Output and Standard Error</H4>
4438
4439 <P>
4440
4441 This construct allows both the
4442 standard output (file descriptor 1) and
4443 the standard error output (file descriptor 2)
4444 to be redirected to the file whose name is the
4445 expansion of
4446 <I>word</I>.
4447
4448 <P>
4449
4450 There are two formats for redirecting standard output and
4451 standard error:
4452 <DL COMPACT><DT><DD>
4453 <P>
4454
4455 <B>&amp;&gt;</B><I>word</I>
4456 </DL>
4457
4458 and
4459 <DL COMPACT><DT><DD>
4460 <B>&gt;&amp;</B><I>word</I>
4461 </DL>
4462
4463 <P>
4464
4465 Of the two forms, the first is preferred.
4466 This is semantically equivalent to
4467 <DL COMPACT><DT><DD>
4468 <P>
4469
4470 <B>&gt;</B><I>word</I> 2<B>&gt;&amp;</B>1
4471 </DL>
4472
4473 <P>
4474
4475 <A NAME="lbBN">&nbsp;</A>
4476 <H4>Appending Standard Output and Standard Error</H4>
4477
4478 <P>
4479
4480 This construct allows both the
4481 standard output (file descriptor 1) and
4482 the standard error output (file descriptor 2)
4483 to be appended to the file whose name is the
4484 expansion of
4485 <I>word</I>.
4486
4487 <P>
4488
4489 The format for appending standard output and standard error is:
4490 <DL COMPACT><DT><DD>
4491 <P>
4492
4493 <B>&amp;&gt;&gt;</B><I>word</I>
4494 </DL>
4495
4496 <P>
4497
4498 This is semantically equivalent to
4499 <DL COMPACT><DT><DD>
4500 <P>
4501
4502 <B>&gt;&gt;</B><I>word</I> 2<B>&gt;&amp;</B>1
4503 </DL>
4504
4505 <A NAME="lbBO">&nbsp;</A>
4506 <H4>Here Documents</H4>
4507
4508 <P>
4509
4510 This type of redirection instructs the shell to read input from the
4511 current source until a line containing only
4512 <I>delimiter</I>
4513
4514 (with no trailing blanks)
4515 is seen. All of
4516 the lines read up to that point are then used as the standard
4517 input for a command.
4518 <P>
4519
4520 The format of here-documents is:
4521 <DL COMPACT><DT><DD>
4522 <P>
4523
4524 <PRE>
4525 <B>&lt;&lt;</B>[<B>-</B>]<I>word</I>
4526 <I>here-document</I>
4527 <I>delimiter</I>
4528 </PRE>
4529
4530 </DL>
4531
4532 <P>
4533
4534 No parameter expansion, command substitution, arithmetic expansion,
4535 or pathname expansion is performed on
4536 <I>word</I>.
4537
4538 If any characters in
4539 <I>word</I>
4540
4541 are quoted, the
4542 <I>delimiter</I>
4543
4544 is the result of quote removal on
4545 <I>word</I>,
4546
4547 and the lines in the here-document are not expanded.
4548 If <I>word</I> is unquoted,
4549 all lines of the here-document are subjected to parameter expansion,
4550 command substitution, and arithmetic expansion. In the latter
4551 case, the character sequence
4552 <B>\&lt;newline&gt;</B>
4553
4554 is ignored, and
4555 <B>\</B>
4556
4557 must be used to quote the characters
4558 <B>\</B>,
4559
4560 <B>$</B>,
4561
4562 and
4563 <B>`</B>.
4564
4565 <P>
4566
4567 If the redirection operator is
4568 <B>&lt;&lt;-</B>,
4569
4570 then all leading tab characters are stripped from input lines and the
4571 line containing
4572 <I>delimiter</I>.
4573
4574 This allows
4575 here-documents within shell scripts to be indented in a
4576 natural fashion.
4577 <A NAME="lbBP">&nbsp;</A>
4578 <H4>Here Strings</H4>
4579
4580 A variant of here documents, the format is:
4581 <DL COMPACT><DT><DD>
4582 <P>
4583
4584 <PRE>
4585 <B>&lt;&lt;&lt;</B><I>word</I>
4586 </PRE>
4587
4588 </DL>
4589
4590 <P>
4591
4592 The <I>word</I> is expanded and supplied to the command on its standard
4593 input.
4594 <A NAME="lbBQ">&nbsp;</A>
4595 <H4>Duplicating File Descriptors</H4>
4596
4597 <P>
4598
4599 The redirection operator
4600 <DL COMPACT><DT><DD>
4601 <P>
4602
4603 [<I>n</I>]<B>&lt;&amp;</B><I>word</I>
4604 </DL>
4605
4606 <P>
4607
4608 is used to duplicate input file descriptors.
4609 If
4610 <I>word</I>
4611
4612 expands to one or more digits, the file descriptor denoted by
4613 <I>n</I>
4614
4615 is made to be a copy of that file descriptor.
4616 If the digits in
4617 <I>word</I>
4618
4619 do not specify a file descriptor open for input, a redirection error occurs.
4620 If
4621 <I>word</I>
4622
4623 evaluates to
4624 <B>-</B>,
4625
4626 file descriptor
4627 <I>n</I>
4628
4629 is closed. If
4630 <I>n</I>
4631
4632 is not specified, the standard input (file descriptor 0) is used.
4633 <P>
4634
4635 The operator
4636 <DL COMPACT><DT><DD>
4637 <P>
4638
4639 [<I>n</I>]<B>&gt;&amp;</B><I>word</I>
4640 </DL>
4641
4642 <P>
4643
4644 is used similarly to duplicate output file descriptors. If
4645 <I>n</I>
4646
4647 is not specified, the standard output (file descriptor 1) is used.
4648 If the digits in
4649 <I>word</I>
4650
4651 do not specify a file descriptor open for output, a redirection error occurs.
4652 As a special case, if <I>n</I> is omitted, and <I>word</I> does not
4653 expand to one or more digits, the standard output and standard
4654 error are redirected as described previously.
4655 <A NAME="lbBR">&nbsp;</A>
4656 <H4>Moving File Descriptors</H4>
4657
4658 <P>
4659
4660 The redirection operator
4661 <DL COMPACT><DT><DD>
4662 <P>
4663
4664 [<I>n</I>]<B>&lt;&amp;</B><I>digit</I><B>-</B>
4665 </DL>
4666
4667 <P>
4668
4669 moves the file descriptor <I>digit</I> to file descriptor
4670 <I>n</I>,
4671
4672 or the standard input (file descriptor 0) if <I>n</I> is not specified.
4673 <I>digit</I> is closed after being duplicated to <I>n</I>.
4674 <P>
4675
4676 Similarly, the redirection operator
4677 <DL COMPACT><DT><DD>
4678 <P>
4679
4680 [<I>n</I>]<B>&gt;&amp;</B><I>digit</I><B>-</B>
4681 </DL>
4682
4683 <P>
4684
4685 moves the file descriptor <I>digit</I> to file descriptor
4686 <I>n</I>,
4687
4688 or the standard output (file descriptor 1) if <I>n</I> is not specified.
4689 <A NAME="lbBS">&nbsp;</A>
4690 <H4>Opening File Descriptors for Reading and Writing</H4>
4691
4692 <P>
4693
4694 The redirection operator
4695 <DL COMPACT><DT><DD>
4696 <P>
4697
4698 [<I>n</I>]<B>&lt;&gt;</B><I>word</I>
4699 </DL>
4700
4701 <P>
4702
4703 causes the file whose name is the expansion of
4704 <I>word</I>
4705
4706 to be opened for both reading and writing on file descriptor
4707 <I>n</I>,
4708
4709 or on file descriptor 0 if
4710 <I>n</I>
4711
4712 is not specified. If the file does not exist, it is created.
4713 <A NAME="lbBT">&nbsp;</A>
4714 <H3>ALIASES</H3>
4715
4716 <I>Aliases</I> allow a string to be substituted for a word when it is used
4717 as the first word of a simple command.
4718 The shell maintains a list of aliases that may be set and unset with the
4719 <B>alias</B>
4720
4721 and
4722 <B>unalias</B>
4723
4724 builtin commands (see
4725 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
4726
4727 </FONT>
4728 below).
4729 The first word of each simple command, if unquoted,
4730 is checked to see if it has an
4731 alias. If so, that word is replaced by the text of the alias.
4732 The characters <B>/</B>, <B>$</B>, <B>`</B>, and <B>=</B> and
4733 any of the shell <I>metacharacters</I> or quoting characters
4734 listed above may not appear in an alias name.
4735 The replacement text may contain any valid shell input,
4736 including shell metacharacters.
4737 The first word of the replacement text is tested
4738 for aliases, but a word that is identical to an alias being expanded
4739 is not expanded a second time.
4740 This means that one may alias
4741 <B>ls</B>
4742
4743 to
4744 <B>ls -F</B>,
4745
4746 for instance, and
4747 <B>bash</B>
4748
4749 does not try to recursively expand the replacement text.
4750 If the last character of the alias value is a
4751 <I>blank</I>,
4752
4753 then the next command
4754 word following the alias is also checked for alias expansion.
4755 <P>
4756
4757 Aliases are created and listed with the
4758 <B>alias</B>
4759
4760 command, and removed with the
4761 <B>unalias</B>
4762
4763 command.
4764 <P>
4765
4766 There is no mechanism for using arguments in the replacement text.
4767 If arguments are needed, a shell function should be used (see
4768 <FONT SIZE=-1><B>FUNCTIONS</B>
4769
4770 </FONT>
4771 below).
4772 <P>
4773
4774 Aliases are not expanded when the shell is not interactive, unless
4775 the
4776 <B>expand_aliases</B>
4777
4778 shell option is set using
4779 <B>shopt</B>
4780
4781 (see the description of
4782 <B>shopt</B>
4783
4784 under
4785 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B></FONT>
4786 below).
4787 <P>
4788
4789 The rules concerning the definition and use of aliases are
4790 somewhat confusing.
4791 <B>Bash</B>
4792
4793 always reads at least one complete line
4794 of input before executing any
4795 of the commands on that line. Aliases are expanded when a
4796 command is read, not when it is executed. Therefore, an
4797 alias definition appearing on the same line as another
4798 command does not take effect until the next line of input is read.
4799 The commands following the alias definition
4800 on that line are not affected by the new alias.
4801 This behavior is also an issue when functions are executed.
4802 Aliases are expanded when a function definition is read,
4803 not when the function is executed, because a function definition
4804 is itself a compound command. As a consequence, aliases
4805 defined in a function are not available until after that
4806 function is executed. To be safe, always put
4807 alias definitions on a separate line, and do not use
4808 <B>alias</B>
4809
4810 in compound commands.
4811 <P>
4812
4813 For almost every purpose, aliases are superseded by
4814 shell functions.
4815 <A NAME="lbBU">&nbsp;</A>
4816 <H3>FUNCTIONS</H3>
4817
4818 A shell function, defined as described above under
4819 <FONT SIZE=-1><B>SHELL GRAMMAR</B>,
4820
4821 </FONT>
4822 stores a series of commands for later execution.
4823 When the name of a shell function is used as a simple command name,
4824 the list of commands associated with that function name is executed.
4825 Functions are executed in the context of the
4826 current shell; no new process is created to interpret
4827 them (contrast this with the execution of a shell script).
4828 When a function is executed, the arguments to the
4829 function become the positional parameters
4830 during its execution.
4831 The special parameter
4832 <B>#</B>
4833
4834 is updated to reflect the change. Special parameter 0
4835 is unchanged.
4836 The first element of the
4837 <FONT SIZE=-1><B>FUNCNAME</B>
4838
4839 </FONT>
4840 variable is set to the name of the function while the function
4841 is executing.
4842 <P>
4843
4844 All other aspects of the shell execution
4845 environment are identical between a function and its caller
4846 with these exceptions: the
4847 <FONT SIZE=-1><B>DEBUG</B>
4848
4849 </FONT>
4850 and
4851 <B>RETURN</B>
4852
4853 traps (see the description of the
4854 <B>trap</B>
4855
4856 builtin under
4857 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
4858
4859 </FONT>
4860 below) are not inherited unless the function has been given the
4861 <B>trace</B> attribute (see the description of the
4862 <FONT SIZE=-1><B>declare</B>
4863
4864 </FONT>
4865 builtin below) or the
4866 <B>-o functrace</B> shell option has been enabled with
4867 the <B>set</B> builtin
4868 (in which case all functions inherit the <B>DEBUG</B> and <B>RETURN</B> traps),
4869 and the
4870 <FONT SIZE=-1><B>ERR</B>
4871
4872 </FONT>
4873 trap is not inherited unless the <B>-o errtrace</B> shell option has
4874 been enabled.
4875 <P>
4876
4877 Variables local to the function may be declared with the
4878 <B>local</B>
4879
4880 builtin command. Ordinarily, variables and their values
4881 are shared between the function and its caller.
4882 <P>
4883
4884 If the builtin command
4885 <B>return</B>
4886
4887 is executed in a function, the function completes and
4888 execution resumes with the next command after the function
4889 call.
4890 Any command associated with the <B>RETURN</B> trap is executed
4891 before execution resumes.
4892 When a function completes, the values of the
4893 positional parameters and the special parameter
4894 <B>#</B>
4895
4896 are restored to the values they had prior to the function's
4897 execution.
4898 <P>
4899
4900 Function names and definitions may be listed with the
4901 <B>-f</B>
4902
4903 option to the
4904 <B>declare</B>
4905
4906 or
4907 <B>typeset</B>
4908
4909 builtin commands. The
4910 <B>-F</B>
4911
4912 option to
4913 <B>declare</B>
4914
4915 or
4916 <B>typeset</B>
4917
4918 will list the function names only
4919 (and optionally the source file and line number, if the <B>extdebug</B>
4920 shell option is enabled).
4921 Functions may be exported so that subshells
4922 automatically have them defined with the
4923 <B>-f</B>
4924
4925 option to the
4926 <B>export</B>
4927
4928 builtin.
4929 A function definition may be deleted using the <B>-f</B> option to
4930 the
4931 <B>unset</B>
4932
4933 builtin.
4934 Note that shell functions and variables with the same name may result
4935 in multiple identically-named entries in the environment passed to the
4936 shell's children.
4937 Care should be taken in cases where this may cause a problem.
4938 <P>
4939
4940 Functions may be recursive. No limit is imposed on the number
4941 of recursive calls.
4942 <A NAME="lbBV">&nbsp;</A>
4943 <H3>ARITHMETIC EVALUATION</H3>
4944
4945 The shell allows arithmetic expressions to be evaluated, under
4946 certain circumstances (see the <B>let</B> and <B>declare</B> builtin
4947 commands and <B>Arithmetic Expansion</B>).
4948 Evaluation is done in fixed-width integers with no check for overflow,
4949 though division by 0 is trapped and flagged as an error.
4950 The operators and their precedence, associativity, and values
4951 are the same as in the C language.
4952 The following list of operators is grouped into levels of
4953 equal-precedence operators.
4954 The levels are listed in order of decreasing precedence.
4955 <P>
4956
4957
4958 <DL COMPACT>
4959 <DT><B></B><I>id</I>++ <I>id</I>--
4960
4961 <DD>
4962 variable post-increment and post-decrement
4963 <DT><B>++</B><I>id</I> --<I>id</I>
4964
4965 <DD>
4966 variable pre-increment and pre-decrement
4967 <DT><B>- +</B>
4968
4969 <DD>
4970 unary minus and plus
4971 <DT><B>! ~</B>
4972
4973 <DD>
4974 logical and bitwise negation
4975 <DT><B>**</B>
4976
4977 <DD>
4978 exponentiation
4979 <DT><B>* / %</B>
4980
4981 <DD>
4982 multiplication, division, remainder
4983 <DT><B>+ -</B>
4984
4985 <DD>
4986 addition, subtraction
4987 <DT><B>&lt;&lt; &gt;&gt;</B>
4988
4989 <DD>
4990 left and right bitwise shifts
4991 <DT><B>&lt;= &gt;= &lt; &gt;</B>
4992
4993 <DD>
4994 comparison
4995 <DT><B>== !=</B>
4996
4997 <DD>
4998 equality and inequality
4999 <DT><B>&amp;</B>
5000
5001 <DD>
5002 bitwise AND
5003 <DT><B>^</B>
5004
5005 <DD>
5006 bitwise exclusive OR
5007 <DT><B>|</B>
5008
5009 <DD>
5010 bitwise OR
5011 <DT><B>&amp;&amp;</B>
5012
5013 <DD>
5014 logical AND
5015 <DT><B>||</B>
5016
5017 <DD>
5018 logical OR
5019 <DT><B></B><I>expr</I>?<I>expr</I>:<I>expr</I>
5020
5021 <DD>
5022 conditional operator
5023 <DT><B>= *= /= %= += -= &lt;&lt;= &gt;&gt;= &amp;= ^= |=</B>
5024
5025 <DD>
5026 assignment
5027 <DT><B></B><I>expr1</I> , <I>expr2</I>
5028
5029 <DD>
5030 comma
5031
5032 </DL>
5033 <P>
5034
5035 Shell variables are allowed as operands; parameter expansion is
5036 performed before the expression is evaluated.
5037 Within an expression, shell variables may also be referenced by name
5038 without using the parameter expansion syntax.
5039 A shell variable that is null or unset evaluates to 0 when referenced
5040 by name without using the parameter expansion syntax.
5041 The value of a variable is evaluated as an arithmetic expression
5042 when it is referenced, or when a variable which has been given the
5043 <I>integer</I> attribute using <B>declare -i</B> is assigned a value.
5044 A null value evaluates to 0.
5045 A shell variable need not have its integer attribute
5046 turned on to be used in an expression.
5047 <P>
5048
5049 Constants with a leading 0 are interpreted as octal numbers.
5050 A leading 0x or 0X denotes hexadecimal.
5051 Otherwise, numbers take the form [<I>base#</I>]n, where <I>base</I>
5052 is a decimal number between 2 and 64 representing the arithmetic
5053 base, and <I>n</I> is a number in that base.
5054 If <I>base#</I> is omitted, then base 10 is used.
5055 The digits greater than 9 are represented by the lowercase letters,
5056 the uppercase letters, @, and _, in that order.
5057 If <I>base</I> is less than or equal to 36, lowercase and uppercase
5058 letters may be used interchangeably to represent numbers between 10
5059 and 35.
5060 <P>
5061
5062 Operators are evaluated in order of precedence. Sub-expressions in
5063 parentheses are evaluated first and may override the precedence
5064 rules above.
5065 <A NAME="lbBW">&nbsp;</A>
5066 <H3>CONDITIONAL EXPRESSIONS</H3>
5067
5068 Conditional expressions are used by the <B>[[</B> compound command and
5069 the <B>test</B> and <B>[</B> builtin commands to test file attributes
5070 and perform string and arithmetic comparisons.
5071 Expressions are formed from the following unary or binary primaries.
5072 If any <I>file</I> argument to one of the primaries is of the form
5073 <I>/dev/fd/n</I>, then file descriptor <I>n</I> is checked.
5074 If the <I>file</I> argument to one of the primaries is one of
5075 <I>/dev/stdin</I>, <I>/dev/stdout</I>, or <I>/dev/stderr</I>, file
5076 descriptor 0, 1, or 2, respectively, is checked.
5077 <P>
5078
5079 Unless otherwise specified, primaries that operate on files follow symbolic
5080 links and operate on the target of the link, rather than the link itself.
5081 <P>
5082
5083
5084 When used with <B>[[</B>, The <B>&lt;</B> and <B>&gt;</B> operators sort
5085 lexicographically using the current locale.
5086 <P>
5087
5088 <DL COMPACT>
5089 <DT><B>-a </B><I>file</I>
5090
5091 <DD>
5092 True if <I>file</I> exists.
5093 <DT><B>-b </B><I>file</I>
5094
5095 <DD>
5096 True if <I>file</I> exists and is a block special file.
5097 <DT><B>-c </B><I>file</I>
5098
5099 <DD>
5100 True if <I>file</I> exists and is a character special file.
5101 <DT><B>-d </B><I>file</I>
5102
5103 <DD>
5104 True if <I>file</I> exists and is a directory.
5105 <DT><B>-e </B><I>file</I>
5106
5107 <DD>
5108 True if <I>file</I> exists.
5109 <DT><B>-f </B><I>file</I>
5110
5111 <DD>
5112 True if <I>file</I> exists and is a regular file.
5113 <DT><B>-g </B><I>file</I>
5114
5115 <DD>
5116 True if <I>file</I> exists and is set-group-id.
5117 <DT><B>-h </B><I>file</I>
5118
5119 <DD>
5120 True if <I>file</I> exists and is a symbolic link.
5121 <DT><B>-k </B><I>file</I>
5122
5123 <DD>
5124 True if <I>file</I> exists and its ``sticky'' bit is set.
5125 <DT><B>-p </B><I>file</I>
5126
5127 <DD>
5128 True if <I>file</I> exists and is a named pipe (FIFO).
5129 <DT><B>-r </B><I>file</I>
5130
5131 <DD>
5132 True if <I>file</I> exists and is readable.
5133 <DT><B>-s </B><I>file</I>
5134
5135 <DD>
5136 True if <I>file</I> exists and has a size greater than zero.
5137 <DT><B>-t </B><I>fd</I>
5138
5139 <DD>
5140 True if file descriptor
5141 <I>fd</I>
5142
5143 is open and refers to a terminal.
5144 <DT><B>-u </B><I>file</I>
5145
5146 <DD>
5147 True if <I>file</I> exists and its set-user-id bit is set.
5148 <DT><B>-w </B><I>file</I>
5149
5150 <DD>
5151 True if <I>file</I> exists and is writable.
5152 <DT><B>-x </B><I>file</I>
5153
5154 <DD>
5155 True if <I>file</I> exists and is executable.
5156 <DT><B>-G </B><I>file</I>
5157
5158 <DD>
5159 True if <I>file</I> exists and is owned by the effective group id.
5160 <DT><B>-L </B><I>file</I>
5161
5162 <DD>
5163 True if <I>file</I> exists and is a symbolic link.
5164 <DT><B>-N </B><I>file</I>
5165
5166 <DD>
5167 True if <I>file</I> exists and has been modified since it was last read.
5168 <DT><B>-O </B><I>file</I>
5169
5170 <DD>
5171 True if <I>file</I> exists and is owned by the effective user id.
5172 <DT><B>-S </B><I>file</I>
5173
5174 <DD>
5175 True if <I>file</I> exists and is a socket.
5176 <DT><I>file1</I> <B>-ef</B> <I>file2</I><DD>
5177 True if <I>file1</I> and <I>file2</I> refer to the same device and
5178 inode numbers.
5179 <DT><I>file1</I> -<B>nt</B> <I>file2</I><DD>
5180 True if <I>file1</I> is newer (according to modification date) than <I>file2</I>,
5181 or if <I>file1</I> exists and file2 does not.
5182 <DT><I>file1</I> -<B>ot</B> <I>file2</I><DD>
5183 True if <I>file1</I> is older than <I>file2</I>, or if <I>file2</I> exists
5184 and <I>file1</I> does not.
5185 <DT><B>-o </B><I>optname</I>
5186
5187 <DD>
5188 True if shell option
5189 <I>optname</I>
5190
5191 is enabled.
5192 See the list of options under the description of the
5193 <B>-o</B>
5194
5195 option to the
5196 <B>set</B>
5197
5198 builtin below.
5199 <DT><B>-z </B><I>string</I>
5200
5201 <DD>
5202 True if the length of <I>string</I> is zero.
5203 <DT><I>string</I><DD>
5204
5205 <DT><B>-n </B><I>string</I>
5206
5207 <DD>
5208
5209 True if the length of
5210 <I>string</I>
5211
5212 is non-zero.
5213 <DT><I>string1</I> <B>==</B> <I>string2</I><DD>
5214
5215 <DT><I>string1</I> <B>=</B> <I>string2</I><DD>
5216
5217 True if the strings are equal. <B>=</B> should be used
5218 with the <B>test</B> command for POSIX conformance.
5219 <DT><I>string1</I> <B>!=</B> <I>string2</I><DD>
5220 True if the strings are not equal.
5221 <DT><I>string1</I> <B>&lt;</B> <I>string2</I><DD>
5222 True if <I>string1</I> sorts before <I>string2</I> lexicographically.
5223 <DT><I>string1</I> <B>&gt;</B> <I>string2</I><DD>
5224 True if <I>string1</I> sorts after <I>string2</I> lexicographically.
5225 <DT><I>arg1</I> <B>OP</B> <I>arg2</I>
5226
5227 <DD>
5228 <FONT SIZE=-1><B>OP</B>
5229
5230 </FONT>
5231 is one of
5232 <B>-eq</B>,
5233
5234 <B>-ne</B>,
5235
5236 <B>-lt</B>,
5237
5238 <B>-le</B>,
5239
5240 <B>-gt</B>,
5241
5242 or
5243 <B>-ge</B>.
5244
5245 These arithmetic binary operators return true if <I>arg1</I>
5246 is equal to, not equal to, less than, less than or equal to,
5247 greater than, or greater than or equal to <I>arg2</I>, respectively.
5248 <I>Arg1</I>
5249
5250 and
5251 <I>arg2</I>
5252
5253 may be positive or negative integers.
5254
5255 </DL>
5256 <A NAME="lbBX">&nbsp;</A>
5257 <H3>SIMPLE COMMAND EXPANSION</H3>
5258
5259 When a simple command is executed, the shell performs the following
5260 expansions, assignments, and redirections, from left to right.
5261 <DL COMPACT>
5262 <DT>1.<DD>
5263 The words that the parser has marked as variable assignments (those
5264 preceding the command name) and redirections are saved for later
5265 processing.
5266 <DT>2.<DD>
5267 The words that are not variable assignments or redirections are
5268 expanded. If any words remain after expansion, the first word
5269 is taken to be the name of the command and the remaining words are
5270 the arguments.
5271 <DT>3.<DD>
5272 Redirections are performed as described above under
5273 <FONT SIZE=-1><B>REDIRECTION</B>.
5274
5275 </FONT>
5276 <DT>4.<DD>
5277 The text after the <B>=</B> in each variable assignment undergoes tilde
5278 expansion, parameter expansion, command substitution, arithmetic expansion,
5279 and quote removal before being assigned to the variable.
5280 </DL>
5281 <P>
5282
5283 If no command name results, the variable assignments affect the current
5284 shell environment. Otherwise, the variables are added to the environment
5285 of the executed command and do not affect the current shell environment.
5286 If any of the assignments attempts to assign a value to a readonly variable,
5287 an error occurs, and the command exits with a non-zero status.
5288 <P>
5289
5290 If no command name results, redirections are performed, but do not
5291 affect the current shell environment. A redirection error causes the
5292 command to exit with a non-zero status.
5293 <P>
5294
5295 If there is a command name left after expansion, execution proceeds as
5296 described below. Otherwise, the command exits. If one of the expansions
5297 contained a command substitution, the exit status of the command is
5298 the exit status of the last command substitution performed. If there
5299 were no command substitutions, the command exits with a status of zero.
5300 <A NAME="lbBY">&nbsp;</A>
5301 <H3>COMMAND EXECUTION</H3>
5302
5303 After a command has been split into words, if it results in a
5304 simple command and an optional list of arguments, the following
5305 actions are taken.
5306 <P>
5307
5308 If the command name contains no slashes, the shell attempts to
5309 locate it. If there exists a shell function by that name, that
5310 function is invoked as described above in
5311 <FONT SIZE=-1><B>FUNCTIONS</B>.
5312
5313 </FONT>
5314 If the name does not match a function, the shell searches for
5315 it in the list of shell builtins. If a match is found, that
5316 builtin is invoked.
5317 <P>
5318
5319 If the name is neither a shell function nor a builtin,
5320 and contains no slashes,
5321 <B>bash</B>
5322
5323 searches each element of the
5324 <FONT SIZE=-1><B>PATH</B>
5325
5326 </FONT>
5327 for a directory containing an executable file by that name.
5328 <B>Bash</B>
5329
5330 uses a hash table to remember the full pathnames of executable
5331 files (see
5332 <B>hash</B>
5333
5334 under
5335 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
5336
5337 </FONT>
5338 below).
5339 A full search of the directories in
5340 <FONT SIZE=-1><B>PATH</B>
5341
5342 </FONT>
5343 is performed only if the command is not found in the hash table.
5344 If the search is unsuccessful, the shell searches for a defined shell
5345 function named <B>command_not_found_handle</B>.
5346 If that function exists, it is invoked with the original command and
5347 the original command's arguments as its arguments, and the function's
5348 exit status becomes the exit status of the shell.
5349 If that function is not defined, the shell prints an error
5350 message and returns an exit status of 127.
5351 <P>
5352
5353 If the search is successful, or if the command name contains
5354 one or more slashes, the shell executes the named program in a
5355 separate execution environment.
5356 Argument 0 is set to the name given, and the remaining arguments
5357 to the command are set to the arguments given, if any.
5358 <P>
5359
5360 If this execution fails because the file is not in executable
5361 format, and the file is not a directory, it is assumed to be
5362 a <I>shell script</I>, a file
5363 containing shell commands. A subshell is spawned to execute
5364 it. This subshell reinitializes itself, so
5365 that the effect is as if a new shell had been invoked
5366 to handle the script, with the exception that the locations of
5367 commands remembered by the parent (see
5368 <B>hash</B>
5369
5370 below under
5371 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>)</FONT>
5372 are retained by the child.
5373 <P>
5374
5375 If the program is a file beginning with
5376 <B>#!</B>,
5377
5378 the remainder of the first line specifies an interpreter
5379 for the program. The shell executes the
5380 specified interpreter on operating systems that do not
5381 handle this executable format themselves. The arguments to the
5382 interpreter consist of a single optional argument following the
5383 interpreter name on the first line of the program, followed
5384 by the name of the program, followed by the command
5385 arguments, if any.
5386 <A NAME="lbBZ">&nbsp;</A>
5387 <H3>COMMAND EXECUTION ENVIRONMENT</H3>
5388
5389 The shell has an <I>execution environment</I>, which consists of the
5390 following:
5391
5392 <DL COMPACT>
5393 <DT>*<DD>
5394 open files inherited by the shell at invocation, as modified by
5395 redirections supplied to the <B>exec</B> builtin
5396 <DT>*<DD>
5397 the current working directory as set by <B>cd</B>, <B>pushd</B>, or
5398 <B>popd</B>, or inherited by the shell at invocation
5399 <DT>*<DD>
5400 the file creation mode mask as set by <B>umask</B> or inherited from
5401 the shell's parent
5402 <DT>*<DD>
5403 current traps set by <B>trap</B>
5404 <DT>*<DD>
5405 shell parameters that are set by variable assignment or with <B>set</B>
5406 or inherited from the shell's parent in the environment
5407 <DT>*<DD>
5408 shell functions defined during execution or inherited from the shell's
5409 parent in the environment
5410 <DT>*<DD>
5411 options enabled at invocation (either by default or with command-line
5412 arguments) or by <B>set</B>
5413 <DT>*<DD>
5414 options enabled by <B>shopt</B>
5415 <DT>*<DD>
5416 shell aliases defined with <B>alias</B>
5417 <DT>*<DD>
5418 various process IDs, including those of background jobs, the value
5419 of <B>$$</B>, and the value of
5420 <FONT SIZE=-1><B>PPID</B>
5421
5422 </FONT>
5423 </DL>
5424 <P>
5425
5426 When a simple command other than a builtin or shell function
5427 is to be executed, it
5428 is invoked in a separate execution environment that consists of
5429 the following. Unless otherwise noted, the values are inherited
5430 from the shell.
5431
5432 <DL COMPACT>
5433 <DT>*<DD>
5434 the shell's open files, plus any modifications and additions specified
5435 by redirections to the command
5436 <DT>*<DD>
5437 the current working directory
5438 <DT>*<DD>
5439 the file creation mode mask
5440 <DT>*<DD>
5441 shell variables and functions marked for export, along with variables
5442 exported for the command, passed in the environment
5443 <DT>*<DD>
5444 traps caught by the shell are reset to the values inherited from the
5445 shell's parent, and traps ignored by the shell are ignored
5446 </DL>
5447 <P>
5448
5449 A command invoked in this separate environment cannot affect the
5450 shell's execution environment.
5451 <P>
5452
5453 Command substitution, commands grouped with parentheses,
5454 and asynchronous commands are invoked in a
5455 subshell environment that is a duplicate of the shell environment,
5456 except that traps caught by the shell are reset to the values
5457 that the shell inherited from its parent at invocation. Builtin
5458 commands that are invoked as part of a pipeline are also executed in a
5459 subshell environment. Changes made to the subshell environment
5460 cannot affect the shell's execution environment.
5461 <P>
5462
5463 Subshells spawned to execute command substitutions inherit the value of
5464 the <B>-e</B> option from the parent shell. When not in posix mode,
5465 Bash clears the <B>-e</B> option in such subshells.
5466 <P>
5467
5468 If a command is followed by a <B>&amp;</B> and job control is not active, the
5469 default standard input for the command is the empty file <I>/dev/null</I>.
5470 Otherwise, the invoked command inherits the file descriptors of the calling
5471 shell as modified by redirections.
5472 <A NAME="lbCA">&nbsp;</A>
5473 <H3>ENVIRONMENT</H3>
5474
5475 When a program is invoked it is given an array of strings
5476 called the
5477 <I>environment</I>.
5478
5479 This is a list of
5480 <I>name</I>-<I>value</I> pairs, of the form
5481 <I>name</I>=value.
5482
5483 <P>
5484
5485 The shell provides several ways to manipulate the environment.
5486 On invocation, the shell scans its own environment and
5487 creates a parameter for each name found, automatically marking
5488 it for
5489 <I>export</I>
5490
5491 to child processes. Executed commands inherit the environment.
5492 The
5493 <B>export</B>
5494
5495 and
5496 <B>declare -x</B>
5497
5498 commands allow parameters and functions to be added to and
5499 deleted from the environment. If the value of a parameter
5500 in the environment is modified, the new value becomes part
5501 of the environment, replacing the old. The environment
5502 inherited by any executed command consists of the shell's
5503 initial environment, whose values may be modified in the shell,
5504 less any pairs removed by the
5505 <B>unset</B>
5506
5507 command, plus any additions via the
5508 <B>export</B>
5509
5510 and
5511 <B>declare -x</B>
5512
5513 commands.
5514 <P>
5515
5516 The environment for any
5517 <I>simple command</I>
5518
5519 or function may be augmented temporarily by prefixing it with
5520 parameter assignments, as described above in
5521 <FONT SIZE=-1><B>PARAMETERS</B>.
5522
5523 </FONT>
5524 These assignment statements affect only the environment seen
5525 by that command.
5526 <P>
5527
5528 If the
5529 <B>-k</B>
5530
5531 option is set (see the
5532 <B>set</B>
5533
5534 builtin command below), then
5535 <I>all</I>
5536
5537 parameter assignments are placed in the environment for a command,
5538 not just those that precede the command name.
5539 <P>
5540
5541 When
5542 <B>bash</B>
5543
5544 invokes an external command, the variable
5545 <B>_</B>
5546
5547 is set to the full file name of the command and passed to that
5548 command in its environment.
5549 <A NAME="lbCB">&nbsp;</A>
5550 <H3>EXIT STATUS</H3>
5551
5552 <P>
5553
5554 The exit status of an executed command is the value returned by the
5555 <I>waitpid</I> system call or equivalent function. Exit statuses
5556 fall between 0 and 255, though, as explained below, the shell may
5557 use values above 125 specially. Exit statuses from shell builtins and
5558 compound commands are also limited to this range. Under certain
5559 circumstances, the shell will use special values to indicate specific
5560 failure modes.
5561 <P>
5562
5563 For the shell's purposes, a command which exits with a
5564 zero exit status has succeeded. An exit status of zero
5565 indicates success. A non-zero exit status indicates failure.
5566 When a command terminates on a fatal signal <I>N</I>, <B>bash</B> uses
5567 the value of 128+<I>N</I> as the exit status.
5568 <P>
5569
5570 If a command is not found, the child process created to
5571 execute it returns a status of 127. If a command is found
5572 but is not executable, the return status is 126.
5573 <P>
5574
5575 If a command fails because of an error during expansion or redirection,
5576 the exit status is greater than zero.
5577 <P>
5578
5579 Shell builtin commands return a status of 0 (<I>true</I>) if
5580 successful, and non-zero (<I>false</I>) if an error occurs
5581 while they execute.
5582 All builtins return an exit status of 2 to indicate incorrect usage.
5583 <P>
5584
5585 <B>Bash</B> itself returns the exit status of the last command
5586 executed, unless a syntax error occurs, in which case it exits
5587 with a non-zero value. See also the <B>exit</B> builtin
5588 command below.
5589 <A NAME="lbCC">&nbsp;</A>
5590 <H3>SIGNALS</H3>
5591
5592 When <B>bash</B> is interactive, in the absence of any traps, it ignores
5593 <FONT SIZE=-1><B>SIGTERM</B>
5594
5595 </FONT>
5596 (so that <B>kill 0</B> does not kill an interactive shell),
5597 and
5598 <FONT SIZE=-1><B>SIGINT</B>
5599
5600 </FONT>
5601 is caught and handled (so that the <B>wait</B> builtin is interruptible).
5602 In all cases, <B>bash</B> ignores
5603 <FONT SIZE=-1><B>SIGQUIT</B>.
5604
5605 </FONT>
5606 If job control is in effect,
5607 <B>bash</B>
5608
5609 ignores
5610 <FONT SIZE=-1><B>SIGTTIN</B>,
5611
5612 </FONT>
5613 <FONT SIZE=-1><B>SIGTTOU</B>,
5614
5615 </FONT>
5616 and
5617 <FONT SIZE=-1><B>SIGTSTP</B>.
5618
5619 </FONT>
5620 <P>
5621
5622 Non-builtin commands run by <B>bash</B> have signal handlers
5623 set to the values inherited by the shell from its parent.
5624 When job control is not in effect, asynchronous commands
5625 ignore
5626 <FONT SIZE=-1><B>SIGINT</B>
5627
5628 </FONT>
5629 and
5630 <FONT SIZE=-1><B>SIGQUIT</B>
5631
5632 </FONT>
5633 in addition to these inherited handlers.
5634 Commands run as a result of command substitution ignore the
5635 keyboard-generated job control signals
5636 <FONT SIZE=-1><B>SIGTTIN</B>,
5637
5638 </FONT>
5639 <FONT SIZE=-1><B>SIGTTOU</B>,
5640
5641 </FONT>
5642 and
5643 <FONT SIZE=-1><B>SIGTSTP</B>.
5644
5645 </FONT>
5646 <P>
5647
5648 The shell exits by default upon receipt of a
5649 <FONT SIZE=-1><B>SIGHUP</B>.
5650
5651 </FONT>
5652 Before exiting, an interactive shell resends the
5653 <FONT SIZE=-1><B>SIGHUP</B>
5654
5655 </FONT>
5656 to all jobs, running or stopped.
5657 Stopped jobs are sent
5658 <FONT SIZE=-1><B>SIGCONT</B>
5659
5660 </FONT>
5661 to ensure that they receive the
5662 <FONT SIZE=-1><B>SIGHUP</B>.
5663
5664 </FONT>
5665 To prevent the shell from
5666 sending the signal to a particular job, it should be removed from the
5667 jobs table with the
5668 <B>disown</B>
5669
5670 builtin (see
5671 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
5672
5673 </FONT>
5674 below) or marked
5675 to not receive
5676 <FONT SIZE=-1><B>SIGHUP</B>
5677
5678 </FONT>
5679 using
5680 <B>disown -h</B>.
5681
5682 <P>
5683
5684 If the
5685 <B>huponexit</B>
5686
5687 shell option has been set with
5688 <B>shopt</B>,
5689
5690 <B>bash</B>
5691
5692 sends a
5693 <FONT SIZE=-1><B>SIGHUP</B>
5694
5695 </FONT>
5696 to all jobs when an interactive login shell exits.
5697 <P>
5698
5699 If <B>bash</B> is waiting for a command to complete and receives a signal
5700 for which a trap has been set, the trap will not be executed until
5701 the command completes.
5702 When <B>bash</B> is waiting for an asynchronous command via the <B>wait</B>
5703 builtin, the reception of a signal for which a trap has been set will
5704 cause the <B>wait</B> builtin to return immediately with an exit status
5705 greater than 128, immediately after which the trap is executed.
5706 <A NAME="lbCD">&nbsp;</A>
5707 <H3>JOB CONTROL</H3>
5708
5709 <I>Job control</I>
5710
5711 refers to the ability to selectively stop (<I>suspend</I>)
5712 the execution of processes and continue (<I>resume</I>)
5713 their execution at a later point. A user typically employs
5714 this facility via an interactive interface supplied jointly
5715 by the operating system kernel's terminal driver and
5716 <B>bash</B>.
5717
5718 <P>
5719
5720 The shell associates a
5721 <I>job</I>
5722
5723 with each pipeline. It keeps a table of currently executing
5724 jobs, which may be listed with the
5725 <B>jobs</B>
5726
5727 command. When
5728 <B>bash</B>
5729
5730 starts a job asynchronously (in the
5731 <I>background</I>),
5732
5733 it prints a line that looks like:
5734 <DL COMPACT><DT><DD>
5735 <P>
5736
5737 [1] 25647
5738 </DL>
5739
5740 <P>
5741
5742 indicating that this job is job number 1 and that the process ID
5743 of the last process in the pipeline associated with this job is 25647.
5744 All of the processes in a single pipeline are members of the same job.
5745 <B>Bash</B>
5746
5747 uses the
5748 <I>job</I>
5749
5750 abstraction as the basis for job control.
5751 <P>
5752
5753 To facilitate the implementation of the user interface to job
5754 control, the operating system maintains the notion of a <I>current terminal
5755 process group ID</I>. Members of this process group (processes whose
5756 process group ID is equal to the current terminal process group ID)
5757 receive keyboard-generated signals such as
5758 <FONT SIZE=-1><B>SIGINT</B>.
5759
5760 </FONT>
5761 These processes are said to be in the
5762 <I>foreground</I>.
5763
5764 <I>Background</I>
5765
5766 processes are those whose process group ID differs from the terminal's;
5767 such processes are immune to keyboard-generated signals.
5768 Only foreground processes are allowed to read from or, if the
5769 user so specifies with <TT>stty tostop</TT>, write to the
5770 terminal.
5771 Background processes which attempt to read from (write to when
5772 <TT>stty tostop</TT> is in effect) the
5773 terminal are sent a
5774 <FONT SIZE=-1><B>SIGTTIN (SIGTTOU)</B>
5775
5776 </FONT>
5777 signal by the kernel's terminal driver,
5778 which, unless caught, suspends the process.
5779 <P>
5780
5781 If the operating system on which
5782 <B>bash</B>
5783
5784 is running supports
5785 job control,
5786 <B>bash</B>
5787
5788 contains facilities to use it.
5789 Typing the
5790 <I>suspend</I>
5791
5792 character (typically
5793 <B>^Z</B>,
5794
5795 Control-Z) while a process is running
5796 causes that process to be stopped and returns control to
5797 <B>bash</B>.
5798
5799 Typing the
5800 <I>delayed suspend</I>
5801
5802 character (typically
5803 <B>^Y</B>,
5804
5805 Control-Y) causes the process to be stopped when it
5806 attempts to read input from the terminal, and control to
5807 be returned to
5808 <B>bash</B>.
5809
5810 The user may then manipulate the state of this job, using the
5811 <B>bg</B>
5812
5813 command to continue it in the background, the
5814 <B>fg</B>
5815
5816 command to continue it in the foreground, or
5817 the
5818 <B>kill</B>
5819
5820 command to kill it. A <B>^Z</B> takes effect immediately,
5821 and has the additional side effect of causing pending output
5822 and typeahead to be discarded.
5823 <P>
5824
5825 There are a number of ways to refer to a job in the shell.
5826 The character
5827 <B>%</B>
5828
5829 introduces a job specification (<I>jobspec</I>). Job number
5830 <I>n</I>
5831
5832 may be referred to as
5833 <B>%n</B>.
5834
5835 A job may also be referred to using a prefix of the name used to
5836 start it, or using a substring that appears in its command line.
5837 For example,
5838 <B>%ce</B>
5839
5840 refers to a stopped
5841 <B>ce</B>
5842
5843 job. If a prefix matches more than one job,
5844 <B>bash</B>
5845
5846 reports an error. Using
5847 <B>%?ce</B>,
5848
5849 on the other hand, refers to any job containing the string
5850 <B>ce</B>
5851
5852 in its command line. If the substring matches more than one job,
5853 <B>bash</B>
5854
5855 reports an error. The symbols
5856 <B>%%</B>
5857
5858 and
5859 <B>%+</B>
5860
5861 refer to the shell's notion of the
5862 <I>current job</I>,
5863
5864 which is the last job stopped while it was in
5865 the foreground or started in the background.
5866 The
5867 <I>previous job</I>
5868
5869 may be referenced using
5870 <B>%-</B>.
5871
5872 If there is only a single job, <B>%+</B> and <B>%-</B> can both be used
5873 to refer to that job.
5874 In output pertaining to jobs (e.g., the output of the
5875 <B>jobs</B>
5876
5877 command), the current job is always flagged with a
5878 <B>+</B>,
5879
5880 and the previous job with a
5881 <B>-</B>.
5882
5883 A single % (with no accompanying job specification) also refers to the
5884 current job.
5885 <P>
5886
5887 Simply naming a job can be used to bring it into the
5888 foreground:
5889 <B>%1</B>
5890
5891 is a synonym for
5892 <B>``fg %1''</B>,
5893 bringing job 1 from the background into the foreground.
5894 Similarly,
5895 <B>``%1 &amp;''</B>
5896
5897 resumes job 1 in the background, equivalent to
5898 <B>``bg %1''</B>.
5899 <P>
5900
5901 The shell learns immediately whenever a job changes state.
5902 Normally,
5903 <B>bash</B>
5904
5905 waits until it is about to print a prompt before reporting
5906 changes in a job's status so as to not interrupt
5907 any other output. If the
5908 <B>-b</B>
5909
5910 option to the
5911 <B>set</B>
5912
5913 builtin command
5914 is enabled,
5915 <B>bash</B>
5916
5917 reports such changes immediately.
5918 Any trap on
5919 <FONT SIZE=-1><B>SIGCHLD</B>
5920
5921 </FONT>
5922 is executed for each child that exits.
5923 <P>
5924
5925 If an attempt to exit
5926 <B>bash</B>
5927
5928 is made while jobs are stopped (or, if the <B>checkjobs</B> shell option has
5929 been enabled using the <B>shopt</B> builtin, running), the shell prints a
5930 warning message, and, if the <B>checkjobs</B> option is enabled, lists the
5931 jobs and their statuses.
5932 The
5933 <B>jobs</B>
5934
5935 command may then be used to inspect their status.
5936 If a second attempt to exit is made without an intervening command,
5937 the shell does not print another warning, and any stopped
5938 jobs are terminated.
5939 <A NAME="lbCE">&nbsp;</A>
5940 <H3>PROMPTING</H3>
5941
5942 When executing interactively,
5943 <B>bash</B>
5944
5945 displays the primary prompt
5946 <FONT SIZE=-1><B>PS1</B>
5947
5948 </FONT>
5949 when it is ready to read a command, and the secondary prompt
5950 <FONT SIZE=-1><B>PS2</B>
5951
5952 </FONT>
5953 when it needs more input to complete a command.
5954 <B>Bash</B>
5955
5956 allows these prompt strings to be customized by inserting a number of
5957 backslash-escaped special characters that are decoded as follows:
5958 <DL COMPACT><DT><DD>
5959
5960 <DL COMPACT>
5961 <DT><B>\a</B>
5962
5963 <DD>
5964 an ASCII bell character (07)
5965 <DT><B>\d</B>
5966
5967 <DD>
5968 the date in &quot;Weekday Month Date&quot; format (e.g., &quot;Tue May 26&quot;)
5969 <DT><B>\D{</B><I>format</I>}
5970
5971 <DD>
5972 the <I>format</I> is passed to <I>strftime</I>(3) and the result is inserted
5973 into the prompt string; an empty <I>format</I> results in a locale-specific
5974 time representation. The braces are required
5975 <DT><B>\e</B>
5976
5977 <DD>
5978 an ASCII escape character (033)
5979 <DT><B>\h</B>
5980
5981 <DD>
5982 the hostname up to the first `.'
5983 <DT><B>\H</B>
5984
5985 <DD>
5986 the hostname
5987 <DT><B>\j</B>
5988
5989 <DD>
5990 the number of jobs currently managed by the shell
5991 <DT><B>\l</B>
5992
5993 <DD>
5994 the basename of the shell's terminal device name
5995 <DT><B>\n</B>
5996
5997 <DD>
5998 newline
5999 <DT><B>\r</B>
6000
6001 <DD>
6002 carriage return
6003 <DT><B>\s</B>
6004
6005 <DD>
6006 the name of the shell, the basename of
6007 <B>$0</B>
6008
6009 (the portion following the final slash)
6010 <DT><B>\t</B>
6011
6012 <DD>
6013 the current time in 24-hour HH:MM:SS format
6014 <DT><B>\T</B>
6015
6016 <DD>
6017 the current time in 12-hour HH:MM:SS format
6018 <DT><B>\@</B>
6019
6020 <DD>
6021 the current time in 12-hour am/pm format
6022 <DT><B>\A</B>
6023
6024 <DD>
6025 the current time in 24-hour HH:MM format
6026 <DT><B>\u</B>
6027
6028 <DD>
6029 the username of the current user
6030 <DT><B>\v</B>
6031
6032 <DD>
6033 the version of <B>bash</B> (e.g., 2.00)
6034 <DT><B>\V</B>
6035
6036 <DD>
6037 the release of <B>bash</B>, version + patch level (e.g., 2.00.0)
6038 <DT><B>\w</B>
6039
6040 <DD>
6041 the current working directory, with
6042 <FONT SIZE=-1><B>$HOME</B>
6043
6044 </FONT>
6045 abbreviated with a tilde
6046 (uses the value of the
6047 <FONT SIZE=-1><B>PROMPT_DIRTRIM</B>
6048
6049 </FONT>
6050 variable)
6051 <DT><B>\W</B>
6052
6053 <DD>
6054 the basename of the current working directory, with
6055 <FONT SIZE=-1><B>$HOME</B>
6056
6057 </FONT>
6058 abbreviated with a tilde
6059 <DT><B>\!</B>
6060
6061 <DD>
6062 the history number of this command
6063 <DT><B>\#</B>
6064
6065 <DD>
6066 the command number of this command
6067 <DT><B>\$</B>
6068
6069 <DD>
6070 if the effective UID is 0, a
6071 <B>#</B>,
6072
6073 otherwise a
6074 <B>$</B>
6075
6076 <DT><B>\</B><I>nnn</I>
6077
6078 <DD>
6079 the character corresponding to the octal number <I>nnn</I>
6080 <DT><B>\\</B>
6081
6082 <DD>
6083 a backslash
6084 <DT><B>\[</B>
6085
6086 <DD>
6087 begin a sequence of non-printing characters, which could be used to
6088 embed a terminal control sequence into the prompt
6089 <DT><B>\]</B>
6090
6091 <DD>
6092 end a sequence of non-printing characters
6093
6094 </DL></DL>
6095
6096 <P>
6097
6098 The command number and the history number are usually different:
6099 the history number of a command is its position in the history
6100 list, which may include commands restored from the history file
6101 (see
6102 <FONT SIZE=-1><B>HISTORY</B>
6103
6104 </FONT>
6105 below), while the command number is the position in the sequence
6106 of commands executed during the current shell session.
6107 After the string is decoded, it is expanded via
6108 parameter expansion, command substitution, arithmetic
6109 expansion, and quote removal, subject to the value of the
6110 <B>promptvars</B>
6111
6112 shell option (see the description of the
6113 <B>shopt</B>
6114
6115 command under
6116 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
6117
6118 </FONT>
6119 below).
6120 <A NAME="lbCF">&nbsp;</A>
6121 <H3>READLINE</H3>
6122
6123 This is the library that handles reading input when using an interactive
6124 shell, unless the
6125 <B>--noediting</B>
6126
6127 option is given at shell invocation.
6128 Line editing is also used when using the <B>-e</B> option to the
6129 <B>read</B> builtin.
6130 By default, the line editing commands are similar to those of emacs.
6131 A vi-style line editing interface is also available.
6132 Line editing can be enabled at any time using the
6133 <B>-o emacs</B>
6134
6135 or
6136 <B>-o vi</B>
6137
6138 options to the
6139 <B>set</B>
6140
6141 builtin (see
6142 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
6143
6144 </FONT>
6145 below).
6146 To turn off line editing after the shell is running, use the
6147 <B>+o emacs</B>
6148
6149 or
6150 <B>+o vi</B>
6151
6152 options to the
6153 <B>set</B>
6154
6155 builtin.
6156 <A NAME="lbCG">&nbsp;</A>
6157 <H4>Readline Notation</H4>
6158
6159 <P>
6160
6161 In this section, the emacs-style notation is used to denote
6162 keystrokes. Control keys are denoted by C-<I>key</I>, e.g., C-n
6163 means Control-N. Similarly,
6164 <I>meta</I>
6165
6166 keys are denoted by M-<I>key</I>, so M-x means Meta-X. (On keyboards
6167 without a
6168 <I>meta</I>
6169
6170 key, M-<I>x</I> means ESC <I>x</I>, i.e., press the Escape key
6171 then the
6172 <I>x</I>
6173
6174 key. This makes ESC the <I>meta prefix</I>.
6175 The combination M-C-<I>x</I> means ESC-Control-<I>x</I>,
6176 or press the Escape key
6177 then hold the Control key while pressing the
6178 <I>x</I>
6179
6180 key.)
6181 <P>
6182
6183 Readline commands may be given numeric
6184 <I>arguments</I>,
6185
6186 which normally act as a repeat count.
6187 Sometimes, however, it is the sign of the argument that is significant.
6188 Passing a negative argument to a command that acts in the forward
6189 direction (e.g., <B>kill-line</B>) causes that command to act in a
6190 backward direction.
6191 Commands whose behavior with arguments deviates from this are noted
6192 below.
6193 <P>
6194
6195 When a command is described as <I>killing</I> text, the text
6196 deleted is saved for possible future retrieval
6197 (<I>yanking</I>). The killed text is saved in a
6198 <I>kill ring</I>. Consecutive kills cause the text to be
6199 accumulated into one unit, which can be yanked all at once.
6200 Commands which do not kill text separate the chunks of text
6201 on the kill ring.
6202 <A NAME="lbCH">&nbsp;</A>
6203 <H4>Readline Initialization</H4>
6204
6205 <P>
6206
6207 Readline is customized by putting commands in an initialization
6208 file (the <I>inputrc</I> file).
6209 The name of this file is taken from the value of the
6210 <FONT SIZE=-1><B>INPUTRC</B>
6211
6212 </FONT>
6213 variable. If that variable is unset, the default is
6214 <A HREF="file:~/.inputrc"><I>~/.inputrc</I></A>.
6215
6216 When a program which uses the readline library starts up, the
6217 initialization file is read, and the key bindings and variables
6218 are set.
6219 There are only a few basic constructs allowed in the
6220 readline initialization file.
6221 Blank lines are ignored.
6222 Lines beginning with a <B>#</B> are comments.
6223 Lines beginning with a <B>$</B> indicate conditional constructs.
6224 Other lines denote key bindings and variable settings.
6225 <P>
6226
6227 The default key-bindings may be changed with an
6228 <I>inputrc </I>
6229
6230 file.
6231 Other programs that use this library may add their own commands
6232 and bindings.
6233 <P>
6234
6235 For example, placing
6236 <DL COMPACT><DT><DD>
6237 <P>
6238
6239 M-Control-u: universal-argument
6240 </DL>
6241
6242 or
6243 <DL COMPACT><DT><DD>
6244 C-Meta-u: universal-argument
6245 </DL>
6246
6247 into the
6248 <I>inputrc</I>
6249
6250 would make M-C-u execute the readline command
6251 <I>universal-argument</I>.
6252
6253 <P>
6254
6255 The following symbolic character names are recognized:
6256 <I>RUBOUT</I>,
6257
6258 <I>DEL</I>,
6259
6260 <I>ESC</I>,
6261
6262 <I>LFD</I>,
6263
6264 <I>NEWLINE</I>,
6265
6266 <I>RET</I>,
6267
6268 <I>RETURN</I>,
6269
6270 <I>SPC</I>,
6271
6272 <I>SPACE</I>,
6273
6274 and
6275 <I>TAB</I>.
6276
6277 <P>
6278
6279 In addition to command names, readline allows keys to be bound
6280 to a string that is inserted when the key is pressed (a <I>macro</I>).
6281 <A NAME="lbCI">&nbsp;</A>
6282 <H4>Readline Key Bindings</H4>
6283
6284 <P>
6285
6286 The syntax for controlling key bindings in the
6287 <I>inputrc</I>
6288
6289 file is simple. All that is required is the name of the
6290 command or the text of a macro and a key sequence to which
6291 it should be bound. The name may be specified in one of two ways:
6292 as a symbolic key name, possibly with <I>Meta-</I> or <I>Control-</I>
6293 prefixes, or as a key sequence.
6294 <P>
6295
6296 When using the form <B>keyname</B>:<I>function-name</I> or <I>macro</I>,
6297 <I>keyname</I>
6298
6299 is the name of a key spelled out in English. For example:
6300 <P>
6301 <DL COMPACT><DT><DD>
6302 Control-u: universal-argument
6303 <BR>
6304
6305 Meta-Rubout: backward-kill-word
6306 <BR>
6307
6308 Control-o: &quot;&gt; output&quot;
6309 </DL>
6310
6311 <P>
6312
6313 In the above example,
6314 <I>C-u</I>
6315
6316 is bound to the function
6317 <B>universal-argument</B>,
6318
6319 <I>M-DEL</I>
6320
6321 is bound to the function
6322 <B>backward-kill-word</B>,
6323
6324 and
6325 <I>C-o</I>
6326
6327 is bound to run the macro
6328 expressed on the right hand side (that is, to insert the text
6329 <TT>&gt; output</TT>
6330
6331 into the line).
6332 <P>
6333
6334 In the second form, <B>&quot;keyseq&quot;</B>:<I>function-name</I> or <I>macro</I>,
6335 <B>keyseq</B>
6336
6337 differs from
6338 <B>keyname</B>
6339
6340 above in that strings denoting
6341 an entire key sequence may be specified by placing the sequence
6342 within double quotes. Some GNU Emacs style key escapes can be
6343 used, as in the following example, but the symbolic character names
6344 are not recognized.
6345 <P>
6346 <DL COMPACT><DT><DD>
6347 &quot;\C-u&quot;: universal-argument
6348 <BR>
6349
6350 &quot;\C-x\C-r&quot;: re-read-init-file
6351 <BR>
6352
6353 &quot;\e[11~&quot;: &quot;Function Key 1&quot;
6354 </DL>
6355
6356 <P>
6357
6358 In this example,
6359 <I>C-u</I>
6360
6361 is again bound to the function
6362 <B>universal-argument</B>.
6363
6364 <I>C-x C-r</I>
6365
6366 is bound to the function
6367 <B>re-read-init-file</B>,
6368
6369 and
6370 <I>ESC [ 1 1 ~</I>
6371
6372 is bound to insert the text
6373 <TT>Function Key 1</TT>.
6374
6375 <P>
6376
6377 The full set of GNU Emacs style escape sequences is
6378 <DL COMPACT><DT><DD>
6379
6380 <DL COMPACT>
6381 <DT><B>\C-</B>
6382
6383 <DD>
6384 control prefix
6385 <DT><B>\M-</B>
6386
6387 <DD>
6388 meta prefix
6389 <DT><B>\e</B>
6390
6391 <DD>
6392 an escape character
6393 <DT><B>\\</B>
6394
6395 <DD>
6396 backslash
6397 <DT><B>\</B>
6398
6399 <DD>
6400 literal &quot;
6401 <DT><B>\aq</B>
6402
6403 <DD>
6404 literal aq
6405 </DL></DL>
6406
6407
6408 <P>
6409
6410 In addition to the GNU Emacs style escape sequences, a second
6411 set of backslash escapes is available:
6412 <DL COMPACT><DT><DD>
6413
6414 <DL COMPACT>
6415 <DT><B>\a</B>
6416
6417 <DD>
6418 alert (bell)
6419 <DT><B>\b</B>
6420
6421 <DD>
6422 backspace
6423 <DT><B>\d</B>
6424
6425 <DD>
6426 delete
6427 <DT><B>\f</B>
6428
6429 <DD>
6430 form feed
6431 <DT><B>\n</B>
6432
6433 <DD>
6434 newline
6435 <DT><B>\r</B>
6436
6437 <DD>
6438 carriage return
6439 <DT><B>\t</B>
6440
6441 <DD>
6442 horizontal tab
6443 <DT><B>\v</B>
6444
6445 <DD>
6446 vertical tab
6447 <DT><B>\</B><I>nnn</I>
6448
6449 <DD>
6450 the eight-bit character whose value is the octal value <I>nnn</I>
6451 (one to three digits)
6452 <DT><B>\x</B><I>HH</I>
6453
6454 <DD>
6455 the eight-bit character whose value is the hexadecimal value <I>HH</I>
6456 (one or two hex digits)
6457 </DL></DL>
6458
6459
6460 <P>
6461
6462 When entering the text of a macro, single or double quotes must
6463 be used to indicate a macro definition.
6464 Unquoted text is assumed to be a function name.
6465 In the macro body, the backslash escapes described above are expanded.
6466 Backslash will quote any other character in the macro text,
6467 including &quot; and aq.
6468 <P>
6469
6470 <B>Bash</B>
6471
6472 allows the current readline key bindings to be displayed or modified
6473 with the
6474 <B>bind</B>
6475
6476 builtin command. The editing mode may be switched during interactive
6477 use by using the
6478 <B>-o</B>
6479
6480 option to the
6481 <B>set</B>
6482
6483 builtin command (see
6484 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
6485
6486 </FONT>
6487 below).
6488 <A NAME="lbCJ">&nbsp;</A>
6489 <H4>Readline Variables</H4>
6490
6491 <P>
6492
6493 Readline has variables that can be used to further customize its
6494 behavior. A variable may be set in the
6495 <I>inputrc</I>
6496
6497 file with a statement of the form
6498 <DL COMPACT><DT><DD>
6499 <P>
6500
6501 <B>set</B> <I>variable-name</I> <I>value</I>
6502 </DL>
6503
6504 <P>
6505
6506 Except where noted, readline variables can take the values
6507 <B>On</B>
6508
6509 or
6510 <B>Off</B>
6511
6512 (without regard to case).
6513 Unrecognized variable names are ignored.
6514 When a variable value is read, empty or null values, &quot;on&quot; (case-insensitive),
6515 and &quot;1&quot; are equivalent to <B>On</B>. All other values are equivalent to
6516 <B>Off</B>.
6517 The variables and their default values are:
6518 <P>
6519
6520
6521 <DL COMPACT>
6522 <DT><B>bell-style (audible)</B>
6523
6524 <DD>
6525 Controls what happens when readline wants to ring the terminal bell.
6526 If set to <B>none</B>, readline never rings the bell. If set to
6527 <B>visible</B>, readline uses a visible bell if one is available.
6528 If set to <B>audible</B>, readline attempts to ring the terminal's bell.
6529 <DT><B>bind-tty-special-chars (On)</B>
6530
6531 <DD>
6532 If set to <B>On</B>, readline attempts to bind the control characters
6533 treated specially by the kernel's terminal driver to their readline
6534 equivalents.
6535 <DT><B>comment-begin (``#'')</B>
6536
6537 <DD>
6538 The string that is inserted when the readline
6539 <B>insert-comment</B>
6540
6541 command is executed.
6542 This command is bound to
6543 <B>M-#</B>
6544
6545 in emacs mode and to
6546 <B>#</B>
6547
6548 in vi command mode.
6549 <DT><B>completion-ignore-case (Off)</B>
6550
6551 <DD>
6552 If set to <B>On</B>, readline performs filename matching and completion
6553 in a case-insensitive fashion.
6554 <DT><B>completion-prefix-display-length (0)</B>
6555
6556 <DD>
6557 The length in characters of the common prefix of a list of possible
6558 completions that is displayed without modification. When set to a
6559 value greater than zero, common prefixes longer than this value are
6560 replaced with an ellipsis when displaying possible completions.
6561 <DT><B>completion-query-items (100)</B>
6562
6563 <DD>
6564 This determines when the user is queried about viewing
6565 the number of possible completions
6566 generated by the <B>possible-completions</B> command.
6567 It may be set to any integer value greater than or equal to
6568 zero. If the number of possible completions is greater than
6569 or equal to the value of this variable, the user is asked whether
6570 or not he wishes to view them; otherwise they are simply listed
6571 on the terminal.
6572 <DT><B>convert-meta (On)</B>
6573
6574 <DD>
6575 If set to <B>On</B>, readline will convert characters with the
6576 eighth bit set to an ASCII key sequence
6577 by stripping the eighth bit and prefixing an
6578 escape character (in effect, using escape as the <I>meta prefix</I>).
6579 <DT><B>disable-completion (Off)</B>
6580
6581 <DD>
6582 If set to <B>On</B>, readline will inhibit word completion. Completion
6583 characters will be inserted into the line as if they had been
6584 mapped to <B>self-insert</B>.
6585 <DT><B>editing-mode (emacs)</B>
6586
6587 <DD>
6588 Controls whether readline begins with a set of key bindings similar
6589 to <I>emacs</I> or <I>vi</I>.
6590 <B>editing-mode</B>
6591
6592 can be set to either
6593 <B>emacs</B>
6594
6595 or
6596 <B>vi</B>.
6597
6598 <DT><B>echo-control-characters (On)</B>
6599
6600 <DD>
6601 When set to <B>On</B>, on operating systems that indicate they support it,
6602 readline echoes a character corresponding to a signal generated from the
6603 keyboard.
6604 <DT><B>enable-keypad (Off)</B>
6605
6606 <DD>
6607 When set to <B>On</B>, readline will try to enable the application
6608 keypad when it is called. Some systems need this to enable the
6609 arrow keys.
6610 <DT><B>enable-meta-key (On)</B>
6611
6612 <DD>
6613 When set to <B>On</B>, readline will try to enable any meta modifier
6614 key the terminal claims to support when it is called. On many terminals,
6615 the meta key is used to send eight-bit characters.
6616 <DT><B>expand-tilde (Off)</B>
6617
6618 <DD>
6619 If set to <B>on</B>, tilde expansion is performed when readline
6620 attempts word completion.
6621 <DT><B>history-preserve-point (Off)</B>
6622
6623 <DD>
6624 If set to <B>on</B>, the history code attempts to place point at the
6625 same location on each history line retrieved with <B>previous-history</B>
6626 or <B>next-history</B>.
6627 <DT><B>history-size (0)</B>
6628
6629 <DD>
6630 Set the maximum number of history entries saved in the history list. If
6631 set to zero, the number of entries in the history list is not limited.
6632 <DT><B>horizontal-scroll-mode (Off)</B>
6633
6634 <DD>
6635 When set to <B>On</B>, makes readline use a single line for display,
6636 scrolling the input horizontally on a single screen line when it
6637 becomes longer than the screen width rather than wrapping to a new line.
6638 <DT><B>input-meta (Off)</B>
6639
6640 <DD>
6641 If set to <B>On</B>, readline will enable eight-bit input (that is,
6642 it will not strip the high bit from the characters it reads),
6643 regardless of what the terminal claims it can support. The name
6644 <B>meta-flag</B>
6645
6646 is a synonym for this variable.
6647 <DT><B>isearch-terminators (``C-[C-J'')</B>
6648
6649 <DD>
6650 The string of characters that should terminate an incremental
6651 search without subsequently executing the character as a command.
6652 If this variable has not been given a value, the characters
6653 <I>ESC</I> and <I>C-J</I> will terminate an incremental search.
6654 <DT><B>keymap (emacs)</B>
6655
6656 <DD>
6657 Set the current readline keymap. The set of valid keymap names is
6658 <I>emacs, emacs-standard, emacs-meta, emacs-ctlx, vi,
6659 vi-command</I>, and
6660 <I>vi-insert</I>.
6661
6662 <I>vi</I> is equivalent to <I>vi-command</I>; <I>emacs</I> is
6663 equivalent to <I>emacs-standard</I>. The default value is
6664 <I>emacs</I>;
6665
6666 the value of
6667 <B>editing-mode</B>
6668
6669 also affects the default keymap.
6670 <DT><B>mark-directories (On)</B>
6671
6672 <DD>
6673 If set to <B>On</B>, completed directory names have a slash
6674 appended.
6675 <DT><B>mark-modified-lines (Off)</B>
6676
6677 <DD>
6678 If set to <B>On</B>, history lines that have been modified are displayed
6679 with a preceding asterisk (<B>*</B>).
6680 <DT><B>mark-symlinked-directories (Off)</B>
6681
6682 <DD>
6683 If set to <B>On</B>, completed names which are symbolic links to directories
6684 have a slash appended (subject to the value of
6685 <B>mark-directories</B>).
6686 <DT><B>match-hidden-files (On)</B>
6687
6688 <DD>
6689 This variable, when set to <B>On</B>, causes readline to match files whose
6690 names begin with a `.' (hidden files) when performing filename
6691 completion, unless the leading `.' is
6692 supplied by the user in the filename to be completed.
6693 <DT><B>output-meta (Off)</B>
6694
6695 <DD>
6696 If set to <B>On</B>, readline will display characters with the
6697 eighth bit set directly rather than as a meta-prefixed escape
6698 sequence.
6699 <DT><B>page-completions (On)</B>
6700
6701 <DD>
6702 If set to <B>On</B>, readline uses an internal <I>more</I>-like pager
6703 to display a screenful of possible completions at a time.
6704 <DT><B>print-completions-horizontally (Off)</B>
6705
6706 <DD>
6707 If set to <B>On</B>, readline will display completions with matches
6708 sorted horizontally in alphabetical order, rather than down the screen.
6709 <DT><B>revert-all-at-newline (Off)</B>
6710
6711 <DD>
6712 If set to <B>on</B>, readline will undo all changes to history lines
6713 before returning when <B>accept-line</B> is executed. By default,
6714 history lines may be modified and retain individual undo lists across
6715 calls to <B>readline</B>.
6716 <DT><B>show-all-if-ambiguous (Off)</B>
6717
6718 <DD>
6719 This alters the default behavior of the completion functions. If
6720 set to
6721 <B>on</B>,
6722
6723 words which have more than one possible completion cause the
6724 matches to be listed immediately instead of ringing the bell.
6725 <DT><B>show-all-if-unmodified (Off)</B>
6726
6727 <DD>
6728 This alters the default behavior of the completion functions in
6729 a fashion similar to <B>show-all-if-ambiguous</B>.
6730 If set to
6731 <B>on</B>,
6732
6733 words which have more than one possible completion without any
6734 possible partial completion (the possible completions don't share
6735 a common prefix) cause the matches to be listed immediately instead
6736 of ringing the bell.
6737 <DT><B>skip-completed-text (Off)</B>
6738
6739 <DD>
6740 If set to <B>On</B>, this alters the default completion behavior when
6741 inserting a single match into the line. It's only active when
6742 performing completion in the middle of a word. If enabled, readline
6743 does not insert characters from the completion that match characters
6744 after point in the word being completed, so portions of the word
6745 following the cursor are not duplicated.
6746 <DT><B>visible-stats (Off)</B>
6747
6748 <DD>
6749 If set to <B>On</B>, a character denoting a file's type as reported
6750 by <I>stat</I>(2) is appended to the filename when listing possible
6751 completions.
6752
6753 </DL>
6754 <A NAME="lbCK">&nbsp;</A>
6755 <H4>Readline Conditional Constructs</H4>
6756
6757 <P>
6758
6759 Readline implements a facility similar in spirit to the conditional
6760 compilation features of the C preprocessor which allows key
6761 bindings and variable settings to be performed as the result
6762 of tests. There are four parser directives used.
6763 <DL COMPACT>
6764 <DT><B>$if</B><DD>
6765 The
6766 <B>$if</B>
6767
6768 construct allows bindings to be made based on the
6769 editing mode, the terminal being used, or the application using
6770 readline. The text of the test extends to the end of the line;
6771 no characters are required to isolate it.
6772 <DL COMPACT><DT><DD>
6773 <DL COMPACT>
6774 <DT><B>mode</B><DD>
6775 The <B>mode=</B> form of the <B>$if</B> directive is used to test
6776 whether readline is in emacs or vi mode.
6777 This may be used in conjunction
6778 with the <B>set keymap</B> command, for instance, to set bindings in
6779 the <I>emacs-standard</I> and <I>emacs-ctlx</I> keymaps only if
6780 readline is starting out in emacs mode.
6781 <DT><B>term</B><DD>
6782 The <B>term=</B> form may be used to include terminal-specific
6783 key bindings, perhaps to bind the key sequences output by the
6784 terminal's function keys. The word on the right side of the
6785 <B>=</B>
6786
6787 is tested against the both full name of the terminal and the portion
6788 of the terminal name before the first <B>-</B>. This allows
6789 <I>sun</I>
6790
6791 to match both
6792 <I>sun</I>
6793
6794 and
6795 <I>sun-cmd</I>,
6796
6797 for instance.
6798 <DT><B>application</B><DD>
6799 The <B>application</B> construct is used to include
6800 application-specific settings. Each program using the readline
6801 library sets the <I>application name</I>, and an initialization
6802 file can test for a particular value.
6803 This could be used to bind key sequences to functions useful for
6804 a specific program. For instance, the following command adds a
6805 key sequence that quotes the current or previous word in Bash:
6806 <P>
6807 <DL COMPACT><DT><DD>
6808 <PRE>
6809 <B>$if</B> Bash
6810 # Quote the current or previous word
6811 &quot;\C-xq&quot;: &quot;\eb\&quot;\ef\&quot;&quot;
6812 <B>$endif</B>
6813 </PRE>
6814
6815 </DL>
6816
6817 </DL></DL>
6818
6819 <DT><B>$endif</B><DD>
6820 This command, as seen in the previous example, terminates an
6821 <B>$if</B> command.
6822 <DT><B>$else</B><DD>
6823 Commands in this branch of the <B>$if</B> directive are executed if
6824 the test fails.
6825 <DT><B>$include</B><DD>
6826 This directive takes a single filename as an argument and reads commands
6827 and bindings from that file. For example, the following directive
6828 would read <A HREF="file:/etc/inputrc"><I>/etc/inputrc</I></A>:
6829 <P>
6830 <DL COMPACT><DT><DD>
6831 <PRE>
6832 <B>$include</B> <A HREF="file:/etc/inputrc"><I>/etc/inputrc</I></A>
6833 </PRE>
6834
6835 </DL>
6836
6837 </DL>
6838 <A NAME="lbCL">&nbsp;</A>
6839 <H4>Searching</H4>
6840
6841 <P>
6842
6843 Readline provides commands for searching through the command history
6844 (see
6845 <FONT SIZE=-1><B>HISTORY</B>
6846
6847 </FONT>
6848 below) for lines containing a specified string.
6849 There are two search modes:
6850 <I>incremental</I>
6851
6852 and
6853 <I>non-incremental</I>.
6854
6855 <P>
6856
6857 Incremental searches begin before the user has finished typing the
6858 search string.
6859 As each character of the search string is typed, readline displays
6860 the next entry from the history matching the string typed so far.
6861 An incremental search requires only as many characters as needed to
6862 find the desired history entry.
6863 The characters present in the value of the <B>isearch-terminators</B>
6864 variable are used to terminate an incremental search.
6865 If that variable has not been assigned a value the Escape and
6866 Control-J characters will terminate an incremental search.
6867 Control-G will abort an incremental search and restore the original
6868 line.
6869 When the search is terminated, the history entry containing the
6870 search string becomes the current line.
6871 <P>
6872
6873 To find other matching entries in the history list, type Control-S or
6874 Control-R as appropriate.
6875 This will search backward or forward in the history for the next
6876 entry matching the search string typed so far.
6877 Any other key sequence bound to a readline command will terminate
6878 the search and execute that command.
6879 For instance, a <I>newline</I> will terminate the search and accept
6880 the line, thereby executing the command from the history list.
6881 <P>
6882
6883 Readline remembers the last incremental search string. If two
6884 Control-Rs are typed without any intervening characters defining a
6885 new search string, any remembered search string is used.
6886 <P>
6887
6888 Non-incremental searches read the entire search string before starting
6889 to search for matching history lines. The search string may be
6890 typed by the user or be part of the contents of the current line.
6891 <A NAME="lbCM">&nbsp;</A>
6892 <H4>Readline Command Names</H4>
6893
6894 <P>
6895
6896 The following is a list of the names of the commands and the default
6897 key sequences to which they are bound.
6898 Command names without an accompanying key sequence are unbound by default.
6899 In the following descriptions, <I>point</I> refers to the current cursor
6900 position, and <I>mark</I> refers to a cursor position saved by the
6901 <B>set-mark</B> command.
6902 The text between the point and mark is referred to as the <I>region</I>.
6903 <A NAME="lbCN">&nbsp;</A>
6904 <H4>Commands for Moving</H4>
6905
6906 <P>
6907
6908
6909 <DL COMPACT>
6910 <DT><B>beginning-of-line (C-a)</B>
6911
6912 <DD>
6913 Move to the start of the current line.
6914 <DT><B>end-of-line (C-e)</B>
6915
6916 <DD>
6917 Move to the end of the line.
6918 <DT><B>forward-char (C-f)</B>
6919
6920 <DD>
6921 Move forward a character.
6922 <DT><B>backward-char (C-b)</B>
6923
6924 <DD>
6925 Move back a character.
6926 <DT><B>forward-word (M-f)</B>
6927
6928 <DD>
6929 Move forward to the end of the next word. Words are composed of
6930 alphanumeric characters (letters and digits).
6931 <DT><B>backward-word (M-b)</B>
6932
6933 <DD>
6934 Move back to the start of the current or previous word.
6935 Words are composed of alphanumeric characters (letters and digits).
6936 <DT><B>shell-forward-word</B>
6937
6938 <DD>
6939 Move forward to the end of the next word.
6940 Words are delimited by non-quoted shell metacharacters.
6941 <DT><B>shell-backward-word</B>
6942
6943 <DD>
6944 Move back to the start of the current or previous word.
6945 Words are delimited by non-quoted shell metacharacters.
6946 <DT><B>clear-screen (C-l)</B>
6947
6948 <DD>
6949 Clear the screen leaving the current line at the top of the screen.
6950 With an argument, refresh the current line without clearing the
6951 screen.
6952 <DT><B>redraw-current-line</B>
6953
6954 <DD>
6955 Refresh the current line.
6956
6957 </DL>
6958 <A NAME="lbCO">&nbsp;</A>
6959 <H4>Commands for Manipulating the History</H4>
6960
6961 <P>
6962
6963
6964 <DL COMPACT>
6965 <DT><B>accept-line (Newline, Return)</B>
6966
6967 <DD>
6968 Accept the line regardless of where the cursor is. If this line is
6969 non-empty, add it to the history list according to the state of the
6970 <FONT SIZE=-1><B>HISTCONTROL</B>
6971
6972 </FONT>
6973 variable. If the line is a modified history
6974 line, then restore the history line to its original state.
6975 <DT><B>previous-history (C-p)</B>
6976
6977 <DD>
6978 Fetch the previous command from the history list, moving back in
6979 the list.
6980 <DT><B>next-history (C-n)</B>
6981
6982 <DD>
6983 Fetch the next command from the history list, moving forward in the
6984 list.
6985 <DT><B>beginning-of-history (M-&lt;)</B>
6986
6987 <DD>
6988 Move to the first line in the history.
6989 <DT><B>end-of-history (M-&gt;)</B>
6990
6991 <DD>
6992 Move to the end of the input history, i.e., the line currently being
6993 entered.
6994 <DT><B>reverse-search-history (C-r)</B>
6995
6996 <DD>
6997 Search backward starting at the current line and moving `up' through
6998 the history as necessary. This is an incremental search.
6999 <DT><B>forward-search-history (C-s)</B>
7000
7001 <DD>
7002 Search forward starting at the current line and moving `down' through
7003 the history as necessary. This is an incremental search.
7004 <DT><B>non-incremental-reverse-search-history (M-p)</B>
7005
7006 <DD>
7007 Search backward through the history starting at the current line
7008 using a non-incremental search for a string supplied by the user.
7009 <DT><B>non-incremental-forward-search-history (M-n)</B>
7010
7011 <DD>
7012 Search forward through the history using a non-incremental search for
7013 a string supplied by the user.
7014 <DT><B>history-search-forward</B>
7015
7016 <DD>
7017 Search forward through the history for the string of characters
7018 between the start of the current line and the point.
7019 This is a non-incremental search.
7020 <DT><B>history-search-backward</B>
7021
7022 <DD>
7023 Search backward through the history for the string of characters
7024 between the start of the current line and the point.
7025 This is a non-incremental search.
7026 <DT><B>yank-nth-arg (M-C-y)</B>
7027
7028 <DD>
7029 Insert the first argument to the previous command (usually
7030 the second word on the previous line) at point.
7031 With an argument
7032 <I>n</I>,
7033
7034 insert the <I>n</I>th word from the previous command (the words
7035 in the previous command begin with word 0). A negative argument
7036 inserts the <I>n</I>th word from the end of the previous command.
7037 Once the argument <I>n</I> is computed, the argument is extracted
7038 as if the &quot;!<I>n</I>&quot; history expansion had been specified.
7039 <DT><B>yank-last-arg (M-., M-_)</B>
7040
7041 <DD>
7042 Insert the last argument to the previous command (the last word of
7043 the previous history entry). With an argument,
7044 behave exactly like <B>yank-nth-arg</B>.
7045 Successive calls to <B>yank-last-arg</B> move back through the history
7046 list, inserting the last argument of each line in turn.
7047 The history expansion facilities are used to extract the last argument,
7048 as if the &quot;!$&quot; history expansion had been specified.
7049 <DT><B>shell-expand-line (M-C-e)</B>
7050
7051 <DD>
7052 Expand the line as the shell does. This
7053 performs alias and history expansion as well as all of the shell
7054 word expansions. See
7055 <FONT SIZE=-1><B>HISTORY EXPANSION</B>
7056
7057 </FONT>
7058 below for a description of history expansion.
7059 <DT><B>history-expand-line (M-^)</B>
7060
7061 <DD>
7062 Perform history expansion on the current line.
7063 See
7064 <FONT SIZE=-1><B>HISTORY EXPANSION</B>
7065
7066 </FONT>
7067 below for a description of history expansion.
7068 <DT><B>magic-space</B>
7069
7070 <DD>
7071 Perform history expansion on the current line and insert a space.
7072 See
7073 <FONT SIZE=-1><B>HISTORY EXPANSION</B>
7074
7075 </FONT>
7076 below for a description of history expansion.
7077 <DT><B>alias-expand-line</B>
7078
7079 <DD>
7080 Perform alias expansion on the current line.
7081 See
7082 <FONT SIZE=-1><B>ALIASES</B>
7083
7084 </FONT>
7085 above for a description of alias expansion.
7086 <DT><B>history-and-alias-expand-line</B>
7087
7088 <DD>
7089 Perform history and alias expansion on the current line.
7090 <DT><B>insert-last-argument (M-., M-_)</B>
7091
7092 <DD>
7093 A synonym for <B>yank-last-arg</B>.
7094 <DT><B>operate-and-get-next (C-o)</B>
7095
7096 <DD>
7097 Accept the current line for execution and fetch the next line
7098 relative to the current line from the history for editing. Any
7099 argument is ignored.
7100 <DT><B>edit-and-execute-command (C-xC-e)</B>
7101
7102 <DD>
7103 Invoke an editor on the current command line, and execute the result as shell
7104 commands.
7105 <B>Bash</B> attempts to invoke
7106 <FONT SIZE=-1><B>$VISUAL</B>,
7107
7108 </FONT>
7109 <FONT SIZE=-1><B>$EDITOR</B>,
7110
7111 </FONT>
7112 and <I>emacs</I> as the editor, in that order.
7113
7114 </DL>
7115 <A NAME="lbCP">&nbsp;</A>
7116 <H4>Commands for Changing Text</H4>
7117
7118 <P>
7119
7120
7121 <DL COMPACT>
7122 <DT><B>delete-char (C-d)</B>
7123
7124 <DD>
7125 Delete the character at point. If point is at the
7126 beginning of the line, there are no characters in the line, and
7127 the last character typed was not bound to <B>delete-char</B>,
7128 then return
7129 <FONT SIZE=-1><B>EOF</B>.
7130
7131 </FONT>
7132 <DT><B>backward-delete-char (Rubout)</B>
7133
7134 <DD>
7135 Delete the character behind the cursor. When given a numeric argument,
7136 save the deleted text on the kill ring.
7137 <DT><B>forward-backward-delete-char</B>
7138
7139 <DD>
7140 Delete the character under the cursor, unless the cursor is at the
7141 end of the line, in which case the character behind the cursor is
7142 deleted.
7143 <DT><B>quoted-insert (C-q, C-v)</B>
7144
7145 <DD>
7146 Add the next character typed to the line verbatim. This is
7147 how to insert characters like <B>C-q</B>, for example.
7148 <DT><B>tab-insert (C-v TAB)</B>
7149
7150 <DD>
7151 Insert a tab character.
7152 <DT><B>self-insert (a,&nbsp;b,&nbsp;A,&nbsp;1,&nbsp;!,&nbsp;...)</B>
7153
7154 <DD>
7155 Insert the character typed.
7156 <DT><B>transpose-chars (C-t)</B>
7157
7158 <DD>
7159 Drag the character before point forward over the character at point,
7160 moving point forward as well.
7161 If point is at the end of the line, then this transposes
7162 the two characters before point.
7163 Negative arguments have no effect.
7164 <DT><B>transpose-words (M-t)</B>
7165
7166 <DD>
7167 Drag the word before point past the word after point,
7168 moving point over that word as well.
7169 If point is at the end of the line, this transposes
7170 the last two words on the line.
7171 <DT><B>upcase-word (M-u)</B>
7172
7173 <DD>
7174 Uppercase the current (or following) word. With a negative argument,
7175 uppercase the previous word, but do not move point.
7176 <DT><B>downcase-word (M-l)</B>
7177
7178 <DD>
7179 Lowercase the current (or following) word. With a negative argument,
7180 lowercase the previous word, but do not move point.
7181 <DT><B>capitalize-word (M-c)</B>
7182
7183 <DD>
7184 Capitalize the current (or following) word. With a negative argument,
7185 capitalize the previous word, but do not move point.
7186 <DT><B>overwrite-mode</B>
7187
7188 <DD>
7189 Toggle overwrite mode. With an explicit positive numeric argument,
7190 switches to overwrite mode. With an explicit non-positive numeric
7191 argument, switches to insert mode. This command affects only
7192 <B>emacs</B> mode; <B>vi</B> mode does overwrite differently.
7193 Each call to <I>readline()</I> starts in insert mode.
7194 In overwrite mode, characters bound to <B>self-insert</B> replace
7195 the text at point rather than pushing the text to the right.
7196 Characters bound to <B>backward-delete-char</B> replace the character
7197 before point with a space. By default, this command is unbound.
7198
7199 </DL>
7200 <A NAME="lbCQ">&nbsp;</A>
7201 <H4>Killing and Yanking</H4>
7202
7203 <P>
7204
7205
7206 <DL COMPACT>
7207 <DT><B>kill-line (C-k)</B>
7208
7209 <DD>
7210 Kill the text from point to the end of the line.
7211 <DT><B>backward-kill-line (C-x Rubout)</B>
7212
7213 <DD>
7214 Kill backward to the beginning of the line.
7215 <DT><B>unix-line-discard (C-u)</B>
7216
7217 <DD>
7218 Kill backward from point to the beginning of the line.
7219 The killed text is saved on the kill-ring.
7220
7221 <DT><B>kill-whole-line</B>
7222
7223 <DD>
7224 Kill all characters on the current line, no matter where point is.
7225 <DT><B>kill-word (M-d)</B>
7226
7227 <DD>
7228 Kill from point to the end of the current word, or if between
7229 words, to the end of the next word.
7230 Word boundaries are the same as those used by <B>forward-word</B>.
7231 <DT><B>backward-kill-word (M-Rubout)</B>
7232
7233 <DD>
7234 Kill the word behind point.
7235 Word boundaries are the same as those used by <B>backward-word</B>.
7236 <DT><B>shell-kill-word (M-d)</B>
7237
7238 <DD>
7239 Kill from point to the end of the current word, or if between
7240 words, to the end of the next word.
7241 Word boundaries are the same as those used by <B>shell-forward-word</B>.
7242 <DT><B>shell-backward-kill-word (M-Rubout)</B>
7243
7244 <DD>
7245 Kill the word behind point.
7246 Word boundaries are the same as those used by <B>shell-backward-word</B>.
7247 <DT><B>unix-word-rubout (C-w)</B>
7248
7249 <DD>
7250 Kill the word behind point, using white space as a word boundary.
7251 The killed text is saved on the kill-ring.
7252 <DT><B>unix-filename-rubout</B>
7253
7254 <DD>
7255 Kill the word behind point, using white space and the slash character
7256 as the word boundaries.
7257 The killed text is saved on the kill-ring.
7258 <DT><B>delete-horizontal-space (M-\)</B>
7259
7260 <DD>
7261 Delete all spaces and tabs around point.
7262 <DT><B>kill-region</B>
7263
7264 <DD>
7265 Kill the text in the current region.
7266 <DT><B>copy-region-as-kill</B>
7267
7268 <DD>
7269 Copy the text in the region to the kill buffer.
7270 <DT><B>copy-backward-word</B>
7271
7272 <DD>
7273 Copy the word before point to the kill buffer.
7274 The word boundaries are the same as <B>backward-word</B>.
7275 <DT><B>copy-forward-word</B>
7276
7277 <DD>
7278 Copy the word following point to the kill buffer.
7279 The word boundaries are the same as <B>forward-word</B>.
7280 <DT><B>yank (C-y)</B>
7281
7282 <DD>
7283 Yank the top of the kill ring into the buffer at point.
7284 <DT><B>yank-pop (M-y)</B>
7285
7286 <DD>
7287 Rotate the kill ring, and yank the new top. Only works following
7288 <B>yank</B>
7289
7290 or
7291 <B>yank-pop</B>.
7292
7293
7294 </DL>
7295 <A NAME="lbCR">&nbsp;</A>
7296 <H4>Numeric Arguments</H4>
7297
7298 <P>
7299
7300
7301 <DL COMPACT>
7302 <DT><B>digit-argument (M-0, M-1, ..., M--)</B>
7303
7304 <DD>
7305 Add this digit to the argument already accumulating, or start a new
7306 argument. M-- starts a negative argument.
7307 <DT><B>universal-argument</B>
7308
7309 <DD>
7310 This is another way to specify an argument.
7311 If this command is followed by one or more digits, optionally with a
7312 leading minus sign, those digits define the argument.
7313 If the command is followed by digits, executing
7314 <B>universal-argument</B>
7315
7316 again ends the numeric argument, but is otherwise ignored.
7317 As a special case, if this command is immediately followed by a
7318 character that is neither a digit or minus sign, the argument count
7319 for the next command is multiplied by four.
7320 The argument count is initially one, so executing this function the
7321 first time makes the argument count four, a second time makes the
7322 argument count sixteen, and so on.
7323
7324 </DL>
7325 <A NAME="lbCS">&nbsp;</A>
7326 <H4>Completing</H4>
7327
7328 <P>
7329
7330
7331 <DL COMPACT>
7332 <DT><B>complete (TAB)</B>
7333
7334 <DD>
7335 Attempt to perform completion on the text before point.
7336 <B>Bash</B>
7337
7338 attempts completion treating the text as a variable (if the
7339 text begins with <B>$</B>), username (if the text begins with
7340 <B>~</B>), hostname (if the text begins with <B>@</B>), or
7341 command (including aliases and functions) in turn. If none
7342 of these produces a match, filename completion is attempted.
7343 <DT><B>possible-completions (M-?)</B>
7344
7345 <DD>
7346 List the possible completions of the text before point.
7347 <DT><B>insert-completions (M-*)</B>
7348
7349 <DD>
7350 Insert all completions of the text before point
7351 that would have been generated by
7352 <B>possible-completions</B>.
7353 <DT><B>menu-complete</B>
7354
7355 <DD>
7356 Similar to <B>complete</B>, but replaces the word to be completed
7357 with a single match from the list of possible completions.
7358 Repeated execution of <B>menu-complete</B> steps through the list
7359 of possible completions, inserting each match in turn.
7360 At the end of the list of completions, the bell is rung
7361 (subject to the setting of <B>bell-style</B>)
7362 and the original text is restored.
7363 An argument of <I>n</I> moves <I>n</I> positions forward in the list
7364 of matches; a negative argument may be used to move backward
7365 through the list.
7366 This command is intended to be bound to <B>TAB</B>, but is unbound
7367 by default.
7368 <DT><B>menu-complete-rd</B>
7369
7370 <DD>
7371 Identical to <B>menu-complete</B>, but moves backward through the list
7372 of possible completions, as if <B>menu-complete</B> had been given a
7373 negative argument. This command is unbound by default.
7374 <DT><B>delete-char-or-list</B>
7375
7376 <DD>
7377 Deletes the character under the cursor if not at the beginning or
7378 end of the line (like <B>delete-char</B>).
7379 If at the end of the line, behaves identically to
7380 <B>possible-completions</B>.
7381 This command is unbound by default.
7382 <DT><B>complete-filename (M-/)</B>
7383
7384 <DD>
7385 Attempt filename completion on the text before point.
7386 <DT><B>possible-filename-completions (C-x /)</B>
7387
7388 <DD>
7389 List the possible completions of the text before point,
7390 treating it as a filename.
7391 <DT><B>complete-username (M-~)</B>
7392
7393 <DD>
7394 Attempt completion on the text before point, treating
7395 it as a username.
7396 <DT><B>possible-username-completions (C-x ~)</B>
7397
7398 <DD>
7399 List the possible completions of the text before point,
7400 treating it as a username.
7401 <DT><B>complete-variable (M-$)</B>
7402
7403 <DD>
7404 Attempt completion on the text before point, treating
7405 it as a shell variable.
7406 <DT><B>possible-variable-completions (C-x $)</B>
7407
7408 <DD>
7409 List the possible completions of the text before point,
7410 treating it as a shell variable.
7411 <DT><B>complete-hostname (M-@)</B>
7412
7413 <DD>
7414 Attempt completion on the text before point, treating
7415 it as a hostname.
7416 <DT><B>possible-hostname-completions (C-x @)</B>
7417
7418 <DD>
7419 List the possible completions of the text before point,
7420 treating it as a hostname.
7421 <DT><B>complete-command (M-!)</B>
7422
7423 <DD>
7424 Attempt completion on the text before point, treating
7425 it as a command name. Command completion attempts to
7426 match the text against aliases, reserved words, shell
7427 functions, shell builtins, and finally executable filenames,
7428 in that order.
7429 <DT><B>possible-command-completions (C-x !)</B>
7430
7431 <DD>
7432 List the possible completions of the text before point,
7433 treating it as a command name.
7434 <DT><B>dynamic-complete-history (M-TAB)</B>
7435
7436 <DD>
7437 Attempt completion on the text before point, comparing
7438 the text against lines from the history list for possible
7439 completion matches.
7440 <DT><B>dabbrev-expand</B>
7441
7442 <DD>
7443 Attempt menu completion on the text before point, comparing
7444 the text against lines from the history list for possible
7445 completion matches.
7446 <DT><B>complete-into-braces (M-{)</B>
7447
7448 <DD>
7449 Perform filename completion and insert the list of possible completions
7450 enclosed within braces so the list is available to the shell (see
7451 <B>Brace Expansion</B>
7452
7453 above).
7454
7455 </DL>
7456 <A NAME="lbCT">&nbsp;</A>
7457 <H4>Keyboard Macros</H4>
7458
7459 <P>
7460
7461
7462 <DL COMPACT>
7463 <DT><B>start-kbd-macro (C-x ()</B>
7464
7465 <DD>
7466 Begin saving the characters typed into the current keyboard macro.
7467 <DT><B>end-kbd-macro (C-x ))</B>
7468
7469 <DD>
7470 Stop saving the characters typed into the current keyboard macro
7471 and store the definition.
7472 <DT><B>call-last-kbd-macro (C-x e)</B>
7473
7474 <DD>
7475 Re-execute the last keyboard macro defined, by making the characters
7476 in the macro appear as if typed at the keyboard.
7477
7478 </DL>
7479 <A NAME="lbCU">&nbsp;</A>
7480 <H4>Miscellaneous</H4>
7481
7482 <P>
7483
7484
7485 <DL COMPACT>
7486 <DT><B>re-read-init-file (C-x C-r)</B>
7487
7488 <DD>
7489 Read in the contents of the <I>inputrc</I> file, and incorporate
7490 any bindings or variable assignments found there.
7491 <DT><B>abort (C-g)</B>
7492
7493 <DD>
7494 Abort the current editing command and
7495 ring the terminal's bell (subject to the setting of
7496 <B>bell-style</B>).
7497
7498 <DT><B>do-uppercase-version (M-a, M-b, M-</B><I>x</I>, ...)
7499
7500 <DD>
7501 If the metafied character <I>x</I> is lowercase, run the command
7502 that is bound to the corresponding uppercase character.
7503 <DT><B>prefix-meta (ESC)</B>
7504
7505 <DD>
7506 Metafy the next character typed.
7507 <FONT SIZE=-1><B>ESC</B>
7508
7509 </FONT>
7510 <B>f</B>
7511
7512 is equivalent to
7513 <B>Meta-f</B>.
7514
7515 <DT><B>undo (C-_, C-x C-u)</B>
7516
7517 <DD>
7518 Incremental undo, separately remembered for each line.
7519 <DT><B>revert-line (M-r)</B>
7520
7521 <DD>
7522 Undo all changes made to this line. This is like executing the
7523 <B>undo</B>
7524
7525 command enough times to return the line to its initial state.
7526 <DT><B>tilde-expand (M-&amp;)</B>
7527
7528 <DD>
7529 Perform tilde expansion on the current word.
7530 <DT><B>set-mark (C-@, M-&lt;space&gt;)</B>
7531
7532 <DD>
7533 Set the mark to the point. If a
7534 numeric argument is supplied, the mark is set to that position.
7535 <DT><B>exchange-point-and-mark (C-x C-x)</B>
7536
7537 <DD>
7538 Swap the point with the mark. The current cursor position is set to
7539 the saved position, and the old cursor position is saved as the mark.
7540 <DT><B>character-search (C-])</B>
7541
7542 <DD>
7543 A character is read and point is moved to the next occurrence of that
7544 character. A negative count searches for previous occurrences.
7545 <DT><B>character-search-backward (M-C-])</B>
7546
7547 <DD>
7548 A character is read and point is moved to the previous occurrence of that
7549 character. A negative count searches for subsequent occurrences.
7550 <DT><B>skip-csi-sequence ()</B>
7551
7552 <DD>
7553 Read enough characters to consume a multi-key sequence such as those
7554 defined for keys like Home and End. Such sequences begin with a
7555 Control Sequence Indicator (CSI), usually ESC-[. If this sequence is
7556 bound to &quot;\[&quot;, keys producing such sequences will have no effect
7557 unless explicitly bound to a readline command, instead of inserting
7558 stray characters into the editing buffer. This is unbound by default,
7559 but usually bound to ESC-[.
7560 <DT><B>insert-comment (M-#)</B>
7561
7562 <DD>
7563 Without a numeric argument, the value of the readline
7564 <B>comment-begin</B>
7565
7566 variable is inserted at the beginning of the current line.
7567 If a numeric argument is supplied, this command acts as a toggle: if
7568 the characters at the beginning of the line do not match the value
7569 of <B>comment-begin</B>, the value is inserted, otherwise
7570 the characters in <B>comment-begin</B> are deleted from the beginning of
7571 the line.
7572 In either case, the line is accepted as if a newline had been typed.
7573 The default value of
7574 <B>comment-begin</B> causes this command to make the current line
7575 a shell comment.
7576 If a numeric argument causes the comment character to be removed, the line
7577 will be executed by the shell.
7578 <DT><B>glob-complete-word (M-g)</B>
7579
7580 <DD>
7581 The word before point is treated as a pattern for pathname expansion,
7582 with an asterisk implicitly appended. This pattern is used to
7583 generate a list of matching file names for possible completions.
7584 <DT><B>glob-expand-word (C-x *)</B>
7585
7586 <DD>
7587 The word before point is treated as a pattern for pathname expansion,
7588 and the list of matching file names is inserted, replacing the word.
7589 If a numeric argument is supplied, an asterisk is appended before
7590 pathname expansion.
7591 <DT><B>glob-list-expansions (C-x g)</B>
7592
7593 <DD>
7594 The list of expansions that would have been generated by
7595 <B>glob-expand-word</B>
7596
7597 is displayed, and the line is redrawn.
7598 If a numeric argument is supplied, an asterisk is appended before
7599 pathname expansion.
7600 <DT><B>dump-functions</B>
7601
7602 <DD>
7603 Print all of the functions and their key bindings to the
7604 readline output stream. If a numeric argument is supplied,
7605 the output is formatted in such a way that it can be made part
7606 of an <I>inputrc</I> file.
7607 <DT><B>dump-variables</B>
7608
7609 <DD>
7610 Print all of the settable readline variables and their values to the
7611 readline output stream. If a numeric argument is supplied,
7612 the output is formatted in such a way that it can be made part
7613 of an <I>inputrc</I> file.
7614 <DT><B>dump-macros</B>
7615
7616 <DD>
7617 Print all of the readline key sequences bound to macros and the
7618 strings they output. If a numeric argument is supplied,
7619 the output is formatted in such a way that it can be made part
7620 of an <I>inputrc</I> file.
7621 <DT><B>display-shell-version (C-x C-v)</B>
7622
7623 <DD>
7624 Display version information about the current instance of
7625 <B>bash</B>.
7626
7627
7628 </DL>
7629 <A NAME="lbCV">&nbsp;</A>
7630 <H4>Programmable Completion</H4>
7631
7632 <P>
7633
7634 When word completion is attempted for an argument to a command for
7635 which a completion specification (a <I>compspec</I>) has been defined
7636 using the <B>complete</B> builtin (see
7637 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
7638
7639 </FONT>
7640 below), the programmable completion facilities are invoked.
7641 <P>
7642
7643 First, the command name is identified.
7644 If the command word is the empty string (completion attempted at the
7645 beginning of an empty line), any compspec defined with
7646 the <B>-E</B> option to <B>complete</B> is used.
7647 If a compspec has been defined for that command, the
7648 compspec is used to generate the list of possible completions for the word.
7649 If the command word is a full pathname, a compspec for the full
7650 pathname is searched for first.
7651 If no compspec is found for the full pathname, an attempt is made to
7652 find a compspec for the portion following the final slash.
7653 If those searches to not result in a compspec, any compspec defined with
7654 the <B>-D</B> option to <B>complete</B> is used as the default.
7655 <P>
7656
7657 Once a compspec has been found, it is used to generate the list of
7658 matching words.
7659 If a compspec is not found, the default <B>bash</B> completion as
7660 described above under <B>Completing</B> is performed.
7661 <P>
7662
7663 First, the actions specified by the compspec are used.
7664 Only matches which are prefixed by the word being completed are
7665 returned.
7666 When the
7667 <B>-f</B>
7668
7669 or
7670 <B>-d</B>
7671
7672 option is used for filename or directory name completion, the shell
7673 variable
7674 <FONT SIZE=-1><B>FIGNORE</B>
7675
7676 </FONT>
7677 is used to filter the matches.
7678 <P>
7679
7680 Any completions specified by a pathname expansion pattern to the
7681 <B>-G</B> option are generated next.
7682 The words generated by the pattern need not match the word
7683 being completed.
7684 The
7685 <FONT SIZE=-1><B>GLOBIGNORE</B>
7686
7687 </FONT>
7688 shell variable is not used to filter the matches, but the
7689 <FONT SIZE=-1><B>FIGNORE</B>
7690
7691 </FONT>
7692 variable is used.
7693 <P>
7694
7695 Next, the string specified as the argument to the <B>-W</B> option
7696 is considered.
7697 The string is first split using the characters in the
7698 <FONT SIZE=-1><B>IFS</B>
7699
7700 </FONT>
7701 special variable as delimiters.
7702 Shell quoting is honored.
7703 Each word is then expanded using
7704 brace expansion, tilde expansion, parameter and variable expansion,
7705 command substitution, and arithmetic expansion,
7706 as described above under
7707 <FONT SIZE=-1><B>EXPANSION</B>.
7708
7709 </FONT>
7710 The results are split using the rules described above under
7711 <B>Word Splitting</B>.
7712 The results of the expansion are prefix-matched against the word being
7713 completed, and the matching words become the possible completions.
7714 <P>
7715
7716 After these matches have been generated, any shell function or command
7717 specified with the <B>-F</B> and <B>-C</B> options is invoked.
7718 When the command or function is invoked, the
7719 <FONT SIZE=-1><B>COMP_LINE</B>,
7720
7721 </FONT>
7722 <FONT SIZE=-1><B>COMP_POINT</B>,
7723
7724 </FONT>
7725 <FONT SIZE=-1><B>COMP_KEY</B>,
7726
7727 </FONT>
7728 and
7729 <FONT SIZE=-1><B>COMP_TYPE</B>
7730
7731 </FONT>
7732 variables are assigned values as described above under
7733 <B>Shell Variables</B>.
7734 If a shell function is being invoked, the
7735 <FONT SIZE=-1><B>COMP_WORDS</B>
7736
7737 </FONT>
7738 and
7739 <FONT SIZE=-1><B>COMP_CWORD</B>
7740
7741 </FONT>
7742 variables are also set.
7743 When the function or command is invoked, the first argument is the
7744 name of the command whose arguments are being completed, the
7745 second argument is the word being completed, and the third argument
7746 is the word preceding the word being completed on the current command line.
7747 No filtering of the generated completions against the word being completed
7748 is performed; the function or command has complete freedom in generating
7749 the matches.
7750 <P>
7751
7752 Any function specified with <B>-F</B> is invoked first.
7753 The function may use any of the shell facilities, including the
7754 <B>compgen</B> builtin described below, to generate the matches.
7755 It must put the possible completions in the
7756 <FONT SIZE=-1><B>COMPREPLY</B>
7757
7758 </FONT>
7759 array variable.
7760 <P>
7761
7762 Next, any command specified with the <B>-C</B> option is invoked
7763 in an environment equivalent to command substitution.
7764 It should print a list of completions, one per line, to the
7765 standard output.
7766 Backslash may be used to escape a newline, if necessary.
7767 <P>
7768
7769 After all of the possible completions are generated, any filter
7770 specified with the <B>-X</B> option is applied to the list.
7771 The filter is a pattern as used for pathname expansion; a <B>&amp;</B>
7772 in the pattern is replaced with the text of the word being completed.
7773 A literal <B>&amp;</B> may be escaped with a backslash; the backslash
7774 is removed before attempting a match.
7775 Any completion that matches the pattern will be removed from the list.
7776 A leading <B>!</B> negates the pattern; in this case any completion
7777 not matching the pattern will be removed.
7778 <P>
7779
7780 Finally, any prefix and suffix specified with the <B>-P</B> and <B>-S</B>
7781 options are added to each member of the completion list, and the result is
7782 returned to the readline completion code as the list of possible
7783 completions.
7784 <P>
7785
7786 If the previously-applied actions do not generate any matches, and the
7787 <B>-o dirnames</B> option was supplied to <B>complete</B> when the
7788 compspec was defined, directory name completion is attempted.
7789 <P>
7790
7791 If the <B>-o plusdirs</B> option was supplied to <B>complete</B> when the
7792 compspec was defined, directory name completion is attempted and any
7793 matches are added to the results of the other actions.
7794 <P>
7795
7796 By default, if a compspec is found, whatever it generates is returned
7797 to the completion code as the full set of possible completions.
7798 The default <B>bash</B> completions are not attempted, and the readline
7799 default of filename completion is disabled.
7800 If the <B>-o bashdefault</B> option was supplied to <B>complete</B> when
7801 the compspec was defined, the <B>bash</B> default completions are attempted
7802 if the compspec generates no matches.
7803 If the <B>-o default</B> option was supplied to <B>complete</B> when the
7804 compspec was defined, readline's default completion will be performed
7805 if the compspec (and, if attempted, the default <B>bash</B> completions)
7806 generate no matches.
7807 <P>
7808
7809 When a compspec indicates that directory name completion is desired,
7810 the programmable completion functions force readline to append a slash
7811 to completed names which are symbolic links to directories, subject to
7812 the value of the <B>mark-directories</B> readline variable, regardless
7813 of the setting of the <B>mark-symlinked-directories</B> readline variable.
7814 <P>
7815
7816 There is some support for dynamically modifying completions. This is
7817 most useful when used in combination with a default completion specified
7818 with <B>complete -D</B>.
7819 It's possible for shell functions executed as completion
7820 handlers to indicate that completion should be retried by returning an
7821 exit status of 124. If a shell function returns 124, and changes
7822 the compspec associated with the command on which completion is being
7823 attempted (supplied as the first argument when the function is executed),
7824 programmable completion restarts from the beginning, with an
7825 attempt to find a compspec for that command. This allows a set of
7826 completions to be built dynamically as completion is attempted, rather than
7827 being loaded all at once.
7828 <P>
7829
7830 For instance, assuming that there is a library of compspecs, each kept in a
7831 file corresponding to the name of the command, the following default
7832 completion function would load completions dynamically:
7833 <P>
7834
7835 <TT>_completion_loader()
7836 <BR>
7837
7838 {
7839 <BR>
7840
7841 <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>
7842 <BR>
7843
7844 }
7845 <BR>
7846
7847 complete -D -F _completion_loader
7848 <BR>
7849
7850 </TT>
7851 <A NAME="lbCW">&nbsp;</A>
7852 <H3>HISTORY</H3>
7853
7854 When the
7855 <B>-o history</B>
7856
7857 option to the
7858 <B>set</B>
7859
7860 builtin is enabled, the shell provides access to the
7861 <I>command history</I>,
7862 the list of commands previously typed.
7863 The value of the
7864 <FONT SIZE=-1><B>HISTSIZE</B>
7865
7866 </FONT>
7867 variable is used as the
7868 number of commands to save in a history list.
7869 The text of the last
7870 <FONT SIZE=-1><B>HISTSIZE</B>
7871
7872 </FONT>
7873 commands (default 500) is saved. The shell
7874 stores each command in the history list prior to parameter and
7875 variable expansion (see
7876 <FONT SIZE=-1><B>EXPANSION</B>
7877
7878 </FONT>
7879 above) but after history expansion is performed, subject to the
7880 values of the shell variables
7881 <FONT SIZE=-1><B>HISTIGNORE</B>
7882
7883 </FONT>
7884 and
7885 <FONT SIZE=-1><B>HISTCONTROL</B>.
7886
7887 </FONT>
7888 <P>
7889
7890 On startup, the history is initialized from the file named by
7891 the variable
7892 <FONT SIZE=-1><B>HISTFILE</B>
7893
7894 </FONT>
7895 (default <A HREF="file:~/.bash_history"><I>~/.bash_history</I></A>).
7896 The file named by the value of
7897 <FONT SIZE=-1><B>HISTFILE</B>
7898
7899 </FONT>
7900 is truncated, if necessary, to contain no more than
7901 the number of lines specified by the value of
7902 <FONT SIZE=-1><B>HISTFILESIZE</B>.
7903
7904 </FONT>
7905 When the history file is read,
7906 lines beginning with the history comment character followed immediately
7907 by a digit are interpreted as timestamps for the preceding history line.
7908 These timestamps are optionally displayed depending on the value of the
7909 <FONT SIZE=-1><B>HISTTIMEFORMAT</B>
7910
7911 </FONT>
7912 variable.
7913 When an interactive shell exits, the last
7914 <FONT SIZE=-1><B>$HISTSIZE</B>
7915
7916 </FONT>
7917 lines are copied from the history list to
7918 <FONT SIZE=-1><B>$HISTFILE</B>.
7919
7920 </FONT>
7921 If the
7922 <B>histappend</B>
7923
7924 shell option is enabled
7925 (see the description of
7926 <B>shopt</B>
7927
7928 under
7929 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
7930
7931 </FONT>
7932 below), the lines are appended to the history file,
7933 otherwise the history file is overwritten.
7934 If
7935 <FONT SIZE=-1><B>HISTFILE</B>
7936
7937 </FONT>
7938 is unset, or if the history file is unwritable, the history is
7939 not saved.
7940 If the
7941 <FONT SIZE=-1><B>HISTTIMEFORMAT</B>
7942
7943 </FONT>
7944 variable is set, time stamps are written to the history file, marked
7945 with the history comment character, so
7946 they may be preserved across shell sessions.
7947 This uses the history comment character to distinguish timestamps from
7948 other history lines.
7949 After saving the history, the history file is truncated
7950 to contain no more than
7951 <FONT SIZE=-1><B>HISTFILESIZE</B>
7952
7953 </FONT>
7954 lines. If
7955 <FONT SIZE=-1><B>HISTFILESIZE</B>
7956
7957 </FONT>
7958 is not set, no truncation is performed.
7959 <P>
7960
7961 The builtin command
7962 <B>fc</B>
7963
7964 (see
7965 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
7966
7967 </FONT>
7968 below) may be used to list or edit and re-execute a portion of
7969 the history list.
7970 The
7971 <B>history</B>
7972
7973 builtin may be used to display or modify the history list and
7974 manipulate the history file.
7975 When using command-line editing, search commands
7976 are available in each editing mode that provide access to the
7977 history list.
7978 <P>
7979
7980 The shell allows control over which commands are saved on the history
7981 list. The
7982 <FONT SIZE=-1><B>HISTCONTROL</B>
7983
7984 </FONT>
7985 and
7986 <FONT SIZE=-1><B>HISTIGNORE</B>
7987
7988 </FONT>
7989 variables may be set to cause the shell to save only a subset of the
7990 commands entered.
7991 The
7992 <B>cmdhist</B>
7993
7994 shell option, if enabled, causes the shell to attempt to save each
7995 line of a multi-line command in the same history entry, adding
7996 semicolons where necessary to preserve syntactic correctness.
7997 The
7998 <B>lithist</B>
7999
8000 shell option causes the shell to save the command with embedded newlines
8001 instead of semicolons. See the description of the
8002 <B>shopt</B>
8003
8004 builtin below under
8005 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
8006
8007 </FONT>
8008 for information on setting and unsetting shell options.
8009 <A NAME="lbCX">&nbsp;</A>
8010 <H3>HISTORY EXPANSION</H3>
8011
8012 <P>
8013
8014 The shell supports a history expansion feature that
8015 is similar to the history expansion in
8016 <B>csh.</B>
8017
8018 This section describes what syntax features are available. This
8019 feature is enabled by default for interactive shells, and can be
8020 disabled using the
8021 <B>+H</B>
8022
8023 option to the
8024 <B>set</B>
8025
8026 builtin command (see
8027 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
8028
8029 </FONT>
8030 below). Non-interactive shells do not perform history expansion
8031 by default.
8032 <P>
8033
8034 History expansions introduce words from the history list into
8035 the input stream, making it easy to repeat commands, insert the
8036 arguments to a previous command into the current input line, or
8037 fix errors in previous commands quickly.
8038 <P>
8039
8040 History expansion is performed immediately after a complete line
8041 is read, before the shell breaks it into words.
8042 It takes place in two parts.
8043 The first is to determine which line from the history list
8044 to use during substitution.
8045 The second is to select portions of that line for inclusion into
8046 the current one.
8047 The line selected from the history is the <I>event</I>,
8048 and the portions of that line that are acted upon are <I>words</I>.
8049 Various <I>modifiers</I> are available to manipulate the selected words.
8050 The line is broken into words in the same fashion as when reading input,
8051 so that several <I>metacharacter</I>-separated words surrounded by
8052 quotes are considered one word.
8053 History expansions are introduced by the appearance of the
8054 history expansion character, which is <B>!</B> by default.
8055 Only backslash (<B>\</B>) and single quotes can quote
8056 the history expansion character.
8057 <P>
8058
8059 Several characters inhibit history expansion if found immediately
8060 following the history expansion character, even if it is unquoted:
8061 space, tab, newline, carriage return, and <B>=</B>.
8062 If the <B>extglob</B> shell option is enabled, <B>(</B> will also
8063 inhibit expansion.
8064 <P>
8065
8066 Several shell options settable with the
8067 <B>shopt</B>
8068
8069 builtin may be used to tailor the behavior of history expansion.
8070 If the
8071 <B>histverify</B>
8072
8073 shell option is enabled (see the description of the
8074 <B>shopt</B>
8075
8076 builtin below), and
8077 <B>readline</B>
8078
8079 is being used, history substitutions are not immediately passed to
8080 the shell parser.
8081 Instead, the expanded line is reloaded into the
8082 <B>readline</B>
8083
8084 editing buffer for further modification.
8085 If
8086 <B>readline</B>
8087
8088 is being used, and the
8089 <B>histreedit</B>
8090
8091 shell option is enabled, a failed history substitution will be reloaded
8092 into the
8093 <B>readline</B>
8094
8095 editing buffer for correction.
8096 The
8097 <B>-p</B>
8098
8099 option to the
8100 <B>history</B>
8101
8102 builtin command may be used to see what a history expansion will
8103 do before using it.
8104 The
8105 <B>-s</B>
8106
8107 option to the
8108 <B>history</B>
8109
8110 builtin may be used to add commands to the end of the history list
8111 without actually executing them, so that they are available for
8112 subsequent recall.
8113 <P>
8114
8115 The shell allows control of the various characters used by the
8116 history expansion mechanism (see the description of
8117 <B>histchars</B>
8118
8119 above under
8120 <B>Shell Variables</B>).
8121
8122 The shell uses
8123 the history comment character to mark history timestamps when
8124 writing the history file.
8125 <A NAME="lbCY">&nbsp;</A>
8126 <H4>Event Designators</H4>
8127
8128 <P>
8129
8130 An event designator is a reference to a command line entry in the
8131 history list.
8132 <P>
8133
8134
8135 <DL COMPACT>
8136 <DT><B>!</B>
8137
8138 <DD>
8139 Start a history substitution, except when followed by a
8140 <B>blank</B>,
8141
8142 newline, carriage return, =
8143 or ( (when the <B>extglob</B> shell option is enabled using
8144 the <B>shopt</B> builtin).
8145 <DT><B>!</B><I>n</I>
8146
8147 <DD>
8148 Refer to command line
8149 <I>n</I>.
8150
8151 <DT><B>!-</B><I>n</I>
8152
8153 <DD>
8154 Refer to the current command line minus
8155 <I>n</I>.
8156
8157 <DT><B>!!</B>
8158
8159 <DD>
8160 Refer to the previous command. This is a synonym for `!-1'.
8161 <DT><B>!</B><I>string</I>
8162
8163 <DD>
8164 Refer to the most recent command starting with
8165 <I>string</I>.
8166
8167 <DT><B>!?</B><I>string</I><B>[?]</B>
8168
8169 <DD>
8170 Refer to the most recent command containing
8171 <I>string</I>.
8172
8173 The trailing <B>?</B> may be omitted if
8174 <I>string</I>
8175
8176 is followed immediately by a newline.
8177 <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>
8178
8179 <DD>
8180 Quick substitution. Repeat the last command, replacing
8181 <I>string1</I>
8182
8183 with
8184 <I>string2</I>.
8185
8186 Equivalent to
8187 ``!!:s/<I>string1</I>/<I>string2</I>/''
8188 (see <B>Modifiers</B> below).
8189 <DT><B>!#</B>
8190
8191 <DD>
8192 The entire command line typed so far.
8193
8194 </DL>
8195 <A NAME="lbCZ">&nbsp;</A>
8196 <H4>Word Designators</H4>
8197
8198 <P>
8199
8200 Word designators are used to select desired words from the event.
8201 A
8202 <B>:</B>
8203
8204 separates the event specification from the word designator.
8205 It may be omitted if the word designator begins with a
8206 <B>^</B>,
8207
8208 <B>$</B>,
8209
8210 <B>*</B>,
8211
8212 <B>-</B>,
8213
8214 or
8215 <B>%</B>.
8216
8217 Words are numbered from the beginning of the line,
8218 with the first word being denoted by 0 (zero).
8219 Words are inserted into the current line separated by single spaces.
8220 <P>
8221
8222
8223 <DL COMPACT>
8224 <DT><B>0 (zero)</B>
8225
8226 <DD>
8227 The zeroth word. For the shell, this is the command
8228 word.
8229 <DT><I>n</I>
8230
8231 <DD>
8232 The <I>n</I>th word.
8233 <DT><B>^</B>
8234
8235 <DD>
8236 The first argument. That is, word 1.
8237 <DT><B>$</B>
8238
8239 <DD>
8240 The last argument.
8241 <DT><B>%</B>
8242
8243 <DD>
8244 The word matched by the most recent `?<I>string</I>?' search.
8245 <DT><I>x</I><B>-</B>y
8246
8247 <DD>
8248 A range of words; `-<I>y</I>' abbreviates `0-<I>y</I>'.
8249 <DT><B>*</B>
8250
8251 <DD>
8252 All of the words but the zeroth. This is a synonym
8253 for `<I>1-$</I>'. It is not an error to use
8254 <B>*</B>
8255
8256 if there is just one
8257 word in the event; the empty string is returned in that case.
8258 <DT><B>x*</B>
8259
8260 <DD>
8261 Abbreviates <I>x-$</I>.
8262 <DT><B>x-</B>
8263
8264 <DD>
8265 Abbreviates <I>x-$</I> like <B>x*</B>, but omits the last word.
8266
8267 </DL>
8268 <P>
8269
8270 If a word designator is supplied without an event specification, the
8271 previous command is used as the event.
8272 <A NAME="lbDA">&nbsp;</A>
8273 <H4>Modifiers</H4>
8274
8275 <P>
8276
8277 After the optional word designator, there may appear a sequence of
8278 one or more of the following modifiers, each preceded by a `:'.
8279 <P>
8280
8281
8282 <P>
8283
8284 <DL COMPACT>
8285 <DT><B>h</B>
8286
8287 <DD>
8288 Remove a trailing file name component, leaving only the head.
8289 <DT><B>t</B>
8290
8291 <DD>
8292 Remove all leading file name components, leaving the tail.
8293 <DT><B>r</B>
8294
8295 <DD>
8296 Remove a trailing suffix of the form <I>.xxx</I>, leaving the
8297 basename.
8298 <DT><B>e</B>
8299
8300 <DD>
8301 Remove all but the trailing suffix.
8302 <DT><B>p</B>
8303
8304 <DD>
8305 Print the new command but do not execute it.
8306 <DT><B>q</B>
8307
8308 <DD>
8309 Quote the substituted words, escaping further substitutions.
8310 <DT><B>x</B>
8311
8312 <DD>
8313 Quote the substituted words as with
8314 <B>q</B>,
8315
8316 but break into words at
8317 <B>blanks</B>
8318
8319 and newlines.
8320 <DT><B>s/</B><I>old</I>/<I>new</I>/
8321
8322 <DD>
8323 Substitute
8324 <I>new</I>
8325
8326 for the first occurrence of
8327 <I>old</I>
8328
8329 in the event line. Any delimiter can be used in place of /. The
8330 final delimiter is optional if it is the last character of the
8331 event line. The delimiter may be quoted in
8332 <I>old</I>
8333
8334 and
8335 <I>new</I>
8336
8337 with a single backslash. If &amp; appears in
8338 <I>new</I>,
8339
8340 it is replaced by
8341 <I>old</I>.
8342
8343 A single backslash will quote the &amp;. If
8344 <I>old</I>
8345
8346 is null, it is set to the last
8347 <I>old</I>
8348
8349 substituted, or, if no previous history substitutions took place,
8350 the last
8351 <I>string</I>
8352
8353 in a
8354 <B>!?</B><I>string</I><B>[?]</B>
8355
8356 search.
8357 <DT><B>&amp;</B>
8358
8359 <DD>
8360 Repeat the previous substitution.
8361 <DT><B>g</B>
8362
8363 <DD>
8364 Cause changes to be applied over the entire event line. This is
8365 used in conjunction with `<B>:s</B>' (e.g., `<B>:gs/</B><I>old</I>/<I>new</I>/')
8366 or `<B>:&amp;</B>'. If used with
8367 `<B>:s</B>', any delimiter can be used
8368 in place of /, and the final delimiter is optional
8369 if it is the last character of the event line.
8370 An <B>a</B> may be used as a synonym for <B>g</B>.
8371 <DT><B>G</B>
8372
8373 <DD>
8374 Apply the following `<B>s</B>' modifier once to each word in the event line.
8375
8376 </DL>
8377 <A NAME="lbDB">&nbsp;</A>
8378 <H3>SHELL BUILTIN COMMANDS</H3>
8379
8380
8381
8382 <P>
8383
8384 Unless otherwise noted, each builtin command documented in this
8385 section as accepting options preceded by
8386 <B>-</B>
8387
8388 accepts
8389 <B>--</B>
8390
8391 to signify the end of the options.
8392 The <B>:</B>, <B>true</B>, <B>false</B>, and <B>test</B> builtins
8393 do not accept options and do not treat <B>--</B> specially.
8394 The <B>exit</B>, <B>logout</B>, <B>break</B>, <B>continue</B>, <B>let</B>,
8395 and <B>shift</B> builtins accept and process arguments beginning with
8396 <B>-</B> without requiring <B>--</B>.
8397 Other builtins that accept arguments but are not specified as accepting
8398 options interpret arguments beginning with <B>-</B> as invalid options and
8399 require <B>--</B> to prevent this interpretation.
8400 <P>
8401
8402 <DL COMPACT>
8403 <DT><B>:</B> [<I>arguments</I>]<DD>
8404
8405 No effect; the command does nothing beyond expanding
8406 <I>arguments</I>
8407
8408 and performing any specified
8409 redirections. A zero exit code is returned.
8410 <DT><B> . </B> <I>filename</I> [<I>arguments</I>]<DD>
8411
8412 <DT><B>source</B> <I>filename</I> [<I>arguments</I>]<DD>
8413
8414 Read and execute commands from
8415 <I>filename</I>
8416
8417 in the current
8418 shell environment and return the exit status of the last command
8419 executed from
8420 <I>filename</I>.
8421
8422 If
8423 <I>filename</I>
8424
8425 does not contain a slash, file names in
8426 <FONT SIZE=-1><B>PATH</B>
8427
8428 </FONT>
8429 are used to find the directory containing
8430 <I>filename</I>.
8431
8432 The file searched for in
8433 <FONT SIZE=-1><B>PATH</B>
8434
8435 </FONT>
8436 need not be executable.
8437 When <B>bash</B> is not in <I>posix mode</I>, the current directory is
8438 searched if no file is found in
8439 <FONT SIZE=-1><B>PATH</B>.
8440
8441 </FONT>
8442 If the
8443 <B>sourcepath</B>
8444
8445 option to the
8446 <B>shopt</B>
8447
8448 builtin command is turned off, the
8449 <FONT SIZE=-1><B>PATH</B>
8450
8451 </FONT>
8452 is not searched.
8453 If any <I>arguments</I> are supplied, they become the positional
8454 parameters when <I>filename</I> is executed. Otherwise the positional
8455 parameters are unchanged.
8456 The return status is the status of the last command exited within
8457 the script (0 if no commands are executed), and false if
8458 <I>filename</I>
8459
8460 is not found or cannot be read.
8461 <DT><B>alias</B> [<B>-p</B>] [<I>name</I>[=<I>value</I>] ...]<DD>
8462 <B>Alias</B> with no arguments or with the
8463 <B>-p</B>
8464
8465 option prints the list of aliases in the form
8466 <B>alias</B> <I>name</I>=<I>value</I> on standard output.
8467 When arguments are supplied, an alias is defined for
8468 each <I>name</I> whose <I>value</I> is given.
8469 A trailing space in <I>value</I> causes the next word to be
8470 checked for alias substitution when the alias is expanded.
8471 For each <I>name</I> in the argument list for which no <I>value</I>
8472 is supplied, the name and value of the alias is printed.
8473 <B>Alias</B> returns true unless a <I>name</I> is given for which
8474 no alias has been defined.
8475 <DT><B>bg</B> [<I>jobspec</I> ...]<DD>
8476 Resume each suspended job <I>jobspec</I> in the background, as if it
8477 had been started with
8478 <B>&amp;</B>.
8479
8480 If
8481 <I>jobspec</I>
8482
8483 is not present, the shell's notion of the <I>current job</I> is used.
8484 <B>bg</B>
8485
8486 <I>jobspec</I>
8487
8488 returns 0 unless run when job control is disabled or, when run with
8489 job control enabled, any specified <I>jobspec</I> was not found
8490 or was started without job control.
8491 <DT><B>bind</B> [<B>-m</B> <I>keymap</I>] [<B>-lpsvPSV</B>]<DD>
8492
8493 <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>
8494 <DT><B>bind</B> [<B>-m</B> <I>keymap</I>] <B>-f</B> <I>filename</I><DD>
8495 <DT><B>bind</B> [<B>-m</B> <I>keymap</I>] <B>-x</B> <I>keyseq</I>:<I>shell-command</I><DD>
8496 <DT><B>bind</B> [<B>-m</B> <I>keymap</I>] <I>keyseq</I>:<I>function-name</I><DD>
8497 <DT><B>bind</B> <I>readline-command</I><DD>
8498
8499 Display current
8500 <B>readline</B>
8501
8502 key and function bindings, bind a key sequence to a
8503 <B>readline</B>
8504
8505 function or macro, or set a
8506 <B>readline</B>
8507
8508 variable.
8509 Each non-option argument is a command as it would appear in
8510 <I>.inputrc</I>,
8511
8512 but each binding or command must be passed as a separate argument;
8513 e.g., '&quot;\C-x\C-r&quot;: re-read-init-file'.
8514 Options, if supplied, have the following meanings:
8515 <DL COMPACT><DT><DD>
8516
8517 <DL COMPACT>
8518 <DT><B>-m </B><I>keymap</I>
8519
8520 <DD>
8521 Use
8522 <I>keymap</I>
8523
8524 as the keymap to be affected by the subsequent bindings.
8525 Acceptable
8526 <I>keymap</I>
8527
8528 names are
8529 <I>emacs, emacs-standard, emacs-meta, emacs-ctlx, vi,
8530 vi-move, vi-command</I>, and
8531 <I>vi-insert</I>.
8532
8533 <I>vi</I> is equivalent to <I>vi-command</I>; <I>emacs</I> is
8534 equivalent to <I>emacs-standard</I>.
8535 <DT><B>-l</B>
8536
8537 <DD>
8538 List the names of all <B>readline</B> functions.
8539 <DT><B>-p</B>
8540
8541 <DD>
8542 Display <B>readline</B> function names and bindings in such a way
8543 that they can be re-read.
8544 <DT><B>-P</B>
8545
8546 <DD>
8547 List current <B>readline</B> function names and bindings.
8548 <DT><B>-s</B>
8549
8550 <DD>
8551 Display <B>readline</B> key sequences bound to macros and the strings
8552 they output in such a way that they can be re-read.
8553 <DT><B>-S</B>
8554
8555 <DD>
8556 Display <B>readline</B> key sequences bound to macros and the strings
8557 they output.
8558 <DT><B>-v</B>
8559
8560 <DD>
8561 Display <B>readline</B> variable names and values in such a way that they
8562 can be re-read.
8563 <DT><B>-V</B>
8564
8565 <DD>
8566 List current <B>readline</B> variable names and values.
8567 <DT><B>-f </B><I>filename</I>
8568
8569 <DD>
8570 Read key bindings from <I>filename</I>.
8571 <DT><B>-q </B><I>function</I>
8572
8573 <DD>
8574 Query about which keys invoke the named <I>function</I>.
8575 <DT><B>-u </B><I>function</I>
8576
8577 <DD>
8578 Unbind all keys bound to the named <I>function</I>.
8579 <DT><B>-r </B><I>keyseq</I>
8580
8581 <DD>
8582 Remove any current binding for <I>keyseq</I>.
8583 <DT><B>-x </B><I>keyseq</I>:<I>shell-command</I>
8584
8585 <DD>
8586 Cause <I>shell-command</I> to be executed whenever <I>keyseq</I> is
8587 entered.
8588 When <I>shell-command</I> is executed, the shell sets the
8589 <FONT SIZE=-1><B>READLINE_LINE</B>
8590
8591 </FONT>
8592 variable to the contents of the <B>readline</B> line buffer and the
8593 <FONT SIZE=-1><B>READLINE_POINT</B>
8594
8595 </FONT>
8596 variable to the current location of the insertion point.
8597 If the executed command changes the value of
8598 <FONT SIZE=-1><B>READLINE_LINE</B>
8599
8600 </FONT>
8601 or
8602 <FONT SIZE=-1><B>READLINE_POINT</B>,
8603
8604 </FONT>
8605 those new values will be reflected in the editing state.
8606
8607 </DL>
8608 <P>
8609
8610 The return value is 0 unless an unrecognized option is given or an
8611 error occurred.
8612 </DL>
8613
8614 <DT><B>break</B> [<I>n</I>]<DD>
8615 Exit from within a
8616 <B>for</B>,
8617
8618 <B>while</B>,
8619
8620 <B>until</B>,
8621
8622 or
8623 <B>select</B>
8624
8625 loop. If <I>n</I> is specified, break <I>n</I> levels.
8626 <I>n</I>
8627
8628 must be >= 1. If
8629 <I>n</I>
8630
8631 is greater than the number of enclosing loops, all enclosing loops
8632 are exited.
8633 The return value is 0 unless <I>n</I> is not greater than or equal to 1.
8634 <DT><B>builtin</B> <I>shell-builtin</I> [<I>arguments</I>]<DD>
8635 Execute the specified shell builtin, passing it
8636 <I>arguments</I>,
8637
8638 and return its exit status.
8639 This is useful when defining a
8640 function whose name is the same as a shell builtin,
8641 retaining the functionality of the builtin within the function.
8642 The <B>cd</B> builtin is commonly redefined this way.
8643 The return status is false if
8644 <I>shell-builtin</I>
8645
8646 is not a shell builtin command.
8647 <DT><B>caller</B> [<I>expr</I>]<DD>
8648 Returns the context of any active subroutine call (a shell function or
8649 a script executed with the <B>.</B> or <B>source</B> builtins).
8650 Without <I>expr</I>, <B>caller</B> displays the line number and source
8651 filename of the current subroutine call.
8652 If a non-negative integer is supplied as <I>expr</I>, <B>caller</B>
8653 displays the line number, subroutine name, and source file corresponding
8654 to that position in the current execution call stack. This extra
8655 information may be used, for example, to print a stack trace. The
8656 current frame is frame 0.
8657 The return value is 0 unless the shell is not executing a subroutine
8658 call or <I>expr</I> does not correspond to a valid position in the
8659 call stack.
8660 <DT><B>cd</B> [<B>-L|-P</B>] [<I>dir</I>]<DD>
8661 Change the current directory to <I>dir</I>. The variable
8662 <FONT SIZE=-1><B>HOME</B>
8663
8664 </FONT>
8665 is the
8666 default
8667 <I>dir</I>.
8668
8669 The variable
8670 <FONT SIZE=-1><B>CDPATH</B>
8671
8672 </FONT>
8673 defines the search path for the directory containing
8674 <I>dir</I>.
8675
8676 Alternative directory names in
8677 <FONT SIZE=-1><B>CDPATH</B>
8678
8679 </FONT>
8680 are separated by a colon (:). A null directory name in
8681 <FONT SIZE=-1><B>CDPATH</B>
8682
8683 </FONT>
8684 is the same as the current directory, i.e., ``<B>.</B>''. If
8685 <I>dir</I>
8686
8687 begins with a slash (/),
8688 then
8689 <FONT SIZE=-1><B>CDPATH</B>
8690
8691 </FONT>
8692 is not used. The
8693 <B>-P</B>
8694
8695 option says to use the physical directory structure instead of
8696 following symbolic links (see also the
8697 <B>-P</B>
8698
8699 option to the
8700 <B>set</B>
8701
8702 builtin command); the
8703 <B>-L</B>
8704
8705 option forces symbolic links to be followed. An argument of
8706 <B>-</B>
8707
8708 is equivalent to
8709 <FONT SIZE=-1><B>$OLDPWD</B>.
8710
8711 </FONT>
8712 If a non-empty directory name from
8713 <FONT SIZE=-1><B>CDPATH</B>
8714
8715 </FONT>
8716 is used, or if
8717 <B>-</B> is the first argument, and the directory change is
8718 successful, the absolute pathname of the new working directory is
8719 written to the standard output.
8720 The return value is true if the directory was successfully changed;
8721 false otherwise.
8722 <DT><B>command</B> [<B>-pVv</B>] <I>command</I> [<I>arg</I> ...]<DD>
8723 Run
8724 <I>command</I>
8725
8726 with
8727 <I>args</I>
8728
8729 suppressing the normal shell function lookup. Only builtin
8730 commands or commands found in the
8731 <FONT SIZE=-1><B>PATH</B>
8732
8733 </FONT>
8734 are executed. If the
8735 <B>-p</B>
8736
8737 option is given, the search for
8738 <I>command</I>
8739
8740 is performed using a default value for
8741 <FONT SIZE=-1><B>PATH</B>
8742
8743 </FONT>
8744 that is guaranteed to find all of the standard utilities.
8745 If either the
8746 <B>-V</B>
8747
8748 or
8749 <B>-v</B>
8750
8751 option is supplied, a description of
8752 <I>command</I>
8753
8754 is printed. The
8755 <B>-v</B>
8756
8757 option causes a single word indicating the command or file name
8758 used to invoke
8759 <I>command</I>
8760
8761 to be displayed; the
8762 <B>-V</B>
8763
8764 option produces a more verbose description.
8765 If the
8766 <B>-V</B>
8767
8768 or
8769 <B>-v</B>
8770
8771 option is supplied, the exit status is 0 if
8772 <I>command</I>
8773
8774 was found, and 1 if not. If neither option is supplied and
8775 an error occurred or
8776 <I>command</I>
8777
8778 cannot be found, the exit status is 127. Otherwise, the exit status of the
8779 <B>command</B>
8780
8781 builtin is the exit status of
8782 <I>command</I>.
8783
8784 <DT><B>compgen</B> [<I>option</I>] [<I>word</I>]<DD>
8785 Generate possible completion matches for <I>word</I> according to
8786 the <I>option</I>s, which may be any option accepted by the
8787 <B>complete</B>
8788
8789 builtin with the exception of <B>-p</B> and <B>-r</B>, and write
8790 the matches to the standard output.
8791 When using the <B>-F</B> or <B>-C</B> options, the various shell variables
8792 set by the programmable completion facilities, while available, will not
8793 have useful values.
8794 <P>
8795 The matches will be generated in the same way as if the programmable
8796 completion code had generated them directly from a completion specification
8797 with the same flags.
8798 If <I>word</I> is specified, only those completions matching <I>word</I>
8799 will be displayed.
8800 <P>
8801 The return value is true unless an invalid option is supplied, or no
8802 matches were generated.
8803 <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>
8804 <BR>
8805
8806 [<B>-X</B> <I>filterpat</I>] [<B>-P</B> <I>prefix</I>] [<B>-S</B> <I>suffix</I>] <I>name</I> [<I>name ...</I>]
8807
8808 <DT><B>complete</B> <B>-pr</B> [<B>-DE</B>] [<I>name</I> ...]<DD>
8809
8810 Specify how arguments to each <I>name</I> should be completed.
8811 If the <B>-p</B> option is supplied, or if no options are supplied,
8812 existing completion specifications are printed in a way that allows
8813 them to be reused as input.
8814 The <B>-r</B> option removes a completion specification for
8815 each <I>name</I>, or, if no <I>name</I>s are supplied, all
8816 completion specifications.
8817 The <B>-D</B> option indicates that the remaining options and actions should
8818 apply to the ``default'' command completion; that is, completion attempted
8819 on a command for which no completion has previously been defined.
8820 The <B>-E</B> option indicates that the remaining options and actions should
8821 apply to ``empty'' command completion; that is, completion attempted on a
8822 blank line.
8823 <P>
8824 The process of applying these completion specifications when word completion
8825 is attempted is described above under <B>Programmable Completion</B>.
8826 <P>
8827 Other options, if specified, have the following meanings.
8828 The arguments to the <B>-G</B>, <B>-W</B>, and <B>-X</B> options
8829 (and, if necessary, the <B>-P</B> and <B>-S</B> options)
8830 should be quoted to protect them from expansion before the
8831 <B>complete</B>
8832
8833 builtin is invoked.
8834 <DL COMPACT><DT><DD>
8835
8836 <DL COMPACT>
8837 <DT><B>-o</B> <I>comp-option</I><DD>
8838 The <I>comp-option</I> controls several aspects of the compspec's behavior
8839 beyond the simple generation of completions.
8840 <I>comp-option</I> may be one of:
8841 <DL COMPACT><DT><DD>
8842 <DL COMPACT>
8843 <DT><B>bashdefault</B>
8844
8845 <DD>
8846 Perform the rest of the default <B>bash</B> completions if the compspec
8847 generates no matches.
8848 <DT><B>default</B>
8849
8850 <DD>
8851 Use readline's default filename completion if the compspec generates
8852 no matches.
8853 <DT><B>dirnames</B>
8854
8855 <DD>
8856 Perform directory name completion if the compspec generates no matches.
8857 <DT><B>filenames</B>
8858
8859 <DD>
8860 Tell readline that the compspec generates filenames, so it can perform any
8861 filename-specific processing (like adding a slash to directory names,
8862 quoting special characters, or suppressing trailing spaces).
8863 Intended to be used with shell functions.
8864 <DT><B>nospace</B>
8865
8866 <DD>
8867 Tell readline not to append a space (the default) to words completed at
8868 the end of the line.
8869 <DT><B>plusdirs</B>
8870
8871 <DD>
8872 After any matches defined by the compspec are generated,
8873 directory name completion is attempted and any
8874 matches are added to the results of the other actions.
8875 </DL></DL>
8876
8877 <DT><B>-A</B> <I>action</I><DD>
8878 The <I>action</I> may be one of the following to generate a list of possible
8879 completions:
8880 <DL COMPACT><DT><DD>
8881 <DL COMPACT>
8882 <DT><B>alias</B>
8883
8884 <DD>
8885 Alias names. May also be specified as <B>-a</B>.
8886 <DT><B>arrayvar</B>
8887
8888 <DD>
8889 Array variable names.
8890 <DT><B>binding</B>
8891
8892 <DD>
8893 <B>Readline</B> key binding names.
8894 <DT><B>builtin</B>
8895
8896 <DD>
8897 Names of shell builtin commands. May also be specified as <B>-b</B>.
8898 <DT><B>command</B>
8899
8900 <DD>
8901 Command names. May also be specified as <B>-c</B>.
8902 <DT><B>directory</B>
8903
8904 <DD>
8905 Directory names. May also be specified as <B>-d</B>.
8906 <DT><B>disabled</B>
8907
8908 <DD>
8909 Names of disabled shell builtins.
8910 <DT><B>enabled</B>
8911
8912 <DD>
8913 Names of enabled shell builtins.
8914 <DT><B>export</B>
8915
8916 <DD>
8917 Names of exported shell variables. May also be specified as <B>-e</B>.
8918 <DT><B>file</B>
8919
8920 <DD>
8921 File names. May also be specified as <B>-f</B>.
8922 <DT><B>function</B>
8923
8924 <DD>
8925 Names of shell functions.
8926 <DT><B>group</B>
8927
8928 <DD>
8929 Group names. May also be specified as <B>-g</B>.
8930 <DT><B>helptopic</B>
8931
8932 <DD>
8933 Help topics as accepted by the <B>help</B> builtin.
8934 <DT><B>hostname</B>
8935
8936 <DD>
8937 Hostnames, as taken from the file specified by the
8938 <FONT SIZE=-1><B>HOSTFILE</B>
8939
8940 </FONT>
8941 shell variable.
8942 <DT><B>job</B>
8943
8944 <DD>
8945 Job names, if job control is active. May also be specified as <B>-j</B>.
8946 <DT><B>keyword</B>
8947
8948 <DD>
8949 Shell reserved words. May also be specified as <B>-k</B>.
8950 <DT><B>running</B>
8951
8952 <DD>
8953 Names of running jobs, if job control is active.
8954 <DT><B>service</B>
8955
8956 <DD>
8957 Service names. May also be specified as <B>-s</B>.
8958 <DT><B>setopt</B>
8959
8960 <DD>
8961 Valid arguments for the <B>-o</B> option to the <B>set</B> builtin.
8962 <DT><B>shopt</B>
8963
8964 <DD>
8965 Shell option names as accepted by the <B>shopt</B> builtin.
8966 <DT><B>signal</B>
8967
8968 <DD>
8969 Signal names.
8970 <DT><B>stopped</B>
8971
8972 <DD>
8973 Names of stopped jobs, if job control is active.
8974 <DT><B>user</B>
8975
8976 <DD>
8977 User names. May also be specified as <B>-u</B>.
8978 <DT><B>variable</B>
8979
8980 <DD>
8981 Names of all shell variables. May also be specified as <B>-v</B>.
8982 </DL></DL>
8983
8984 <DT><B>-C</B> <I>command</I><DD>
8985 <I>command</I> is executed in a subshell environment, and its output is
8986 used as the possible completions.
8987 <DT><B>-F</B> <I>function</I><DD>
8988 The shell function <I>function</I> is executed in the current shell
8989 environment.
8990 When it finishes, the possible completions are retrieved from the value
8991 of the
8992 <FONT SIZE=-1><B>COMPREPLY</B>
8993
8994 </FONT>
8995 array variable.
8996 <DT><B>-G</B> <I>globpat</I><DD>
8997 The pathname expansion pattern <I>globpat</I> is expanded to generate
8998 the possible completions.
8999 <DT><B>-P</B> <I>prefix</I><DD>
9000 <I>prefix</I> is added at the beginning of each possible completion
9001 after all other options have been applied.
9002 <DT><B>-S</B> <I>suffix</I><DD>
9003 <I>suffix</I> is appended to each possible completion
9004 after all other options have been applied.
9005 <DT><B>-W</B> <I>wordlist</I><DD>
9006 The <I>wordlist</I> is split using the characters in the
9007 <FONT SIZE=-1><B>IFS</B>
9008
9009 </FONT>
9010 special variable as delimiters, and each resultant word is expanded.
9011 The possible completions are the members of the resultant list which
9012 match the word being completed.
9013 <DT><B>-X</B> <I>filterpat</I><DD>
9014 <I>filterpat</I> is a pattern as used for pathname expansion.
9015 It is applied to the list of possible completions generated by the
9016 preceding options and arguments, and each completion matching
9017 <I>filterpat</I> is removed from the list.
9018 A leading <B>!</B> in <I>filterpat</I> negates the pattern; in this
9019 case, any completion not matching <I>filterpat</I> is removed.
9020
9021 </DL>
9022 <P>
9023
9024 The return value is true unless an invalid option is supplied, an option
9025 other than <B>-p</B> or <B>-r</B> is supplied without a <I>name</I>
9026 argument, an attempt is made to remove a completion specification for
9027 a <I>name</I> for which no specification exists, or
9028 an error occurs adding a completion specification.
9029 </DL>
9030
9031 <DT><B>compopt</B> [<B>-o</B> <I>option</I>] [<B>-DE</B>] [<B>+o</B> <I>option</I>] [<I>name</I>]<DD>
9032 Modify completion options for each <I>name</I> according to the
9033 <I>option</I>s, or for the
9034 currently-executing completion if no <I>name</I>s are supplied.
9035 If no <I>option</I>s are given, display the completion options for each
9036 <I>name</I> or the current completion.
9037 The possible values of <I>option</I> are those valid for the <B>complete</B>
9038 builtin described above.
9039 The <B>-D</B> option indicates that the remaining options should
9040 apply to the ``default'' command completion; that is, completion attempted
9041 on a command for which no completion has previously been defined.
9042 The <B>-E</B> option indicates that the remaining options should
9043 apply to ``empty'' command completion; that is, completion attempted on a
9044 blank line.
9045 <P>
9046 The return value is true unless an invalid option is supplied, an attempt
9047 is made to modify the options for a <I>name</I> for which no completion
9048 specification exists, or an output error occurs.
9049 <DT><B>continue</B> [<I>n</I>]<DD>
9050 Resume the next iteration of the enclosing
9051 <B>for</B>,
9052
9053 <B>while</B>,
9054
9055 <B>until</B>,
9056
9057 or
9058 <B>select</B>
9059
9060 loop.
9061 If
9062 <I>n</I>
9063
9064 is specified, resume at the <I>n</I>th enclosing loop.
9065 <I>n</I>
9066
9067 must be >= 1. If
9068 <I>n</I>
9069
9070 is greater than the number of enclosing loops, the last enclosing loop
9071 (the ``top-level'' loop) is resumed.
9072 The return value is 0 unless <I>n</I> is not greater than or equal to 1.
9073 <DT><B>declare</B> [<B>-aAfFilrtux</B>] [<B>-p</B>] [<I>name</I>[=<I>value</I>] ...]<DD>
9074
9075 <DT><B>typeset</B> [<B>-aAfFilrtux</B>] [<B>-p</B>] [<I>name</I>[=<I>value</I>] ...]<DD>
9076
9077 Declare variables and/or give them attributes.
9078 If no <I>name</I>s are given then display the values of variables.
9079 The
9080 <B>-p</B>
9081
9082 option will display the attributes and values of each
9083 <I>name</I>.
9084
9085 When
9086 <B>-p</B>
9087
9088 is used with <I>name</I> arguments, additional options are ignored.
9089 When
9090 <B>-p</B>
9091
9092 is supplied without <I>name</I> arguments, it will display the attributes
9093 and values of all variables having the attributes specified by the
9094 additional options.
9095 If no other options are supplied with <B>-p</B>, <B>declare</B> will display
9096 the attributes and values of all shell variables. The <B>-f</B> option
9097 will restrict the display to shell functions.
9098 The
9099 <B>-F</B>
9100
9101 option inhibits the display of function definitions; only the
9102 function name and attributes are printed.
9103 If the <B>extdebug</B> shell option is enabled using <B>shopt</B>,
9104 the source file name and line number where the function is defined
9105 are displayed as well. The
9106 <B>-F</B>
9107
9108 option implies
9109 <B>-f</B>.
9110
9111 The following options can
9112 be used to restrict output to variables with the specified attribute or
9113 to give variables attributes:
9114 <DL COMPACT><DT><DD>
9115
9116 <DL COMPACT>
9117 <DT><B>-a</B>
9118
9119 <DD>
9120 Each <I>name</I> is an indexed array variable (see
9121 <B>Arrays</B>
9122
9123 above).
9124 <DT><B>-A</B>
9125
9126 <DD>
9127 Each <I>name</I> is an associative array variable (see
9128 <B>Arrays</B>
9129
9130 above).
9131 <DT><B>-f</B>
9132
9133 <DD>
9134 Use function names only.
9135 <DT><B>-i</B>
9136
9137 <DD>
9138 The variable is treated as an integer; arithmetic evaluation (see
9139 <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>
9140
9141 </FONT>
9142 above) is performed when the variable is assigned a value.
9143 <DT><B>-l</B>
9144
9145 <DD>
9146 When the variable is assigned a value, all upper-case characters are
9147 converted to lower-case.
9148 The upper-case attribute is disabled.
9149 <DT><B>-r</B>
9150
9151 <DD>
9152 Make <I>name</I>s readonly. These names cannot then be assigned values
9153 by subsequent assignment statements or unset.
9154 <DT><B>-t</B>
9155
9156 <DD>
9157 Give each <I>name</I> the <I>trace</I> attribute.
9158 Traced functions inherit the <B>DEBUG</B> and <B>RETURN</B> traps from
9159 the calling shell.
9160 The trace attribute has no special meaning for variables.
9161 <DT><B>-u</B>
9162
9163 <DD>
9164 When the variable is assigned a value, all lower-case characters are
9165 converted to upper-case.
9166 The lower-case attribute is disabled.
9167 <DT><B>-x</B>
9168
9169 <DD>
9170 Mark <I>name</I>s for export to subsequent commands via the environment.
9171
9172 </DL>
9173 <P>
9174
9175 Using `+' instead of `-'
9176 turns off the attribute instead,
9177 with the exceptions that <B>+a</B>
9178 may not be used to destroy an array variable and <B>+r</B> will not
9179 remove the readonly attribute.
9180 When used in a function,
9181 makes each
9182 <I>name</I> local, as with the
9183 <B>local</B>
9184
9185 command.
9186 If a variable name is followed by =<I>value</I>, the value of
9187 the variable is set to <I>value</I>.
9188 The return value is 0 unless an invalid option is encountered,
9189 an attempt is made to define a function using
9190
9191 <TT>-f foo=bar</TT>,
9192 an attempt is made to assign a value to a readonly variable,
9193 an attempt is made to assign a value to an array variable without
9194 using the compound assignment syntax (see
9195 <B>Arrays</B>
9196
9197 above), one of the <I>names</I> is not a valid shell variable name,
9198 an attempt is made to turn off readonly status for a readonly variable,
9199 an attempt is made to turn off array status for an array variable,
9200 or an attempt is made to display a non-existent function with <B>-f</B>.
9201 </DL>
9202
9203 <DT><B>dirs [+</B><I>n</I>] [-<I>n</I>] [<B>-clpv</B>]
9204
9205 <DD>
9206 Without options, displays the list of currently remembered directories.
9207 The default display is on a single line with directory names separated
9208 by spaces.
9209 Directories are added to the list with the
9210 <B>pushd</B>
9211
9212 command; the
9213 <B>popd</B>
9214
9215 command removes entries from the list.
9216 <DL COMPACT><DT><DD>
9217
9218 <DL COMPACT>
9219 <DT><B>+</B><I>n</I><DD>
9220 Displays the <I>n</I>th entry counting from the left of the list
9221 shown by
9222 <B>dirs</B>
9223
9224 when invoked without options, starting with zero.
9225 <DT><B>-</B><I>n</I><DD>
9226 Displays the <I>n</I>th entry counting from the right of the list
9227 shown by
9228 <B>dirs</B>
9229
9230 when invoked without options, starting with zero.
9231 <DT><B>-c</B>
9232
9233 <DD>
9234 Clears the directory stack by deleting all of the entries.
9235 <DT><B>-l</B>
9236
9237 <DD>
9238 Produces a longer listing; the default listing format uses a
9239 tilde to denote the home directory.
9240 <DT><B>-p</B>
9241
9242 <DD>
9243 Print the directory stack with one entry per line.
9244 <DT><B>-v</B>
9245
9246 <DD>
9247 Print the directory stack with one entry per line,
9248 prefixing each entry with its index in the stack.
9249
9250 </DL>
9251 <P>
9252
9253 The return value is 0 unless an
9254 invalid option is supplied or <I>n</I> indexes beyond the end
9255 of the directory stack.
9256 </DL>
9257
9258 <DT><B>disown</B> [<B>-ar</B>] [<B>-h</B>] [<I>jobspec</I> ...]<DD>
9259 Without options, each
9260 <I>jobspec</I>
9261
9262 is removed from the table of active jobs.
9263 If
9264 <I>jobspec</I>
9265
9266 is not present, and neither <B>-a</B> nor <B>-r</B> is supplied,
9267 the shell's notion of the <I>current job</I> is used.
9268 If the <B>-h</B> option is given, each
9269 <I>jobspec</I>
9270
9271 is not removed from the table, but is marked so that
9272 <FONT SIZE=-1><B>SIGHUP</B>
9273
9274 </FONT>
9275 is not sent to the job if the shell receives a
9276 <FONT SIZE=-1><B>SIGHUP</B>.
9277
9278 </FONT>
9279 If no
9280 <I>jobspec</I>
9281
9282 is present, and neither the
9283 <B>-a</B>
9284
9285 nor the
9286 <B>-r</B>
9287
9288 option is supplied, the <I>current job</I> is used.
9289 If no
9290 <I>jobspec</I>
9291
9292 is supplied, the
9293 <B>-a</B>
9294
9295 option means to remove or mark all jobs; the
9296 <B>-r</B>
9297
9298 option without a
9299 <I>jobspec</I>
9300
9301 argument restricts operation to running jobs.
9302 The return value is 0 unless a
9303 <I>jobspec</I>
9304
9305 does not specify a valid job.
9306 <DT><B>echo</B> [<B>-neE</B>] [<I>arg</I> ...]<DD>
9307 Output the <I>arg</I>s, separated by spaces, followed by a newline.
9308 The return status is always 0.
9309 If <B>-n</B> is specified, the trailing newline is
9310 suppressed. If the <B>-e</B> option is given, interpretation of
9311 the following backslash-escaped characters is enabled. The
9312 <B>-E</B>
9313
9314 option disables the interpretation of these escape characters,
9315 even on systems where they are interpreted by default.
9316 The <B>xpg_echo</B> shell option may be used to
9317 dynamically determine whether or not <B>echo</B> expands these
9318 escape characters by default.
9319 <B>echo</B>
9320
9321 does not interpret <B>--</B> to mean the end of options.
9322 <B>echo</B>
9323
9324 interprets the following escape sequences:
9325 <DL COMPACT><DT><DD>
9326
9327 <DL COMPACT>
9328 <DT><B>\a</B>
9329
9330 <DD>
9331 alert (bell)
9332 <DT><B>\b</B>
9333
9334 <DD>
9335 backspace
9336 <DT><B>\c</B>
9337
9338 <DD>
9339 suppress further output
9340 <DT><B>\e</B>
9341
9342 <DD>
9343 an escape character
9344 <DT><B>\f</B>
9345
9346 <DD>
9347 form feed
9348 <DT><B>\n</B>
9349
9350 <DD>
9351 new line
9352 <DT><B>\r</B>
9353
9354 <DD>
9355 carriage return
9356 <DT><B>\t</B>
9357
9358 <DD>
9359 horizontal tab
9360 <DT><B>\v</B>
9361
9362 <DD>
9363 vertical tab
9364 <DT><B>\\</B>
9365
9366 <DD>
9367 backslash
9368 <DT><B>\0</B><I>nnn</I>
9369
9370 <DD>
9371 the eight-bit character whose value is the octal value <I>nnn</I>
9372 (zero to three octal digits)
9373 <DT><B>\x</B><I>HH</I>
9374
9375 <DD>
9376 the eight-bit character whose value is the hexadecimal value <I>HH</I>
9377 (one or two hex digits)
9378
9379 </DL></DL>
9380
9381 <DT><B>enable</B> [<B>-a</B>] [<B>-dnps</B>] [<B>-f</B> <I>filename</I>] [<I>name</I> ...]<DD>
9382 Enable and disable builtin shell commands.
9383 Disabling a builtin allows a disk command which has the same name
9384 as a shell builtin to be executed without specifying a full pathname,
9385 even though the shell normally searches for builtins before disk commands.
9386 If <B>-n</B> is used, each <I>name</I>
9387 is disabled; otherwise,
9388 <I>names</I> are enabled. For example, to use the
9389 <B>test</B>
9390
9391 binary found via the
9392 <FONT SIZE=-1><B>PATH</B>
9393
9394 </FONT>
9395 instead of the shell builtin version, run
9396 <TT>enable -n test</TT>.
9397
9398 The
9399 <B>-f</B>
9400
9401 option means to load the new builtin command
9402 <I>name</I>
9403
9404 from shared object
9405 <I>filename</I>,
9406
9407 on systems that support dynamic loading. The
9408 <B>-d</B>
9409
9410 option will delete a builtin previously loaded with
9411 <B>-f</B>.
9412
9413 If no <I>name</I> arguments are given, or if the
9414 <B>-p</B>
9415
9416 option is supplied, a list of shell builtins is printed.
9417 With no other option arguments, the list consists of all enabled
9418 shell builtins.
9419 If <B>-n</B> is supplied, only disabled builtins are printed.
9420 If <B>-a</B> is supplied, the list printed includes all builtins, with an
9421 indication of whether or not each is enabled.
9422 If <B>-s</B> is supplied, the output is restricted to the POSIX
9423 <I>special</I> builtins.
9424 The return value is 0 unless a
9425 <I>name</I>
9426
9427 is not a shell builtin or there is an error loading a new builtin
9428 from a shared object.
9429 <DT><B>eval</B> [<I>arg</I> ...]<DD>
9430 The <I>arg</I>s are read and concatenated together into a single
9431 command. This command is then read and executed by the shell, and
9432 its exit status is returned as the value of
9433 <B>eval</B>.
9434
9435 If there are no
9436 <I>args</I>,
9437
9438 or only null arguments,
9439 <B>eval</B>
9440
9441 returns 0.
9442 <DT><B>exec</B> [<B>-cl</B>] [<B>-a</B> <I>name</I>] [<I>command</I> [<I>arguments</I>]]<DD>
9443 If
9444 <I>command</I>
9445
9446 is specified, it replaces the shell.
9447 No new process is created. The
9448 <I>arguments</I>
9449
9450 become the arguments to <I>command</I>.
9451 If the
9452 <B>-l</B>
9453
9454 option is supplied,
9455 the shell places a dash at the beginning of the zeroth argument passed to
9456 <I>command</I>.
9457
9458 This is what
9459 <I>login</I>(1)
9460
9461 does. The
9462 <B>-c</B>
9463
9464 option causes
9465 <I>command</I>
9466
9467 to be executed with an empty environment. If
9468 <B>-a</B>
9469
9470 is supplied, the shell passes
9471 <I>name</I>
9472
9473 as the zeroth argument to the executed command. If
9474 <I>command</I>
9475
9476 cannot be executed for some reason, a non-interactive shell exits,
9477 unless the shell option
9478 <B>execfail</B>
9479
9480 is enabled, in which case it returns failure.
9481 An interactive shell returns failure if the file cannot be executed.
9482 If
9483 <I>command</I>
9484
9485 is not specified, any redirections take effect in the current shell,
9486 and the return status is 0. If there is a redirection error, the
9487 return status is 1.
9488 <DT><B>exit</B> [<I>n</I>]<DD>
9489 Cause the shell to exit
9490 with a status of <I>n</I>. If
9491 <I>n</I>
9492
9493 is omitted, the exit status
9494 is that of the last command executed.
9495 A trap on
9496 <FONT SIZE=-1><B>EXIT</B>
9497
9498 </FONT>
9499 is executed before the shell terminates.
9500 <DT><B>export</B> [<B>-fn</B>] [<I>name</I>[=<I>word</I>]] ...<DD>
9501
9502 <DT><B>export -p</B>
9503
9504 <DD>
9505
9506 The supplied
9507 <I>names</I>
9508
9509 are marked for automatic export to the environment of
9510 subsequently executed commands. If the
9511 <B>-f</B>
9512
9513 option is given,
9514 the
9515 <I>names</I>
9516
9517 refer to functions.
9518 If no
9519 <I>names</I>
9520
9521 are given, or if the
9522 <B>-p</B>
9523
9524 option is supplied, a list
9525 of all names that are exported in this shell is printed.
9526 The
9527 <B>-n</B>
9528
9529 option causes the export property to be removed from each
9530 <I>name</I>.
9531 If a variable name is followed by =<I>word</I>, the value of
9532 the variable is set to <I>word</I>.
9533 <B>export</B>
9534
9535 returns an exit status of 0 unless an invalid option is
9536 encountered,
9537 one of the <I>names</I> is not a valid shell variable name, or
9538 <B>-f</B>
9539
9540 is supplied with a
9541 <I>name</I>
9542
9543 that is not a function.
9544 <DT><B>fc</B> [<B>-e</B> <I>ename</I>] [<B>-lnr</B>] [<I>first</I>] [<I>last</I>]<DD>
9545
9546 <DT><B>fc</B> <B>-s</B> [<I>pat</I>=<I>rep</I>] [<I>cmd</I>]<DD>
9547
9548 Fix Command. In the first form, a range of commands from
9549 <I>first</I>
9550
9551 to
9552 <I>last</I>
9553
9554 is selected from the history list.
9555 <I>First</I>
9556
9557 and
9558 <I>last</I>
9559
9560 may be specified as a string (to locate the last command beginning
9561 with that string) or as a number (an index into the history list,
9562 where a negative number is used as an offset from the current
9563 command number). If
9564 <I>last</I>
9565
9566 is not specified it is set to
9567 the current command for listing (so that
9568
9569 <TT>fc -l -10</TT>
9570 prints the last 10 commands) and to
9571 <I>first</I>
9572
9573 otherwise.
9574 If
9575 <I>first</I>
9576
9577 is not specified it is set to the previous
9578 command for editing and -16 for listing.
9579 <P>
9580 The
9581 <B>-n</B>
9582
9583 option suppresses
9584 the command numbers when listing. The
9585 <B>-r</B>
9586
9587 option reverses the order of
9588 the commands. If the
9589 <B>-l</B>
9590
9591 option is given,
9592 the commands are listed on
9593 standard output. Otherwise, the editor given by
9594 <I>ename</I>
9595
9596 is invoked
9597 on a file containing those commands. If
9598 <I>ename</I>
9599
9600 is not given, the
9601 value of the
9602 <FONT SIZE=-1><B>FCEDIT</B>
9603
9604 </FONT>
9605 variable is used, and
9606 the value of
9607 <FONT SIZE=-1><B>EDITOR</B>
9608
9609 </FONT>
9610 if
9611 <FONT SIZE=-1><B>FCEDIT</B>
9612
9613 </FONT>
9614 is not set. If neither variable is set,
9615
9616 <I>vi</I>
9617
9618 is used. When editing is complete, the edited commands are
9619 echoed and executed.
9620 <P>
9621 In the second form, <I>command</I> is re-executed after each instance
9622 of <I>pat</I> is replaced by <I>rep</I>.
9623 A useful alias to use with this is
9624
9625 <TT>r='fc -s'</TT>,
9626 so that typing
9627
9628 <TT>r cc</TT>
9629 runs the last command beginning with
9630
9631 <TT>cc</TT>
9632 and typing
9633
9634 <TT>r</TT>
9635 re-executes the last command.
9636 <P>
9637 If the first form is used, the return value is 0 unless an invalid
9638 option is encountered or
9639 <I>first</I>
9640
9641 or
9642 <I>last</I>
9643
9644 specify history lines out of range.
9645 If the
9646 <B>-e</B>
9647
9648 option is supplied, the return value is the value of the last
9649 command executed or failure if an error occurs with the temporary
9650 file of commands. If the second form is used, the return status
9651 is that of the command re-executed, unless
9652 <I>cmd</I>
9653
9654 does not specify a valid history line, in which case
9655 <B>fc</B>
9656
9657 returns failure.
9658 <DT><B>fg</B> [<I>jobspec</I>]<DD>
9659 Resume
9660 <I>jobspec</I>
9661
9662 in the foreground, and make it the current job.
9663 If
9664 <I>jobspec</I>
9665
9666 is not present, the shell's notion of the <I>current job</I> is used.
9667 The return value is that of the command placed into the foreground,
9668 or failure if run when job control is disabled or, when run with
9669 job control enabled, if
9670 <I>jobspec</I>
9671
9672 does not specify a valid job or
9673 <I>jobspec</I>
9674
9675 specifies a job that was started without job control.
9676 <DT><B>getopts</B> <I>optstring</I> <I>name</I> [<I>args</I>]<DD>
9677 <B>getopts</B>
9678
9679 is used by shell procedures to parse positional parameters.
9680 <I>optstring</I>
9681
9682 contains the option characters to be recognized; if a character
9683 is followed by a colon, the option is expected to have an
9684 argument, which should be separated from it by white space.
9685 The colon and question mark characters may not be used as
9686 option characters.
9687 Each time it is invoked,
9688 <B>getopts</B>
9689
9690 places the next option in the shell variable
9691 <I>name</I>,
9692
9693 initializing
9694 <I>name</I>
9695
9696 if it does not exist,
9697 and the index of the next argument to be processed into the
9698 variable
9699 <FONT SIZE=-1><B>OPTIND</B>.
9700
9701 </FONT>
9702 <FONT SIZE=-1><B>OPTIND</B>
9703
9704 </FONT>
9705 is initialized to 1 each time the shell or a shell script
9706 is invoked. When an option requires an argument,
9707 <B>getopts</B>
9708
9709 places that argument into the variable
9710 <FONT SIZE=-1><B>OPTARG</B>.
9711
9712 </FONT>
9713 The shell does not reset
9714 <FONT SIZE=-1><B>OPTIND</B>
9715
9716 </FONT>
9717 automatically; it must be manually reset between multiple
9718 calls to
9719 <B>getopts</B>
9720
9721 within the same shell invocation if a new set of parameters
9722 is to be used.
9723 <P>
9724 When the end of options is encountered, <B>getopts</B> exits with a
9725 return value greater than zero.
9726 <FONT SIZE=-1><B>OPTIND</B>
9727
9728 </FONT>
9729 is set to the index of the first non-option argument,
9730 and <B>name</B> is set to ?.
9731 <P>
9732 <B>getopts</B>
9733
9734 normally parses the positional parameters, but if more arguments are
9735 given in
9736 <I>args</I>,
9737
9738 <B>getopts</B>
9739
9740 parses those instead.
9741 <P>
9742 <B>getopts</B>
9743
9744 can report errors in two ways. If the first character of
9745 <I>optstring</I>
9746
9747 is a colon,
9748 <I>silent</I>
9749
9750 error reporting is used. In normal operation diagnostic messages
9751 are printed when invalid options or missing option arguments are
9752 encountered.
9753 If the variable
9754 <FONT SIZE=-1><B>OPTERR</B>
9755
9756 </FONT>
9757 is set to 0, no error messages will be displayed, even if the first
9758 character of
9759 <I>optstring</I>
9760
9761 is not a colon.
9762 <P>
9763 If an invalid option is seen,
9764 <B>getopts</B>
9765
9766 places ? into
9767 <I>name</I>
9768
9769 and, if not silent,
9770 prints an error message and unsets
9771 <FONT SIZE=-1><B>OPTARG</B>.
9772
9773 </FONT>
9774 If
9775 <B>getopts</B>
9776
9777 is silent,
9778 the option character found is placed in
9779 <FONT SIZE=-1><B>OPTARG</B>
9780
9781 </FONT>
9782 and no diagnostic message is printed.
9783 <P>
9784 If a required argument is not found, and
9785 <B>getopts</B>
9786
9787 is not silent,
9788 a question mark (<B>?</B>) is placed in
9789 <I>name</I>,
9790
9791 <FONT SIZE=-1><B>OPTARG</B>
9792
9793 </FONT>
9794 is unset, and a diagnostic message is printed.
9795 If
9796 <B>getopts</B>
9797
9798 is silent, then a colon (<B>:</B>) is placed in
9799 <I>name</I>
9800
9801 and
9802 <FONT SIZE=-1><B>OPTARG</B>
9803
9804 </FONT>
9805 is set to the option character found.
9806 <P>
9807 <B>getopts</B>
9808
9809 returns true if an option, specified or unspecified, is found.
9810 It returns false if the end of options is encountered or an
9811 error occurs.
9812 <DT><B>hash</B> [<B>-lr</B>] [<B>-p</B> <I>filename</I>] [<B>-dt</B>] [<I>name</I>]<DD>
9813 For each
9814 <I>name</I>,
9815
9816 the full file name of the command is determined by searching
9817 the directories in
9818 <B>$PATH</B>
9819
9820 and remembered.
9821 If the
9822 <B>-p</B>
9823
9824 option is supplied, no path search is performed, and
9825 <I>filename</I>
9826
9827 is used as the full file name of the command.
9828 The
9829 <B>-r</B>
9830
9831 option causes the shell to forget all
9832 remembered locations.
9833 The
9834 <B>-d</B>
9835
9836 option causes the shell to forget the remembered location of each <I>name</I>.
9837 If the
9838 <B>-t</B>
9839
9840 option is supplied, the full pathname to which each <I>name</I> corresponds
9841 is printed. If multiple <I>name</I> arguments are supplied with <B>-t</B>,
9842 the <I>name</I> is printed before the hashed full pathname.
9843 The
9844 <B>-l</B>
9845
9846 option causes output to be displayed in a format that may be reused as input.
9847 If no arguments are given, or if only <B>-l</B> is supplied,
9848 information about remembered commands is printed.
9849 The return status is true unless a
9850 <I>name</I>
9851
9852 is not found or an invalid option is supplied.
9853 <DT><B>help</B> [<B>-dms</B>] [<I>pattern</I>]<DD>
9854 Display helpful information about builtin commands. If
9855 <I>pattern</I>
9856
9857 is specified,
9858 <B>help</B>
9859
9860 gives detailed help on all commands matching
9861 <I>pattern</I>;
9862
9863 otherwise help for all the builtins and shell control structures
9864 is printed.
9865 <DL COMPACT><DT><DD>
9866
9867 <DL COMPACT>
9868 <DT><B>-d</B>
9869
9870 <DD>
9871 Display a short description of each <I>pattern</I>
9872 <DT><B>-m</B>
9873
9874 <DD>
9875 Display the description of each <I>pattern</I> in a manpage-like format
9876 <DT><B>-s</B>
9877
9878 <DD>
9879 Display only a short usage synopsis for each <I>pattern</I>
9880
9881 </DL></DL>
9882
9883 The return status is 0 unless no command matches
9884 <I>pattern</I>.
9885
9886 <DT><B>history [</B><I>n</I>]<DD>
9887
9888 <DT><B>history</B> <B>-c</B><DD>
9889 <DT><B>history -d</B> <I>offset</I><DD>
9890 <DT><B>history</B> <B>-anrw</B> [<I>filename</I>]<DD>
9891 <DT><B>history</B> <B>-p</B> <I>arg</I> [<I>arg ...</I>]<DD>
9892 <DT><B>history</B> <B>-s</B> <I>arg</I> [<I>arg ...</I>]<DD>
9893
9894 With no options, display the command
9895 history list with line numbers. Lines listed
9896 with a
9897 <B>*</B>
9898
9899 have been modified. An argument of
9900 <I>n</I>
9901
9902 lists only the last
9903 <I>n</I>
9904
9905 lines.
9906 If the shell variable
9907 <FONT SIZE=-1><B>HISTTIMEFORMAT</B>
9908
9909 </FONT>
9910 is set and not null,
9911 it is used as a format string for <I>strftime</I>(3) to display
9912 the time stamp associated with each displayed history entry.
9913 No intervening blank is printed between the formatted time stamp
9914 and the history line.
9915 If <I>filename</I> is supplied, it is used as the
9916 name of the history file; if not, the value of
9917 <FONT SIZE=-1><B>HISTFILE</B>
9918
9919 </FONT>
9920 is used. Options, if supplied, have the following meanings:
9921 <DL COMPACT><DT><DD>
9922
9923 <DL COMPACT>
9924 <DT><B>-c</B>
9925
9926 <DD>
9927 Clear the history list by deleting all the entries.
9928 <DT><B>-d</B> <I>offset</I><DD>
9929 Delete the history entry at position <I>offset</I>.
9930 <DT><B>-a</B>
9931
9932 <DD>
9933 Append the ``new'' history lines (history lines entered since the
9934 beginning of the current <B>bash</B> session) to the history file.
9935 <DT><B>-n</B>
9936
9937 <DD>
9938 Read the history lines not already read from the history
9939 file into the current history list. These are lines
9940 appended to the history file since the beginning of the
9941 current <B>bash</B> session.
9942 <DT><B>-r</B>
9943
9944 <DD>
9945 Read the contents of the history file
9946 and use them as the current history.
9947 <DT><B>-w</B>
9948
9949 <DD>
9950 Write the current history to the history file, overwriting the
9951 history file's contents.
9952 <DT><B>-p</B>
9953
9954 <DD>
9955 Perform history substitution on the following <I>args</I> and display
9956 the result on the standard output.
9957 Does not store the results in the history list.
9958 Each <I>arg</I> must be quoted to disable normal history expansion.
9959 <DT><B>-s</B>
9960
9961 <DD>
9962 Store the
9963 <I>args</I>
9964
9965 in the history list as a single entry. The last command in the
9966 history list is removed before the
9967 <I>args</I>
9968
9969 are added.
9970
9971 </DL>
9972 <P>
9973
9974 If the
9975 <FONT SIZE=-1><B>HISTTIMEFORMAT</B>
9976
9977 </FONT>
9978 variable is set, the time stamp information
9979 associated with each history entry is written to the history file,
9980 marked with the history comment character.
9981 When the history file is read, lines beginning with the history
9982 comment character followed immediately by a digit are interpreted
9983 as timestamps for the previous history line.
9984 The return value is 0 unless an invalid option is encountered, an
9985 error occurs while reading or writing the history file, an invalid
9986 <I>offset</I> is supplied as an argument to <B>-d</B>, or the
9987 history expansion supplied as an argument to <B>-p</B> fails.
9988 </DL>
9989
9990 <DT><B>jobs</B> [<B>-lnprs</B>] [ <I>jobspec</I> ... ]<DD>
9991
9992 <DT><B>jobs</B> <B>-x</B> <I>command</I> [ <I>args</I> ... ]<DD>
9993
9994 The first form lists the active jobs. The options have the following
9995 meanings:
9996 <DL COMPACT><DT><DD>
9997
9998 <DL COMPACT>
9999 <DT><B>-l</B>
10000
10001 <DD>
10002 List process IDs
10003 in addition to the normal information.
10004 <DT><B>-n</B>
10005
10006 <DD>
10007 Display information only about jobs that have changed status since
10008 the user was last notified of their status.
10009 <DT><B>-p</B>
10010
10011 <DD>
10012 List only the process ID of the job's process group
10013 leader.
10014 <DT><B>-r</B>
10015
10016 <DD>
10017 Restrict output to running jobs.
10018 <DT><B>-s</B>
10019
10020 <DD>
10021 Restrict output to stopped jobs.
10022
10023 </DL>
10024 <P>
10025
10026 If
10027 <I>jobspec</I>
10028
10029 is given, output is restricted to information about that job.
10030 The return status is 0 unless an invalid option is encountered
10031 or an invalid
10032 <I>jobspec</I>
10033
10034 is supplied.
10035 <P>
10036
10037 If the
10038 <B>-x</B>
10039
10040 option is supplied,
10041 <B>jobs</B>
10042
10043 replaces any
10044 <I>jobspec</I>
10045
10046 found in
10047 <I>command</I>
10048
10049 or
10050 <I>args</I>
10051
10052 with the corresponding process group ID, and executes
10053 <I>command</I>
10054
10055 passing it
10056 <I>args</I>,
10057
10058 returning its exit status.
10059 </DL>
10060
10061 <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>
10062
10063 <DT><B>kill</B> <B>-l</B> [<I>sigspec</I> | <I>exit_status</I>]<DD>
10064
10065 Send the signal named by
10066 <I>sigspec</I>
10067
10068 or
10069 <I>signum</I>
10070
10071 to the processes named by
10072 <I>pid</I>
10073
10074 or
10075 <I>jobspec</I>.
10076
10077 <I>sigspec</I>
10078
10079 is either a case-insensitive signal name such as
10080 <FONT SIZE=-1><B>SIGKILL</B>
10081
10082 </FONT>
10083 (with or without the
10084 <FONT SIZE=-1><B>SIG</B>
10085
10086 </FONT>
10087 prefix) or a signal number;
10088 <I>signum</I>
10089
10090 is a signal number.
10091 If
10092 <I>sigspec</I>
10093
10094 is not present, then
10095 <FONT SIZE=-1><B>SIGTERM</B>
10096
10097 </FONT>
10098 is assumed.
10099 An argument of
10100 <B>-l</B>
10101
10102 lists the signal names.
10103 If any arguments are supplied when
10104 <B>-l</B>
10105
10106 is given, the names of the signals corresponding to the arguments are
10107 listed, and the return status is 0.
10108 The <I>exit_status</I> argument to
10109 <B>-l</B>
10110
10111 is a number specifying either a signal number or the exit status of
10112 a process terminated by a signal.
10113 <B>kill</B>
10114
10115 returns true if at least one signal was successfully sent, or false
10116 if an error occurs or an invalid option is encountered.
10117 <DT><B>let</B> <I>arg</I> [<I>arg</I> ...]<DD>
10118 Each
10119 <I>arg</I>
10120
10121 is an arithmetic expression to be evaluated (see
10122 <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>
10123
10124 </FONT>
10125 above).
10126 If the last
10127 <I>arg</I>
10128
10129 evaluates to 0,
10130 <B>let</B>
10131
10132 returns 1; 0 is returned otherwise.
10133 <DT><B>local</B> [<I>option</I>] [<I>name</I>[=<I>value</I>] ...]<DD>
10134 For each argument, a local variable named
10135 <I>name </I>
10136
10137 is created, and assigned
10138 <I>value</I>.
10139
10140 The <I>option</I> can be any of the options accepted by <B>declare</B>.
10141 When
10142 <B>local</B>
10143
10144 is used within a function, it causes the variable
10145 <I>name</I>
10146
10147 to have a visible scope restricted to that function and its children.
10148 With no operands,
10149 <B>local</B>
10150
10151 writes a list of local variables to the standard output. It is
10152 an error to use
10153 <B>local</B>
10154
10155 when not within a function. The return status is 0 unless
10156 <B>local</B>
10157
10158 is used outside a function, an invalid
10159 <I>name</I>
10160
10161 is supplied, or
10162 <I>name</I> is a readonly variable.
10163 <DT><B>logout</B>
10164
10165 <DD>
10166 Exit a login shell.
10167 <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>
10168
10169 <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>
10170
10171 Read lines from the standard input into the indexed array variable
10172 <I>array</I>,
10173
10174 or from file descriptor
10175 <I>fd</I>
10176
10177 if the
10178 <B>-u</B>
10179
10180 option is supplied.
10181 The variable
10182 <FONT SIZE=-1><B>MAPFILE</B>
10183
10184 </FONT>
10185 is the default <I>array</I>.
10186 Options, if supplied, have the following meanings:
10187 <DL COMPACT><DT><DD>
10188
10189 <DL COMPACT>
10190 <DT><B>-n</B>
10191
10192 <DD>
10193 Copy at most
10194 <I>count</I>
10195
10196 lines. If <I>count</I> is 0, all lines are copied.
10197 <DT><B>-O</B>
10198
10199 <DD>
10200 Begin assigning to
10201 <I>array</I>
10202
10203 at index
10204 <I>origin</I>.
10205
10206 The default index is 0.
10207 <DT><B>-s</B>
10208
10209 <DD>
10210 Discard the first <I>count</I> lines read.
10211 <DT><B>-t</B>
10212
10213 <DD>
10214 Remove a trailing newline from each line read.
10215 <DT><B>-u</B>
10216
10217 <DD>
10218 Read lines from file descriptor <I>fd</I> instead of the standard input.
10219 <DT><B>-C</B>
10220
10221 <DD>
10222 Evaluate
10223 <I>callback</I>
10224
10225 each time <I>quantum</I> lines are read. The <B>-c</B> option specifies
10226 <I>quantum</I>.
10227
10228 <DT><B>-c</B>
10229
10230 <DD>
10231 Specify the number of lines read between each call to
10232 <I>callback</I>.
10233
10234
10235 </DL>
10236 <P>
10237
10238 If
10239 <B>-C</B>
10240
10241 is specified without
10242 <B>-c</B>,
10243
10244 the default quantum is 5000.
10245 When <I>callback</I> is evaluated, it is supplied the index of the next
10246 array element to be assigned as an additional argument.
10247 <I>callback</I> is evaluated after the line is read but before the
10248 array element is assigned.
10249 <P>
10250
10251 If not supplied with an explicit origin, <B>mapfile</B> will clear <I>array</I>
10252 before assigning to it.
10253 <P>
10254
10255 <B>mapfile</B> returns successfully unless an invalid option or option
10256 argument is supplied, <I>array</I> is invalid or unassignable, or if
10257 <I>array</I> is not an indexed array.
10258 </DL>
10259
10260 <DT><B>popd</B> [-<B>n</B>] [+<I>n</I>] [-<I>n</I>]<DD>
10261 Removes entries from the directory stack. With no arguments,
10262 removes the top directory from the stack, and performs a
10263 <B>cd</B>
10264
10265 to the new top directory.
10266 Arguments, if supplied, have the following meanings:
10267 <DL COMPACT><DT><DD>
10268
10269 <DL COMPACT>
10270 <DT><B>-n</B>
10271
10272 <DD>
10273 Suppresses the normal change of directory when removing directories
10274 from the stack, so that only the stack is manipulated.
10275 <DT><B>+</B><I>n</I><DD>
10276 Removes the <I>n</I>th entry counting from the left of the list
10277 shown by
10278 <B>dirs</B>,
10279
10280 starting with zero. For example:
10281
10282 <TT>popd +0</TT>
10283 removes the first directory,
10284
10285 <TT>popd +1</TT>
10286 the second.
10287 <DT><B>-</B><I>n</I><DD>
10288 Removes the <I>n</I>th entry counting from the right of the list
10289 shown by
10290 <B>dirs</B>,
10291
10292 starting with zero. For example:
10293
10294 <TT>popd -0</TT>
10295 removes the last directory,
10296
10297 <TT>popd -1</TT>
10298 the next to last.
10299
10300 </DL>
10301 <P>
10302
10303 If the
10304 <B>popd</B>
10305
10306 command is successful, a
10307 <B>dirs</B>
10308
10309 is performed as well, and the return status is 0.
10310 <B>popd</B>
10311
10312 returns false if an invalid option is encountered, the directory stack
10313 is empty, a non-existent directory stack entry is specified, or the
10314 directory change fails.
10315 </DL>
10316
10317 <DT><B>printf</B> [<B>-v</B> <I>var</I>] <I>format</I> [<I>arguments</I>]<DD>
10318 Write the formatted <I>arguments</I> to the standard output under the
10319 control of the <I>format</I>.
10320 The <I>format</I> is a character string which contains three types of objects:
10321 plain characters, which are simply copied to standard output, character
10322 escape sequences, which are converted and copied to the standard output, and
10323 format specifications, each of which causes printing of the next successive
10324 <I>argument</I>.
10325 In addition to the standard <I>printf</I>(1) formats, <B>%b</B> causes
10326 <B>printf</B> to expand backslash escape sequences in the corresponding
10327 <I>argument</I> (except that <B>\c</B> terminates output, backslashes in
10328 <B>\aq</B>, <B>\&quot;</B>, and <B>\?</B> are not removed, and octal escapes
10329 beginning with <B>\0</B> may contain up to four digits),
10330 and <B>%q</B> causes <B>printf</B> to output the corresponding
10331 <I>argument</I> in a format that can be reused as shell input.
10332 <P>
10333 The <B>-v</B> option causes the output to be assigned to the variable
10334 <I>var</I> rather than being printed to the standard output.
10335 <P>
10336 The <I>format</I> is reused as necessary to consume all of the <I>arguments</I>.
10337 If the <I>format</I> requires more <I>arguments</I> than are supplied, the
10338 extra format specifications behave as if a zero value or null string, as
10339 appropriate, had been supplied. The return value is zero on success,
10340 non-zero on failure.
10341 <DT><B>pushd</B> [<B>-n</B>] [+<I>n</I>] [-<I>n</I>]<DD>
10342
10343 <DT><B>pushd</B> [<B>-n</B>] [<I>dir</I>]<DD>
10344
10345 Adds a directory to the top of the directory stack, or rotates
10346 the stack, making the new top of the stack the current working
10347 directory. With no arguments, exchanges the top two directories
10348 and returns 0, unless the directory stack is empty.
10349 Arguments, if supplied, have the following meanings:
10350 <DL COMPACT><DT><DD>
10351
10352 <DL COMPACT>
10353 <DT><B>-n</B>
10354
10355 <DD>
10356 Suppresses the normal change of directory when adding directories
10357 to the stack, so that only the stack is manipulated.
10358 <DT><B>+</B><I>n</I><DD>
10359 Rotates the stack so that the <I>n</I>th directory
10360 (counting from the left of the list shown by
10361 <B>dirs</B>,
10362
10363 starting with zero)
10364 is at the top.
10365 <DT><B>-</B><I>n</I><DD>
10366 Rotates the stack so that the <I>n</I>th directory
10367 (counting from the right of the list shown by
10368 <B>dirs</B>,
10369
10370 starting with zero) is at the top.
10371 <DT><I>dir</I>
10372
10373 <DD>
10374 Adds
10375 <I>dir</I>
10376
10377 to the directory stack at the top, making it the
10378 new current working directory.
10379
10380 </DL>
10381 <P>
10382
10383 If the
10384 <B>pushd</B>
10385
10386 command is successful, a
10387 <B>dirs</B>
10388
10389 is performed as well.
10390 If the first form is used,
10391 <B>pushd</B>
10392
10393 returns 0 unless the cd to
10394 <I>dir</I>
10395
10396 fails. With the second form,
10397 <B>pushd</B>
10398
10399 returns 0 unless the directory stack is empty,
10400 a non-existent directory stack element is specified,
10401 or the directory change to the specified new current directory
10402 fails.
10403 </DL>
10404
10405 <DT><B>pwd</B> [<B>-LP</B>]<DD>
10406 Print the absolute pathname of the current working directory.
10407 The pathname printed contains no symbolic links if the
10408 <B>-P</B>
10409
10410 option is supplied or the
10411 <B>-o physical</B>
10412
10413 option to the
10414 <B>set</B>
10415
10416 builtin command is enabled.
10417 If the
10418 <B>-L</B>
10419
10420 option is used, the pathname printed may contain symbolic links.
10421 The return status is 0 unless an error occurs while
10422 reading the name of the current directory or an
10423 invalid option is supplied.
10424 <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>
10425 One line is read from the standard input, or from the file descriptor
10426 <I>fd</I> supplied as an argument to the <B>-u</B> option, and the first word
10427 is assigned to the first
10428 <I>name</I>,
10429
10430 the second word to the second
10431 <I>name</I>,
10432
10433 and so on, with leftover words and their intervening separators assigned
10434 to the last
10435 <I>name</I>.
10436
10437 If there are fewer words read from the input stream than names,
10438 the remaining names are assigned empty values.
10439 The characters in
10440 <FONT SIZE=-1><B>IFS</B>
10441
10442 </FONT>
10443 are used to split the line into words.
10444 The backslash character (<B>\</B>) may be used to remove any special
10445 meaning for the next character read and for line continuation.
10446 Options, if supplied, have the following meanings:
10447 <DL COMPACT><DT><DD>
10448
10449 <DL COMPACT>
10450 <DT><B>-a </B><I>aname</I>
10451
10452 <DD>
10453 The words are assigned to sequential indices
10454 of the array variable
10455 <I>aname</I>,
10456
10457 starting at 0.
10458 <I>aname</I>
10459
10460 is unset before any new values are assigned.
10461 Other <I>name</I> arguments are ignored.
10462 <DT><B>-d </B><I>delim</I>
10463
10464 <DD>
10465 The first character of <I>delim</I> is used to terminate the input line,
10466 rather than newline.
10467 <DT><B>-e</B>
10468
10469 <DD>
10470 If the standard input
10471 is coming from a terminal,
10472 <B>readline</B>
10473
10474 (see
10475 <FONT SIZE=-1><B>READLINE</B>
10476
10477 </FONT>
10478 above) is used to obtain the line.
10479 Readline uses the current (or default, if line editing was not previously
10480 active) editing settings.
10481 <DT><B>-i </B><I>text</I>
10482
10483 <DD>
10484 If
10485 <B>readline</B>
10486
10487 is being used to read the line, <I>text</I> is placed into the editing
10488 buffer before editing begins.
10489 <DT><B>-n </B><I>nchars</I>
10490
10491 <DD>
10492 <B>read</B> returns after reading <I>nchars</I> characters rather than
10493 waiting for a complete line of input, but honor a delimiter if fewer
10494 than <I>nchars</I> characters are read before the delimiter.
10495 <DT><B>-N </B><I>nchars</I>
10496
10497 <DD>
10498 <B>read</B> returns after reading exactly <I>nchars</I> characters rather
10499 than waiting for a complete line of input, unless EOF is encountered or
10500 <B>read</B> times out.
10501 Delimiter characters encountered in the input are
10502 not treated specially and do not cause <B>read</B> to return until
10503 <I>nchars</I> characters are read.
10504 <DT><B>-p </B><I>prompt</I>
10505
10506 <DD>
10507 Display <I>prompt</I> on standard error, without a
10508 trailing newline, before attempting to read any input. The prompt
10509 is displayed only if input is coming from a terminal.
10510 <DT><B>-r</B>
10511
10512 <DD>
10513 Backslash does not act as an escape character.
10514 The backslash is considered to be part of the line.
10515 In particular, a backslash-newline pair may not be used as a line
10516 continuation.
10517 <DT><B>-s</B>
10518
10519 <DD>
10520 Silent mode. If input is coming from a terminal, characters are
10521 not echoed.
10522 <DT><B>-t </B><I>timeout</I>
10523
10524 <DD>
10525 Cause <B>read</B> to time out and return failure if a complete line of
10526 input is not read within <I>timeout</I> seconds.
10527 <I>timeout</I> may be a decimal number with a fractional portion following
10528 the decimal point.
10529 This option is only effective if <B>read</B> is reading input from a
10530 terminal, pipe, or other special file; it has no effect when reading
10531 from regular files.
10532 If <I>timeout</I> is 0, <B>read</B> returns success if input is available on
10533 the specified file descriptor, failure otherwise.
10534 The exit status is greater than 128 if the timeout is exceeded.
10535 <DT><B>-u </B><I>fd</I>
10536
10537 <DD>
10538 Read input from file descriptor <I>fd</I>.
10539
10540 </DL>
10541 <P>
10542
10543 If no
10544 <I>names</I>
10545
10546 are supplied, the line read is assigned to the variable
10547 <FONT SIZE=-1><B>REPLY</B>.
10548
10549 </FONT>
10550 The return code is zero, unless end-of-file is encountered, <B>read</B>
10551 times out (in which case the return code is greater than 128), or an
10552 invalid file descriptor is supplied as the argument to <B>-u</B>.
10553 </DL>
10554
10555 <DT><B>readonly</B> [<B>-aApf</B>] [<I>name</I>[=<I>word</I>] ...]<DD>
10556
10557 The given
10558 <I>names</I> are marked readonly; the values of these
10559 <I>names</I>
10560
10561 may not be changed by subsequent assignment.
10562 If the
10563 <B>-f</B>
10564
10565 option is supplied, the functions corresponding to the
10566 <I>names</I> are so
10567 marked.
10568 The
10569 <B>-a</B>
10570
10571 option restricts the variables to indexed arrays; the
10572 <B>-A</B>
10573
10574 option restricts the variables to associative arrays.
10575 If no
10576 <I>name</I>
10577
10578 arguments are given, or if the
10579 <B>-p</B>
10580
10581 option is supplied, a list of all readonly names is printed.
10582 The
10583 <B>-p</B>
10584
10585 option causes output to be displayed in a format that
10586 may be reused as input.
10587 If a variable name is followed by =<I>word</I>, the value of
10588 the variable is set to <I>word</I>.
10589 The return status is 0 unless an invalid option is encountered,
10590 one of the
10591 <I>names</I>
10592
10593 is not a valid shell variable name, or
10594 <B>-f</B>
10595
10596 is supplied with a
10597 <I>name</I>
10598
10599 that is not a function.
10600 <DT><B>return</B> [<I>n</I>]<DD>
10601 Causes a function to exit with the return value specified by
10602 <I>n</I>.
10603
10604 If
10605 <I>n</I>
10606
10607 is omitted, the return status is that of the last command
10608 executed in the function body. If used outside a function,
10609 but during execution of a script by the
10610 <B>.</B>
10611
10612 (<B>source</B>) command, it causes the shell to stop executing
10613 that script and return either
10614 <I>n</I>
10615
10616 or the exit status of the last command executed within the
10617 script as the exit status of the script. If used outside a
10618 function and not during execution of a script by <B>.</B>,
10619 the return status is false.
10620 Any command associated with the <B>RETURN</B> trap is executed
10621 before execution resumes after the function or script.
10622 <DT><B>set</B> [<B>--abefhkmnptuvxBCEHPT</B>] [<B>-o</B> <I>option</I>] [<I>arg</I> ...]<DD>
10623
10624 <DT><B>set</B> [<B>+abefhkmnptuvxBCEHPT</B>] [<B>+o</B> <I>option</I>] [<I>arg</I> ...]<DD>
10625
10626 Without options, the name and value of each shell variable are displayed
10627 in a format that can be reused as input
10628 for setting or resetting the currently-set variables.
10629 Read-only variables cannot be reset.
10630 In <I>posix mode</I>, only shell variables are listed.
10631 The output is sorted according to the current locale.
10632 When options are specified, they set or unset shell attributes.
10633 Any arguments remaining after option processing are treated
10634 as values for the positional parameters and are assigned, in order, to
10635 <B>$1</B>,
10636
10637 <B>$2</B>,
10638
10639 <B>...</B>
10640
10641 <B>$</B><I>n</I>.
10642
10643 Options, if specified, have the following meanings:
10644 <DL COMPACT><DT><DD>
10645
10646 <DL COMPACT>
10647 <DT><B>-a</B>
10648
10649 <DD>
10650 Automatically mark variables and functions which are modified or
10651 created for export to the environment of subsequent commands.
10652 <DT><B>-b</B>
10653
10654 <DD>
10655 Report the status of terminated background jobs
10656 immediately, rather than before the next primary prompt. This is
10657 effective only when job control is enabled.
10658 <DT><B>-e</B>
10659
10660 <DD>
10661 Exit immediately if a <I>pipeline</I> (which may consist of a single
10662 <I>simple command</I>), a <I>subshell</I> command enclosed in parentheses,
10663 or one of the commands executed as part of a command list enclosed
10664 by braces (see
10665 <FONT SIZE=-1><B>SHELL GRAMMAR</B>
10666
10667 </FONT>
10668 above) exits with a non-zero status.
10669 The shell does not exit if the
10670 command that fails is part of the command list immediately following a
10671 <B>while</B>
10672
10673 or
10674 <B>until</B>
10675
10676 keyword,
10677 part of the test following the
10678 <B>if</B>
10679
10680 or
10681 <B>elif</B>
10682
10683 reserved words, part of any command executed in a
10684 <B>&amp;&amp;</B>
10685
10686 or
10687 <B>||</B>
10688
10689 list except the command following the final <B>&amp;&amp;</B> or <B>||</B>,
10690 any command in a pipeline but the last,
10691 or if the command's return value is
10692 being inverted with
10693 <B>!</B>.
10694
10695 A trap on <B>ERR</B>, if set, is executed before the shell exits.
10696 This option applies to the shell environment and each subshell environment
10697 separately (see
10698 <FONT SIZE=-1><B>COMMAND EXECUTION ENVIRONMENT</B>
10699
10700 </FONT>
10701 above), and may cause
10702 subshells to exit before executing all the commands in the subshell.
10703 <DT><B>-f</B>
10704
10705 <DD>
10706 Disable pathname expansion.
10707 <DT><B>-h</B>
10708
10709 <DD>
10710 Remember the location of commands as they are looked up for execution.
10711 This is enabled by default.
10712 <DT><B>-k</B>
10713
10714 <DD>
10715 All arguments in the form of assignment statements
10716 are placed in the environment for a command, not just
10717 those that precede the command name.
10718 <DT><B>-m</B>
10719
10720 <DD>
10721 Monitor mode. Job control is enabled. This option is on
10722 by default for interactive shells on systems that support
10723 it (see
10724 <FONT SIZE=-1><B>JOB CONTROL</B>
10725
10726 </FONT>
10727 above). Background processes run in a separate process
10728 group and a line containing their exit status is printed
10729 upon their completion.
10730 <DT><B>-n</B>
10731
10732 <DD>
10733 Read commands but do not execute them. This may be used to
10734 check a shell script for syntax errors. This is ignored by
10735 interactive shells.
10736 <DT><B>-o </B><I>option-name</I>
10737
10738 <DD>
10739 The <I>option-name</I> can be one of the following:
10740 <DL COMPACT><DT><DD>
10741 <DL COMPACT>
10742 <DT><B>allexport</B>
10743
10744 <DD>
10745 Same as
10746 <B>-a</B>.
10747
10748 <DT><B>braceexpand</B>
10749
10750 <DD>
10751 Same as
10752 <B>-B</B>.
10753
10754 <DT><B>emacs</B>
10755
10756 <DD>
10757 Use an emacs-style command line editing interface. This is enabled
10758 by default when the shell is interactive, unless the shell is started
10759 with the
10760 <B>--noediting</B>
10761
10762 option.
10763 This also affects the editing interface used for <B>read -e</B>.
10764 <DT><B>errexit</B>
10765
10766 <DD>
10767 Same as
10768 <B>-e</B>.
10769
10770 <DT><B>errtrace</B>
10771
10772 <DD>
10773 Same as
10774 <B>-E</B>.
10775
10776 <DT><B>functrace</B>
10777
10778 <DD>
10779 Same as
10780 <B>-T</B>.
10781
10782 <DT><B>hashall</B>
10783
10784 <DD>
10785 Same as
10786 <B>-h</B>.
10787
10788 <DT><B>histexpand</B>
10789
10790 <DD>
10791 Same as
10792 <B>-H</B>.
10793
10794 <DT><B>history</B>
10795
10796 <DD>
10797 Enable command history, as described above under
10798 <FONT SIZE=-1><B>HISTORY</B>.
10799
10800 </FONT>
10801 This option is on by default in interactive shells.
10802 <DT><B>ignoreeof</B>
10803
10804 <DD>
10805 The effect is as if the shell command
10806 <TT>IGNOREEOF=10</TT>
10807
10808 had been executed
10809 (see
10810 <B>Shell Variables</B>
10811
10812 above).
10813 <DT><B>keyword</B>
10814
10815 <DD>
10816 Same as
10817 <B>-k</B>.
10818
10819 <DT><B>monitor</B>
10820
10821 <DD>
10822 Same as
10823 <B>-m</B>.
10824
10825 <DT><B>noclobber</B>
10826
10827 <DD>
10828 Same as
10829 <B>-C</B>.
10830
10831 <DT><B>noexec</B>
10832
10833 <DD>
10834 Same as
10835 <B>-n</B>.
10836
10837 <DT><B>noglob</B>
10838
10839 <DD>
10840 Same as
10841 <B>-f</B>.
10842
10843 <DT><B>nolog</B>
10844
10845 <DD>
10846 Currently ignored.
10847 <DT><B>notify</B>
10848
10849 <DD>
10850 Same as
10851 <B>-b</B>.
10852
10853 <DT><B>nounset</B>
10854
10855 <DD>
10856 Same as
10857 <B>-u</B>.
10858
10859 <DT><B>onecmd</B>
10860
10861 <DD>
10862 Same as
10863 <B>-t</B>.
10864
10865 <DT><B>physical</B>
10866
10867 <DD>
10868 Same as
10869 <B>-P</B>.
10870
10871 <DT><B>pipefail</B>
10872
10873 <DD>
10874 If set, the return value of a pipeline is the value of the last
10875 (rightmost) command to exit with a non-zero status, or zero if all
10876 commands in the pipeline exit successfully.
10877 This option is disabled by default.
10878 <DT><B>posix</B>
10879
10880 <DD>
10881 Change the behavior of
10882 <B>bash</B>
10883
10884 where the default operation differs
10885 from the POSIX standard to match the standard (<I>posix mode</I>).
10886 <DT><B>privileged</B>
10887
10888 <DD>
10889 Same as
10890 <B>-p</B>.
10891
10892 <DT><B>verbose</B>
10893
10894 <DD>
10895 Same as
10896 <B>-v</B>.
10897
10898 <DT><B>vi</B>
10899
10900 <DD>
10901 Use a vi-style command line editing interface.
10902 This also affects the editing interface used for <B>read -e</B>.
10903 <DT><B>xtrace</B>
10904
10905 <DD>
10906 Same as
10907 <B>-x</B>.
10908
10909 <P>
10910 </DL>
10911 <P>
10912
10913 If
10914 <B>-o</B>
10915
10916 is supplied with no <I>option-name</I>, the values of the current options are
10917 printed.
10918 If
10919 <B>+o</B>
10920
10921 is supplied with no <I>option-name</I>, a series of
10922 <B>set</B>
10923
10924 commands to recreate the current option settings is displayed on
10925 the standard output.
10926 </DL>
10927
10928 <DT><B>-p</B>
10929
10930 <DD>
10931 Turn on
10932 <I>privileged</I>
10933
10934 mode. In this mode, the
10935 <FONT SIZE=-1><B>$ENV</B>
10936
10937 </FONT>
10938 and
10939 <FONT SIZE=-1><B>$BASH_ENV</B>
10940
10941 </FONT>
10942 files are not processed, shell functions are not inherited from the
10943 environment, and the
10944 <FONT SIZE=-1><B>SHELLOPTS</B>,
10945
10946 </FONT>
10947 <FONT SIZE=-1><B>BASHOPTS</B>,
10948
10949 </FONT>
10950 <FONT SIZE=-1><B>CDPATH</B>,
10951
10952 </FONT>
10953 and
10954 <FONT SIZE=-1><B>GLOBIGNORE</B>
10955
10956 </FONT>
10957 variables, if they appear in the environment, are ignored.
10958 If the shell is started with the effective user (group) id not equal to the
10959 real user (group) id, and the <B>-p</B> option is not supplied, these actions
10960 are taken and the effective user id is set to the real user id.
10961 If the <B>-p</B> option is supplied at startup, the effective user id is
10962 not reset.
10963 Turning this option off causes the effective user
10964 and group ids to be set to the real user and group ids.
10965 <DT><B>-t</B>
10966
10967 <DD>
10968 Exit after reading and executing one command.
10969 <DT><B>-u</B>
10970
10971 <DD>
10972 Treat unset variables and parameters other than the special
10973 parameters &quot;@&quot; and &quot;*&quot; as an error when performing
10974 parameter expansion. If expansion is attempted on an
10975 unset variable or parameter, the shell prints an error message, and,
10976 if not interactive, exits with a non-zero status.
10977 <DT><B>-v</B>
10978
10979 <DD>
10980 Print shell input lines as they are read.
10981 <DT><B>-x</B>
10982
10983 <DD>
10984 After expanding each <I>simple command</I>,
10985 <B>for</B> command, <B>case</B> command, <B>select</B> command, or
10986 arithmetic <B>for</B> command, display the expanded value of
10987 <FONT SIZE=-1><B>PS4</B>,
10988
10989 </FONT>
10990 followed by the command and its expanded arguments
10991 or associated word list.
10992 <DT><B>-B</B>
10993
10994 <DD>
10995 The shell performs brace expansion (see
10996 <B>Brace Expansion</B>
10997
10998 above). This is on by default.
10999 <DT><B>-C</B>
11000
11001 <DD>
11002 If set,
11003 <B>bash</B>
11004
11005 does not overwrite an existing file with the
11006 <B>&gt;</B>,
11007
11008 <B>&gt;&amp;</B>,
11009
11010 and
11011 <B>&lt;&gt;</B>
11012
11013 redirection operators. This may be overridden when
11014 creating output files by using the redirection operator
11015 <B>&gt;|</B>
11016
11017 instead of
11018 <B>&gt;</B>.
11019
11020 <DT><B>-E</B>
11021
11022 <DD>
11023 If set, any trap on <B>ERR</B> is inherited by shell functions, command
11024 substitutions, and commands executed in a subshell environment.
11025 The <B>ERR</B> trap is normally not inherited in such cases.
11026 <DT><B>-H</B>
11027
11028 <DD>
11029 Enable
11030 <B>!</B>
11031
11032 style history substitution. This option is on by
11033 default when the shell is interactive.
11034 <DT><B>-P</B>
11035
11036 <DD>
11037 If set, the shell does not follow symbolic links when executing
11038 commands such as
11039 <B>cd</B>
11040
11041 that change the current working directory. It uses the
11042 physical directory structure instead. By default,
11043 <B>bash</B>
11044
11045 follows the logical chain of directories when performing commands
11046 which change the current directory.
11047 <DT><B>-T</B>
11048
11049 <DD>
11050 If set, any traps on <B>DEBUG</B> and <B>RETURN</B> are inherited by shell
11051 functions, command substitutions, and commands executed in a
11052 subshell environment.
11053 The <B>DEBUG</B> and <B>RETURN</B> traps are normally not inherited
11054 in such cases.
11055 <DT><B>--</B>
11056
11057 <DD>
11058 If no arguments follow this option, then the positional parameters are
11059 unset. Otherwise, the positional parameters are set to the
11060 <I>arg</I>s, even if some of them begin with a
11061 <B>-</B>.
11062
11063 <DT><B>-</B>
11064
11065 <DD>
11066 Signal the end of options, cause all remaining <I>arg</I>s to be
11067 assigned to the positional parameters. The
11068 <B>-x</B>
11069
11070 and
11071 <B>-v</B>
11072
11073 options are turned off.
11074 If there are no <I>arg</I>s,
11075 the positional parameters remain unchanged.
11076
11077 </DL>
11078 <P>
11079
11080 The options are off by default unless otherwise noted.
11081 Using + rather than - causes these options to be turned off.
11082 The options can also be specified as arguments to an invocation of
11083 the shell.
11084 The current set of options may be found in
11085 <B>$-</B>.
11086
11087 The return status is always true unless an invalid option is encountered.
11088 </DL>
11089
11090 <DT><B>shift</B> [<I>n</I>]<DD>
11091 The positional parameters from <I>n</I>+1 ... are renamed to
11092 <B>$1</B>
11093
11094 <B>....</B>
11095
11096 Parameters represented by the numbers <B>$#</B>
11097 down to <B>$#</B>-<I>n</I>+1 are unset.
11098 <I>n</I>
11099
11100 must be a non-negative number less than or equal to <B>$#</B>.
11101 If
11102 <I>n</I>
11103
11104 is 0, no parameters are changed.
11105 If
11106 <I>n </I>
11107
11108 is not given, it is assumed to be 1.
11109 If
11110 <I>n</I>
11111
11112 is greater than <B>$#</B>, the positional parameters are not changed.
11113 The return status is greater than zero if
11114 <I>n</I>
11115
11116 is greater than
11117 <B>$#</B>
11118
11119 or less than zero; otherwise 0.
11120 <DT><B>shopt</B> [<B>-pqsu</B>] [<B>-o</B>] [<I>optname</I> ...]<DD>
11121 Toggle the values of variables controlling optional shell behavior.
11122 With no options, or with the
11123 <B>-p</B>
11124
11125 option, a list of all settable options is displayed, with
11126 an indication of whether or not each is set.
11127 The <B>-p</B> option causes output to be displayed in a form that
11128 may be reused as input.
11129 Other options have the following meanings:
11130 <DL COMPACT><DT><DD>
11131
11132 <DL COMPACT>
11133 <DT><B>-s</B>
11134
11135 <DD>
11136 Enable (set) each <I>optname</I>.
11137 <DT><B>-u</B>
11138
11139 <DD>
11140 Disable (unset) each <I>optname</I>.
11141 <DT><B>-q</B>
11142
11143 <DD>
11144 Suppresses normal output (quiet mode); the return status indicates
11145 whether the <I>optname</I> is set or unset.
11146 If multiple <I>optname</I> arguments are given with
11147 <B>-q</B>,
11148
11149 the return status is zero if all <I>optnames</I> are enabled; non-zero
11150 otherwise.
11151 <DT><B>-o</B>
11152
11153 <DD>
11154 Restricts the values of <I>optname</I> to be those defined for the
11155 <B>-o</B>
11156
11157 option to the
11158 <B>set</B>
11159
11160 builtin.
11161
11162 </DL>
11163 <P>
11164
11165 If either
11166 <B>-s</B>
11167
11168 or
11169 <B>-u</B>
11170
11171 is used with no <I>optname</I> arguments, the display is limited to
11172 those options which are set or unset, respectively.
11173 Unless otherwise noted, the <B>shopt</B> options are disabled (unset)
11174 by default.
11175 <P>
11176
11177 The return status when listing options is zero if all <I>optnames</I>
11178 are enabled, non-zero otherwise. When setting or unsetting options,
11179 the return status is zero unless an <I>optname</I> is not a valid shell
11180 option.
11181 <P>
11182
11183 The list of <B>shopt</B> options is:
11184 <P>
11185
11186
11187
11188 <DL COMPACT>
11189 <DT><B>autocd</B>
11190
11191 <DD>
11192 If set, a command name that is the name of a directory is executed as if
11193 it were the argument to the <B>cd</B> command.
11194 This option is only used by interactive shells.
11195 <DT><B>cdable_vars</B>
11196
11197 <DD>
11198 If set, an argument to the
11199 <B>cd</B>
11200
11201 builtin command that
11202 is not a directory is assumed to be the name of a variable whose
11203 value is the directory to change to.
11204 <DT><B>cdspell</B>
11205
11206 <DD>
11207 If set, minor errors in the spelling of a directory component in a
11208 <B>cd</B>
11209
11210 command will be corrected.
11211 The errors checked for are transposed characters,
11212 a missing character, and one character too many.
11213 If a correction is found, the corrected file name is printed,
11214 and the command proceeds.
11215 This option is only used by interactive shells.
11216 <DT><B>checkhash</B>
11217
11218 <DD>
11219 If set, <B>bash</B> checks that a command found in the hash
11220 table exists before trying to execute it. If a hashed command no
11221 longer exists, a normal path search is performed.
11222 <DT><B>checkjobs</B>
11223
11224 <DD>
11225 If set, <B>bash</B> lists the status of any stopped and running jobs before
11226 exiting an interactive shell. If any jobs are running, this causes
11227 the exit to be deferred until a second exit is attempted without an
11228 intervening command (see
11229 <FONT SIZE=-1><B>JOB CONTROL</B>
11230
11231 </FONT>
11232 above). The shell always
11233 postpones exiting if any jobs are stopped.
11234 <DT><B>checkwinsize</B>
11235
11236 <DD>
11237 If set, <B>bash</B> checks the window size after each command
11238 and, if necessary, updates the values of
11239 <FONT SIZE=-1><B>LINES</B>
11240
11241 </FONT>
11242 and
11243 <FONT SIZE=-1><B>COLUMNS</B>.
11244
11245 </FONT>
11246 <DT><B>cmdhist</B>
11247
11248 <DD>
11249 If set,
11250 <B>bash</B>
11251
11252 attempts to save all lines of a multiple-line
11253 command in the same history entry. This allows
11254 easy re-editing of multi-line commands.
11255 <DT><B>compat31</B>
11256
11257 <DD>
11258 If set,
11259 <B>bash</B>
11260
11261 changes its behavior to that of version 3.1 with respect to quoted
11262 arguments to the conditional command's =~ operator.
11263 <DT><B>compat32</B>
11264
11265 <DD>
11266 If set,
11267 <B>bash</B>
11268
11269 changes its behavior to that of version 3.2 with respect to locale-specific
11270 string comparison when using the conditional command's &lt; and &gt; operators.
11271 <DT><B>compat40</B>
11272
11273 <DD>
11274 If set,
11275 <B>bash</B>
11276
11277 changes its behavior to that of version 4.0 with respect to locale-specific
11278 string comparison when using the conditional command's &lt; and &gt; operators
11279 and the effect of interrupting a command list.
11280 <DT><B>dirspell</B>
11281
11282 <DD>
11283 If set,
11284 <B>bash</B>
11285
11286 attempts spelling correction on directory names during word completion
11287 if the directory name initially supplied does not exist.
11288 <DT><B>dotglob</B>
11289
11290 <DD>
11291 If set,
11292 <B>bash</B>
11293
11294 includes filenames beginning with a `.' in the results of pathname
11295 expansion.
11296 <DT><B>execfail</B>
11297
11298 <DD>
11299 If set, a non-interactive shell will not exit if
11300 it cannot execute the file specified as an argument to the
11301 <B>exec</B>
11302
11303 builtin command. An interactive shell does not exit if
11304 <B>exec</B>
11305
11306 fails.
11307 <DT><B>expand_aliases</B>
11308
11309 <DD>
11310 If set, aliases are expanded as described above under
11311 <FONT SIZE=-1><B>ALIASES</B>.
11312
11313 </FONT>
11314 This option is enabled by default for interactive shells.
11315 <DT><B>extdebug</B>
11316
11317 <DD>
11318 If set, behavior intended for use by debuggers is enabled:
11319 <DL COMPACT><DT><DD>
11320 <DL COMPACT>
11321 <DT><B>1.</B>
11322
11323 <DD>
11324 The <B>-F</B> option to the <B>declare</B> builtin displays the source
11325 file name and line number corresponding to each function name supplied
11326 as an argument.
11327 <DT><B>2.</B>
11328
11329 <DD>
11330 If the command run by the <B>DEBUG</B> trap returns a non-zero value, the
11331 next command is skipped and not executed.
11332 <DT><B>3.</B>
11333
11334 <DD>
11335 If the command run by the <B>DEBUG</B> trap returns a value of 2, and the
11336 shell is executing in a subroutine (a shell function or a shell script
11337 executed by the <B>.</B> or <B>source</B> builtins), a call to
11338 <B>return</B> is simulated.
11339 <DT><B>4.</B>
11340
11341 <DD>
11342 <FONT SIZE=-1><B>BASH_ARGC</B>
11343
11344 </FONT>
11345 and
11346 <FONT SIZE=-1><B>BASH_ARGV</B>
11347
11348 </FONT>
11349 are updated as described in their descriptions above.
11350 <DT><B>5.</B>
11351
11352 <DD>
11353 Function tracing is enabled: command substitution, shell functions, and
11354 subshells invoked with <B>(</B> <I>command</I> <B>)</B> inherit the
11355 <B>DEBUG</B> and <B>RETURN</B> traps.
11356 <DT><B>6.</B>
11357
11358 <DD>
11359 Error tracing is enabled: command substitution, shell functions, and
11360 subshells invoked with <B>(</B> <I>command</I> <B>)</B> inherit the
11361 <B>ERR</B> trap.
11362 </DL></DL>
11363
11364 <DT><B>extglob</B>
11365
11366 <DD>
11367 If set, the extended pattern matching features described above under
11368 <B>Pathname Expansion</B> are enabled.
11369 <DT><B>extquote</B>
11370
11371 <DD>
11372 If set, <B>$</B>aq<I>string</I>aq and <B>$</B>&quot;<I>string</I>&quot; quoting is
11373 performed within <B>${</B><I>parameter</I><B>}</B> expansions
11374 enclosed in double quotes. This option is enabled by default.
11375 <DT><B>failglob</B>
11376
11377 <DD>
11378 If set, patterns which fail to match filenames during pathname expansion
11379 result in an expansion error.
11380 <DT><B>force_fignore</B>
11381
11382 <DD>
11383 If set, the suffixes specified by the
11384 <FONT SIZE=-1><B>FIGNORE</B>
11385
11386 </FONT>
11387 shell variable
11388 cause words to be ignored when performing word completion even if
11389 the ignored words are the only possible completions.
11390 See
11391 <FONT SIZE=-1><B>SHELL VARIABLES</B></FONT>
11392 above for a description of
11393 <FONT SIZE=-1><B>FIGNORE</B>.
11394
11395 </FONT>
11396 This option is enabled by default.
11397 <DT><B>globstar</B>
11398
11399 <DD>
11400 If set, the pattern <B>**</B> used in a pathname expansion context will
11401 match a files and zero or more directories and subdirectories.
11402 If the pattern is followed by a <B>/</B>, only directories and
11403 subdirectories match.
11404 <DT><B>gnu_errfmt</B>
11405
11406 <DD>
11407 If set, shell error messages are written in the standard GNU error
11408 message format.
11409 <DT><B>histappend</B>
11410
11411 <DD>
11412 If set, the history list is appended to the file named by the value
11413 of the
11414 <FONT SIZE=-1><B>HISTFILE</B>
11415
11416 </FONT>
11417 variable when the shell exits, rather than overwriting the file.
11418 <DT><B>histreedit</B>
11419
11420 <DD>
11421 If set, and
11422 <B>readline</B>
11423
11424 is being used, a user is given the opportunity to re-edit a
11425 failed history substitution.
11426 <DT><B>histverify</B>
11427
11428 <DD>
11429 If set, and
11430 <B>readline</B>
11431
11432 is being used, the results of history substitution are not immediately
11433 passed to the shell parser. Instead, the resulting line is loaded into
11434 the <B>readline</B> editing buffer, allowing further modification.
11435 <DT><B>hostcomplete</B>
11436
11437 <DD>
11438 If set, and
11439 <B>readline</B>
11440
11441 is being used, <B>bash</B> will attempt to perform hostname completion when a
11442 word containing a <B>@</B> is being completed (see
11443 <B>Completing</B>
11444
11445 under
11446 <FONT SIZE=-1><B>READLINE</B>
11447
11448 </FONT>
11449 above).
11450 This is enabled by default.
11451 <DT><B>huponexit</B>
11452
11453 <DD>
11454 If set, <B>bash</B> will send
11455 <FONT SIZE=-1><B>SIGHUP</B>
11456
11457 </FONT>
11458 to all jobs when an interactive login shell exits.
11459 <DT><B>interactive_comments</B>
11460
11461 <DD>
11462 If set, allow a word beginning with
11463 <B>#</B>
11464
11465 to cause that word and all remaining characters on that
11466 line to be ignored in an interactive shell (see
11467 <FONT SIZE=-1><B>COMMENTS</B>
11468
11469 </FONT>
11470 above). This option is enabled by default.
11471 <DT><B>lithist</B>
11472
11473 <DD>
11474 If set, and the
11475 <B>cmdhist</B>
11476
11477 option is enabled, multi-line commands are saved to the history with
11478 embedded newlines rather than using semicolon separators where possible.
11479 <DT><B>login_shell</B>
11480
11481 <DD>
11482 The shell sets this option if it is started as a login shell (see
11483 <FONT SIZE=-1><B>INVOCATION</B>
11484
11485 </FONT>
11486 above).
11487 The value may not be changed.
11488 <DT><B>mailwarn</B>
11489
11490 <DD>
11491 If set, and a file that <B>bash</B> is checking for mail has been
11492 accessed since the last time it was checked, the message ``The mail in
11493 <I>mailfile</I> has been read'' is displayed.
11494 <DT><B>no_empty_cmd_completion</B>
11495
11496 <DD>
11497 If set, and
11498 <B>readline</B>
11499
11500 is being used,
11501 <B>bash</B>
11502
11503 will not attempt to search the
11504 <FONT SIZE=-1><B>PATH</B>
11505
11506 </FONT>
11507 for possible completions when
11508 completion is attempted on an empty line.
11509 <DT><B>nocaseglob</B>
11510
11511 <DD>
11512 If set,
11513 <B>bash</B>
11514
11515 matches filenames in a case-insensitive fashion when performing pathname
11516 expansion (see
11517 <B>Pathname Expansion</B>
11518
11519 above).
11520 <DT><B>nocasematch</B>
11521
11522 <DD>
11523 If set,
11524 <B>bash</B>
11525
11526 matches patterns in a case-insensitive fashion when performing matching
11527 while executing <B>case</B> or <B>[[</B> conditional commands.
11528 <DT><B>nullglob</B>
11529
11530 <DD>
11531 If set,
11532 <B>bash</B>
11533
11534 allows patterns which match no
11535 files (see
11536 <B>Pathname Expansion</B>
11537
11538 above)
11539 to expand to a null string, rather than themselves.
11540 <DT><B>progcomp</B>
11541
11542 <DD>
11543 If set, the programmable completion facilities (see
11544 <B>Programmable Completion</B> above) are enabled.
11545 This option is enabled by default.
11546 <DT><B>promptvars</B>
11547
11548 <DD>
11549 If set, prompt strings undergo
11550 parameter expansion, command substitution, arithmetic
11551 expansion, and quote removal after being expanded as described in
11552 <FONT SIZE=-1><B>PROMPTING</B>
11553
11554 </FONT>
11555 above. This option is enabled by default.
11556 <DT><B>restricted_shell</B>
11557
11558 <DD>
11559 The shell sets this option if it is started in restricted mode (see
11560 <FONT SIZE=-1><B>RESTRICTED SHELL</B>
11561
11562 </FONT>
11563 below).
11564 The value may not be changed.
11565 This is not reset when the startup files are executed, allowing
11566 the startup files to discover whether or not a shell is restricted.
11567 <DT><B>shift_verbose</B>
11568
11569 <DD>
11570 If set, the
11571 <B>shift</B>
11572
11573 builtin prints an error message when the shift count exceeds the
11574 number of positional parameters.
11575 <DT><B>sourcepath</B>
11576
11577 <DD>
11578 If set, the
11579 <B>source</B> (<B>.</B>) builtin uses the value of
11580 <FONT SIZE=-1><B>PATH</B>
11581
11582 </FONT>
11583 to find the directory containing the file supplied as an argument.
11584 This option is enabled by default.
11585 <DT><B>xpg_echo</B>
11586
11587 <DD>
11588 If set, the <B>echo</B> builtin expands backslash-escape sequences
11589 by default.
11590 </DL></DL>
11591
11592 <DT><B>suspend</B> [<B>-f</B>]<DD>
11593 Suspend the execution of this shell until it receives a
11594 <FONT SIZE=-1><B>SIGCONT</B>
11595
11596 </FONT>
11597 signal. A login shell cannot be suspended; the
11598 <B>-f</B>
11599
11600 option can be used to override this and force the suspension.
11601 The return status is 0 unless the shell is a login shell and
11602 <B>-f</B>
11603
11604 is not supplied, or if job control is not enabled.
11605 <DT><B>test</B> <I>expr</I><DD>
11606
11607 <DT><B>[</B> <I>expr</I> <B>]</B><DD>
11608 Return a status of 0 or 1 depending on
11609 the evaluation of the conditional expression
11610 <I>expr</I>.
11611
11612 Each operator and operand must be a separate argument.
11613 Expressions are composed of the primaries described above under
11614 <FONT SIZE=-1><B>CONDITIONAL EXPRESSIONS</B>.
11615
11616 </FONT>
11617 <B>test</B> does not accept any options, nor does it accept and ignore
11618 an argument of <B>--</B> as signifying the end of options.
11619 <P>
11620
11621
11622 Expressions may be combined using the following operators, listed
11623 in decreasing order of precedence.
11624 The evaluation depends on the number of arguments; see below.
11625 <DL COMPACT><DT><DD>
11626
11627 <DL COMPACT>
11628 <DT><B>! </B><I>expr</I>
11629
11630 <DD>
11631 True if
11632 <I>expr</I>
11633
11634 is false.
11635 <DT><B>( </B><I>expr</I> )
11636
11637 <DD>
11638 Returns the value of <I>expr</I>.
11639 This may be used to override the normal precedence of operators.
11640 <DT><I>expr1</I> -<B>a</B> <I>expr2</I><DD>
11641 True if both
11642 <I>expr1</I>
11643
11644 and
11645 <I>expr2</I>
11646
11647 are true.
11648 <DT><I>expr1</I> -<B>o</B> <I>expr2</I><DD>
11649 True if either
11650 <I>expr1</I>
11651
11652 or
11653 <I>expr2</I>
11654
11655 is true.
11656
11657 </DL>
11658 <P>
11659
11660 <B>test</B> and <B>[</B> evaluate conditional
11661 expressions using a set of rules based on the number of arguments.
11662 <P>
11663
11664
11665
11666 <DL COMPACT>
11667 <DT>0 arguments<DD>
11668 The expression is false.
11669 <DT>1 argument<DD>
11670 The expression is true if and only if the argument is not null.
11671 <DT>2 arguments<DD>
11672 If the first argument is <B>!</B>, the expression is true if and
11673 only if the second argument is null.
11674 If the first argument is one of the unary conditional operators listed above
11675 under
11676 <FONT SIZE=-1><B>CONDITIONAL EXPRESSIONS</B>,
11677
11678 </FONT>
11679 the expression is true if the unary test is true.
11680 If the first argument is not a valid unary conditional operator, the expression
11681 is false.
11682 <DT>3 arguments<DD>
11683 If the second argument is one of the binary conditional operators listed above
11684 under
11685 <FONT SIZE=-1><B>CONDITIONAL EXPRESSIONS</B>,
11686
11687 </FONT>
11688 the result of the expression is the result of the binary test using
11689 the first and third arguments as operands.
11690 The <B>-a</B> and <B>-o</B> operators are considered binary operators
11691 when there are three arguments.
11692 If the first argument is <B>!</B>, the value is the negation of
11693 the two-argument test using the second and third arguments.
11694 If the first argument is exactly <B>(</B> and the third argument is
11695 exactly <B>)</B>, the result is the one-argument test of the second
11696 argument.
11697 Otherwise, the expression is false.
11698 <DT>4 arguments<DD>
11699 If the first argument is <B>!</B>, the result is the negation of
11700 the three-argument expression composed of the remaining arguments.
11701 Otherwise, the expression is parsed and evaluated according to
11702 precedence using the rules listed above.
11703 <DT>5 or more arguments<DD>
11704 The expression is parsed and evaluated according to precedence
11705 using the rules listed above.
11706 </DL></DL>
11707
11708
11709 <DT><B>times</B>
11710
11711 <DD>
11712 Print the accumulated user and system times for the shell and
11713 for processes run from the shell. The return status is 0.
11714 <DT><B>trap</B> [<B>-lp</B>] [[<I>arg</I>] <I>sigspec</I> ...]<DD>
11715 The command
11716 <I>arg</I>
11717
11718 is to be read and executed when the shell receives
11719 signal(s)
11720 <I>sigspec</I>.
11721
11722 If
11723 <I>arg</I>
11724
11725 is absent (and there is a single <I>sigspec</I>) or
11726 <B>-</B>,
11727
11728 each specified signal is
11729 reset to its original disposition (the value it had
11730 upon entrance to the shell).
11731 If
11732 <I>arg</I>
11733
11734 is the null string the signal specified by each
11735 <I>sigspec</I>
11736
11737 is ignored by the shell and by the commands it invokes.
11738 If
11739 <I>arg</I>
11740
11741 is not present and
11742 <B>-p</B>
11743
11744 has been supplied, then the trap commands associated with each
11745 <I>sigspec</I>
11746
11747 are displayed.
11748 If no arguments are supplied or if only
11749 <B>-p</B>
11750
11751 is given,
11752 <B>trap</B>
11753
11754 prints the list of commands associated with each signal.
11755 The
11756 <B>-l</B>
11757
11758 option causes the shell to print a list of signal names and
11759 their corresponding numbers.
11760 Each
11761 <I>sigspec</I>
11762
11763 is either
11764 a signal name defined in &lt;<I>signal.h</I>&gt;, or a signal number.
11765 Signal names are case insensitive and the
11766 <FONT SIZE=-1><B>SIG</B>
11767
11768 </FONT>
11769 prefix is optional.
11770 <P>
11771
11772
11773 If a
11774 <I>sigspec</I>
11775
11776 is
11777 <FONT SIZE=-1><B>EXIT</B>
11778
11779 </FONT>
11780 (0) the command
11781 <I>arg</I>
11782
11783 is executed on exit from the shell.
11784 If a
11785 <I>sigspec</I>
11786
11787 is
11788 <FONT SIZE=-1><B>DEBUG</B>,
11789
11790 </FONT>
11791 the command
11792 <I>arg</I>
11793
11794 is executed before every <I>simple command</I>, <I>for</I> command,
11795 <I>case</I> command, <I>select</I> command, every arithmetic <I>for</I>
11796 command, and before the first command executes in a shell function (see
11797 <FONT SIZE=-1><B>SHELL GRAMMAR</B>
11798
11799 </FONT>
11800 above).
11801 Refer to the description of the <B>extdebug</B> option to the
11802 <B>shopt</B> builtin for details of its effect on the <B>DEBUG</B> trap.
11803 If a
11804 <I>sigspec</I>
11805
11806 is
11807 <FONT SIZE=-1><B>RETURN</B>,
11808
11809 </FONT>
11810 the command
11811 <I>arg</I>
11812
11813 is executed each time a shell function or a script executed with the
11814 <B>.</B> or <B>source</B> builtins finishes executing.
11815 <P>
11816
11817
11818 If a
11819 <I>sigspec</I>
11820
11821 is
11822 <FONT SIZE=-1><B>ERR</B>,
11823
11824 </FONT>
11825 the command
11826 <I>arg</I>
11827
11828 is executed whenever a simple command has a non-zero exit status,
11829 subject to the following conditions.
11830 The
11831 <FONT SIZE=-1><B>ERR</B>
11832
11833 </FONT>
11834 trap is not executed if the failed
11835 command is part of the command list immediately following a
11836 <B>while</B>
11837
11838 or
11839 <B>until</B>
11840
11841 keyword,
11842 part of the test in an
11843 <I>if</I>
11844
11845 statement, part of a command executed in a
11846 <B>&amp;&amp;</B>
11847
11848 or
11849 <B>||</B>
11850
11851 list, or if the command's return value is
11852 being inverted via
11853 <B>!</B>.
11854
11855 These are the same conditions obeyed by the <B>errexit</B> option.
11856 <P>
11857
11858
11859 Signals ignored upon entry to the shell cannot be trapped or reset.
11860 Trapped signals that are not being ignored are reset to their original
11861 values in a subshell or subshell environment when one is created.
11862 The return status is false if any
11863 <I>sigspec</I>
11864
11865 is invalid; otherwise
11866 <B>trap</B>
11867
11868 returns true.
11869 <DT><B>type</B> [<B>-aftpP</B>] <I>name</I> [<I>name</I> ...]<DD>
11870 With no options,
11871 indicate how each
11872 <I>name</I>
11873
11874 would be interpreted if used as a command name.
11875 If the
11876 <B>-t</B>
11877
11878 option is used,
11879 <B>type</B>
11880
11881 prints a string which is one of
11882 <I>alias</I>,
11883
11884 <I>keyword</I>,
11885
11886 <I>function</I>,
11887
11888 <I>builtin</I>,
11889
11890 or
11891 <I>file </I>
11892
11893 if
11894 <I>name</I>
11895
11896 is an alias, shell reserved word, function, builtin, or disk file,
11897 respectively.
11898 If the
11899 <I>name</I>
11900
11901 is not found, then nothing is printed, and an exit status of false
11902 is returned.
11903 If the
11904 <B>-p</B>
11905
11906 option is used,
11907 <B>type</B>
11908
11909 either returns the name of the disk file
11910 that would be executed if
11911 <I>name</I>
11912
11913 were specified as a command name,
11914 or nothing if
11915 <TT>type -t name</TT>
11916
11917 would not return
11918 <I>file</I>.
11919
11920 The
11921 <B>-P</B>
11922
11923 option forces a
11924 <FONT SIZE=-1><B>PATH</B>
11925
11926 </FONT>
11927 search for each <I>name</I>, even if
11928 <TT>type -t name</TT>
11929
11930 would not return
11931 <I>file</I>.
11932
11933 If a command is hashed,
11934 <B>-p</B>
11935
11936 and
11937 <B>-P</B>
11938
11939 print the hashed value, not necessarily the file that appears
11940 first in
11941 <FONT SIZE=-1><B>PATH</B>.
11942
11943 </FONT>
11944 If the
11945 <B>-a</B>
11946
11947 option is used,
11948 <B>type</B>
11949
11950 prints all of the places that contain
11951 an executable named
11952 <I>name</I>.
11953
11954 This includes aliases and functions,
11955 if and only if the
11956 <B>-p</B>
11957
11958 option is not also used.
11959 The table of hashed commands is not consulted
11960 when using
11961 <B>-a</B>.
11962
11963 The
11964 <B>-f</B>
11965
11966 option suppresses shell function lookup, as with the <B>command</B> builtin.
11967 <B>type</B>
11968
11969 returns true if all of the arguments are found, false if
11970 any are not found.
11971 <DT><B>ulimit</B> [<B>-HSTabcdefilmnpqrstuvx</B> [<I>limit</I>]]<DD>
11972 Provides control over the resources available to the shell and to
11973 processes started by it, on systems that allow such control.
11974 The <B>-H</B> and <B>-S</B> options specify that the hard or soft limit is
11975 set for the given resource.
11976 A hard limit cannot be increased by a non-root user once it is set;
11977 a soft limit may be increased up to the value of the hard limit.
11978 If neither <B>-H</B> nor <B>-S</B> is specified, both the soft and hard
11979 limits are set.
11980 The value of
11981 <I>limit</I>
11982
11983 can be a number in the unit specified for the resource
11984 or one of the special values
11985 <B>hard</B>,
11986
11987 <B>soft</B>,
11988
11989 or
11990 <B>unlimited</B>,
11991
11992 which stand for the current hard limit, the current soft limit, and
11993 no limit, respectively.
11994 If
11995 <I>limit</I>
11996
11997 is omitted, the current value of the soft limit of the resource is
11998 printed, unless the <B>-H</B> option is given. When more than one
11999 resource is specified, the limit name and unit are printed before the value.
12000 Other options are interpreted as follows:
12001 <DL COMPACT><DT><DD>
12002
12003 <DL COMPACT>
12004 <DT><B>-a</B>
12005
12006 <DD>
12007 All current limits are reported
12008 <DT><B>-b</B>
12009
12010 <DD>
12011 The maximum socket buffer size
12012 <DT><B>-c</B>
12013
12014 <DD>
12015 The maximum size of core files created
12016 <DT><B>-d</B>
12017
12018 <DD>
12019 The maximum size of a process's data segment
12020 <DT><B>-e</B>
12021
12022 <DD>
12023 The maximum scheduling priority (&quot;nice&quot;)
12024 <DT><B>-f</B>
12025
12026 <DD>
12027 The maximum size of files written by the shell and its children
12028 <DT><B>-i</B>
12029
12030 <DD>
12031 The maximum number of pending signals
12032 <DT><B>-l</B>
12033
12034 <DD>
12035 The maximum size that may be locked into memory
12036 <DT><B>-m</B>
12037
12038 <DD>
12039 The maximum resident set size (many systems do not honor this limit)
12040 <DT><B>-n</B>
12041
12042 <DD>
12043 The maximum number of open file descriptors (most systems do not
12044 allow this value to be set)
12045 <DT><B>-p</B>
12046
12047 <DD>
12048 The pipe size in 512-byte blocks (this may not be set)
12049 <DT><B>-q</B>
12050
12051 <DD>
12052 The maximum number of bytes in POSIX message queues
12053 <DT><B>-r</B>
12054
12055 <DD>
12056 The maximum real-time scheduling priority
12057 <DT><B>-s</B>
12058
12059 <DD>
12060 The maximum stack size
12061 <DT><B>-t</B>
12062
12063 <DD>
12064 The maximum amount of cpu time in seconds
12065 <DT><B>-u</B>
12066
12067 <DD>
12068 The maximum number of processes available to a single user
12069 <DT><B>-v</B>
12070
12071 <DD>
12072 The maximum amount of virtual memory available to the shell
12073 <DT><B>-x</B>
12074
12075 <DD>
12076 The maximum number of file locks
12077 <DT><B>-T</B>
12078
12079 <DD>
12080 The maximum number of threads
12081
12082 </DL>
12083 <P>
12084
12085 If
12086 <I>limit</I>
12087
12088 is given, it is the new value of the specified resource (the
12089 <B>-a</B>
12090
12091 option is display only).
12092 If no option is given, then
12093 <B>-f</B>
12094
12095 is assumed. Values are in 1024-byte increments, except for
12096 <B>-t</B>,
12097
12098 which is in seconds,
12099 <B>-p</B>,
12100
12101 which is in units of 512-byte blocks,
12102 and
12103 <B>-T</B>,
12104
12105 <B>-b</B>,
12106
12107 <B>-n</B>,
12108
12109 and
12110 <B>-u</B>,
12111
12112 which are unscaled values.
12113 The return status is 0 unless an invalid option or argument is supplied,
12114 or an error occurs while setting a new limit.
12115 </DL>
12116
12117 <DT><B>umask</B> [<B>-p</B>] [<B>-S</B>] [<I>mode</I>]<DD>
12118 The user file-creation mask is set to
12119 <I>mode</I>.
12120
12121 If
12122 <I>mode</I>
12123
12124 begins with a digit, it
12125 is interpreted as an octal number; otherwise
12126 it is interpreted as a symbolic mode mask similar
12127 to that accepted by
12128 <I>chmod</I>(1).
12129
12130 If
12131 <I>mode</I>
12132
12133 is omitted, the current value of the mask is printed.
12134 The
12135 <B>-S</B>
12136
12137 option causes the mask to be printed in symbolic form; the
12138 default output is an octal number.
12139 If the
12140 <B>-p</B>
12141
12142 option is supplied, and
12143 <I>mode</I>
12144
12145 is omitted, the output is in a form that may be reused as input.
12146 The return status is 0 if the mode was successfully changed or if
12147 no <I>mode</I> argument was supplied, and false otherwise.
12148 <DT><B>unalias</B> [-<B>a</B>] [<I>name</I> ...]<DD>
12149 Remove each <I>name</I> from the list of defined aliases. If
12150 <B>-a</B>
12151
12152 is supplied, all alias definitions are removed. The return
12153 value is true unless a supplied
12154 <I>name</I>
12155
12156 is not a defined alias.
12157 <DT><B>unset</B> [-<B>fv</B>] [<I>name</I> ...]<DD>
12158 For each
12159 <I>name</I>,
12160
12161 remove the corresponding variable or function.
12162 If no options are supplied, or the
12163 <B>-v</B>
12164
12165 option is given, each
12166 <I>name</I>
12167
12168 refers to a shell variable.
12169 Read-only variables may not be unset.
12170 If
12171 <B>-f</B>
12172
12173 is specified, each
12174 <I>name</I>
12175
12176 refers to a shell function, and the function definition
12177 is removed.
12178 Each unset variable or function is removed from the environment
12179 passed to subsequent commands.
12180 If any of
12181 <FONT SIZE=-1><B>COMP_WORDBREAKS</B>,
12182
12183 </FONT>
12184 <FONT SIZE=-1><B>RANDOM</B>,
12185
12186 </FONT>
12187 <FONT SIZE=-1><B>SECONDS</B>,
12188
12189 </FONT>
12190 <FONT SIZE=-1><B>LINENO</B>,
12191
12192 </FONT>
12193 <FONT SIZE=-1><B>HISTCMD</B>,
12194
12195 </FONT>
12196 <FONT SIZE=-1><B>FUNCNAME</B>,
12197
12198 </FONT>
12199 <FONT SIZE=-1><B>GROUPS</B>,
12200
12201 </FONT>
12202 or
12203 <FONT SIZE=-1><B>DIRSTACK</B>
12204
12205 </FONT>
12206 are unset, they lose their special properties, even if they are
12207 subsequently reset. The exit status is true unless a
12208 <I>name</I>
12209
12210 is readonly.
12211 <DT><B>wait</B> [<I>n ...</I>]<DD>
12212 Wait for each specified process and return its termination status.
12213 Each
12214 <I>n</I>
12215
12216 may be a process
12217 ID or a job specification; if a job spec is given, all processes
12218 in that job's pipeline are waited for. If
12219 <I>n</I>
12220
12221 is not given, all currently active child processes
12222 are waited for, and the return status is zero. If
12223 <I>n</I>
12224
12225 specifies a non-existent process or job, the return status is
12226 127. Otherwise, the return status is the exit status of the last
12227 process or job waited for.
12228
12229
12230 </DL>
12231 <A NAME="lbDC">&nbsp;</A>
12232 <H3>RESTRICTED SHELL</H3>
12233
12234
12235
12236 <P>
12237
12238 If
12239 <B>bash</B>
12240
12241 is started with the name
12242 <B>rbash</B>,
12243
12244 or the
12245 <B>-r</B>
12246
12247 option is supplied at invocation,
12248 the shell becomes restricted.
12249 A restricted shell is used to
12250 set up an environment more controlled than the standard shell.
12251 It behaves identically to
12252 <B>bash</B>
12253
12254 with the exception that the following are disallowed or not performed:
12255 <DL COMPACT>
12256 <DT>*<DD>
12257 changing directories with <B>cd</B>
12258 <DT>*<DD>
12259 setting or unsetting the values of
12260 <FONT SIZE=-1><B>SHELL</B>,
12261
12262 </FONT>
12263 <FONT SIZE=-1><B>PATH</B>,
12264
12265 </FONT>
12266 <FONT SIZE=-1><B>ENV</B>,
12267
12268 </FONT>
12269 or
12270 <FONT SIZE=-1><B>BASH_ENV</B>
12271
12272 </FONT>
12273 <DT>*<DD>
12274 specifying command names containing
12275 <B>/</B>
12276
12277 <DT>*<DD>
12278 specifying a file name containing a
12279 <B>/</B>
12280
12281 as an argument to the
12282 <B>.</B>
12283
12284 builtin command
12285 <DT>*<DD>
12286 Specifying a filename containing a slash as an argument to the
12287 <B>-p</B>
12288
12289 option to the
12290 <B>hash</B>
12291
12292 builtin command
12293 <DT>*<DD>
12294 importing function definitions from the shell environment at startup
12295 <DT>*<DD>
12296 parsing the value of
12297 <FONT SIZE=-1><B>SHELLOPTS</B>
12298
12299 </FONT>
12300 from the shell environment at startup
12301 <DT>*<DD>
12302 redirecting output using the &gt;, &gt;|, &lt;&gt;, &gt;&amp;, &amp;&gt;, and &gt;&gt; redirection operators
12303 <DT>*<DD>
12304 using the
12305 <B>exec</B>
12306
12307 builtin command to replace the shell with another command
12308 <DT>*<DD>
12309 adding or deleting builtin commands with the
12310 <B>-f</B>
12311
12312 and
12313 <B>-d</B>
12314
12315 options to the
12316 <B>enable</B>
12317
12318 builtin command
12319 <DT>*<DD>
12320 Using the <B>enable</B> builtin command to enable disabled shell builtins
12321 <DT>*<DD>
12322 specifying the
12323 <B>-p</B>
12324
12325 option to the
12326 <B>command</B>
12327
12328 builtin command
12329 <DT>*<DD>
12330 turning off restricted mode with
12331 <B>set +r</B> or <B>set +o restricted</B>.
12332 </DL>
12333 <P>
12334
12335 These restrictions are enforced after any startup files are read.
12336 <P>
12337
12338
12339 When a command that is found to be a shell script is executed
12340 (see
12341 <FONT SIZE=-1><B>COMMAND EXECUTION</B>
12342
12343 </FONT>
12344
12345 above),
12346
12347 <B>rbash</B>
12348
12349 turns off any restrictions in the shell spawned to execute the
12350 script.
12351
12352
12353 <A NAME="lbDD">&nbsp;</A>
12354 <H3>SEE ALSO</H3>
12355
12356
12357 <DL COMPACT>
12358 <DT><I>Bash Reference Manual</I>, Brian Fox and Chet Ramey<DD>
12359 <DT><I>The Gnu Readline Library</I>, Brian Fox and Chet Ramey<DD>
12360 <DT><I>The Gnu History Library</I>, Brian Fox and Chet Ramey<DD>
12361 <DT><I>Portable Operating System Interface (POSIX) Part 2: Shell and Utilities</I>, IEEE<DD>
12362 <DT><I>sh</I>(1), <I>ksh</I>(1), <I>csh</I>(1)<DD>
12363 <DT><I>emacs</I>(1), <I>vi</I>(1)<DD>
12364 <DT><I>readline</I>(3)<DD>
12365
12366 </DL>
12367 <A NAME="lbDE">&nbsp;</A>
12368 <H3>FILES</H3>
12369
12370
12371 <DL COMPACT>
12372 <DT>
12373 <A HREF="file:/bin/bash"><I>/bin/bash</I></A>
12374
12375 <DD>
12376 The <B>bash</B> executable
12377 <DT>
12378 <A HREF="file:/etc/profile"><I>/etc/profile</I></A>
12379
12380 <DD>
12381 The systemwide initialization file, executed for login shells
12382 <DT>
12383 <A HREF="file:~/.bash_profile"><I>~/.bash_profile</I></A>
12384
12385 <DD>
12386 The personal initialization file, executed for login shells
12387 <DT>
12388 <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>
12389
12390 <DD>
12391 The individual per-interactive-shell startup file
12392 <DT>
12393 <A HREF="file:~/.bash_logout"><I>~/.bash_logout</I></A>
12394
12395 <DD>
12396 The individual login shell cleanup file, executed when a login shell exits
12397 <DT>
12398 <A HREF="file:~/.inputrc"><I>~/.inputrc</I></A>
12399
12400 <DD>
12401 Individual <I>readline</I> initialization file
12402
12403 </DL>
12404 <A NAME="lbDF">&nbsp;</A>
12405 <H3>AUTHORS</H3>
12406
12407 Brian Fox, Free Software Foundation
12408 <BR>
12409
12410 <A HREF="mailto:bfox@gnu.org">bfox@gnu.org</A>
12411 <P>
12412
12413 Chet Ramey, Case Western Reserve University
12414 <BR>
12415
12416 <A HREF="mailto:chet.ramey@case.edu">chet.ramey@case.edu</A>
12417 <A NAME="lbDG">&nbsp;</A>
12418 <H3>BUG REPORTS</H3>
12419
12420 If you find a bug in
12421 <B>bash,</B>
12422
12423 you should report it. But first, you should
12424 make sure that it really is a bug, and that it appears in the latest
12425 version of
12426 <B>bash</B>.
12427
12428 The latest version is always available from
12429 <I><A HREF="ftp://ftp.gnu.org/pub/gnu/bash/">ftp://ftp.gnu.org/pub/gnu/bash/</A></I>.
12430 <P>
12431
12432 Once you have determined that a bug actually exists, use the
12433 <I>bashbug</I>
12434
12435 command to submit a bug report.
12436 If you have a fix, you are encouraged to mail that as well!
12437 Suggestions and `philosophical' bug reports may be mailed
12438 to <I><A HREF="mailto:bug-bash@gnu.org">bug-bash@gnu.org</A></I> or posted to the Usenet
12439 newsgroup
12440 <A HREF="news:gnu.bash.bug">gnu.bash.bug</A>.
12441
12442 <P>
12443
12444 ALL bug reports should include:
12445 <P>
12446
12447
12448 <DL COMPACT>
12449 <DT>The version number of <B>bash</B><DD>
12450 <DT>The hardware and operating system<DD>
12451 <DT>The compiler used to compile<DD>
12452 <DT>A description of the bug behaviour<DD>
12453 <DT>A short script or `recipe' which exercises the bug<DD>
12454
12455 </DL>
12456 <P>
12457
12458 <I>bashbug</I>
12459
12460 inserts the first three items automatically into the template
12461 it provides for filing a bug report.
12462 <P>
12463
12464 Comments and bug reports concerning
12465 this manual page should be directed to
12466 <I><A HREF="mailto:chet@po.cwru.edu">chet@po.cwru.edu</A></I>.
12467
12468 <A NAME="lbDH">&nbsp;</A>
12469 <H3>BUGS</H3>
12470
12471 <P>
12472
12473 It's too big and too slow.
12474 <P>
12475
12476 There are some subtle differences between
12477 <B>bash</B>
12478
12479 and traditional versions of
12480 <B>sh</B>,
12481
12482 mostly because of the
12483 <FONT SIZE=-1><B>POSIX</B>
12484
12485 </FONT>
12486 specification.
12487 <P>
12488
12489 Aliases are confusing in some uses.
12490 <P>
12491
12492 Shell builtin commands and functions are not stoppable/restartable.
12493 <P>
12494
12495 Compound commands and command sequences of the form `a ; b ; c'
12496 are not handled gracefully when process suspension is attempted.
12497 When a process is stopped, the shell immediately executes the next
12498 command in the sequence.
12499 It suffices to place the sequence of commands between
12500 parentheses to force it into a subshell, which may be stopped as
12501 a unit.
12502 <P>
12503
12504 Array variables may not (yet) be exported.
12505 <P>
12506
12507 There may be only one active coprocess at a time.
12508
12509
12510
12511 <HR>
12512 <TABLE WIDTH=100%>
12513 <TR>
12514 <TH ALIGN=LEFT width=33%>GNU Bash-4.1<TH ALIGN=CENTER width=33%>2010 January 15<TH ALIGN=RIGHT width=33%>BASH(1)
12515 </TR>
12516 </TABLE>
12517 <HR>
12518 <A NAME="index">&nbsp;</A><H2>Index</H2>
12519 <DL>
12520 <DT><A HREF="#lbAB">NAME</A><DD>
12521 <DT><A HREF="#lbAC">SYNOPSIS</A><DD>
12522 <DT><A HREF="#lbAD">COPYRIGHT</A><DD>
12523 <DT><A HREF="#lbAE">DESCRIPTION</A><DD>
12524 <DT><A HREF="#lbAF">OPTIONS</A><DD>
12525 <DT><A HREF="#lbAG">ARGUMENTS</A><DD>
12526 <DT><A HREF="#lbAH">INVOCATION</A><DD>
12527 <DT><A HREF="#lbAI">DEFINITIONS</A><DD>
12528 <DT><A HREF="#lbAJ">RESERVED WORDS</A><DD>
12529 <DT><A HREF="#lbAK">SHELL GRAMMAR</A><DD>
12530 <DL>
12531 <DT><A HREF="#lbAL">Simple Commands</A><DD>
12532 <DT><A HREF="#lbAM">Pipelines</A><DD>
12533 <DT><A HREF="#lbAN">Lists</A><DD>
12534 <DT><A HREF="#lbAO">Compound Commands</A><DD>
12535 <DT><A HREF="#lbAP">Coprocesses</A><DD>
12536 <DT><A HREF="#lbAQ">Shell Function Definitions</A><DD>
12537 </DL>
12538 <DT><A HREF="#lbAR">COMMENTS</A><DD>
12539 <DT><A HREF="#lbAS">QUOTING</A><DD>
12540 <DT><A HREF="#lbAT">PARAMETERS</A><DD>
12541 <DL>
12542 <DT><A HREF="#lbAU">Positional Parameters</A><DD>
12543 <DT><A HREF="#lbAV">Special Parameters</A><DD>
12544 <DT><A HREF="#lbAW">Shell Variables</A><DD>
12545 <DT><A HREF="#lbAX">Arrays</A><DD>
12546 </DL>
12547 <DT><A HREF="#lbAY">EXPANSION</A><DD>
12548 <DL>
12549 <DT><A HREF="#lbAZ">Brace Expansion</A><DD>
12550 <DT><A HREF="#lbBA">Tilde Expansion</A><DD>
12551 <DT><A HREF="#lbBB">Parameter Expansion</A><DD>
12552 <DT><A HREF="#lbBC">Command Substitution</A><DD>
12553 <DT><A HREF="#lbBD">Arithmetic Expansion</A><DD>
12554 <DT><A HREF="#lbBE">Process Substitution</A><DD>
12555 <DT><A HREF="#lbBF">Word Splitting</A><DD>
12556 <DT><A HREF="#lbBG">Pathname Expansion</A><DD>
12557 <DT><A HREF="#lbBH">Quote Removal</A><DD>
12558 </DL>
12559 <DT><A HREF="#lbBI">REDIRECTION</A><DD>
12560 <DL>
12561 <DT><A HREF="#lbBJ">Redirecting Input</A><DD>
12562 <DT><A HREF="#lbBK">Redirecting Output</A><DD>
12563 <DT><A HREF="#lbBL">Appending Redirected Output</A><DD>
12564 <DT><A HREF="#lbBM">Redirecting Standard Output and Standard Error</A><DD>
12565 <DT><A HREF="#lbBN">Appending Standard Output and Standard Error</A><DD>
12566 <DT><A HREF="#lbBO">Here Documents</A><DD>
12567 <DT><A HREF="#lbBP">Here Strings</A><DD>
12568 <DT><A HREF="#lbBQ">Duplicating File Descriptors</A><DD>
12569 <DT><A HREF="#lbBR">Moving File Descriptors</A><DD>
12570 <DT><A HREF="#lbBS">Opening File Descriptors for Reading and Writing</A><DD>
12571 </DL>
12572 <DT><A HREF="#lbBT">ALIASES</A><DD>
12573 <DT><A HREF="#lbBU">FUNCTIONS</A><DD>
12574 <DT><A HREF="#lbBV">ARITHMETIC EVALUATION</A><DD>
12575 <DT><A HREF="#lbBW">CONDITIONAL EXPRESSIONS</A><DD>
12576 <DT><A HREF="#lbBX">SIMPLE COMMAND EXPANSION</A><DD>
12577 <DT><A HREF="#lbBY">COMMAND EXECUTION</A><DD>
12578 <DT><A HREF="#lbBZ">COMMAND EXECUTION ENVIRONMENT</A><DD>
12579 <DT><A HREF="#lbCA">ENVIRONMENT</A><DD>
12580 <DT><A HREF="#lbCB">EXIT STATUS</A><DD>
12581 <DT><A HREF="#lbCC">SIGNALS</A><DD>
12582 <DT><A HREF="#lbCD">JOB CONTROL</A><DD>
12583 <DT><A HREF="#lbCE">PROMPTING</A><DD>
12584 <DT><A HREF="#lbCF">READLINE</A><DD>
12585 <DL>
12586 <DT><A HREF="#lbCG">Readline Notation</A><DD>
12587 <DT><A HREF="#lbCH">Readline Initialization</A><DD>
12588 <DT><A HREF="#lbCI">Readline Key Bindings</A><DD>
12589 <DT><A HREF="#lbCJ">Readline Variables</A><DD>
12590 <DT><A HREF="#lbCK">Readline Conditional Constructs</A><DD>
12591 <DT><A HREF="#lbCL">Searching</A><DD>
12592 <DT><A HREF="#lbCM">Readline Command Names</A><DD>
12593 <DT><A HREF="#lbCN">Commands for Moving</A><DD>
12594 <DT><A HREF="#lbCO">Commands for Manipulating the History</A><DD>
12595 <DT><A HREF="#lbCP">Commands for Changing Text</A><DD>
12596 <DT><A HREF="#lbCQ">Killing and Yanking</A><DD>
12597 <DT><A HREF="#lbCR">Numeric Arguments</A><DD>
12598 <DT><A HREF="#lbCS">Completing</A><DD>
12599 <DT><A HREF="#lbCT">Keyboard Macros</A><DD>
12600 <DT><A HREF="#lbCU">Miscellaneous</A><DD>
12601 <DT><A HREF="#lbCV">Programmable Completion</A><DD>
12602 </DL>
12603 <DT><A HREF="#lbCW">HISTORY</A><DD>
12604 <DT><A HREF="#lbCX">HISTORY EXPANSION</A><DD>
12605 <DL>
12606 <DT><A HREF="#lbCY">Event Designators</A><DD>
12607 <DT><A HREF="#lbCZ">Word Designators</A><DD>
12608 <DT><A HREF="#lbDA">Modifiers</A><DD>
12609 </DL>
12610 <DT><A HREF="#lbDB">SHELL BUILTIN COMMANDS</A><DD>
12611 <DT><A HREF="#lbDC">RESTRICTED SHELL</A><DD>
12612 <DT><A HREF="#lbDD">SEE ALSO</A><DD>
12613 <DT><A HREF="#lbDE">FILES</A><DD>
12614 <DT><A HREF="#lbDF">AUTHORS</A><DD>
12615 <DT><A HREF="#lbDG">BUG REPORTS</A><DD>
12616 <DT><A HREF="#lbDH">BUGS</A><DD>
12617 </DL>
12618 <HR>
12619 This document was created by man2html from bash.1.<BR>
12620 Time: 15 January 2010 11:58:10 EST
12621 </BODY>
12622 </HTML>