2 <TITLE>BASH(1) Manual Page</TITLE>
4 <BODY><TABLE WIDTH=100%>
6 <TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2009 December 29<TH ALIGN=RIGHT width=33%>BASH(1)
9 <BR><A HREF="#index">Index</A>
30 <A NAME="lbAB"> </A>
33 bash - GNU Bourne-Again SHell
34 <A NAME="lbAC"> </A>
41 <A NAME="lbAD"> </A>
45 Bash is Copyright © 1989-2009 by the Free Software Foundation, Inc.
46 <A NAME="lbAE"> </A>
51 is an <B>sh</B>-compatible command language interpreter that
52 executes commands read from the standard input or from a file.
55 also incorporates useful features from the <I>Korn</I> and <I>C</I>
56 shells (<B>ksh</B> and <B>csh</B>).
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).
66 can be configured to be POSIX-conformant by default.
67 <A NAME="lbAF"> </A>
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:
77 <DT><B>-c</B><I> string</I>
83 option is present, then commands are read from
86 If there are arguments after the
89 they are assigned to the positional parameters, starting with
98 option is present, the shell is
107 act as if it had been invoked as a login shell (see
108 <FONT SIZE=-1><B>INVOCATION</B>
118 option is present, the shell becomes
122 <FONT SIZE=-1><B>RESTRICTED SHELL</B>
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.
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>]
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>
154 If <I>shopt_option</I> is present, <B>-O</B> sets the value of that option;
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.
166 signals the end of options and disables further option processing.
167 Any arguments after the
170 are treated as filenames and arguments. An argument of
173 is equivalent to <B>--</B>.
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.
187 <DT><B>--debugger</B>
190 Arrange for the debugger profile to be executed before the shell
192 Turns on extended debugging mode (see the description of the
199 and shell function tracing (see the description of the
200 <B>-o functrace</B> option to the
204 <DT><B>--dump-po-strings</B>
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>
212 Equivalent to <B>-D</B>.
216 Display a usage message on standard output and exit successfully.
217 <DT><B>--init-file</B> <I>file</I><DD>
219 <DT><B>--rcfile</B> <I>file</I><DD>
221 Execute commands from
224 instead of the standard personal initialization file
225 <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>
227 if the shell is interactive (see
228 <FONT SIZE=-1><B>INVOCATION</B>
235 Equivalent to <B>-l</B>.
236 <DT><B>--noediting</B>
242 library to read command lines when the shell is interactive.
243 <DT><B>--noprofile</B>
246 Do not read either the system-wide startup file
248 <A HREF="file:/etc/profile"><I>/etc/profile</I></A>
250 or any of the personal initialization files
251 <A HREF="file:~/.bash_profile"><I>~/.bash_profile</I></A>,
253 <A HREF="file:~/.bash_login"><I>~/.bash_login</I></A>,
256 <A HREF="file:~/.profile"><I>~/.profile</I></A>.
261 reads these files when it is invoked as a login shell (see
262 <FONT SIZE=-1><B>INVOCATION</B>
269 Do not read and execute the personal initialization file
270 <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>
272 if the shell is interactive.
273 This option is on by default if the shell is invoked as
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>
284 The shell becomes restricted (see
285 <FONT SIZE=-1><B>RESTRICTED SHELL</B>
292 Equivalent to <B>-v</B>.
296 Show version information for this instance of
299 on the standard output and exit successfully.
302 <A NAME="lbAG"> </A>
305 If arguments remain after option processing, and neither the
311 option has been supplied, the first argument is assumed to
312 be the name of a file containing shell commands.
316 is invoked in this fashion,
319 is set to the name of the file, and the positional parameters
320 are set to the remaining arguments.
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>
333 <A NAME="lbAH"> </A>
336 A <I>login shell</I> is one whose first character of argument zero is a
339 or one started with the
345 An <I>interactive</I> shell is one started without non-option arguments
350 whose standard input and error are
351 both connected to terminals (as determined by
354 or one started with the
358 <FONT SIZE=-1><B>PS1</B>
371 allowing a shell script or a startup file to test this state.
374 The following paragraphs describe how
377 executes its startup files.
378 If any of the files exist but cannot be read,
382 Tildes are expanded in file names as described below under
383 <B>Tilde Expansion</B>
386 <FONT SIZE=-1><B>EXPANSION</B>
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
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.
405 option may be used when the shell is started to inhibit this behavior.
408 When a login shell exits,
411 reads and executes commands from the file <A HREF="file:~/.bash_logout"><I>~/.bash_logout</I></A>, if it
415 When an interactive shell that is not a login shell is started,
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
423 The <B>--rcfile</B> <I>file</I> option will force
426 to read and execute commands from <I>file</I> instead of <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>.
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>
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.
441 behaves as if the following command were executed:
444 <TT>if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi</TT>
450 <FONT SIZE=-1><B>PATH</B>
453 variable is not used to search for the file name.
459 is invoked with the name
462 it tries to mimic the startup behavior of historical versions of
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>
473 <A HREF="file:~/.profile"><I>~/.profile</I></A>,
479 option may be used to inhibit this behavior.
480 When invoked as an interactive shell with the name
485 looks for the variable
486 <FONT SIZE=-1><B>ENV</B>,
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
494 does not attempt to read and execute commands from any other startup
498 option has no effect.
499 A non-interactive shell invoked with the name
502 does not attempt to read any other startup files.
511 mode after the startup files are read.
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>
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.
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>.
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>.
547 option may be used to inhibit this behavior, and the
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.
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>,
561 <FONT SIZE=-1><B>BASHOPTS</B>,
564 <FONT SIZE=-1><B>CDPATH</B>,
568 <FONT SIZE=-1><B>GLOBIGNORE</B>
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"> </A>
580 The following definitions are used throughout the rest of this
591 A sequence of characters considered as a single unit by the shell.
601 consisting only of alphanumeric characters and underscores, and
602 beginning with an alphabetic character or an underscore. Also
606 <DT><B>metacharacter</B>
609 A character that, when unquoted, separates words. One of the following:
615 <B>| & ; ( ) < > space tab</B>
623 <DT><B>control operator</B>
626 A <I>token</I> that performs a control function. It is one of the following
631 <B>|| & && ; ;; ( ) | |& <newline></B>
637 <A NAME="lbAJ"> </A>
638 <H3>RESERVED WORDS</H3>
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>
646 below) or the third word of a
660 ! case do done elif else esac fi for function if in select then until while { } time [[ ]]
664 <A NAME="lbAK"> </A>
665 <H3>SHELL GRAMMAR</H3>
667 <A NAME="lbAL"> </A>
668 <H4>Simple Commands</H4>
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.
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
683 <A NAME="lbAM"> </A>
688 A <I>pipeline</I> is a sequence of one or more commands separated by
689 one of the control operators
693 The format for a pipeline is:
697 [<B>time</B> [<B>-p</B>]] [ ! ] <I>command</I> [ [<B>|</B>|<B>|&</B>] <I>command2</I> ... ]
702 The standard output of
705 is connected via a pipe to the standard input of
708 This connection is performed before any redirections specified by the
710 <FONT SIZE=-1><B>REDIRECTION</B>
714 If <B>|&</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>&1 |</B>.
717 This implicit redirection of the standard error is performed after any
718 redirections specified by the command.
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.
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.
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
741 The <B>-p</B> option changes the output format to that specified by POSIX.
743 <FONT SIZE=-1><B>TIMEFORMAT</B>
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>
752 <B>Shell Variables</B>
757 Each command in a pipeline is executed as a separate process (i.e., in a
759 <A NAME="lbAN"> </A>
764 A <I>list</I> is a sequence of one or more pipelines separated by one
775 and optionally terminated by one of
781 <B><newline></B>.
785 Of these list operators,
791 have equal precedence, followed by
797 which have equal precedence.
800 A sequence of one or more newlines may appear in a <I>list</I> instead
801 of a semicolon to delimit commands.
804 If a command is terminated by the control operator
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
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.
817 AND and OR lists are sequences of one of more pipelines separated by the
818 <B>&&</B> and <B>||</B> control operators, respectively.
819 AND and OR lists are executed with left associativity.
820 An AND list has the form
824 <I>command1</I> <B>&&</B> <I>command2</I>
831 is executed if, and only if,
834 returns an exit status of zero.
837 An OR list has the form
841 <I>command1</I> <B>||</B> <I>command2</I>
850 is executed if and only if
853 returns a non-zero exit status.
855 AND and OR lists is the exit status of the last command
856 executed in the list.
857 <A NAME="lbAO"> </A>
858 <H4>Compound Commands</H4>
862 A <I>compound command</I> is one of the following:
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>
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
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
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
883 <DT>((<I>expression</I>))<DD>
884 The <I>expression</I> is evaluated according to the rules described
886 <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>.
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 "</B><I>expression</I>".
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>.
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
908 When used with <B>[[</B>, The <B><</B> and <B>></B> operators sort
909 lexicographically using the current locale.
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>.
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
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.
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
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>.
949 <FONT SIZE=-1><B>BASH_REMATCH</B>
952 with index 0 is the portion of the string
953 matching the entire regular expression.
955 <FONT SIZE=-1><B>BASH_REMATCH</B>
958 with index <I>n</I> is the portion of the
959 string matching the <I>n</I>th parenthesized subexpression.
963 Expressions may be combined using the following operators, listed
964 in decreasing order of precedence:
971 <DT><B>( </B><I>expression</I> )
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>
983 <DT><I>expression1</I> <B>&&</B> <I>expression2</I><DD>
991 <DT><I>expression1</I> <B>||</B> <I>expression2</I>
1005 The <B>&&</B> and
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.
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
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>
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>.
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>
1049 <FONT SIZE=-1><B>PS3</B>
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
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
1062 to be set to null. The line read is saved in the variable
1063 <FONT SIZE=-1><B>REPLY</B>.
1069 is executed after each selection until a
1072 command is executed.
1076 is the exit status of the last command executed in
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> ]
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>
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.
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>;&</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>;;&</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>
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>
1125 <DT><B>until</B> <I>list</I>; <B>do</B> <I>list</I>; <B>done</B><DD>
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;
1136 is executed as long as the last command in
1139 returns a non-zero exit status.
1140 The exit status of the <B>while</B> and <B>until</B> commands
1142 of the last <B>do</B> <I>list</I> command executed, or zero if
1145 <A NAME="lbAP"> </A>
1146 <H4>Coprocesses</H4>
1150 A <I>coprocess</I> is a shell command preceded by the <B>coproc</B> reserved
1152 A coprocess is executed asynchronously in a subshell, as if the command
1153 had been terminated with the <B>&</B> control operator, with a two-way pipe
1154 established between the executing shell and the coprocess.
1157 The format for a coprocess is:
1158 <DL COMPACT><DT><DD>
1161 <B>coproc</B> [<I>NAME</I>] <I>command</I> [<I>redirections</I>]
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
1174 below) named <I>NAME</I> in the context of the executing shell.
1175 The standard output of
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
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
1187 <FONT SIZE=-1><B>REDIRECTION</B>
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.
1196 builtin command may be used to wait for the coprocess to terminate.
1199 The return status of a coprocess is the exit status of <I>command</I>.
1200 <A NAME="lbAQ"> </A>
1201 <H4>Shell Function Definitions</H4>
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:
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>
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>
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>
1236 <A NAME="lbAR"> </A>
1239 In a non-interactive shell, or an interactive shell in which the
1240 <B>interactive_comments</B>
1245 builtin is enabled (see
1246 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
1249 below), a word beginning with
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>
1256 option enabled does not allow comments. The
1257 <B>interactive_comments</B>
1259 option is on by default in interactive shells.
1260 <A NAME="lbAS"> </A>
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.
1270 Each of the <I>metacharacters</I> listed above under
1271 <FONT SIZE=-1><B>DEFINITIONS</B>
1274 has special meaning to the shell and must be quoted if it is to
1278 When the command history expansion facilities are being used
1280 <FONT SIZE=-1><B>HISTORY EXPANSION</B>
1284 <I>history expansion</I> character, usually <B>!</B>, must be quoted
1285 to prevent history expansion.
1288 There are three quoting mechanisms: the
1289 <I>escape character</I>,
1291 single quotes, and double quotes.
1294 A non-quoted backslash (<B>\</B>) is the
1295 <I>escape character</I>.
1297 It preserves the literal value of the next character that follows,
1298 with the exception of <newline>. If a <B>\</B><newline> pair
1299 appears, and the backslash is not itself quoted, the <B>\</B><newline>
1300 is treated as a line continuation (that is, it is removed from the
1301 input stream and effectively ignored).
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.
1309 Enclosing characters in double quotes preserves the literal value
1310 of all characters within the quotes, with the exception of
1317 and, when history expansion is enabled,
1326 retain their special meaning within double quotes. The backslash
1327 retains its special meaning only when followed by one of the following
1337 <B><newline></B>.
1339 A double quote may be quoted within double quotes by preceding it with
1341 If enabled, history expansion will be performed unless an
1344 appearing in double quotes is escaped using a backslash.
1345 The backslash preceding the
1351 The special parameters
1357 have special meaning when in double
1359 <FONT SIZE=-1><B>PARAMETERS</B>
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>
1419 <DT><B>\</B><I>nnn</I>
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>
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>
1432 a control-<I>x</I> character
1438 The expanded result is single-quoted, as if the dollar sign had
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
1446 If the string is translated and replaced, the replacement is
1448 <A NAME="lbAT"> </A>
1454 is an entity that stores values.
1458 a number, or one of the special characters listed below under
1459 <B>Special Parameters</B>.
1464 is a parameter denoted by a
1467 A variable has a <I>value</I> and zero or more <I>attributes</I>.
1468 Attributes are assigned using the
1471 builtin command (see
1475 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>).
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
1485 builtin command (see
1486 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
1495 may be assigned to by a statement of the form
1496 <DL COMPACT><DT><DD>
1499 <I>name</I>=[<I>value</I>]
1507 is not given, the variable is assigned the null string. All
1510 undergo tilde expansion, parameter and variable expansion,
1511 command substitution, arithmetic expansion, and quote
1513 <FONT SIZE=-1><B>EXPANSION</B>
1516 below). If the variable has its
1522 is evaluated as an arithmetic expression even if the $((...)) expansion is
1524 <B>Arithmetic Expansion</B>
1527 Word splitting is not performed, with the exception
1528 of <B>"$@"</B> as explained below under
1529 <B>Special Parameters</B>.
1531 Pathname expansion is not performed.
1532 Assignment statements may also appear as arguments to the
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
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
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"> </A>
1566 <H4>Positional Parameters</H4>
1571 <I>positional parameter</I>
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
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>
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>
1594 <A NAME="lbAV"> </A>
1595 <H4>Special Parameters</H4>
1599 The shell treats several parameters specially. These parameters may
1600 only be referenced; assignment to them is not allowed.
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
1610 <FONT SIZE=-1><B>IFS</B>
1613 special variable. That is, "<B>$*</B>" is equivalent
1614 to "<B>$1</B><I>c</I><B>$2</B><I>c</I><B>...</B>", where
1617 is the first character of the value of the
1618 <FONT SIZE=-1><B>IFS</B>
1622 <FONT SIZE=-1><B>IFS</B>
1625 is unset, the parameters are separated by spaces.
1627 <FONT SIZE=-1><B>IFS</B>
1630 is null, the parameters are joined without intervening separators.
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, "<B>$@</B>" is equivalent to
1637 "<B>$1</B>" "<B>$2</B>" ...
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, "<B>$@</B>" and
1645 expand to nothing (i.e., they are removed).
1649 Expands to the number of positional parameters in decimal.
1653 Expands to the exit status of the most recently executed foreground
1658 Expands to the current option flags as specified upon invocation,
1662 builtin command, or those set by the shell itself
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
1676 Expands to the process ID of the most recently executed background
1677 (asynchronous) command.
1681 Expands to the name of the shell or shell script. This is set at
1682 shell initialization. If
1685 is invoked with a file of commands,
1688 is set to the name of that file. If
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
1702 as given by argument zero.
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
1709 Subsequently, expands to the last argument to the previous command,
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.
1717 <A NAME="lbAW"> </A>
1718 <H4>Shell Variables</H4>
1722 The following variables are set by the shell:
1730 Expands to the full file name used to invoke this instance of
1736 A colon-separated list of enabled shell options. Each word in
1737 the list is a valid argument for the
1743 builtin command (see
1744 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
1747 below). The options appearing in
1748 <FONT SIZE=-1><B>BASHOPTS</B>
1751 are those reported as
1755 If this variable is in the environment when
1758 starts up, each shell option in the list will be enabled before
1759 reading any startup files.
1760 This variable is read-only.
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>
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>
1777 An array variable whose values are the number of parameters in each
1778 frame of the current <B>bash</B> execution call stack.
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>.
1787 <FONT SIZE=-1><B>BASH_ARGC</B>
1790 only when in extended debugging mode (see the description of the
1797 <DT><B>BASH_ARGV</B>
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
1805 <FONT SIZE=-1><B>BASH_ARGV</B>.
1809 <FONT SIZE=-1><B>BASH_ARGV</B>
1812 only when in extended debugging mode
1813 (see the description of the
1820 <DT><B>BASH_CMDS</B>
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>
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>
1836 The command argument to the <B>-c</B> invocation option.
1837 <DT><B>BASH_LINENO</B>
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>.
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
1849 The corresponding source file name is <B>${BASH_SOURCE[</B><I>$i</I><B>]}</B>.
1851 <FONT SIZE=-1><B>LINENO</B>
1854 to obtain the current line number.
1855 <DT><B>BASH_REMATCH</B>
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>
1868 An array variable whose members are the source filenames corresponding
1869 to the elements in the
1870 <FONT SIZE=-1><B>FUNCNAME</B>
1874 <DT><B>BASH_SUBSHELL</B>
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>
1882 A readonly array variable whose members hold version information for
1886 The values assigned to the array members are as follows:
1888 <DL COMPACT><DT><DD>
1891 <DT><B>BASH_VERSINFO[</B>0]
1894 The major version number (the <I>release</I>).
1895 <DT><B>BASH_VERSINFO[</B>1]
1898 The minor version number (the <I>version</I>).
1899 <DT><B>BASH_VERSINFO[</B>2]
1903 <DT><B>BASH_VERSINFO[</B>3]
1907 <DT><B>BASH_VERSINFO[</B>4]
1910 The release status (e.g., <I>beta1</I>).
1911 <DT><B>BASH_VERSINFO[</B>5]
1915 <FONT SIZE=-1><B>MACHTYPE</B>.
1921 <DT><B>BASH_VERSION</B>
1924 Expands to a string describing the version of this instance of
1927 <DT><B>COMP_CWORD</B>
1930 An index into <B>${COMP_WORDS}</B> of the word containing the current
1932 This variable is available only in shell functions invoked by the
1933 programmable completion facilities (see <B>Programmable Completion</B>
1938 The key (or final key of a key sequence) used to invoke the current
1939 completion function.
1940 <DT><B>COMP_LINE</B>
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>
1948 <DT><B>COMP_POINT</B>
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>
1959 <DT><B>COMP_TYPE</B>
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,
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>
1974 <DT><B>COMP_WORDBREAKS</B>
1977 The set of characters that the <B>readline</B> library treats as word
1978 separators when performing word completion.
1980 <FONT SIZE=-1><B>COMP_WORDBREAKS</B>
1983 is unset, it loses its special properties, even if it is
1985 <DT><B>COMP_WORDS</B>
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>
1995 This variable is available only in shell functions invoked by the
1996 programmable completion facilities (see <B>Programmable Completion</B>
2001 An array variable (see
2004 below) containing the current contents of the directory stack.
2005 Directories appear in the stack in the order they are displayed by the
2009 Assigning to members of this array variable may be used to modify
2010 directories already in the stack, but the
2016 builtins must be used to add and remove directories.
2017 Assignment to this variable will not change the current directory.
2019 <FONT SIZE=-1><B>DIRSTACK</B>
2022 is unset, it loses its special properties, even if it is
2027 Expands to the effective user ID of the current user, initialized at
2028 shell startup. This variable is readonly.
2032 An array variable containing the names of all shell functions
2033 currently in the execution call stack.
2034 The element with index 0 is the name of any currently-executing
2036 The bottom-most element is
2037 <TT>"main"</TT>.
2039 This variable exists only when a shell function is executing.
2041 <FONT SIZE=-1><B>FUNCNAME</B>
2044 have no effect and return an error status.
2046 <FONT SIZE=-1><B>FUNCNAME</B>
2049 is unset, it loses its special properties, even if it is
2054 An array variable containing the list of groups of which the current
2057 <FONT SIZE=-1><B>GROUPS</B>
2060 have no effect and return an error status.
2062 <FONT SIZE=-1><B>GROUPS</B>
2065 is unset, it loses its special properties, even if it is
2070 The history number, or index in the history list, of the current
2073 <FONT SIZE=-1><B>HISTCMD</B>
2076 is unset, it loses its special properties, even if it is
2081 Automatically set to the name of the current host.
2085 Automatically set to a string that uniquely
2086 describes the type of machine on which
2090 The default is system-dependent.
2094 Each time this parameter is referenced, the shell substitutes
2095 a decimal number representing the current sequential line number
2096 (starting with 1) within a script or function. When not in a
2097 script or function, the value substituted is not guaranteed to
2100 <FONT SIZE=-1><B>LINENO</B>
2103 is unset, it loses its special properties, even if it is
2108 Automatically set to a string that fully describes the system
2112 is executing, in the standard GNU <I>cpu-company-system</I> format.
2113 The default is system-dependent.
2117 The previous working directory as set by the
2124 The value of the last option argument processed by the
2127 builtin command (see
2128 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
2135 The index of the next argument to be processed by the
2138 builtin command (see
2139 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
2146 Automatically set to a string that
2147 describes the operating system on which
2151 The default is system-dependent.
2152 <DT><B>PIPESTATUS</B>
2155 An array variable (see
2158 below) containing a list of exit status values from the processes
2159 in the most-recently-executed foreground pipeline (which may
2160 contain only a single command).
2164 The process ID of the shell's parent. This variable is readonly.
2168 The current working directory as set by the
2175 Each time this parameter is referenced, a random integer between
2177 generated. The sequence of random numbers may be initialized by assigning
2179 <FONT SIZE=-1><B>RANDOM</B>.
2183 <FONT SIZE=-1><B>RANDOM</B>
2186 is unset, it loses its special properties, even if it is
2191 Set to the line of input read by the
2194 builtin command when no arguments are supplied.
2198 Each time this parameter is
2199 referenced, the number of seconds since shell invocation is returned. If a
2200 value is assigned to
2201 <FONT SIZE=-1><B>SECONDS</B>,
2204 the value returned upon subsequent
2206 the number of seconds since the assignment plus the value assigned.
2208 <FONT SIZE=-1><B>SECONDS</B>
2211 is unset, it loses its special properties, even if it is
2213 <DT><B>SHELLOPTS</B>
2216 A colon-separated list of enabled shell options. Each word in
2217 the list is a valid argument for the
2223 builtin command (see
2224 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
2227 below). The options appearing in
2228 <FONT SIZE=-1><B>SHELLOPTS</B>
2231 are those reported as
2235 If this variable is in the environment when
2238 starts up, each shell option in the list will be enabled before
2239 reading any startup files.
2240 This variable is read-only.
2244 Incremented by one each time an instance of
2251 Expands to the user ID of the current user, initialized at shell startup.
2252 This variable is readonly.
2257 The following variables are used by the shell. In some cases,
2260 assigns a default value to a variable; these cases are noted
2269 If this parameter is set when <B>bash</B> is executing a shell script,
2270 its value is interpreted as a filename containing commands to
2271 initialize the shell, as in
2272 <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>.
2275 <FONT SIZE=-1><B>BASH_ENV</B>
2278 is subjected to parameter expansion, command substitution, and arithmetic
2279 expansion before being interpreted as a file name.
2280 <FONT SIZE=-1><B>PATH</B>
2283 is not used to search for the resultant file name.
2287 The search path for the
2291 This is a colon-separated list of directories in which the shell looks
2292 for destination directories specified by the
2297 <TT>".:~:/usr"</TT>.
2299 <DT><B>BASH_XTRACEFD</B>
2302 If set to an integer corresponding to a valid file descriptor, <B>bash</B>
2303 will write the trace output generated when
2306 is enabled to that file descriptor.
2307 The file descriptor is closed when
2308 <FONT SIZE=-1><B>BASH_XTRACEFD</B>
2311 is unset or assigned a new value.
2313 <FONT SIZE=-1><B>BASH_XTRACEFD</B>
2316 or assigning it the empty string causes the
2317 trace output to be sent to the standard error.
2319 <FONT SIZE=-1><B>BASH_XTRACEFD</B>
2322 to 2 (the standard error file
2323 descriptor) and then unsetting it will result in the standard error
2328 Used by the <B>select</B> builtin command to determine the terminal width
2329 when printing selection lists. Automatically set upon receipt of a SIGWINCH.
2330 <DT><B>COMPREPLY</B>
2333 An array variable from which <B>bash</B> reads the possible completions
2334 generated by a shell function invoked by the programmable completion
2335 facility (see <B>Programmable Completion</B> below).
2339 If <B>bash</B> finds this variable in the environment when the shell starts
2343 it assumes that the shell is running in an emacs shell buffer and disables
2348 The default editor for the
2355 A colon-separated list of suffixes to ignore when performing
2356 filename completion (see
2357 <FONT SIZE=-1><B>READLINE</B>
2361 A filename whose suffix matches one of the entries in
2362 <FONT SIZE=-1><B>FIGNORE</B>
2365 is excluded from the list of matched filenames.
2367 <TT>".o:~"</TT>.
2369 <DT><B>GLOBIGNORE</B>
2372 A colon-separated list of patterns defining the set of filenames to
2373 be ignored by pathname expansion.
2374 If a filename matched by a pathname expansion pattern also matches one
2376 <FONT SIZE=-1><B>GLOBIGNORE</B>,
2379 it is removed from the list of matches.
2380 <DT><B>HISTCONTROL</B>
2383 A colon-separated list of values controlling how commands are saved on
2385 If the list of values includes
2388 lines which begin with a
2391 character are not saved in the history list.
2395 causes lines matching the previous history entry to not be saved.
2399 is shorthand for <I>ignorespace</I> and <I>ignoredups</I>.
2403 causes all previous lines matching the current line to be removed from
2404 the history list before that line is saved.
2405 Any value not in the above list is ignored.
2407 <FONT SIZE=-1><B>HISTCONTROL</B>
2410 is unset, or does not include a valid value,
2411 all lines read by the shell parser are saved on the history list,
2412 subject to the value of
2413 <FONT SIZE=-1><B>HISTIGNORE</B>.
2416 The second and subsequent lines of a multi-line compound command are
2417 not tested, and are added to the history regardless of the value of
2418 <FONT SIZE=-1><B>HISTCONTROL</B>.
2424 The name of the file in which command history is saved (see
2425 <FONT SIZE=-1><B>HISTORY</B>
2428 below). The default value is <A HREF="file:~/.bash_history"><I>~/.bash_history</I></A>. If unset, the
2429 command history is not saved when an interactive shell exits.
2430 <DT><B>HISTFILESIZE</B>
2433 The maximum number of lines contained in the history file. When this
2434 variable is assigned a value, the history file is truncated, if
2435 necessary, by removing the oldest entries,
2436 to contain no more than that number of lines. The default
2437 value is 500. The history file is also truncated to this size after
2438 writing it when an interactive shell exits.
2439 <DT><B>HISTIGNORE</B>
2442 A colon-separated list of patterns used to decide which command lines
2443 should be saved on the history list. Each pattern is anchored at the
2444 beginning of the line and must match the complete line (no implicit
2445 `<B>*</B>' is appended). Each pattern is tested against the line
2446 after the checks specified by
2447 <FONT SIZE=-1><B>HISTCONTROL</B>
2451 In addition to the normal shell pattern matching characters, `<B>&</B>'
2452 matches the previous history line. `<B>&</B>' may be escaped using a
2453 backslash; the backslash is removed before attempting a match.
2454 The second and subsequent lines of a multi-line compound command are
2455 not tested, and are added to the history regardless of the value of
2456 <FONT SIZE=-1><B>HISTIGNORE</B>.
2462 The number of commands to remember in the command history (see
2463 <FONT SIZE=-1><B>HISTORY</B>
2466 below). The default value is 500.
2467 <DT><B>HISTTIMEFORMAT</B>
2470 If this variable is set and not null, its value is used as a format string
2471 for <I>strftime</I>(3) to print the time stamp associated with each history
2472 entry displayed by the <B>history</B> builtin.
2473 If this variable is set, time stamps are written to the history file so
2474 they may be preserved across shell sessions.
2475 This uses the history comment character to distinguish timestamps from
2476 other history lines.
2480 The home directory of the current user; the default argument for the
2481 <B>cd</B> builtin command.
2482 The value of this variable is also used when performing tilde expansion.
2486 Contains the name of a file in the same format as
2490 that should be read when the shell needs to complete a
2492 The list of possible hostname completions may be changed while the
2494 the next time hostname completion is attempted after the
2498 adds the contents of the new file to the existing list.
2500 <FONT SIZE=-1><B>HOSTFILE</B>
2503 is set, but has no value, or does not name a readable file,
2504 <B>bash</B> attempts to read
2508 to obtain the list of possible hostname completions.
2510 <FONT SIZE=-1><B>HOSTFILE</B>
2513 is unset, the hostname list is cleared.
2518 <I>Internal Field Separator</I>
2521 for word splitting after expansion and to
2522 split lines into words with the
2525 builtin command. The default value is
2526 ``<space><tab><newline>''.
2527 <DT><B>IGNOREEOF</B>
2531 action of an interactive shell on receipt of an
2532 <FONT SIZE=-1><B>EOF</B>
2535 character as the sole input. If set, the value is the number of
2537 <FONT SIZE=-1><B>EOF</B>
2540 characters which must be
2541 typed as the first characters on an input line before
2544 exits. If the variable exists but does not have a numeric value, or
2545 has no value, the default value is 10. If it does not exist,
2546 <FONT SIZE=-1><B>EOF</B>
2549 signifies the end of input to the shell.
2553 The filename for the
2556 startup file, overriding the default of
2558 <A HREF="file:~/.inputrc"><I>~/.inputrc</I></A>
2561 <FONT SIZE=-1><B>READLINE</B>
2568 Used to determine the locale category for any category not specifically
2569 selected with a variable starting with <B>LC_</B>.
2573 This variable overrides the value of
2574 <FONT SIZE=-1><B>LANG</B>
2578 <B>LC_</B> variable specifying a locale category.
2579 <DT><B>LC_COLLATE</B>
2582 This variable determines the collation order used when sorting the
2583 results of pathname expansion, and determines the behavior of range
2584 expressions, equivalence classes, and collating sequences within
2585 pathname expansion and pattern matching.
2589 This variable determines the interpretation of characters and the
2590 behavior of character classes within pathname expansion and pattern
2592 <DT><B>LC_MESSAGES</B>
2595 This variable determines the locale used to translate double-quoted
2596 strings preceded by a <B>$</B>.
2597 <DT><B>LC_NUMERIC</B>
2600 This variable determines the locale category used for number formatting.
2604 Used by the <B>select</B> builtin command to determine the column length
2605 for printing selection lists. Automatically set upon receipt of a
2606 <FONT SIZE=-1><B>SIGWINCH</B>.
2612 If this parameter is set to a file name and the
2613 <FONT SIZE=-1><B>MAILPATH</B>
2616 variable is not set,
2619 informs the user of the arrival of mail in the specified file.
2620 <DT><B>MAILCHECK</B>
2627 checks for mail. The default is 60 seconds. When it is time to check
2628 for mail, the shell does so before displaying the primary prompt.
2629 If this variable is unset, or set to a value that is not a number
2630 greater than or equal to zero, the shell disables mail checking.
2634 A colon-separated list of file names to be checked for mail.
2635 The message to be printed when mail arrives in a particular file
2636 may be specified by separating the file name from the message with a `?'.
2637 When used in the text of the message, <B>$_</B> expands to the name of
2638 the current mailfile.
2640 <DL COMPACT><DT><DD>
2643 <B>MAILPATH</B>=aq/var/mail/bfox?"You have mail":~/shell-mail?"$_ has mail!"aq
2648 supplies a default value for this variable, but the location of the user
2649 mail files that it uses is system dependent (e.g., /var/mail/<B>$USER</B>).
2655 If set to the value 1,
2658 displays error messages generated by the
2661 builtin command (see
2662 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
2666 <FONT SIZE=-1><B>OPTERR</B>
2669 is initialized to 1 each time the shell is invoked or a shell
2674 The search path for commands. It
2675 is a colon-separated list of directories in which
2676 the shell looks for commands (see
2677 <FONT SIZE=-1><B>COMMAND EXECUTION</B>
2681 A zero-length (null) directory name in the value of
2682 <FONT SIZE=-1><B>PATH</B>
2685 indicates the current directory.
2686 A null directory name may appear as two adjacent colons, or as an initial
2688 The default path is system-dependent,
2689 and is set by the administrator who installs
2693 <TT>/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin</TT>.
2695 <DT><B>POSIXLY_CORRECT</B>
2698 If this variable is in the environment when <B>bash</B> starts, the shell
2699 enters <I>posix mode</I> before reading the startup files, as if the
2702 invocation option had been supplied. If it is set while the shell is
2703 running, <B>bash</B> enables <I>posix mode</I>, as if the command
2704 <TT>set -o posix</TT>
2707 <DT><B>PROMPT_COMMAND</B>
2710 If set, the value is executed as a command prior to issuing each primary
2712 <DT><B>PROMPT_DIRTRIM</B>
2715 If set to a number greater than zero, the value is used as the number of
2716 trailing directory components to retain when expanding the <B>\w</B> and
2717 <B>\W</B> prompt string escapes (see
2718 <FONT SIZE=-1><B>PROMPTING</B>
2721 below). Characters removed are replaced with an ellipsis.
2725 The value of this parameter is expanded (see
2726 <FONT SIZE=-1><B>PROMPTING</B>
2729 below) and used as the primary prompt string. The default value is
2730 ``<B>\s-\v\$ </B>''.
2734 The value of this parameter is expanded as with
2735 <FONT SIZE=-1><B>PS1</B>
2738 and used as the secondary prompt string. The default is
2743 The value of this parameter is used as the prompt for the
2747 <FONT SIZE=-1><B>SHELL GRAMMAR</B>
2754 The value of this parameter is expanded as with
2755 <FONT SIZE=-1><B>PS1</B>
2758 and the value is printed before each command
2761 displays during an execution trace. The first character of
2762 <FONT SIZE=-1><B>PS4</B>
2765 is replicated multiple times, as necessary, to indicate multiple
2766 levels of indirection. The default is ``<B>+ </B>''.
2770 The full pathname to the shell is kept in this environment variable.
2771 If it is not set when the shell starts,
2774 assigns to it the full pathname of the current user's login shell.
2775 <DT><B>TIMEFORMAT</B>
2778 The value of this parameter is used as a format string specifying
2779 how the timing information for pipelines prefixed with the
2782 reserved word should be displayed.
2783 The <B>%</B> character introduces an escape sequence that is
2784 expanded to a time value or other information.
2785 The escape sequences and their meanings are as follows; the
2786 braces denote optional portions.
2788 <DL COMPACT><DT><DD>
2795 <DT><B>%[</B><I>p</I>][l]R
2798 The elapsed time in seconds.
2799 <DT><B>%[</B><I>p</I>][l]U
2802 The number of CPU seconds spent in user mode.
2803 <DT><B>%[</B><I>p</I>][l]S
2806 The number of CPU seconds spent in system mode.
2810 The CPU percentage, computed as (%U + %S) / %R.
2815 The optional <I>p</I> is a digit specifying the <I>precision</I>,
2816 the number of fractional digits after a decimal point.
2817 A value of 0 causes no decimal point or fraction to be output.
2818 At most three places after the decimal point may be specified;
2819 values of <I>p</I> greater than 3 are changed to 3.
2820 If <I>p</I> is not specified, the value 3 is used.
2822 The optional <B>l</B> specifies a longer format, including
2823 minutes, of the form <I>MM</I>m<I>SS</I>.<I>FF</I>s.
2824 The value of <I>p</I> determines whether or not the fraction is
2827 If this variable is not set, <B>bash</B> acts as if it had the
2828 value <B>$aq\nreal\t%3lR\nuser\t%3lU\nsys %3lSaq</B>.
2829 If the value is null, no timing information is displayed.
2830 A trailing newline is added when the format string is displayed.
2834 If set to a value greater than zero,
2835 <FONT SIZE=-1><B>TMOUT</B>
2839 default timeout for the <B>read</B> builtin.
2840 The <B>select</B> command terminates if input does not arrive
2842 <FONT SIZE=-1><B>TMOUT</B>
2845 seconds when input is coming from a terminal.
2846 In an interactive shell, the value is interpreted as the
2847 number of seconds to wait for input after issuing the primary prompt.
2850 terminates after waiting for that number of seconds if input does
2855 If set, <B>Bash</B> uses its value as the name of a directory in which
2856 <B>Bash</B> creates temporary files for the shell's use.
2857 <DT><B>auto_resume</B>
2860 This variable controls how the shell interacts with the user and
2861 job control. If this variable is set, single word simple
2862 commands without redirections are treated as candidates for resumption
2863 of an existing stopped job. There is no ambiguity allowed; if there is
2864 more than one job beginning with the string typed, the job most recently
2865 accessed is selected. The
2868 of a stopped job, in this context, is the command line used to
2873 the string supplied must match the name of a stopped job exactly;
2877 the string supplied needs to match a substring of the name of a
2881 value provides functionality analogous to the
2885 <FONT SIZE=-1><B>JOB CONTROL</B>
2888 below). If set to any other value, the supplied string must
2889 be a prefix of a stopped job's name; this provides functionality
2890 analogous to the <B>%</B><I>string</I> job identifier.
2891 <DT><B>histchars</B>
2894 The two or three characters which control history expansion
2895 and tokenization (see
2896 <FONT SIZE=-1><B>HISTORY EXPANSION</B>
2899 below). The first character is the <I>history expansion</I> character,
2900 the character which signals the start of a history
2901 expansion, normally `<B>!</B>'.
2902 The second character is the <I>quick substitution</I>
2903 character, which is used as shorthand for re-running the previous
2904 command entered, substituting one string for another in the command.
2905 The default is `<B>^</B>'.
2906 The optional third character is the character
2907 which indicates that the remainder of the line is a comment when found
2908 as the first character of a word, normally `<B>#</B>'. The history
2909 comment character causes history substitution to be skipped for the
2910 remaining words on the line. It does not necessarily cause the shell
2911 parser to treat the rest of the line as a comment.
2914 <A NAME="lbAX"> </A>
2919 provides one-dimensional indexed and associative array variables.
2920 Any variable may be used as an indexed array; the
2923 builtin will explicitly declare an array.
2925 limit on the size of an array, nor any requirement that members
2926 be indexed or assigned contiguously.
2927 Indexed arrays are referenced using integers (including arithmetic
2928 expressions) and are zero-based; associative arrays are referenced
2929 using arbitrary strings.
2932 An indexed array is created automatically if any variable is assigned to
2933 using the syntax <I>name</I>[<I>subscript</I>]=<I>value</I>. The
2936 is treated as an arithmetic expression that must evaluate to a number
2937 greater than or equal to zero. To explicitly declare an indexed array,
2939 <B>declare -a </B><I>name</I>
2942 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
2946 <B>declare -a </B><I>name</I>[<I>subscript</I>]
2948 is also accepted; the <I>subscript</I> is ignored.
2951 Associative arrays are created using
2952 <B>declare -A </B><I>name</I>.
2957 specified for an array variable using the
2963 builtins. Each attribute applies to all members of an array.
2966 Arrays are assigned to using compound assignments of the form
2967 <I>name</I>=<B>(</B>value<I>1</I> ... value<I>n</I><B>)</B>, where each
2968 <I>value</I> is of the form [<I>subscript</I>]=<I>string</I>.
2969 Indexed array assignments do not require the bracket and subscript.
2970 When assigning to indexed arrays, if the optional brackets and subscript
2971 are supplied, that index is assigned to;
2972 otherwise the index of the element assigned is the last index assigned
2973 to by the statement plus one. Indexing starts at zero.
2976 When assigning to an associative array, the subscript is required.
2979 This syntax is also accepted by the
2982 builtin. Individual array elements may be assigned to using the
2983 <I>name</I>[<I>subscript</I>]=<I>value</I> syntax introduced above.
2986 Any element of an array may be referenced using
2987 ${<I>name</I>[<I>subscript</I>]}. The braces are required to avoid
2988 conflicts with pathname expansion. If
2989 <I>subscript</I> is <B>@</B> or <B>*</B>, the word expands to
2990 all members of <I>name</I>. These subscripts differ only when the
2991 word appears within double quotes. If the word is double-quoted,
2992 ${<I>name</I>[*]} expands to a single
2993 word with the value of each array member separated by the first
2995 <FONT SIZE=-1><B>IFS</B>
2998 special variable, and ${<I>name</I>[@]} expands each element of
2999 <I>name</I> to a separate word. When there are no array members,
3000 ${<I>name</I>[@]} expands to nothing.
3001 If the double-quoted expansion occurs within a word, the expansion of
3002 the first parameter is joined with the beginning part of the original
3003 word, and the expansion of the last parameter is joined with the last
3004 part of the original word.
3005 This is analogous to the expansion
3006 of the special parameters <B>*</B> and <B>@</B> (see
3007 <B>Special Parameters</B>
3009 above). ${#<I>name</I>[<I>subscript</I>]} expands to the length of
3010 ${<I>name</I>[<I>subscript</I>]}. If <I>subscript</I> is <B>*</B> or
3011 <B>@</B>, the expansion is the number of elements in the array.
3012 Referencing an array variable without a subscript is equivalent to
3013 referencing the array with a subscript of 0.
3016 An array variable is considered set if a subscript has been assigned a
3017 value. The null string is a valid value.
3023 builtin is used to destroy arrays. <B>unset</B> <I>name</I>[<I>subscript</I>]
3024 destroys the array element at index <I>subscript</I>.
3025 Care must be taken to avoid unwanted side effects caused by pathname
3027 <B>unset</B> <I>name</I>, where <I>name</I> is an array, or
3028 <B>unset</B> <I>name</I>[<I>subscript</I>], where
3029 <I>subscript</I> is <B>*</B> or <B>@</B>, removes the entire array.
3040 builtins each accept a
3043 option to specify an indexed array and a
3046 option to specify an associative array.
3053 option to assign a list of words read from the standard input
3060 builtins display array values in a way that allows them to be
3061 reused as assignments.
3062 <A NAME="lbAY"> </A>
3065 Expansion is performed on the command line after it has been split into
3066 words. There are seven kinds of expansion performed:
3067 <I>brace expansion</I>,
3069 <I>tilde expansion</I>,
3071 <I>parameter and variable expansion</I>,
3073 <I>command substitution</I>,
3075 <I>arithmetic expansion</I>,
3077 <I>word splitting</I>,
3080 <I>pathname expansion</I>.
3084 The order of expansions is: brace expansion, tilde expansion,
3085 parameter, variable and arithmetic expansion and
3086 command substitution
3087 (done in a left-to-right fashion), word splitting, and pathname
3091 On systems that can support it, there is an additional expansion
3092 available: <I>process substitution</I>.
3095 Only brace expansion, word splitting, and pathname expansion
3096 can change the number of words of the expansion; other expansions
3097 expand a single word to a single word.
3098 The only exceptions to this are the expansions of
3099 "<B>$@</B>" and "<B>${</B><I>name</I><B>[@]}</B>"
3100 as explained above (see
3101 <FONT SIZE=-1><B>PARAMETERS</B>).
3104 <A NAME="lbAZ"> </A>
3105 <H4>Brace Expansion</H4>
3109 <I>Brace expansion</I>
3111 is a mechanism by which arbitrary strings
3112 may be generated. This mechanism is similar to
3113 <I>pathname expansion</I>, but the filenames generated
3114 need not exist. Patterns to be brace expanded take
3115 the form of an optional
3118 followed by either a series of comma-separated strings or
3119 a sequence expression between a pair of braces, followed by
3123 The preamble is prefixed to each string contained
3124 within the braces, and the postscript is then appended
3125 to each resulting string, expanding left to right.
3128 Brace expansions may be nested. The results of each expanded
3129 string are not sorted; left to right order is preserved.
3130 For example, a<B>{</B>d,c,b<B>}</B>e expands into `ade ace abe'.
3133 A sequence expression takes the form
3134 <B>{</B><I>x</I><B>..</B><I>y</I><B>[..</B><I>incr</I><B>]}</B>,
3135 where <I>x</I> and <I>y</I> are either integers or single characters,
3136 and <I>incr</I>, an optional increment, is an integer.
3137 When integers are supplied, the expression expands to each number between
3138 <I>x</I> and <I>y</I>, inclusive.
3139 Supplied integers may be prefixed with <I>0</I> to force each term to have the
3140 same width. When either <I>x</I> or y begins with a zero, the shell
3141 attempts to force all generated terms to contain the same number of digits,
3142 zero-padding where necessary.
3143 When characters are supplied, the expression expands to each character
3144 lexicographically between <I>x</I> and <I>y</I>, inclusive. Note that
3145 both <I>x</I> and <I>y</I> must be of the same type.
3146 When the increment is supplied, it is used as the difference between
3147 each term. The default increment is 1 or -1 as appropriate.
3150 Brace expansion is performed before any other expansions,
3151 and any characters special to other expansions are preserved
3152 in the result. It is strictly textual.
3155 does not apply any syntactic interpretation to the context of the
3156 expansion or the text between the braces.
3159 A correctly-formed brace expansion must contain unquoted opening
3160 and closing braces, and at least one unquoted comma or a valid
3161 sequence expression.
3162 Any incorrectly formed brace expansion is left unchanged.
3163 A <B>{</B> or <B>,</B> may be quoted with a backslash to prevent its
3164 being considered part of a brace expression.
3165 To avoid conflicts with parameter expansion, the string <B>${</B>
3166 is not considered eligible for brace expansion.
3169 This construct is typically used as shorthand when the common
3170 prefix of the strings to be generated is longer than in the
3172 <DL COMPACT><DT><DD>
3175 mkdir /usr/local/src/bash/{old,new,dist,bugs}
3179 <DL COMPACT><DT><DD>
3180 chown root /usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}}
3185 Brace expansion introduces a slight incompatibility with
3186 historical versions of
3191 does not treat opening or closing braces specially when they
3192 appear as part of a word, and preserves them in the output.
3195 removes braces from words as a consequence of brace
3196 expansion. For example, a word entered to
3200 appears identically in the output. The same word is
3207 If strict compatibility with
3216 option or disable brace expansion with the
3223 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
3227 <A NAME="lbBA"> </A>
3228 <H4>Tilde Expansion</H4>
3232 If a word begins with an unquoted tilde character (`<B>~</B>'), all of
3233 the characters preceding the first unquoted slash (or all characters,
3234 if there is no unquoted slash) are considered a <I>tilde-prefix</I>.
3235 If none of the characters in the tilde-prefix are quoted, the
3236 characters in the tilde-prefix following the tilde are treated as a
3237 possible <I>login name</I>.
3238 If this login name is the null string, the tilde is replaced with the
3239 value of the shell parameter
3240 <FONT SIZE=-1><B>HOME</B>.
3244 <FONT SIZE=-1><B>HOME</B>
3247 is unset, the home directory of the user executing the shell is
3248 substituted instead.
3249 Otherwise, the tilde-prefix is replaced with the home directory
3250 associated with the specified login name.
3253 If the tilde-prefix is a `~+', the value of the shell variable
3254 <FONT SIZE=-1><B>PWD</B>
3257 replaces the tilde-prefix.
3258 If the tilde-prefix is a `~-', the value of the shell variable
3259 <FONT SIZE=-1><B>OLDPWD</B>,
3262 if it is set, is substituted.
3263 If the characters following the tilde in the tilde-prefix consist
3264 of a number <I>N</I>, optionally prefixed
3265 by a `+' or a `-', the tilde-prefix is replaced with the corresponding
3266 element from the directory stack, as it would be displayed by the
3269 builtin invoked with the tilde-prefix as an argument.
3270 If the characters following the tilde in the tilde-prefix consist of a
3271 number without a leading `+' or `-', `+' is assumed.
3274 If the login name is invalid, or the tilde expansion fails, the word
3278 Each variable assignment is checked for unquoted tilde-prefixes immediately
3285 In these cases, tilde expansion is also performed.
3286 Consequently, one may use file names with tildes in assignments to
3287 <FONT SIZE=-1><B>PATH</B>,
3290 <FONT SIZE=-1><B>MAILPATH</B>,
3294 <FONT SIZE=-1><B>CDPATH</B>,
3297 and the shell assigns the expanded value.
3298 <A NAME="lbBB"> </A>
3299 <H4>Parameter Expansion</H4>
3303 The `<B>$</B>' character introduces parameter expansion,
3304 command substitution, or arithmetic expansion. The parameter name
3305 or symbol to be expanded may be enclosed in braces, which
3306 are optional but serve to protect the variable to be expanded from
3307 characters immediately following it which could be
3308 interpreted as part of the name.
3311 When braces are used, the matching ending brace is the first `<B>}</B>'
3312 not escaped by a backslash or within a quoted string, and not within an
3313 embedded arithmetic expansion, command substitution, or parameter
3319 <DT>${<I>parameter</I>}<DD>
3320 The value of <I>parameter</I> is substituted. The braces are required
3324 is a positional parameter with more than one digit,
3328 is followed by a character which is not to be
3329 interpreted as part of its name.
3334 If the first character of <I>parameter</I> is an exclamation point (<B>!</B>),
3335 a level of variable indirection is introduced.
3336 <B>Bash</B> uses the value of the variable formed from the rest of
3337 <I>parameter</I> as the name of the variable; this variable is then
3338 expanded and that value is used in the rest of the substitution, rather
3339 than the value of <I>parameter</I> itself.
3340 This is known as <I>indirect expansion</I>.
3341 The exceptions to this are the expansions of ${!<I>prefix</I>*} and
3342 ${<B>!</B><I>name</I>[<I>@</I>]} described below.
3343 The exclamation point must immediately follow the left brace in order to
3344 introduce indirection.
3347 In each of the cases below, <I>word</I> is subject to tilde expansion,
3348 parameter expansion, command substitution, and arithmetic expansion.
3351 When not performing substring expansion, using the forms documented below,
3352 <B>bash</B> tests for a parameter that is unset or null. Omitting the colon
3353 results in a test only for a parameter that is unset.
3358 <DT>${<I>parameter</I><B>:-</B><I>word</I>}<DD>
3359 <B>Use Default Values</B>. If
3362 is unset or null, the expansion of
3365 is substituted. Otherwise, the value of
3369 <DT>${<I>parameter</I><B>:=</B><I>word</I>}<DD>
3370 <B>Assign Default Values</B>.
3374 is unset or null, the expansion of
3383 is then substituted. Positional parameters and special parameters may
3384 not be assigned to in this way.
3385 <DT>${<I>parameter</I><B>:?</B><I>word</I>}<DD>
3386 <B>Display Error if Null or Unset</B>.
3390 is null or unset, the expansion of <I>word</I> (or a message to that effect
3394 is not present) is written to the standard error and the shell, if it
3395 is not interactive, exits. Otherwise, the value of <I>parameter</I> is
3397 <DT>${<I>parameter</I><B>:+</B><I>word</I>}<DD>
3398 <B>Use Alternate Value</B>.
3402 is null or unset, nothing is substituted, otherwise the expansion of
3406 <DT>${<I>parameter</I><B>:</B><I>offset</I>}<DD>
3408 <DT>${<I>parameter</I><B>:</B><I>offset</I><B>:</B><I>length</I>}<DD>
3410 <B>Substring Expansion.</B>
3411 Expands to up to <I>length</I> characters of <I>parameter</I>
3412 starting at the character specified by <I>offset</I>.
3413 If <I>length</I> is omitted, expands to the substring of
3414 <I>parameter</I> starting at the character specified by <I>offset</I>.
3415 <I>length</I> and <I>offset</I> are arithmetic expressions (see
3416 <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>
3420 <I>length</I> must evaluate to a number greater than or equal to zero.
3421 If <I>offset</I> evaluates to a number less than zero, the value
3422 is used as an offset from the end of the value of <I>parameter</I>.
3423 If <I>parameter</I> is <B>@</B>, the result is <I>length</I> positional
3424 parameters beginning at <I>offset</I>.
3425 If <I>parameter</I> is an indexed array name subscripted by @ or *,
3426 the result is the <I>length</I>
3427 members of the array beginning with ${<I>parameter</I>[<I>offset</I>]}.
3428 A negative <I>offset</I> is taken relative to one greater than the maximum
3429 index of the specified array.
3430 Substring expansion applied to an associative array produces undefined
3432 Note that a negative offset must be separated from the colon by at least
3433 one space to avoid being confused with the :- expansion.
3434 Substring indexing is zero-based unless the positional parameters
3435 are used, in which case the indexing starts at 1 by default.
3436 If <I>offset</I> is 0, and the positional parameters are used, <B>$0</B> is
3437 prefixed to the list.
3438 <DT>${<B>!</B><I>prefix</I><B>*</B>}<DD>
3440 <DT>${<B>!</B><I>prefix</I><B>@</B>}<DD>
3442 <B>Names matching prefix.</B>
3443 Expands to the names of variables whose names begin with <I>prefix</I>,
3444 separated by the first character of the
3445 <FONT SIZE=-1><B>IFS</B>
3449 When <I>@</I> is used and the expansion appears within double quotes, each
3450 variable name expands to a separate word.
3451 <DT>${<B>!</B><I>name</I>[<I>@</I>]}<DD>
3453 <DT>${<B>!</B><I>name</I>[<I>*</I>]}<DD>
3455 <B>List of array keys.</B>
3456 If <I>name</I> is an array variable, expands to the list of array indices
3457 (keys) assigned in <I>name</I>.
3458 If <I>name</I> is not an array, expands to 0 if <I>name</I> is set and null
3460 When <I>@</I> is used and the expansion appears within double quotes, each
3461 key expands to a separate word.
3462 <DT>${<B>#</B><I>parameter</I>}<DD>
3463 <B>Parameter length.</B>
3464 The length in characters of the value of <I>parameter</I> is substituted.
3474 the value substituted is the number of positional parameters.
3478 is an array name subscripted by
3484 the value substituted is the number of elements in the array.
3485 <DT>${<I>parameter</I><B>#</B><I>word</I>}<DD>
3487 <DT>${<I>parameter</I><B>##</B><I>word</I>}<DD>
3489 <B>Remove matching prefix pattern.</B>
3493 is expanded to produce a pattern just as in pathname
3494 expansion. If the pattern matches the beginning of
3498 then the result of the expansion is the expanded value of
3501 with the shortest matching pattern (the ``<B>#</B>'' case) or the
3502 longest matching pattern (the ``<B>##</B>'' case) deleted.
3512 the pattern removal operation is applied to each positional
3513 parameter in turn, and the expansion is the resultant list.
3517 is an array variable subscripted with
3523 the pattern removal operation is applied to each member of the
3524 array in turn, and the expansion is the resultant list.
3525 <DT>${<I>parameter</I><B>%</B><I>word</I>}<DD>
3527 <DT>${<I>parameter</I><B>%%</B><I>word</I>}<DD>
3529 <B>Remove matching suffix pattern.</B>
3530 The <I>word</I> is expanded to produce a pattern just as in
3532 If the pattern matches a trailing portion of the expanded value of
3535 then the result of the expansion is the expanded value of
3538 with the shortest matching pattern (the ``<B>%</B>'' case) or the
3539 longest matching pattern (the ``<B>%%</B>'' case) deleted.
3549 the pattern removal operation is applied to each positional
3550 parameter in turn, and the expansion is the resultant list.
3554 is an array variable subscripted with
3560 the pattern removal operation is applied to each member of the
3561 array in turn, and the expansion is the resultant list.
3562 <DT>${<I>parameter</I><B>/</B><I>pattern</I><B>/</B><I>string</I>}<DD>
3563 <B>Pattern substitution.</B>
3564 The <I>pattern</I> is expanded to produce a pattern just as in
3566 <I>Parameter</I> is expanded and the longest match of <I>pattern</I>
3567 against its value is replaced with <I>string</I>.
3568 If <I>pattern</I> begins with <B>/</B>, all matches of <I>pattern</I> are
3569 replaced with <I>string</I>. Normally only the first match is replaced.
3570 If <I>pattern</I> begins with <B>#</B>, it must match at the beginning
3571 of the expanded value of <I>parameter</I>.
3572 If <I>pattern</I> begins with <B>%</B>, it must match at the end
3573 of the expanded value of <I>parameter</I>.
3574 If <I>string</I> is null, matches of <I>pattern</I> are deleted
3575 and the <B>/</B> following <I>pattern</I> may be omitted.
3585 the substitution operation is applied to each positional
3586 parameter in turn, and the expansion is the resultant list.
3590 is an array variable subscripted with
3596 the substitution operation is applied to each member of the
3597 array in turn, and the expansion is the resultant list.
3598 <DT>${<I>parameter</I><B>^</B><I>pattern</I>}<DD>
3600 <DT>${<I>parameter</I><B>^^</B><I>pattern</I>}<DD>
3601 <DT>${<I>parameter</I><B>,</B><I>pattern</I>}<DD>
3602 <DT>${<I>parameter</I><B>,,</B><I>pattern</I>}<DD>
3604 <B>Case modification.</B>
3605 This expansion modifies the case of alphabetic characters in <I>parameter</I>.
3606 The <I>pattern</I> is expanded to produce a pattern just as in
3608 The <B>^</B> operator converts lowercase letters matching <I>pattern</I>
3609 to uppercase; the <B>,</B> operator converts matching uppercase letters
3611 The <B>^^</B> and <B>,,</B> expansions convert each matched character in the
3612 expanded value; the <B>^</B> and <B>,</B> expansions match and convert only
3613 the first character in the expanded value..
3614 If <I>pattern</I> is omitted, it is treated like a <B>?</B>, which matches
3625 the case modification operation is applied to each positional
3626 parameter in turn, and the expansion is the resultant list.
3630 is an array variable subscripted with
3636 the case modification operation is applied to each member of the
3637 array in turn, and the expansion is the resultant list.
3639 <A NAME="lbBC"> </A>
3640 <H4>Command Substitution</H4>
3644 <I>Command substitution</I> allows the output of a command to replace
3645 the command name. There are two forms:
3648 <DL COMPACT><DT><DD>
3651 <B>$(</B><I>command</I><B>)</B>
3655 <DL COMPACT><DT><DD>
3656 <B>`</B><I>command</I><B>`</B>
3663 performs the expansion by executing <I>command</I> and
3664 replacing the command substitution with the standard output of the
3665 command, with any trailing newlines deleted.
3666 Embedded newlines are not deleted, but they may be removed during
3668 The command substitution <B>$(cat </B><I>file</I>) can be replaced by
3669 the equivalent but faster <B>$(< </B><I>file</I>).
3672 When the old-style backquote form of substitution is used,
3673 backslash retains its literal meaning except when followed by
3681 The first backquote not preceded by a backslash terminates the
3682 command substitution.
3683 When using the $(<I>command</I>) form, all characters between the
3684 parentheses make up the command; none are treated specially.
3687 Command substitutions may be nested. To nest when using the backquoted form,
3688 escape the inner backquotes with backslashes.
3691 If the substitution appears within double quotes, word splitting and
3692 pathname expansion are not performed on the results.
3693 <A NAME="lbBD"> </A>
3694 <H4>Arithmetic Expansion</H4>
3698 Arithmetic expansion allows the evaluation of an arithmetic expression
3699 and the substitution of the result. The format for arithmetic expansion is:
3700 <DL COMPACT><DT><DD>
3703 <B>$((</B><I>expression</I><B>))</B>
3711 is treated as if it were within double quotes, but a double quote
3712 inside the parentheses is not treated specially.
3713 All tokens in the expression undergo parameter expansion, string
3714 expansion, command substitution, and quote removal.
3715 Arithmetic expansions may be nested.
3718 The evaluation is performed according to the rules listed below under
3719 <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>.
3728 prints a message indicating failure and no substitution occurs.
3729 <A NAME="lbBE"> </A>
3730 <H4>Process Substitution</H4>
3734 <I>Process substitution</I> is supported on systems that support named
3735 pipes (<I>FIFOs</I>) or the <B>/dev/fd</B> method of naming open files.
3736 It takes the form of
3737 <B><(</B><I>list</I><B>)</B>
3739 <B>>(</B><I>list</I><B>)</B>.
3740 The process <I>list</I> is run with its input or output connected to a
3741 <I>FIFO</I> or some file in <B>/dev/fd</B>. The name of this file is
3742 passed as an argument to the current command as the result of the
3743 expansion. If the <B>>(</B><I>list</I><B>)</B> form is used, writing to
3744 the file will provide input for <I>list</I>. If the
3745 <B><(</B><I>list</I><B>)</B> form is used, the file passed as an
3746 argument should be read to obtain the output of <I>list</I>.
3749 When available, process substitution is performed
3750 simultaneously with parameter and variable expansion,
3751 command substitution,
3752 and arithmetic expansion.
3753 <A NAME="lbBF"> </A>
3754 <H4>Word Splitting</H4>
3758 The shell scans the results of
3759 parameter expansion,
3760 command substitution,
3762 arithmetic expansion
3763 that did not occur within double quotes for
3764 <I>word splitting</I>.
3768 The shell treats each character of
3769 <FONT SIZE=-1><B>IFS</B>
3772 as a delimiter, and splits the results of the other
3773 expansions into words on these characters. If
3774 <FONT SIZE=-1><B>IFS</B>
3779 <B><space><tab><newline></B>,
3783 <B><space></B>,
3788 <B><newline></B>
3790 at the beginning and end of the results of the previous
3791 expansions are ignored, and
3793 <FONT SIZE=-1><B>IFS</B>
3796 characters not at the beginning or end serves to delimit words.
3798 <FONT SIZE=-1><B>IFS</B>
3801 has a value other than the default, then sequences of
3802 the whitespace characters
3808 are ignored at the beginning and end of the
3809 word, as long as the whitespace character is in the
3811 <FONT SIZE=-1><B>IFS</B>
3815 <FONT SIZE=-1><B>IFS</B>
3818 whitespace character).
3820 <FONT SIZE=-1><B>IFS</B>
3824 <FONT SIZE=-1><B>IFS</B>
3827 whitespace, along with any adjacent
3828 <FONT SIZE=-1><B>IFS</B>
3831 whitespace characters, delimits a field.
3833 <FONT SIZE=-1><B>IFS</B>
3836 whitespace characters is also treated as a delimiter.
3838 <FONT SIZE=-1><B>IFS</B>
3841 is null, no word splitting occurs.
3844 Explicit null arguments (<B>""</B> or <B>aqaq</B>) are retained.
3845 Unquoted implicit null arguments, resulting from the expansion of
3846 parameters that have no values, are removed.
3847 If a parameter with no value is expanded within double quotes, a
3848 null argument results and is retained.
3851 Note that if no expansion occurs, no splitting
3853 <A NAME="lbBG"> </A>
3854 <H4>Pathname Expansion</H4>
3858 After word splitting,
3862 option has been set,
3865 scans each word for the characters
3873 If one of these characters appears, then the word is
3877 and replaced with an alphabetically sorted list of
3878 file names matching the pattern.
3879 If no matching file names are found,
3880 and the shell option
3883 is not enabled, the word is left unchanged.
3887 option is set, and no matches are found,
3888 the word is removed.
3892 shell option is set, and no matches are found, an error message
3893 is printed and the command is not executed.
3897 is enabled, the match is performed without regard to the case
3898 of alphabetic characters.
3899 When a pattern is used for pathname expansion,
3903 at the start of a name or immediately following a slash
3904 must be matched explicitly, unless the shell option
3908 When matching a pathname, the slash character must always be
3913 character is not treated specially.
3914 See the description of
3918 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
3921 for a description of the
3935 <FONT SIZE=-1><B>GLOBIGNORE</B>
3938 shell variable may be used to restrict the set of file names matching a
3942 <FONT SIZE=-1><B>GLOBIGNORE</B>
3945 is set, each matching file name that also matches one of the patterns in
3946 <FONT SIZE=-1><B>GLOBIGNORE</B>
3949 is removed from the list of matches.
3956 are always ignored when
3957 <FONT SIZE=-1><B>GLOBIGNORE</B>
3960 is set and not null. However, setting
3961 <FONT SIZE=-1><B>GLOBIGNORE</B>
3964 to a non-null value has the effect of enabling the
3967 shell option, so all other file names beginning with a
3971 To get the old behavior of ignoring file names beginning with a
3977 one of the patterns in
3978 <FONT SIZE=-1><B>GLOBIGNORE</B>.
3984 option is disabled when
3985 <FONT SIZE=-1><B>GLOBIGNORE</B>
3991 <B>Pattern Matching</B>
3994 Any character that appears in a pattern, other than the special pattern
3995 characters described below, matches itself. The NUL character may not
3996 occur in a pattern. A backslash escapes the following character; the
3997 escaping backslash is discarded when matching.
3998 The special pattern characters must be quoted if
3999 they are to be matched literally.
4002 The special pattern characters have the following meanings:
4010 Matches any string, including the null string.
4011 When the <B>globstar</B> shell option is enabled, and <B>*</B> is used in
4012 a pathname expansion context, two adjacent <B>*</B>s used as a single
4013 pattern will match all files and zero or more directories and
4015 If followed by a <B>/</B>, two adjacent <B>*</B>s will match only directories
4020 Matches any single character.
4024 Matches any one of the enclosed characters. A pair of characters
4025 separated by a hyphen denotes a
4026 <I>range expression</I>;
4027 any character that sorts between those two characters, inclusive,
4028 using the current locale's collating sequence and character set,
4029 is matched. If the first character following the
4038 then any character not enclosed is matched.
4039 The sorting order of characters in range expressions is determined by
4040 the current locale and the value of the
4041 <FONT SIZE=-1><B>LC_COLLATE</B>
4049 may be matched by including it as the first or last character
4054 may be matched by including it as the first character
4067 <I>character classes</I> can be specified using the syntax
4068 <B>[:</B><I>class</I><B>:]</B>, where <I>class</I> is one of the
4069 following classes defined in the POSIX standard:
4073 <DL COMPACT><DT><DD>
4077 alnum alpha ascii blank cntrl digit graph lower print punct space upper word xdigit
4080 A character class matches any character belonging to that class.
4081 The <B>word</B> character class matches letters, digits, and the character _.
4093 an <I>equivalence class</I> can be specified using the syntax
4094 <B>[=</B><I>c</I><B>=]</B>, which matches all characters with the
4095 same collation weight (as defined by the current locale) as
4096 the character <I>c</I>.
4108 the syntax <B>[.</B><I>symbol</I><B>.]</B> matches the collating symbol
4115 If the <B>extglob</B> shell option is enabled using the <B>shopt</B>
4116 builtin, several extended pattern matching operators are recognized.
4117 In the following description, a <I>pattern-list</I> is a list of one
4118 or more patterns separated by a <B>|</B>.
4119 Composite patterns may be formed using one or more of the following
4123 <DL COMPACT><DT><DD>
4125 <DT><B>?(</B><I>pattern-list</I><B>)</B><DD>
4126 Matches zero or one occurrence of the given patterns
4127 <DT><B>*(</B><I>pattern-list</I><B>)</B><DD>
4128 Matches zero or more occurrences of the given patterns
4129 <DT><B>+(</B><I>pattern-list</I><B>)</B><DD>
4130 Matches one or more occurrences of the given patterns
4131 <DT><B>@(</B><I>pattern-list</I><B>)</B><DD>
4132 Matches one of the given patterns
4133 <DT><B>!(</B><I>pattern-list</I><B>)</B><DD>
4134 Matches anything except one of the given patterns
4138 <A NAME="lbBH"> </A>
4139 <H4>Quote Removal</H4>
4143 After the preceding expansions, all unquoted occurrences of the
4149 and <B>"</B> that did not result from one of the above
4150 expansions are removed.
4151 <A NAME="lbBI"> </A>
4152 <H3>REDIRECTION</H3>
4154 Before a command is executed, its input and output
4158 using a special notation interpreted by the shell.
4159 Redirection may also be used to open and close files for the
4160 current shell execution environment. The following redirection
4161 operators may precede or appear anywhere within a
4162 <I>simple command</I>
4167 Redirections are processed in the order they appear, from
4171 Each redirection that may be preceded by a file descriptor number
4172 may instead be preceded by a word of the form {<I>varname</I>}.
4173 In this case, for each redirection operator except
4174 >&- and <&-, the shell will allocate a file descriptor greater
4175 than 10 and assign it to <I>varname</I>. If >&- or <&- is preceded
4176 by {<I>varname</I>}, the value of <I>varname</I> defines the file
4177 descriptor to close.
4180 In the following descriptions, if the file descriptor number is
4181 omitted, and the first character of the redirection operator is
4184 the redirection refers to the standard input (file descriptor
4185 0). If the first character of the redirection operator is
4188 the redirection refers to the standard output (file descriptor
4192 The word following the redirection operator in the following
4193 descriptions, unless otherwise noted, is subjected to brace expansion,
4194 tilde expansion, parameter expansion, command substitution, arithmetic
4195 expansion, quote removal, pathname expansion, and word splitting.
4196 If it expands to more than one word,
4202 Note that the order of redirections is significant. For example,
4204 <DL COMPACT><DT><DD>
4207 ls <B>></B> dirlist 2<B>>&</B>1
4212 directs both standard output and standard error to the file
4216 <DL COMPACT><DT><DD>
4219 ls 2<B>>&</B>1 <B>></B> dirlist
4224 directs only the standard output to file
4227 because the standard error was duplicated from the standard output
4228 before the standard output was redirected to
4233 <B>Bash</B> handles several filenames specially when they are used in
4234 redirections, as described in the following table:
4235 <DL COMPACT><DT><DD>
4240 <DT><B>/dev/fd/</B><I>fd</I>
4243 If <I>fd</I> is a valid integer, file descriptor <I>fd</I> is duplicated.
4244 <DT><B>/dev/stdin</B>
4247 File descriptor 0 is duplicated.
4248 <DT><B>/dev/stdout</B>
4251 File descriptor 1 is duplicated.
4252 <DT><B>/dev/stderr</B>
4255 File descriptor 2 is duplicated.
4256 <DT><B>/dev/tcp/</B><I>host</I>/<I>port</I>
4259 If <I>host</I> is a valid hostname or Internet address, and <I>port</I>
4260 is an integer port number or service name, <B>bash</B> attempts to open
4261 a TCP connection to the corresponding socket.
4262 <DT><B>/dev/udp/</B><I>host</I>/<I>port</I>
4265 If <I>host</I> is a valid hostname or Internet address, and <I>port</I>
4266 is an integer port number or service name, <B>bash</B> attempts to open
4267 a UDP connection to the corresponding socket.
4273 A failure to open or create a file causes the redirection to fail.
4276 Redirections using file descriptors greater than 9 should be used with
4277 care, as they may conflict with file descriptors the shell uses
4279 <A NAME="lbBJ"> </A>
4280 <H4>Redirecting Input</H4>
4284 Redirection of input causes the file whose name results from
4288 to be opened for reading on file descriptor
4291 or the standard input (file descriptor 0) if
4297 The general format for redirecting input is:
4298 <DL COMPACT><DT><DD>
4301 [<I>n</I>]<B><</B><I>word</I>
4304 <A NAME="lbBK"> </A>
4305 <H4>Redirecting Output</H4>
4309 Redirection of output causes the file whose name results from
4313 to be opened for writing on file descriptor
4316 or the standard output (file descriptor 1) if
4319 is not specified. If the file does not exist it is created;
4320 if it does exist it is truncated to zero size.
4323 The general format for redirecting output is:
4324 <DL COMPACT><DT><DD>
4327 [<I>n</I>]<B>></B><I>word</I>
4332 If the redirection operator is
4341 builtin has been enabled, the redirection will fail if the file
4342 whose name results from the expansion of <I>word</I> exists and is
4344 If the redirection operator is
4347 or the redirection operator is
4356 builtin command is not enabled, the redirection is attempted even
4357 if the file named by <I>word</I> exists.
4358 <A NAME="lbBL"> </A>
4359 <H4>Appending Redirected Output</H4>
4363 Redirection of output in this fashion
4364 causes the file whose name results from
4368 to be opened for appending on file descriptor
4371 or the standard output (file descriptor 1) if
4374 is not specified. If the file does not exist it is created.
4377 The general format for appending output is:
4378 <DL COMPACT><DT><DD>
4381 [<I>n</I>]<B>>></B><I>word</I>
4386 <A NAME="lbBM"> </A>
4387 <H4>Redirecting Standard Output and Standard Error</H4>
4391 This construct allows both the
4392 standard output (file descriptor 1) and
4393 the standard error output (file descriptor 2)
4394 to be redirected to the file whose name is the
4400 There are two formats for redirecting standard output and
4402 <DL COMPACT><DT><DD>
4405 <B>&></B><I>word</I>
4409 <DL COMPACT><DT><DD>
4410 <B>>&</B><I>word</I>
4415 Of the two forms, the first is preferred.
4416 This is semantically equivalent to
4417 <DL COMPACT><DT><DD>
4420 <B>></B><I>word</I> 2<B>>&</B>1
4425 <A NAME="lbBN"> </A>
4426 <H4>Appending Standard Output and Standard Error</H4>
4430 This construct allows both the
4431 standard output (file descriptor 1) and
4432 the standard error output (file descriptor 2)
4433 to be appended to the file whose name is the
4439 The format for appending standard output and standard error is:
4440 <DL COMPACT><DT><DD>
4443 <B>&>></B><I>word</I>
4448 This is semantically equivalent to
4449 <DL COMPACT><DT><DD>
4452 <B>>></B><I>word</I> 2<B>>&</B>1
4455 <A NAME="lbBO"> </A>
4456 <H4>Here Documents</H4>
4460 This type of redirection instructs the shell to read input from the
4461 current source until a line containing only
4464 (with no trailing blanks)
4466 the lines read up to that point are then used as the standard
4467 input for a command.
4470 The format of here-documents is:
4471 <DL COMPACT><DT><DD>
4475 <B><<</B>[<B>-</B>]<I>word</I>
4476 <I>here-document</I>
4484 No parameter expansion, command substitution, arithmetic expansion,
4485 or pathname expansion is performed on
4488 If any characters in
4494 is the result of quote removal on
4497 and the lines in the here-document are not expanded.
4498 If <I>word</I> is unquoted,
4499 all lines of the here-document are subjected to parameter expansion,
4500 command substitution, and arithmetic expansion. In the latter
4501 case, the character sequence
4502 <B>\<newline></B>
4507 must be used to quote the characters
4517 If the redirection operator is
4520 then all leading tab characters are stripped from input lines and the
4525 here-documents within shell scripts to be indented in a
4527 <A NAME="lbBP"> </A>
4528 <H4>Here Strings</H4>
4530 A variant of here documents, the format is:
4531 <DL COMPACT><DT><DD>
4535 <B><<<</B><I>word</I>
4542 The <I>word</I> is expanded and supplied to the command on its standard
4544 <A NAME="lbBQ"> </A>
4545 <H4>Duplicating File Descriptors</H4>
4549 The redirection operator
4550 <DL COMPACT><DT><DD>
4553 [<I>n</I>]<B><&</B><I>word</I>
4558 is used to duplicate input file descriptors.
4562 expands to one or more digits, the file descriptor denoted by
4565 is made to be a copy of that file descriptor.
4569 do not specify a file descriptor open for input, a redirection error occurs.
4582 is not specified, the standard input (file descriptor 0) is used.
4586 <DL COMPACT><DT><DD>
4589 [<I>n</I>]<B>>&</B><I>word</I>
4594 is used similarly to duplicate output file descriptors. If
4597 is not specified, the standard output (file descriptor 1) is used.
4601 do not specify a file descriptor open for output, a redirection error occurs.
4602 As a special case, if <I>n</I> is omitted, and <I>word</I> does not
4603 expand to one or more digits, the standard output and standard
4604 error are redirected as described previously.
4605 <A NAME="lbBR"> </A>
4606 <H4>Moving File Descriptors</H4>
4610 The redirection operator
4611 <DL COMPACT><DT><DD>
4614 [<I>n</I>]<B><&</B><I>digit</I><B>-</B>
4619 moves the file descriptor <I>digit</I> to file descriptor
4622 or the standard input (file descriptor 0) if <I>n</I> is not specified.
4623 <I>digit</I> is closed after being duplicated to <I>n</I>.
4626 Similarly, the redirection operator
4627 <DL COMPACT><DT><DD>
4630 [<I>n</I>]<B>>&</B><I>digit</I><B>-</B>
4635 moves the file descriptor <I>digit</I> to file descriptor
4638 or the standard output (file descriptor 1) if <I>n</I> is not specified.
4639 <A NAME="lbBS"> </A>
4640 <H4>Opening File Descriptors for Reading and Writing</H4>
4644 The redirection operator
4645 <DL COMPACT><DT><DD>
4648 [<I>n</I>]<B><></B><I>word</I>
4653 causes the file whose name is the expansion of
4656 to be opened for both reading and writing on file descriptor
4659 or on file descriptor 0 if
4662 is not specified. If the file does not exist, it is created.
4663 <A NAME="lbBT"> </A>
4666 <I>Aliases</I> allow a string to be substituted for a word when it is used
4667 as the first word of a simple command.
4668 The shell maintains a list of aliases that may be set and unset with the
4674 builtin commands (see
4675 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
4679 The first word of each simple command, if unquoted,
4680 is checked to see if it has an
4681 alias. If so, that word is replaced by the text of the alias.
4682 The characters <B>/</B>, <B>$</B>, <B>`</B>, and <B>=</B> and
4683 any of the shell <I>metacharacters</I> or quoting characters
4684 listed above may not appear in an alias name.
4685 The replacement text may contain any valid shell input,
4686 including shell metacharacters.
4687 The first word of the replacement text is tested
4688 for aliases, but a word that is identical to an alias being expanded
4689 is not expanded a second time.
4690 This means that one may alias
4699 does not try to recursively expand the replacement text.
4700 If the last character of the alias value is a
4703 then the next command
4704 word following the alias is also checked for alias expansion.
4707 Aliases are created and listed with the
4710 command, and removed with the
4716 There is no mechanism for using arguments in the replacement text.
4717 If arguments are needed, a shell function should be used (see
4718 <FONT SIZE=-1><B>FUNCTIONS</B>
4724 Aliases are not expanded when the shell is not interactive, unless
4726 <B>expand_aliases</B>
4728 shell option is set using
4731 (see the description of
4735 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B></FONT>
4739 The rules concerning the definition and use of aliases are
4743 always reads at least one complete line
4744 of input before executing any
4745 of the commands on that line. Aliases are expanded when a
4746 command is read, not when it is executed. Therefore, an
4747 alias definition appearing on the same line as another
4748 command does not take effect until the next line of input is read.
4749 The commands following the alias definition
4750 on that line are not affected by the new alias.
4751 This behavior is also an issue when functions are executed.
4752 Aliases are expanded when a function definition is read,
4753 not when the function is executed, because a function definition
4754 is itself a compound command. As a consequence, aliases
4755 defined in a function are not available until after that
4756 function is executed. To be safe, always put
4757 alias definitions on a separate line, and do not use
4760 in compound commands.
4763 For almost every purpose, aliases are superseded by
4765 <A NAME="lbBU"> </A>
4768 A shell function, defined as described above under
4769 <FONT SIZE=-1><B>SHELL GRAMMAR</B>,
4772 stores a series of commands for later execution.
4773 When the name of a shell function is used as a simple command name,
4774 the list of commands associated with that function name is executed.
4775 Functions are executed in the context of the
4776 current shell; no new process is created to interpret
4777 them (contrast this with the execution of a shell script).
4778 When a function is executed, the arguments to the
4779 function become the positional parameters
4780 during its execution.
4781 The special parameter
4784 is updated to reflect the change. Special parameter 0
4786 The first element of the
4787 <FONT SIZE=-1><B>FUNCNAME</B>
4790 variable is set to the name of the function while the function
4794 All other aspects of the shell execution
4795 environment are identical between a function and its caller
4796 with these exceptions: the
4797 <FONT SIZE=-1><B>DEBUG</B>
4803 traps (see the description of the
4807 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
4810 below) are not inherited unless the function has been given the
4811 <B>trace</B> attribute (see the description of the
4812 <FONT SIZE=-1><B>declare</B>
4815 builtin below) or the
4816 <B>-o functrace</B> shell option has been enabled with
4817 the <B>set</B> builtin
4818 (in which case all functions inherit the <B>DEBUG</B> and <B>RETURN</B> traps),
4820 <FONT SIZE=-1><B>ERR</B>
4823 trap is not inherited unless the <B>-o errtrace</B> shell option has
4827 Variables local to the function may be declared with the
4830 builtin command. Ordinarily, variables and their values
4831 are shared between the function and its caller.
4834 If the builtin command
4837 is executed in a function, the function completes and
4838 execution resumes with the next command after the function
4840 Any command associated with the <B>RETURN</B> trap is executed
4841 before execution resumes.
4842 When a function completes, the values of the
4843 positional parameters and the special parameter
4846 are restored to the values they had prior to the function's
4850 Function names and definitions may be listed with the
4859 builtin commands. The
4868 will list the function names only
4869 (and optionally the source file and line number, if the <B>extdebug</B>
4870 shell option is enabled).
4871 Functions may be exported so that subshells
4872 automatically have them defined with the
4879 A function definition may be deleted using the <B>-f</B> option to
4884 Note that shell functions and variables with the same name may result
4885 in multiple identically-named entries in the environment passed to the
4887 Care should be taken in cases where this may cause a problem.
4890 Functions may be recursive. No limit is imposed on the number
4892 <A NAME="lbBV"> </A>
4893 <H3>ARITHMETIC EVALUATION</H3>
4895 The shell allows arithmetic expressions to be evaluated, under
4896 certain circumstances (see the <B>let</B> and <B>declare</B> builtin
4897 commands and <B>Arithmetic Expansion</B>).
4898 Evaluation is done in fixed-width integers with no check for overflow,
4899 though division by 0 is trapped and flagged as an error.
4900 The operators and their precedence, associativity, and values
4901 are the same as in the C language.
4902 The following list of operators is grouped into levels of
4903 equal-precedence operators.
4904 The levels are listed in order of decreasing precedence.
4909 <DT><B></B><I>id</I>++ <I>id</I>--
4912 variable post-increment and post-decrement
4913 <DT><B>++</B><I>id</I> --<I>id</I>
4916 variable pre-increment and pre-decrement
4920 unary minus and plus
4924 logical and bitwise negation
4932 multiplication, division, remainder
4936 addition, subtraction
4937 <DT><B><< >></B>
4940 left and right bitwise shifts
4941 <DT><B><= >= < ></B>
4948 equality and inequality
4956 bitwise exclusive OR
4961 <DT><B>&&</B>
4969 <DT><B></B><I>expr</I>?<I>expr</I>:<I>expr</I>
4972 conditional operator
4973 <DT><B>= *= /= %= += -= <<= >>= &= ^= |=</B>
4977 <DT><B></B><I>expr1</I> , <I>expr2</I>
4985 Shell variables are allowed as operands; parameter expansion is
4986 performed before the expression is evaluated.
4987 Within an expression, shell variables may also be referenced by name
4988 without using the parameter expansion syntax.
4989 A shell variable that is null or unset evaluates to 0 when referenced
4990 by name without using the parameter expansion syntax.
4991 The value of a variable is evaluated as an arithmetic expression
4992 when it is referenced, or when a variable which has been given the
4993 <I>integer</I> attribute using <B>declare -i</B> is assigned a value.
4994 A null value evaluates to 0.
4995 A shell variable need not have its integer attribute
4996 turned on to be used in an expression.
4999 Constants with a leading 0 are interpreted as octal numbers.
5000 A leading 0x or 0X denotes hexadecimal.
5001 Otherwise, numbers take the form [<I>base#</I>]n, where <I>base</I>
5002 is a decimal number between 2 and 64 representing the arithmetic
5003 base, and <I>n</I> is a number in that base.
5004 If <I>base#</I> is omitted, then base 10 is used.
5005 The digits greater than 9 are represented by the lowercase letters,
5006 the uppercase letters, @, and _, in that order.
5007 If <I>base</I> is less than or equal to 36, lowercase and uppercase
5008 letters may be used interchangeably to represent numbers between 10
5012 Operators are evaluated in order of precedence. Sub-expressions in
5013 parentheses are evaluated first and may override the precedence
5015 <A NAME="lbBW"> </A>
5016 <H3>CONDITIONAL EXPRESSIONS</H3>
5018 Conditional expressions are used by the <B>[[</B> compound command and
5019 the <B>test</B> and <B>[</B> builtin commands to test file attributes
5020 and perform string and arithmetic comparisons.
5021 Expressions are formed from the following unary or binary primaries.
5022 If any <I>file</I> argument to one of the primaries is of the form
5023 <I>/dev/fd/n</I>, then file descriptor <I>n</I> is checked.
5024 If the <I>file</I> argument to one of the primaries is one of
5025 <I>/dev/stdin</I>, <I>/dev/stdout</I>, or <I>/dev/stderr</I>, file
5026 descriptor 0, 1, or 2, respectively, is checked.
5029 Unless otherwise specified, primaries that operate on files follow symbolic
5030 links and operate on the target of the link, rather than the link itself.
5034 When used with <B>[[</B>, The <B><</B> and <B>></B> operators sort
5035 lexicographically using the current locale.
5039 <DT><B>-a </B><I>file</I>
5042 True if <I>file</I> exists.
5043 <DT><B>-b </B><I>file</I>
5046 True if <I>file</I> exists and is a block special file.
5047 <DT><B>-c </B><I>file</I>
5050 True if <I>file</I> exists and is a character special file.
5051 <DT><B>-d </B><I>file</I>
5054 True if <I>file</I> exists and is a directory.
5055 <DT><B>-e </B><I>file</I>
5058 True if <I>file</I> exists.
5059 <DT><B>-f </B><I>file</I>
5062 True if <I>file</I> exists and is a regular file.
5063 <DT><B>-g </B><I>file</I>
5066 True if <I>file</I> exists and is set-group-id.
5067 <DT><B>-h </B><I>file</I>
5070 True if <I>file</I> exists and is a symbolic link.
5071 <DT><B>-k </B><I>file</I>
5074 True if <I>file</I> exists and its ``sticky'' bit is set.
5075 <DT><B>-p </B><I>file</I>
5078 True if <I>file</I> exists and is a named pipe (FIFO).
5079 <DT><B>-r </B><I>file</I>
5082 True if <I>file</I> exists and is readable.
5083 <DT><B>-s </B><I>file</I>
5086 True if <I>file</I> exists and has a size greater than zero.
5087 <DT><B>-t </B><I>fd</I>
5090 True if file descriptor
5093 is open and refers to a terminal.
5094 <DT><B>-u </B><I>file</I>
5097 True if <I>file</I> exists and its set-user-id bit is set.
5098 <DT><B>-w </B><I>file</I>
5101 True if <I>file</I> exists and is writable.
5102 <DT><B>-x </B><I>file</I>
5105 True if <I>file</I> exists and is executable.
5106 <DT><B>-O </B><I>file</I>
5109 True if <I>file</I> exists and is owned by the effective user id.
5110 <DT><B>-G </B><I>file</I>
5113 True if <I>file</I> exists and is owned by the effective group id.
5114 <DT><B>-L </B><I>file</I>
5117 True if <I>file</I> exists and is a symbolic link.
5118 <DT><B>-S </B><I>file</I>
5121 True if <I>file</I> exists and is a socket.
5122 <DT><B>-N </B><I>file</I>
5125 True if <I>file</I> exists and has been modified since it was last read.
5126 <DT><I>file1</I> -<B>nt</B> <I>file2</I><DD>
5127 True if <I>file1</I> is newer (according to modification date) than <I>file2</I>,
5128 or if <I>file1</I> exists and file2 does not.
5129 <DT><I>file1</I> -<B>ot</B> <I>file2</I><DD>
5130 True if <I>file1</I> is older than <I>file2</I>, or if <I>file2</I> exists
5131 and <I>file1</I> does not.
5132 <DT><I>file1</I> <B>-ef</B> <I>file2</I><DD>
5133 True if <I>file1</I> and <I>file2</I> refer to the same device and
5135 <DT><B>-o </B><I>optname</I>
5138 True if shell option
5142 See the list of options under the description of the
5149 <DT><B>-z </B><I>string</I>
5152 True if the length of <I>string</I> is zero.
5153 <DT><I>string</I><DD>
5155 <DT><B>-n </B><I>string</I>
5159 True if the length of
5163 <DT><I>string1</I> <B>==</B> <I>string2</I><DD>
5165 <DT><I>string1</I> <B>=</B> <I>string2</I><DD>
5167 True if the strings are equal. <B>=</B> should be used
5168 with the <B>test</B> command for POSIX conformance.
5169 <DT><I>string1</I> <B>!=</B> <I>string2</I><DD>
5170 True if the strings are not equal.
5171 <DT><I>string1</I> <B><</B> <I>string2</I><DD>
5172 True if <I>string1</I> sorts before <I>string2</I> lexicographically.
5173 <DT><I>string1</I> <B>></B> <I>string2</I><DD>
5174 True if <I>string1</I> sorts after <I>string2</I> lexicographically.
5175 <DT><I>arg1</I> <B>OP</B> <I>arg2</I>
5178 <FONT SIZE=-1><B>OP</B>
5195 These arithmetic binary operators return true if <I>arg1</I>
5196 is equal to, not equal to, less than, less than or equal to,
5197 greater than, or greater than or equal to <I>arg2</I>, respectively.
5203 may be positive or negative integers.
5206 <A NAME="lbBX"> </A>
5207 <H3>SIMPLE COMMAND EXPANSION</H3>
5209 When a simple command is executed, the shell performs the following
5210 expansions, assignments, and redirections, from left to right.
5213 The words that the parser has marked as variable assignments (those
5214 preceding the command name) and redirections are saved for later
5217 The words that are not variable assignments or redirections are
5218 expanded. If any words remain after expansion, the first word
5219 is taken to be the name of the command and the remaining words are
5222 Redirections are performed as described above under
5223 <FONT SIZE=-1><B>REDIRECTION</B>.
5227 The text after the <B>=</B> in each variable assignment undergoes tilde
5228 expansion, parameter expansion, command substitution, arithmetic expansion,
5229 and quote removal before being assigned to the variable.
5233 If no command name results, the variable assignments affect the current
5234 shell environment. Otherwise, the variables are added to the environment
5235 of the executed command and do not affect the current shell environment.
5236 If any of the assignments attempts to assign a value to a readonly variable,
5237 an error occurs, and the command exits with a non-zero status.
5240 If no command name results, redirections are performed, but do not
5241 affect the current shell environment. A redirection error causes the
5242 command to exit with a non-zero status.
5245 If there is a command name left after expansion, execution proceeds as
5246 described below. Otherwise, the command exits. If one of the expansions
5247 contained a command substitution, the exit status of the command is
5248 the exit status of the last command substitution performed. If there
5249 were no command substitutions, the command exits with a status of zero.
5250 <A NAME="lbBY"> </A>
5251 <H3>COMMAND EXECUTION</H3>
5253 After a command has been split into words, if it results in a
5254 simple command and an optional list of arguments, the following
5258 If the command name contains no slashes, the shell attempts to
5259 locate it. If there exists a shell function by that name, that
5260 function is invoked as described above in
5261 <FONT SIZE=-1><B>FUNCTIONS</B>.
5264 If the name does not match a function, the shell searches for
5265 it in the list of shell builtins. If a match is found, that
5269 If the name is neither a shell function nor a builtin,
5270 and contains no slashes,
5273 searches each element of the
5274 <FONT SIZE=-1><B>PATH</B>
5277 for a directory containing an executable file by that name.
5280 uses a hash table to remember the full pathnames of executable
5285 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
5289 A full search of the directories in
5290 <FONT SIZE=-1><B>PATH</B>
5293 is performed only if the command is not found in the hash table.
5294 If the search is unsuccessful, the shell searches for a defined shell
5295 function named <B>command_not_found_handle</B>.
5296 If that function exists, it is invoked with the original command and
5297 the original command's arguments as its arguments, and the function's
5298 exit status becomes the exit status of the shell.
5299 If that function is not defined, the shell prints an error
5300 message and returns an exit status of 127.
5303 If the search is successful, or if the command name contains
5304 one or more slashes, the shell executes the named program in a
5305 separate execution environment.
5306 Argument 0 is set to the name given, and the remaining arguments
5307 to the command are set to the arguments given, if any.
5310 If this execution fails because the file is not in executable
5311 format, and the file is not a directory, it is assumed to be
5312 a <I>shell script</I>, a file
5313 containing shell commands. A subshell is spawned to execute
5314 it. This subshell reinitializes itself, so
5315 that the effect is as if a new shell had been invoked
5316 to handle the script, with the exception that the locations of
5317 commands remembered by the parent (see
5321 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>)</FONT>
5322 are retained by the child.
5325 If the program is a file beginning with
5328 the remainder of the first line specifies an interpreter
5329 for the program. The shell executes the
5330 specified interpreter on operating systems that do not
5331 handle this executable format themselves. The arguments to the
5332 interpreter consist of a single optional argument following the
5333 interpreter name on the first line of the program, followed
5334 by the name of the program, followed by the command
5336 <A NAME="lbBZ"> </A>
5337 <H3>COMMAND EXECUTION ENVIRONMENT</H3>
5339 The shell has an <I>execution environment</I>, which consists of the
5344 open files inherited by the shell at invocation, as modified by
5345 redirections supplied to the <B>exec</B> builtin
5347 the current working directory as set by <B>cd</B>, <B>pushd</B>, or
5348 <B>popd</B>, or inherited by the shell at invocation
5350 the file creation mode mask as set by <B>umask</B> or inherited from
5353 current traps set by <B>trap</B>
5355 shell parameters that are set by variable assignment or with <B>set</B>
5356 or inherited from the shell's parent in the environment
5358 shell functions defined during execution or inherited from the shell's
5359 parent in the environment
5361 options enabled at invocation (either by default or with command-line
5362 arguments) or by <B>set</B>
5364 options enabled by <B>shopt</B>
5366 shell aliases defined with <B>alias</B>
5368 various process IDs, including those of background jobs, the value
5369 of <B>$$</B>, and the value of
5370 <FONT SIZE=-1><B>PPID</B>
5376 When a simple command other than a builtin or shell function
5377 is to be executed, it
5378 is invoked in a separate execution environment that consists of
5379 the following. Unless otherwise noted, the values are inherited
5384 the shell's open files, plus any modifications and additions specified
5385 by redirections to the command
5387 the current working directory
5389 the file creation mode mask
5391 shell variables and functions marked for export, along with variables
5392 exported for the command, passed in the environment
5394 traps caught by the shell are reset to the values inherited from the
5395 shell's parent, and traps ignored by the shell are ignored
5399 A command invoked in this separate environment cannot affect the
5400 shell's execution environment.
5403 Command substitution, commands grouped with parentheses,
5404 and asynchronous commands are invoked in a
5405 subshell environment that is a duplicate of the shell environment,
5406 except that traps caught by the shell are reset to the values
5407 that the shell inherited from its parent at invocation. Builtin
5408 commands that are invoked as part of a pipeline are also executed in a
5409 subshell environment. Changes made to the subshell environment
5410 cannot affect the shell's execution environment.
5413 Subshells spawned to execute command substitutions inherit the value of
5414 the <B>-e</B> option from the parent shell. When not in posix mode,
5415 Bash clears the <B>-e</B> option in such subshells.
5418 If a command is followed by a <B>&</B> and job control is not active, the
5419 default standard input for the command is the empty file <I>/dev/null</I>.
5420 Otherwise, the invoked command inherits the file descriptors of the calling
5421 shell as modified by redirections.
5422 <A NAME="lbCA"> </A>
5423 <H3>ENVIRONMENT</H3>
5425 When a program is invoked it is given an array of strings
5430 <I>name</I>-<I>value</I> pairs, of the form
5435 The shell provides several ways to manipulate the environment.
5436 On invocation, the shell scans its own environment and
5437 creates a parameter for each name found, automatically marking
5441 to child processes. Executed commands inherit the environment.
5448 commands allow parameters and functions to be added to and
5449 deleted from the environment. If the value of a parameter
5450 in the environment is modified, the new value becomes part
5451 of the environment, replacing the old. The environment
5452 inherited by any executed command consists of the shell's
5453 initial environment, whose values may be modified in the shell,
5454 less any pairs removed by the
5457 command, plus any additions via the
5466 The environment for any
5467 <I>simple command</I>
5469 or function may be augmented temporarily by prefixing it with
5470 parameter assignments, as described above in
5471 <FONT SIZE=-1><B>PARAMETERS</B>.
5474 These assignment statements affect only the environment seen
5481 option is set (see the
5484 builtin command below), then
5487 parameter assignments are placed in the environment for a command,
5488 not just those that precede the command name.
5494 invokes an external command, the variable
5497 is set to the full file name of the command and passed to that
5498 command in its environment.
5499 <A NAME="lbCB"> </A>
5500 <H3>EXIT STATUS</H3>
5504 The exit status of an executed command is the value returned by the
5505 <I>waitpid</I> system call or equivalent function. Exit statuses
5506 fall between 0 and 255, though, as explained below, the shell may
5507 use values above 125 specially. Exit statuses from shell builtins and
5508 compound commands are also limited to this range. Under certain
5509 circumstances, the shell will use special values to indicate specific
5513 For the shell's purposes, a command which exits with a
5514 zero exit status has succeeded. An exit status of zero
5515 indicates success. A non-zero exit status indicates failure.
5516 When a command terminates on a fatal signal <I>N</I>, <B>bash</B> uses
5517 the value of 128+<I>N</I> as the exit status.
5520 If a command is not found, the child process created to
5521 execute it returns a status of 127. If a command is found
5522 but is not executable, the return status is 126.
5525 If a command fails because of an error during expansion or redirection,
5526 the exit status is greater than zero.
5529 Shell builtin commands return a status of 0 (<I>true</I>) if
5530 successful, and non-zero (<I>false</I>) if an error occurs
5532 All builtins return an exit status of 2 to indicate incorrect usage.
5535 <B>Bash</B> itself returns the exit status of the last command
5536 executed, unless a syntax error occurs, in which case it exits
5537 with a non-zero value. See also the <B>exit</B> builtin
5539 <A NAME="lbCC"> </A>
5542 When <B>bash</B> is interactive, in the absence of any traps, it ignores
5543 <FONT SIZE=-1><B>SIGTERM</B>
5546 (so that <B>kill 0</B> does not kill an interactive shell),
5548 <FONT SIZE=-1><B>SIGINT</B>
5551 is caught and handled (so that the <B>wait</B> builtin is interruptible).
5552 In all cases, <B>bash</B> ignores
5553 <FONT SIZE=-1><B>SIGQUIT</B>.
5556 If job control is in effect,
5560 <FONT SIZE=-1><B>SIGTTIN</B>,
5563 <FONT SIZE=-1><B>SIGTTOU</B>,
5567 <FONT SIZE=-1><B>SIGTSTP</B>.
5572 Non-builtin commands run by <B>bash</B> have signal handlers
5573 set to the values inherited by the shell from its parent.
5574 When job control is not in effect, asynchronous commands
5576 <FONT SIZE=-1><B>SIGINT</B>
5580 <FONT SIZE=-1><B>SIGQUIT</B>
5583 in addition to these inherited handlers.
5584 Commands run as a result of command substitution ignore the
5585 keyboard-generated job control signals
5586 <FONT SIZE=-1><B>SIGTTIN</B>,
5589 <FONT SIZE=-1><B>SIGTTOU</B>,
5593 <FONT SIZE=-1><B>SIGTSTP</B>.
5598 The shell exits by default upon receipt of a
5599 <FONT SIZE=-1><B>SIGHUP</B>.
5602 Before exiting, an interactive shell resends the
5603 <FONT SIZE=-1><B>SIGHUP</B>
5606 to all jobs, running or stopped.
5607 Stopped jobs are sent
5608 <FONT SIZE=-1><B>SIGCONT</B>
5611 to ensure that they receive the
5612 <FONT SIZE=-1><B>SIGHUP</B>.
5615 To prevent the shell from
5616 sending the signal to a particular job, it should be removed from the
5621 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
5626 <FONT SIZE=-1><B>SIGHUP</B>
5637 shell option has been set with
5643 <FONT SIZE=-1><B>SIGHUP</B>
5646 to all jobs when an interactive login shell exits.
5649 If <B>bash</B> is waiting for a command to complete and receives a signal
5650 for which a trap has been set, the trap will not be executed until
5651 the command completes.
5652 When <B>bash</B> is waiting for an asynchronous command via the <B>wait</B>
5653 builtin, the reception of a signal for which a trap has been set will
5654 cause the <B>wait</B> builtin to return immediately with an exit status
5655 greater than 128, immediately after which the trap is executed.
5656 <A NAME="lbCD"> </A>
5657 <H3>JOB CONTROL</H3>
5661 refers to the ability to selectively stop (<I>suspend</I>)
5662 the execution of processes and continue (<I>resume</I>)
5663 their execution at a later point. A user typically employs
5664 this facility via an interactive interface supplied jointly
5665 by the operating system kernel's terminal driver and
5670 The shell associates a
5673 with each pipeline. It keeps a table of currently executing
5674 jobs, which may be listed with the
5680 starts a job asynchronously (in the
5683 it prints a line that looks like:
5684 <DL COMPACT><DT><DD>
5692 indicating that this job is job number 1 and that the process ID
5693 of the last process in the pipeline associated with this job is 25647.
5694 All of the processes in a single pipeline are members of the same job.
5700 abstraction as the basis for job control.
5703 To facilitate the implementation of the user interface to job
5704 control, the operating system maintains the notion of a <I>current terminal
5705 process group ID</I>. Members of this process group (processes whose
5706 process group ID is equal to the current terminal process group ID)
5707 receive keyboard-generated signals such as
5708 <FONT SIZE=-1><B>SIGINT</B>.
5711 These processes are said to be in the
5716 processes are those whose process group ID differs from the terminal's;
5717 such processes are immune to keyboard-generated signals.
5718 Only foreground processes are allowed to read from or, if the
5719 user so specifies with <TT>stty tostop</TT>, write to the
5721 Background processes which attempt to read from (write to when
5722 <TT>stty tostop</TT> is in effect) the
5724 <FONT SIZE=-1><B>SIGTTIN (SIGTTOU)</B>
5727 signal by the kernel's terminal driver,
5728 which, unless caught, suspends the process.
5731 If the operating system on which
5738 contains facilities to use it.
5742 character (typically
5745 Control-Z) while a process is running
5746 causes that process to be stopped and returns control to
5750 <I>delayed suspend</I>
5752 character (typically
5755 Control-Y) causes the process to be stopped when it
5756 attempts to read input from the terminal, and control to
5760 The user may then manipulate the state of this job, using the
5763 command to continue it in the background, the
5766 command to continue it in the foreground, or
5770 command to kill it. A <B>^Z</B> takes effect immediately,
5771 and has the additional side effect of causing pending output
5772 and typeahead to be discarded.
5775 There are a number of ways to refer to a job in the shell.
5779 introduces a job specification (<I>jobspec</I>). Job number
5782 may be referred to as
5785 A job may also be referred to using a prefix of the name used to
5786 start it, or using a substring that appears in its command line.
5793 job. If a prefix matches more than one job,
5796 reports an error. Using
5799 on the other hand, refers to any job containing the string
5802 in its command line. If the substring matches more than one job,
5805 reports an error. The symbols
5811 refer to the shell's notion of the
5814 which is the last job stopped while it was in
5815 the foreground or started in the background.
5819 may be referenced using
5822 If there is only a single job, <B>%+</B> and <B>%-</B> can both be used
5823 to refer to that job.
5824 In output pertaining to jobs (e.g., the output of the
5827 command), the current job is always flagged with a
5830 and the previous job with a
5833 A single % (with no accompanying job specification) also refers to the
5837 Simply naming a job can be used to bring it into the
5843 bringing job 1 from the background into the foreground.
5847 resumes job 1 in the background, equivalent to
5851 The shell learns immediately whenever a job changes state.
5855 waits until it is about to print a prompt before reporting
5856 changes in a job's status so as to not interrupt
5857 any other output. If the
5867 reports such changes immediately.
5869 <FONT SIZE=-1><B>SIGCHLD</B>
5872 is executed for each child that exits.
5875 If an attempt to exit
5878 is made while jobs are stopped (or, if the <B>checkjobs</B> shell option has
5879 been enabled using the <B>shopt</B> builtin, running), the shell prints a
5880 warning message, and, if the <B>checkjobs</B> option is enabled, lists the
5881 jobs and their statuses.
5885 command may then be used to inspect their status.
5886 If a second attempt to exit is made without an intervening command,
5887 the shell does not print another warning, and any stopped
5888 jobs are terminated.
5889 <A NAME="lbCE"> </A>
5892 When executing interactively,
5895 displays the primary prompt
5896 <FONT SIZE=-1><B>PS1</B>
5899 when it is ready to read a command, and the secondary prompt
5900 <FONT SIZE=-1><B>PS2</B>
5903 when it needs more input to complete a command.
5906 allows these prompt strings to be customized by inserting a number of
5907 backslash-escaped special characters that are decoded as follows:
5908 <DL COMPACT><DT><DD>
5914 an ASCII bell character (07)
5918 the date in "Weekday Month Date" format (e.g., "Tue May 26")
5919 <DT><B>\D{</B><I>format</I>}
5922 the <I>format</I> is passed to <I>strftime</I>(3) and the result is inserted
5923 into the prompt string; an empty <I>format</I> results in a locale-specific
5924 time representation. The braces are required
5928 an ASCII escape character (033)
5932 the hostname up to the first `.'
5940 the number of jobs currently managed by the shell
5944 the basename of the shell's terminal device name
5956 the name of the shell, the basename of
5959 (the portion following the final slash)
5963 the current time in 24-hour HH:MM:SS format
5967 the current time in 12-hour HH:MM:SS format
5971 the current time in 12-hour am/pm format
5975 the current time in 24-hour HH:MM format
5979 the username of the current user
5983 the version of <B>bash</B> (e.g., 2.00)
5987 the release of <B>bash</B>, version + patch level (e.g., 2.00.0)
5991 the current working directory, with
5992 <FONT SIZE=-1><B>$HOME</B>
5995 abbreviated with a tilde
5996 (uses the value of the
5997 <FONT SIZE=-1><B>PROMPT_DIRTRIM</B>
6004 the basename of the current working directory, with
6005 <FONT SIZE=-1><B>$HOME</B>
6008 abbreviated with a tilde
6012 the history number of this command
6016 the command number of this command
6020 if the effective UID is 0, a
6026 <DT><B>\</B><I>nnn</I>
6029 the character corresponding to the octal number <I>nnn</I>
6037 begin a sequence of non-printing characters, which could be used to
6038 embed a terminal control sequence into the prompt
6042 end a sequence of non-printing characters
6048 The command number and the history number are usually different:
6049 the history number of a command is its position in the history
6050 list, which may include commands restored from the history file
6052 <FONT SIZE=-1><B>HISTORY</B>
6055 below), while the command number is the position in the sequence
6056 of commands executed during the current shell session.
6057 After the string is decoded, it is expanded via
6058 parameter expansion, command substitution, arithmetic
6059 expansion, and quote removal, subject to the value of the
6062 shell option (see the description of the
6066 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
6070 <A NAME="lbCF"> </A>
6073 This is the library that handles reading input when using an interactive
6077 option is given at shell invocation.
6078 Line editing is also used when using the <B>-e</B> option to the
6079 <B>read</B> builtin.
6080 By default, the line editing commands are similar to those of emacs.
6081 A vi-style line editing interface is also available.
6082 Line editing can be enabled at any time using the
6092 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
6096 To turn off line editing after the shell is running, use the
6106 <A NAME="lbCG"> </A>
6107 <H4>Readline Notation</H4>
6111 In this section, the emacs-style notation is used to denote
6112 keystrokes. Control keys are denoted by C-<I>key</I>, e.g., C-n
6113 means Control-N. Similarly,
6116 keys are denoted by M-<I>key</I>, so M-x means Meta-X. (On keyboards
6120 key, M-<I>x</I> means ESC <I>x</I>, i.e., press the Escape key
6124 key. This makes ESC the <I>meta prefix</I>.
6125 The combination M-C-<I>x</I> means ESC-Control-<I>x</I>,
6126 or press the Escape key
6127 then hold the Control key while pressing the
6133 Readline commands may be given numeric
6136 which normally act as a repeat count.
6137 Sometimes, however, it is the sign of the argument that is significant.
6138 Passing a negative argument to a command that acts in the forward
6139 direction (e.g., <B>kill-line</B>) causes that command to act in a
6141 Commands whose behavior with arguments deviates from this are noted
6145 When a command is described as <I>killing</I> text, the text
6146 deleted is saved for possible future retrieval
6147 (<I>yanking</I>). The killed text is saved in a
6148 <I>kill ring</I>. Consecutive kills cause the text to be
6149 accumulated into one unit, which can be yanked all at once.
6150 Commands which do not kill text separate the chunks of text
6152 <A NAME="lbCH"> </A>
6153 <H4>Readline Initialization</H4>
6157 Readline is customized by putting commands in an initialization
6158 file (the <I>inputrc</I> file).
6159 The name of this file is taken from the value of the
6160 <FONT SIZE=-1><B>INPUTRC</B>
6163 variable. If that variable is unset, the default is
6164 <A HREF="file:~/.inputrc"><I>~/.inputrc</I></A>.
6166 When a program which uses the readline library starts up, the
6167 initialization file is read, and the key bindings and variables
6169 There are only a few basic constructs allowed in the
6170 readline initialization file.
6171 Blank lines are ignored.
6172 Lines beginning with a <B>#</B> are comments.
6173 Lines beginning with a <B>$</B> indicate conditional constructs.
6174 Other lines denote key bindings and variable settings.
6177 The default key-bindings may be changed with an
6181 Other programs that use this library may add their own commands
6185 For example, placing
6186 <DL COMPACT><DT><DD>
6189 M-Control-u: universal-argument
6193 <DL COMPACT><DT><DD>
6194 C-Meta-u: universal-argument
6200 would make M-C-u execute the readline command
6201 <I>universal-argument</I>.
6205 The following symbolic character names are recognized:
6229 In addition to command names, readline allows keys to be bound
6230 to a string that is inserted when the key is pressed (a <I>macro</I>).
6231 <A NAME="lbCI"> </A>
6232 <H4>Readline Key Bindings</H4>
6236 The syntax for controlling key bindings in the
6239 file is simple. All that is required is the name of the
6240 command or the text of a macro and a key sequence to which
6241 it should be bound. The name may be specified in one of two ways:
6242 as a symbolic key name, possibly with <I>Meta-</I> or <I>Control-</I>
6243 prefixes, or as a key sequence.
6246 When using the form <B>keyname</B>:<I>function-name</I> or <I>macro</I>,
6249 is the name of a key spelled out in English. For example:
6251 <DL COMPACT><DT><DD>
6252 Control-u: universal-argument
6255 Meta-Rubout: backward-kill-word
6258 Control-o: "> output"
6263 In the above example,
6266 is bound to the function
6267 <B>universal-argument</B>,
6271 is bound to the function
6272 <B>backward-kill-word</B>,
6277 is bound to run the macro
6278 expressed on the right hand side (that is, to insert the text
6279 <TT>> output</TT>
6284 In the second form, <B>"keyseq"</B>:<I>function-name</I> or <I>macro</I>,
6290 above in that strings denoting
6291 an entire key sequence may be specified by placing the sequence
6292 within double quotes. Some GNU Emacs style key escapes can be
6293 used, as in the following example, but the symbolic character names
6296 <DL COMPACT><DT><DD>
6297 "\C-u": universal-argument
6300 "\C-x\C-r": re-read-init-file
6303 "\e[11~": "Function Key 1"
6311 is again bound to the function
6312 <B>universal-argument</B>.
6316 is bound to the function
6317 <B>re-read-init-file</B>,
6322 is bound to insert the text
6323 <TT>Function Key 1</TT>.
6327 The full set of GNU Emacs style escape sequences is
6328 <DL COMPACT><DT><DD>
6360 In addition to the GNU Emacs style escape sequences, a second
6361 set of backslash escapes is available:
6362 <DL COMPACT><DT><DD>
6397 <DT><B>\</B><I>nnn</I>
6400 the eight-bit character whose value is the octal value <I>nnn</I>
6401 (one to three digits)
6402 <DT><B>\x</B><I>HH</I>
6405 the eight-bit character whose value is the hexadecimal value <I>HH</I>
6406 (one or two hex digits)
6412 When entering the text of a macro, single or double quotes must
6413 be used to indicate a macro definition.
6414 Unquoted text is assumed to be a function name.
6415 In the macro body, the backslash escapes described above are expanded.
6416 Backslash will quote any other character in the macro text,
6417 including " and aq.
6422 allows the current readline key bindings to be displayed or modified
6426 builtin command. The editing mode may be switched during interactive
6433 builtin command (see
6434 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
6438 <A NAME="lbCJ"> </A>
6439 <H4>Readline Variables</H4>
6443 Readline has variables that can be used to further customize its
6444 behavior. A variable may be set in the
6447 file with a statement of the form
6448 <DL COMPACT><DT><DD>
6451 <B>set</B> <I>variable-name</I> <I>value</I>
6456 Except where noted, readline variables can take the values
6462 (without regard to case).
6463 Unrecognized variable names are ignored.
6464 When a variable value is read, empty or null values, "on" (case-insensitive),
6465 and "1" are equivalent to <B>On</B>. All other values are equivalent to
6467 The variables and their default values are:
6472 <DT><B>bell-style (audible)</B>
6475 Controls what happens when readline wants to ring the terminal bell.
6476 If set to <B>none</B>, readline never rings the bell. If set to
6477 <B>visible</B>, readline uses a visible bell if one is available.
6478 If set to <B>audible</B>, readline attempts to ring the terminal's bell.
6479 <DT><B>bind-tty-special-chars (On)</B>
6482 If set to <B>On</B>, readline attempts to bind the control characters
6483 treated specially by the kernel's terminal driver to their readline
6485 <DT><B>comment-begin (``#'')</B>
6488 The string that is inserted when the readline
6489 <B>insert-comment</B>
6491 command is executed.
6492 This command is bound to
6495 in emacs mode and to
6499 <DT><B>completion-ignore-case (Off)</B>
6502 If set to <B>On</B>, readline performs filename matching and completion
6503 in a case-insensitive fashion.
6504 <DT><B>completion-prefix-display-length (0)</B>
6507 The length in characters of the common prefix of a list of possible
6508 completions that is displayed without modification. When set to a
6509 value greater than zero, common prefixes longer than this value are
6510 replaced with an ellipsis when displaying possible completions.
6511 <DT><B>completion-query-items (100)</B>
6514 This determines when the user is queried about viewing
6515 the number of possible completions
6516 generated by the <B>possible-completions</B> command.
6517 It may be set to any integer value greater than or equal to
6518 zero. If the number of possible completions is greater than
6519 or equal to the value of this variable, the user is asked whether
6520 or not he wishes to view them; otherwise they are simply listed
6522 <DT><B>convert-meta (On)</B>
6525 If set to <B>On</B>, readline will convert characters with the
6526 eighth bit set to an ASCII key sequence
6527 by stripping the eighth bit and prefixing an
6528 escape character (in effect, using escape as the <I>meta prefix</I>).
6529 <DT><B>disable-completion (Off)</B>
6532 If set to <B>On</B>, readline will inhibit word completion. Completion
6533 characters will be inserted into the line as if they had been
6534 mapped to <B>self-insert</B>.
6535 <DT><B>editing-mode (emacs)</B>
6538 Controls whether readline begins with a set of key bindings similar
6539 to <I>emacs</I> or <I>vi</I>.
6542 can be set to either
6548 <DT><B>echo-control-characters (On)</B>
6551 When set to <B>On</B>, on operating systems that indicate they support it,
6552 readline echoes a character corresponding to a signal generated from the
6554 <DT><B>enable-keypad (Off)</B>
6557 When set to <B>On</B>, readline will try to enable the application
6558 keypad when it is called. Some systems need this to enable the
6560 <DT><B>enable-meta-key (On)</B>
6563 When set to <B>On</B>, readline will try to enable any meta modifier
6564 key the terminal claims to support when it is called. On many terminals,
6565 the meta key is used to send eight-bit characters.
6566 <DT><B>expand-tilde (Off)</B>
6569 If set to <B>on</B>, tilde expansion is performed when readline
6570 attempts word completion.
6571 <DT><B>history-preserve-point (Off)</B>
6574 If set to <B>on</B>, the history code attempts to place point at the
6575 same location on each history line retrieved with <B>previous-history</B>
6576 or <B>next-history</B>.
6577 <DT><B>history-size (0)</B>
6580 Set the maximum number of history entries saved in the history list. If
6581 set to zero, the number of entries in the history list is not limited.
6582 <DT><B>horizontal-scroll-mode (Off)</B>
6585 When set to <B>On</B>, makes readline use a single line for display,
6586 scrolling the input horizontally on a single screen line when it
6587 becomes longer than the screen width rather than wrapping to a new line.
6588 <DT><B>input-meta (Off)</B>
6591 If set to <B>On</B>, readline will enable eight-bit input (that is,
6592 it will not strip the high bit from the characters it reads),
6593 regardless of what the terminal claims it can support. The name
6596 is a synonym for this variable.
6597 <DT><B>isearch-terminators (``C-[C-J'')</B>
6600 The string of characters that should terminate an incremental
6601 search without subsequently executing the character as a command.
6602 If this variable has not been given a value, the characters
6603 <I>ESC</I> and <I>C-J</I> will terminate an incremental search.
6604 <DT><B>keymap (emacs)</B>
6607 Set the current readline keymap. The set of valid keymap names is
6608 <I>emacs, emacs-standard, emacs-meta, emacs-ctlx, vi,
6612 <I>vi</I> is equivalent to <I>vi-command</I>; <I>emacs</I> is
6613 equivalent to <I>emacs-standard</I>. The default value is
6619 also affects the default keymap.
6620 <DT><B>mark-directories (On)</B>
6623 If set to <B>On</B>, completed directory names have a slash
6625 <DT><B>mark-modified-lines (Off)</B>
6628 If set to <B>On</B>, history lines that have been modified are displayed
6629 with a preceding asterisk (<B>*</B>).
6630 <DT><B>mark-symlinked-directories (Off)</B>
6633 If set to <B>On</B>, completed names which are symbolic links to directories
6634 have a slash appended (subject to the value of
6635 <B>mark-directories</B>).
6636 <DT><B>match-hidden-files (On)</B>
6639 This variable, when set to <B>On</B>, causes readline to match files whose
6640 names begin with a `.' (hidden files) when performing filename
6641 completion, unless the leading `.' is
6642 supplied by the user in the filename to be completed.
6643 <DT><B>output-meta (Off)</B>
6646 If set to <B>On</B>, readline will display characters with the
6647 eighth bit set directly rather than as a meta-prefixed escape
6649 <DT><B>page-completions (On)</B>
6652 If set to <B>On</B>, readline uses an internal <I>more</I>-like pager
6653 to display a screenful of possible completions at a time.
6654 <DT><B>print-completions-horizontally (Off)</B>
6657 If set to <B>On</B>, readline will display completions with matches
6658 sorted horizontally in alphabetical order, rather than down the screen.
6659 <DT><B>revert-all-at-newline (Off)</B>
6662 If set to <B>on</B>, readline will undo all changes to history lines
6663 before returning when <B>accept-line</B> is executed. By default,
6664 history lines may be modified and retain individual undo lists across
6665 calls to <B>readline</B>.
6666 <DT><B>show-all-if-ambiguous (Off)</B>
6669 This alters the default behavior of the completion functions. If
6673 words which have more than one possible completion cause the
6674 matches to be listed immediately instead of ringing the bell.
6675 <DT><B>show-all-if-unmodified (Off)</B>
6678 This alters the default behavior of the completion functions in
6679 a fashion similar to <B>show-all-if-ambiguous</B>.
6683 words which have more than one possible completion without any
6684 possible partial completion (the possible completions don't share
6685 a common prefix) cause the matches to be listed immediately instead
6686 of ringing the bell.
6687 <DT><B>skip-completed-text (Off)</B>
6690 If set to <B>On</B>, this alters the default completion behavior when
6691 inserting a single match into the line. It's only active when
6692 performing completion in the middle of a word. If enabled, readline
6693 does not insert characters from the completion that match characters
6694 after point in the word being completed, so portions of the word
6695 following the cursor are not duplicated.
6696 <DT><B>visible-stats (Off)</B>
6699 If set to <B>On</B>, a character denoting a file's type as reported
6700 by <I>stat</I>(2) is appended to the filename when listing possible
6704 <A NAME="lbCK"> </A>
6705 <H4>Readline Conditional Constructs</H4>
6709 Readline implements a facility similar in spirit to the conditional
6710 compilation features of the C preprocessor which allows key
6711 bindings and variable settings to be performed as the result
6712 of tests. There are four parser directives used.
6718 construct allows bindings to be made based on the
6719 editing mode, the terminal being used, or the application using
6720 readline. The text of the test extends to the end of the line;
6721 no characters are required to isolate it.
6722 <DL COMPACT><DT><DD>
6725 The <B>mode=</B> form of the <B>$if</B> directive is used to test
6726 whether readline is in emacs or vi mode.
6727 This may be used in conjunction
6728 with the <B>set keymap</B> command, for instance, to set bindings in
6729 the <I>emacs-standard</I> and <I>emacs-ctlx</I> keymaps only if
6730 readline is starting out in emacs mode.
6732 The <B>term=</B> form may be used to include terminal-specific
6733 key bindings, perhaps to bind the key sequences output by the
6734 terminal's function keys. The word on the right side of the
6737 is tested against the both full name of the terminal and the portion
6738 of the terminal name before the first <B>-</B>. This allows
6748 <DT><B>application</B><DD>
6749 The <B>application</B> construct is used to include
6750 application-specific settings. Each program using the readline
6751 library sets the <I>application name</I>, and an initialization
6752 file can test for a particular value.
6753 This could be used to bind key sequences to functions useful for
6754 a specific program. For instance, the following command adds a
6755 key sequence that quotes the current or previous word in Bash:
6757 <DL COMPACT><DT><DD>
6760 # Quote the current or previous word
6761 "\C-xq": "\eb\"\ef\""
6769 <DT><B>$endif</B><DD>
6770 This command, as seen in the previous example, terminates an
6772 <DT><B>$else</B><DD>
6773 Commands in this branch of the <B>$if</B> directive are executed if
6775 <DT><B>$include</B><DD>
6776 This directive takes a single filename as an argument and reads commands
6777 and bindings from that file. For example, the following directive
6778 would read <A HREF="file:/etc/inputrc"><I>/etc/inputrc</I></A>:
6780 <DL COMPACT><DT><DD>
6782 <B>$include</B> <A HREF="file:/etc/inputrc"><I>/etc/inputrc</I></A>
6788 <A NAME="lbCL"> </A>
6793 Readline provides commands for searching through the command history
6795 <FONT SIZE=-1><B>HISTORY</B>
6798 below) for lines containing a specified string.
6799 There are two search modes:
6803 <I>non-incremental</I>.
6807 Incremental searches begin before the user has finished typing the
6809 As each character of the search string is typed, readline displays
6810 the next entry from the history matching the string typed so far.
6811 An incremental search requires only as many characters as needed to
6812 find the desired history entry.
6813 The characters present in the value of the <B>isearch-terminators</B>
6814 variable are used to terminate an incremental search.
6815 If that variable has not been assigned a value the Escape and
6816 Control-J characters will terminate an incremental search.
6817 Control-G will abort an incremental search and restore the original
6819 When the search is terminated, the history entry containing the
6820 search string becomes the current line.
6823 To find other matching entries in the history list, type Control-S or
6824 Control-R as appropriate.
6825 This will search backward or forward in the history for the next
6826 entry matching the search string typed so far.
6827 Any other key sequence bound to a readline command will terminate
6828 the search and execute that command.
6829 For instance, a <I>newline</I> will terminate the search and accept
6830 the line, thereby executing the command from the history list.
6833 Readline remembers the last incremental search string. If two
6834 Control-Rs are typed without any intervening characters defining a
6835 new search string, any remembered search string is used.
6838 Non-incremental searches read the entire search string before starting
6839 to search for matching history lines. The search string may be
6840 typed by the user or be part of the contents of the current line.
6841 <A NAME="lbCM"> </A>
6842 <H4>Readline Command Names</H4>
6846 The following is a list of the names of the commands and the default
6847 key sequences to which they are bound.
6848 Command names without an accompanying key sequence are unbound by default.
6849 In the following descriptions, <I>point</I> refers to the current cursor
6850 position, and <I>mark</I> refers to a cursor position saved by the
6851 <B>set-mark</B> command.
6852 The text between the point and mark is referred to as the <I>region</I>.
6853 <A NAME="lbCN"> </A>
6854 <H4>Commands for Moving</H4>
6860 <DT><B>beginning-of-line (C-a)</B>
6863 Move to the start of the current line.
6864 <DT><B>end-of-line (C-e)</B>
6867 Move to the end of the line.
6868 <DT><B>forward-char (C-f)</B>
6871 Move forward a character.
6872 <DT><B>backward-char (C-b)</B>
6875 Move back a character.
6876 <DT><B>forward-word (M-f)</B>
6879 Move forward to the end of the next word. Words are composed of
6880 alphanumeric characters (letters and digits).
6881 <DT><B>backward-word (M-b)</B>
6884 Move back to the start of the current or previous word.
6885 Words are composed of alphanumeric characters (letters and digits).
6886 <DT><B>shell-forward-word</B>
6889 Move forward to the end of the next word.
6890 Words are delimited by non-quoted shell metacharacters.
6891 <DT><B>shell-backward-word</B>
6894 Move back to the start of the current or previous word.
6895 Words are delimited by non-quoted shell metacharacters.
6896 <DT><B>clear-screen (C-l)</B>
6899 Clear the screen leaving the current line at the top of the screen.
6900 With an argument, refresh the current line without clearing the
6902 <DT><B>redraw-current-line</B>
6905 Refresh the current line.
6908 <A NAME="lbCO"> </A>
6909 <H4>Commands for Manipulating the History</H4>
6915 <DT><B>accept-line (Newline, Return)</B>
6918 Accept the line regardless of where the cursor is. If this line is
6919 non-empty, add it to the history list according to the state of the
6920 <FONT SIZE=-1><B>HISTCONTROL</B>
6923 variable. If the line is a modified history
6924 line, then restore the history line to its original state.
6925 <DT><B>previous-history (C-p)</B>
6928 Fetch the previous command from the history list, moving back in
6930 <DT><B>next-history (C-n)</B>
6933 Fetch the next command from the history list, moving forward in the
6935 <DT><B>beginning-of-history (M-<)</B>
6938 Move to the first line in the history.
6939 <DT><B>end-of-history (M->)</B>
6942 Move to the end of the input history, i.e., the line currently being
6944 <DT><B>reverse-search-history (C-r)</B>
6947 Search backward starting at the current line and moving `up' through
6948 the history as necessary. This is an incremental search.
6949 <DT><B>forward-search-history (C-s)</B>
6952 Search forward starting at the current line and moving `down' through
6953 the history as necessary. This is an incremental search.
6954 <DT><B>non-incremental-reverse-search-history (M-p)</B>
6957 Search backward through the history starting at the current line
6958 using a non-incremental search for a string supplied by the user.
6959 <DT><B>non-incremental-forward-search-history (M-n)</B>
6962 Search forward through the history using a non-incremental search for
6963 a string supplied by the user.
6964 <DT><B>history-search-forward</B>
6967 Search forward through the history for the string of characters
6968 between the start of the current line and the point.
6969 This is a non-incremental search.
6970 <DT><B>history-search-backward</B>
6973 Search backward through the history for the string of characters
6974 between the start of the current line and the point.
6975 This is a non-incremental search.
6976 <DT><B>yank-nth-arg (M-C-y)</B>
6979 Insert the first argument to the previous command (usually
6980 the second word on the previous line) at point.
6984 insert the <I>n</I>th word from the previous command (the words
6985 in the previous command begin with word 0). A negative argument
6986 inserts the <I>n</I>th word from the end of the previous command.
6987 Once the argument <I>n</I> is computed, the argument is extracted
6988 as if the "!<I>n</I>" history expansion had been specified.
6989 <DT><B>yank-last-arg (M-., M-_)</B>
6992 Insert the last argument to the previous command (the last word of
6993 the previous history entry). With an argument,
6994 behave exactly like <B>yank-nth-arg</B>.
6995 Successive calls to <B>yank-last-arg</B> move back through the history
6996 list, inserting the last argument of each line in turn.
6997 The history expansion facilities are used to extract the last argument,
6998 as if the "!$" history expansion had been specified.
6999 <DT><B>shell-expand-line (M-C-e)</B>
7002 Expand the line as the shell does. This
7003 performs alias and history expansion as well as all of the shell
7004 word expansions. See
7005 <FONT SIZE=-1><B>HISTORY EXPANSION</B>
7008 below for a description of history expansion.
7009 <DT><B>history-expand-line (M-^)</B>
7012 Perform history expansion on the current line.
7014 <FONT SIZE=-1><B>HISTORY EXPANSION</B>
7017 below for a description of history expansion.
7018 <DT><B>magic-space</B>
7021 Perform history expansion on the current line and insert a space.
7023 <FONT SIZE=-1><B>HISTORY EXPANSION</B>
7026 below for a description of history expansion.
7027 <DT><B>alias-expand-line</B>
7030 Perform alias expansion on the current line.
7032 <FONT SIZE=-1><B>ALIASES</B>
7035 above for a description of alias expansion.
7036 <DT><B>history-and-alias-expand-line</B>
7039 Perform history and alias expansion on the current line.
7040 <DT><B>insert-last-argument (M-., M-_)</B>
7043 A synonym for <B>yank-last-arg</B>.
7044 <DT><B>operate-and-get-next (C-o)</B>
7047 Accept the current line for execution and fetch the next line
7048 relative to the current line from the history for editing. Any
7049 argument is ignored.
7050 <DT><B>edit-and-execute-command (C-xC-e)</B>
7053 Invoke an editor on the current command line, and execute the result as shell
7055 <B>Bash</B> attempts to invoke
7056 <FONT SIZE=-1><B>$VISUAL</B>,
7059 <FONT SIZE=-1><B>$EDITOR</B>,
7062 and <I>emacs</I> as the editor, in that order.
7065 <A NAME="lbCP"> </A>
7066 <H4>Commands for Changing Text</H4>
7072 <DT><B>delete-char (C-d)</B>
7075 Delete the character at point. If point is at the
7076 beginning of the line, there are no characters in the line, and
7077 the last character typed was not bound to <B>delete-char</B>,
7079 <FONT SIZE=-1><B>EOF</B>.
7082 <DT><B>backward-delete-char (Rubout)</B>
7085 Delete the character behind the cursor. When given a numeric argument,
7086 save the deleted text on the kill ring.
7087 <DT><B>forward-backward-delete-char</B>
7090 Delete the character under the cursor, unless the cursor is at the
7091 end of the line, in which case the character behind the cursor is
7093 <DT><B>quoted-insert (C-q, C-v)</B>
7096 Add the next character typed to the line verbatim. This is
7097 how to insert characters like <B>C-q</B>, for example.
7098 <DT><B>tab-insert (C-v TAB)</B>
7101 Insert a tab character.
7102 <DT><B>self-insert (a, b, A, 1, !, ...)</B>
7105 Insert the character typed.
7106 <DT><B>transpose-chars (C-t)</B>
7109 Drag the character before point forward over the character at point,
7110 moving point forward as well.
7111 If point is at the end of the line, then this transposes
7112 the two characters before point.
7113 Negative arguments have no effect.
7114 <DT><B>transpose-words (M-t)</B>
7117 Drag the word before point past the word after point,
7118 moving point over that word as well.
7119 If point is at the end of the line, this transposes
7120 the last two words on the line.
7121 <DT><B>upcase-word (M-u)</B>
7124 Uppercase the current (or following) word. With a negative argument,
7125 uppercase the previous word, but do not move point.
7126 <DT><B>downcase-word (M-l)</B>
7129 Lowercase the current (or following) word. With a negative argument,
7130 lowercase the previous word, but do not move point.
7131 <DT><B>capitalize-word (M-c)</B>
7134 Capitalize the current (or following) word. With a negative argument,
7135 capitalize the previous word, but do not move point.
7136 <DT><B>overwrite-mode</B>
7139 Toggle overwrite mode. With an explicit positive numeric argument,
7140 switches to overwrite mode. With an explicit non-positive numeric
7141 argument, switches to insert mode. This command affects only
7142 <B>emacs</B> mode; <B>vi</B> mode does overwrite differently.
7143 Each call to <I>readline()</I> starts in insert mode.
7144 In overwrite mode, characters bound to <B>self-insert</B> replace
7145 the text at point rather than pushing the text to the right.
7146 Characters bound to <B>backward-delete-char</B> replace the character
7147 before point with a space. By default, this command is unbound.
7150 <A NAME="lbCQ"> </A>
7151 <H4>Killing and Yanking</H4>
7157 <DT><B>kill-line (C-k)</B>
7160 Kill the text from point to the end of the line.
7161 <DT><B>backward-kill-line (C-x Rubout)</B>
7164 Kill backward to the beginning of the line.
7165 <DT><B>unix-line-discard (C-u)</B>
7168 Kill backward from point to the beginning of the line.
7169 The killed text is saved on the kill-ring.
7171 <DT><B>kill-whole-line</B>
7174 Kill all characters on the current line, no matter where point is.
7175 <DT><B>kill-word (M-d)</B>
7178 Kill from point to the end of the current word, or if between
7179 words, to the end of the next word.
7180 Word boundaries are the same as those used by <B>forward-word</B>.
7181 <DT><B>backward-kill-word (M-Rubout)</B>
7184 Kill the word behind point.
7185 Word boundaries are the same as those used by <B>backward-word</B>.
7186 <DT><B>shell-kill-word (M-d)</B>
7189 Kill from point to the end of the current word, or if between
7190 words, to the end of the next word.
7191 Word boundaries are the same as those used by <B>shell-forward-word</B>.
7192 <DT><B>shell-backward-kill-word (M-Rubout)</B>
7195 Kill the word behind point.
7196 Word boundaries are the same as those used by <B>shell-backward-word</B>.
7197 <DT><B>unix-word-rubout (C-w)</B>
7200 Kill the word behind point, using white space as a word boundary.
7201 The killed text is saved on the kill-ring.
7202 <DT><B>unix-filename-rubout</B>
7205 Kill the word behind point, using white space and the slash character
7206 as the word boundaries.
7207 The killed text is saved on the kill-ring.
7208 <DT><B>delete-horizontal-space (M-\)</B>
7211 Delete all spaces and tabs around point.
7212 <DT><B>kill-region</B>
7215 Kill the text in the current region.
7216 <DT><B>copy-region-as-kill</B>
7219 Copy the text in the region to the kill buffer.
7220 <DT><B>copy-backward-word</B>
7223 Copy the word before point to the kill buffer.
7224 The word boundaries are the same as <B>backward-word</B>.
7225 <DT><B>copy-forward-word</B>
7228 Copy the word following point to the kill buffer.
7229 The word boundaries are the same as <B>forward-word</B>.
7230 <DT><B>yank (C-y)</B>
7233 Yank the top of the kill ring into the buffer at point.
7234 <DT><B>yank-pop (M-y)</B>
7237 Rotate the kill ring, and yank the new top. Only works following
7245 <A NAME="lbCR"> </A>
7246 <H4>Numeric Arguments</H4>
7252 <DT><B>digit-argument (M-0, M-1, ..., M--)</B>
7255 Add this digit to the argument already accumulating, or start a new
7256 argument. M-- starts a negative argument.
7257 <DT><B>universal-argument</B>
7260 This is another way to specify an argument.
7261 If this command is followed by one or more digits, optionally with a
7262 leading minus sign, those digits define the argument.
7263 If the command is followed by digits, executing
7264 <B>universal-argument</B>
7266 again ends the numeric argument, but is otherwise ignored.
7267 As a special case, if this command is immediately followed by a
7268 character that is neither a digit or minus sign, the argument count
7269 for the next command is multiplied by four.
7270 The argument count is initially one, so executing this function the
7271 first time makes the argument count four, a second time makes the
7272 argument count sixteen, and so on.
7275 <A NAME="lbCS"> </A>
7282 <DT><B>complete (TAB)</B>
7285 Attempt to perform completion on the text before point.
7288 attempts completion treating the text as a variable (if the
7289 text begins with <B>$</B>), username (if the text begins with
7290 <B>~</B>), hostname (if the text begins with <B>@</B>), or
7291 command (including aliases and functions) in turn. If none
7292 of these produces a match, filename completion is attempted.
7293 <DT><B>possible-completions (M-?)</B>
7296 List the possible completions of the text before point.
7297 <DT><B>insert-completions (M-*)</B>
7300 Insert all completions of the text before point
7301 that would have been generated by
7302 <B>possible-completions</B>.
7303 <DT><B>menu-complete</B>
7306 Similar to <B>complete</B>, but replaces the word to be completed
7307 with a single match from the list of possible completions.
7308 Repeated execution of <B>menu-complete</B> steps through the list
7309 of possible completions, inserting each match in turn.
7310 At the end of the list of completions, the bell is rung
7311 (subject to the setting of <B>bell-style</B>)
7312 and the original text is restored.
7313 An argument of <I>n</I> moves <I>n</I> positions forward in the list
7314 of matches; a negative argument may be used to move backward
7316 This command is intended to be bound to <B>TAB</B>, but is unbound
7318 <DT><B>menu-complete-rd</B>
7321 Identical to <B>menu-complete</B>, but moves backward through the list
7322 of possible completions, as if <B>menu-complete</B> had been given a
7323 negative argument. This command is unbound by default.
7324 <DT><B>delete-char-or-list</B>
7327 Deletes the character under the cursor if not at the beginning or
7328 end of the line (like <B>delete-char</B>).
7329 If at the end of the line, behaves identically to
7330 <B>possible-completions</B>.
7331 This command is unbound by default.
7332 <DT><B>complete-filename (M-/)</B>
7335 Attempt filename completion on the text before point.
7336 <DT><B>possible-filename-completions (C-x /)</B>
7339 List the possible completions of the text before point,
7340 treating it as a filename.
7341 <DT><B>complete-username (M-~)</B>
7344 Attempt completion on the text before point, treating
7346 <DT><B>possible-username-completions (C-x ~)</B>
7349 List the possible completions of the text before point,
7350 treating it as a username.
7351 <DT><B>complete-variable (M-$)</B>
7354 Attempt completion on the text before point, treating
7355 it as a shell variable.
7356 <DT><B>possible-variable-completions (C-x $)</B>
7359 List the possible completions of the text before point,
7360 treating it as a shell variable.
7361 <DT><B>complete-hostname (M-@)</B>
7364 Attempt completion on the text before point, treating
7366 <DT><B>possible-hostname-completions (C-x @)</B>
7369 List the possible completions of the text before point,
7370 treating it as a hostname.
7371 <DT><B>complete-command (M-!)</B>
7374 Attempt completion on the text before point, treating
7375 it as a command name. Command completion attempts to
7376 match the text against aliases, reserved words, shell
7377 functions, shell builtins, and finally executable filenames,
7379 <DT><B>possible-command-completions (C-x !)</B>
7382 List the possible completions of the text before point,
7383 treating it as a command name.
7384 <DT><B>dynamic-complete-history (M-TAB)</B>
7387 Attempt completion on the text before point, comparing
7388 the text against lines from the history list for possible
7390 <DT><B>dabbrev-expand</B>
7393 Attempt menu completion on the text before point, comparing
7394 the text against lines from the history list for possible
7396 <DT><B>complete-into-braces (M-{)</B>
7399 Perform filename completion and insert the list of possible completions
7400 enclosed within braces so the list is available to the shell (see
7401 <B>Brace Expansion</B>
7406 <A NAME="lbCT"> </A>
7407 <H4>Keyboard Macros</H4>
7413 <DT><B>start-kbd-macro (C-x ()</B>
7416 Begin saving the characters typed into the current keyboard macro.
7417 <DT><B>end-kbd-macro (C-x ))</B>
7420 Stop saving the characters typed into the current keyboard macro
7421 and store the definition.
7422 <DT><B>call-last-kbd-macro (C-x e)</B>
7425 Re-execute the last keyboard macro defined, by making the characters
7426 in the macro appear as if typed at the keyboard.
7429 <A NAME="lbCU"> </A>
7430 <H4>Miscellaneous</H4>
7436 <DT><B>re-read-init-file (C-x C-r)</B>
7439 Read in the contents of the <I>inputrc</I> file, and incorporate
7440 any bindings or variable assignments found there.
7441 <DT><B>abort (C-g)</B>
7444 Abort the current editing command and
7445 ring the terminal's bell (subject to the setting of
7448 <DT><B>do-uppercase-version (M-a, M-b, M-</B><I>x</I>, ...)
7451 If the metafied character <I>x</I> is lowercase, run the command
7452 that is bound to the corresponding uppercase character.
7453 <DT><B>prefix-meta (ESC)</B>
7456 Metafy the next character typed.
7457 <FONT SIZE=-1><B>ESC</B>
7465 <DT><B>undo (C-_, C-x C-u)</B>
7468 Incremental undo, separately remembered for each line.
7469 <DT><B>revert-line (M-r)</B>
7472 Undo all changes made to this line. This is like executing the
7475 command enough times to return the line to its initial state.
7476 <DT><B>tilde-expand (M-&)</B>
7479 Perform tilde expansion on the current word.
7480 <DT><B>set-mark (C-@, M-<space>)</B>
7483 Set the mark to the point. If a
7484 numeric argument is supplied, the mark is set to that position.
7485 <DT><B>exchange-point-and-mark (C-x C-x)</B>
7488 Swap the point with the mark. The current cursor position is set to
7489 the saved position, and the old cursor position is saved as the mark.
7490 <DT><B>character-search (C-])</B>
7493 A character is read and point is moved to the next occurrence of that
7494 character. A negative count searches for previous occurrences.
7495 <DT><B>character-search-backward (M-C-])</B>
7498 A character is read and point is moved to the previous occurrence of that
7499 character. A negative count searches for subsequent occurrences.
7500 <DT><B>skip-csi-sequence ()</B>
7503 Read enough characters to consume a multi-key sequence such as those
7504 defined for keys like Home and End. Such sequences begin with a
7505 Control Sequence Indicator (CSI), usually ESC-[. If this sequence is
7506 bound to "\[", keys producing such sequences will have no effect
7507 unless explicitly bound to a readline command, instead of inserting
7508 stray characters into the editing buffer. This is unbound by default,
7509 but usually bound to ESC-[.
7510 <DT><B>insert-comment (M-#)</B>
7513 Without a numeric argument, the value of the readline
7514 <B>comment-begin</B>
7516 variable is inserted at the beginning of the current line.
7517 If a numeric argument is supplied, this command acts as a toggle: if
7518 the characters at the beginning of the line do not match the value
7519 of <B>comment-begin</B>, the value is inserted, otherwise
7520 the characters in <B>comment-begin</B> are deleted from the beginning of
7522 In either case, the line is accepted as if a newline had been typed.
7523 The default value of
7524 <B>comment-begin</B> causes this command to make the current line
7526 If a numeric argument causes the comment character to be removed, the line
7527 will be executed by the shell.
7528 <DT><B>glob-complete-word (M-g)</B>
7531 The word before point is treated as a pattern for pathname expansion,
7532 with an asterisk implicitly appended. This pattern is used to
7533 generate a list of matching file names for possible completions.
7534 <DT><B>glob-expand-word (C-x *)</B>
7537 The word before point is treated as a pattern for pathname expansion,
7538 and the list of matching file names is inserted, replacing the word.
7539 If a numeric argument is supplied, an asterisk is appended before
7541 <DT><B>glob-list-expansions (C-x g)</B>
7544 The list of expansions that would have been generated by
7545 <B>glob-expand-word</B>
7547 is displayed, and the line is redrawn.
7548 If a numeric argument is supplied, an asterisk is appended before
7550 <DT><B>dump-functions</B>
7553 Print all of the functions and their key bindings to the
7554 readline output stream. If a numeric argument is supplied,
7555 the output is formatted in such a way that it can be made part
7556 of an <I>inputrc</I> file.
7557 <DT><B>dump-variables</B>
7560 Print all of the settable readline variables and their values to the
7561 readline output stream. If a numeric argument is supplied,
7562 the output is formatted in such a way that it can be made part
7563 of an <I>inputrc</I> file.
7564 <DT><B>dump-macros</B>
7567 Print all of the readline key sequences bound to macros and the
7568 strings they output. If a numeric argument is supplied,
7569 the output is formatted in such a way that it can be made part
7570 of an <I>inputrc</I> file.
7571 <DT><B>display-shell-version (C-x C-v)</B>
7574 Display version information about the current instance of
7579 <A NAME="lbCV"> </A>
7580 <H4>Programmable Completion</H4>
7584 When word completion is attempted for an argument to a command for
7585 which a completion specification (a <I>compspec</I>) has been defined
7586 using the <B>complete</B> builtin (see
7587 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
7590 below), the programmable completion facilities are invoked.
7593 First, the command name is identified.
7594 If the command word is the empty string (completion attempted at the
7595 beginning of an empty line), any compspec defined with
7596 the <B>-E</B> option to <B>complete</B> is used.
7597 If a compspec has been defined for that command, the
7598 compspec is used to generate the list of possible completions for the word.
7599 If the command word is a full pathname, a compspec for the full
7600 pathname is searched for first.
7601 If no compspec is found for the full pathname, an attempt is made to
7602 find a compspec for the portion following the final slash.
7603 If those searches to not result in a compspec, any compspec defined with
7604 the <B>-D</B> option to <B>complete</B> is used as the default.
7607 Once a compspec has been found, it is used to generate the list of
7609 If a compspec is not found, the default <B>bash</B> completion as
7610 described above under <B>Completing</B> is performed.
7613 First, the actions specified by the compspec are used.
7614 Only matches which are prefixed by the word being completed are
7622 option is used for filename or directory name completion, the shell
7624 <FONT SIZE=-1><B>FIGNORE</B>
7627 is used to filter the matches.
7630 Any completions specified by a pathname expansion pattern to the
7631 <B>-G</B> option are generated next.
7632 The words generated by the pattern need not match the word
7635 <FONT SIZE=-1><B>GLOBIGNORE</B>
7638 shell variable is not used to filter the matches, but the
7639 <FONT SIZE=-1><B>FIGNORE</B>
7645 Next, the string specified as the argument to the <B>-W</B> option
7647 The string is first split using the characters in the
7648 <FONT SIZE=-1><B>IFS</B>
7651 special variable as delimiters.
7652 Shell quoting is honored.
7653 Each word is then expanded using
7654 brace expansion, tilde expansion, parameter and variable expansion,
7655 command substitution, and arithmetic expansion,
7656 as described above under
7657 <FONT SIZE=-1><B>EXPANSION</B>.
7660 The results are split using the rules described above under
7661 <B>Word Splitting</B>.
7662 The results of the expansion are prefix-matched against the word being
7663 completed, and the matching words become the possible completions.
7666 After these matches have been generated, any shell function or command
7667 specified with the <B>-F</B> and <B>-C</B> options is invoked.
7668 When the command or function is invoked, the
7669 <FONT SIZE=-1><B>COMP_LINE</B>,
7672 <FONT SIZE=-1><B>COMP_POINT</B>,
7675 <FONT SIZE=-1><B>COMP_KEY</B>,
7679 <FONT SIZE=-1><B>COMP_TYPE</B>
7682 variables are assigned values as described above under
7683 <B>Shell Variables</B>.
7684 If a shell function is being invoked, the
7685 <FONT SIZE=-1><B>COMP_WORDS</B>
7689 <FONT SIZE=-1><B>COMP_CWORD</B>
7692 variables are also set.
7693 When the function or command is invoked, the first argument is the
7694 name of the command whose arguments are being completed, the
7695 second argument is the word being completed, and the third argument
7696 is the word preceding the word being completed on the current command line.
7697 No filtering of the generated completions against the word being completed
7698 is performed; the function or command has complete freedom in generating
7702 Any function specified with <B>-F</B> is invoked first.
7703 The function may use any of the shell facilities, including the
7704 <B>compgen</B> builtin described below, to generate the matches.
7705 It must put the possible completions in the
7706 <FONT SIZE=-1><B>COMPREPLY</B>
7712 Next, any command specified with the <B>-C</B> option is invoked
7713 in an environment equivalent to command substitution.
7714 It should print a list of completions, one per line, to the
7716 Backslash may be used to escape a newline, if necessary.
7719 After all of the possible completions are generated, any filter
7720 specified with the <B>-X</B> option is applied to the list.
7721 The filter is a pattern as used for pathname expansion; a <B>&</B>
7722 in the pattern is replaced with the text of the word being completed.
7723 A literal <B>&</B> may be escaped with a backslash; the backslash
7724 is removed before attempting a match.
7725 Any completion that matches the pattern will be removed from the list.
7726 A leading <B>!</B> negates the pattern; in this case any completion
7727 not matching the pattern will be removed.
7730 Finally, any prefix and suffix specified with the <B>-P</B> and <B>-S</B>
7731 options are added to each member of the completion list, and the result is
7732 returned to the readline completion code as the list of possible
7736 If the previously-applied actions do not generate any matches, and the
7737 <B>-o dirnames</B> option was supplied to <B>complete</B> when the
7738 compspec was defined, directory name completion is attempted.
7741 If the <B>-o plusdirs</B> option was supplied to <B>complete</B> when the
7742 compspec was defined, directory name completion is attempted and any
7743 matches are added to the results of the other actions.
7746 By default, if a compspec is found, whatever it generates is returned
7747 to the completion code as the full set of possible completions.
7748 The default <B>bash</B> completions are not attempted, and the readline
7749 default of filename completion is disabled.
7750 If the <B>-o bashdefault</B> option was supplied to <B>complete</B> when
7751 the compspec was defined, the <B>bash</B> default completions are attempted
7752 if the compspec generates no matches.
7753 If the <B>-o default</B> option was supplied to <B>complete</B> when the
7754 compspec was defined, readline's default completion will be performed
7755 if the compspec (and, if attempted, the default <B>bash</B> completions)
7756 generate no matches.
7759 When a compspec indicates that directory name completion is desired,
7760 the programmable completion functions force readline to append a slash
7761 to completed names which are symbolic links to directories, subject to
7762 the value of the <B>mark-directories</B> readline variable, regardless
7763 of the setting of the <B>mark-symlinked-directories</B> readline variable.
7766 There is some support for dynamically modifying completions. This is
7767 most useful when used in combination with a default completion specified
7768 with <B>complete -D</B>.
7769 It's possible for shell functions executed as completion
7770 handlers to indicate that completion should be retried by returning an
7771 exit status of 124. If a shell function returns 124, and changes
7772 the compspec associated with the command on which completion is being
7773 attempted (supplied as the first argument when the function is executed),
7774 programmable completion restarts from the beginning, with an
7775 attempt to find a compspec for that command. This allows a set of
7776 completions to be built dynamically as completion is attempted, rather than
7777 being loaded all at once.
7780 For instance, assuming that there is a library of compspecs, each kept in a
7781 file corresponding to the name of the command, the following default
7782 completion function would load completions dynamically:
7785 <TT>_completion_loader()
7791 <TT> </TT>. "/etc/bash_completion.d/$1.sh" >/dev/null 2>&1 && return 124<BR>
7797 complete -D -F _completion_loader
7801 <A NAME="lbCW"> </A>
7810 builtin is enabled, the shell provides access to the
7811 <I>command history</I>,
7812 the list of commands previously typed.
7814 <FONT SIZE=-1><B>HISTSIZE</B>
7817 variable is used as the
7818 number of commands to save in a history list.
7819 The text of the last
7820 <FONT SIZE=-1><B>HISTSIZE</B>
7823 commands (default 500) is saved. The shell
7824 stores each command in the history list prior to parameter and
7825 variable expansion (see
7826 <FONT SIZE=-1><B>EXPANSION</B>
7829 above) but after history expansion is performed, subject to the
7830 values of the shell variables
7831 <FONT SIZE=-1><B>HISTIGNORE</B>
7835 <FONT SIZE=-1><B>HISTCONTROL</B>.
7840 On startup, the history is initialized from the file named by
7842 <FONT SIZE=-1><B>HISTFILE</B>
7845 (default <A HREF="file:~/.bash_history"><I>~/.bash_history</I></A>).
7846 The file named by the value of
7847 <FONT SIZE=-1><B>HISTFILE</B>
7850 is truncated, if necessary, to contain no more than
7851 the number of lines specified by the value of
7852 <FONT SIZE=-1><B>HISTFILESIZE</B>.
7855 When the history file is read,
7856 lines beginning with the history comment character followed immediately
7857 by a digit are interpreted as timestamps for the preceding history line.
7858 These timestamps are optionally displayed depending on the value of the
7859 <FONT SIZE=-1><B>HISTTIMEFORMAT</B>
7863 When an interactive shell exits, the last
7864 <FONT SIZE=-1><B>$HISTSIZE</B>
7867 lines are copied from the history list to
7868 <FONT SIZE=-1><B>$HISTFILE</B>.
7874 shell option is enabled
7875 (see the description of
7879 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
7882 below), the lines are appended to the history file,
7883 otherwise the history file is overwritten.
7885 <FONT SIZE=-1><B>HISTFILE</B>
7888 is unset, or if the history file is unwritable, the history is
7891 <FONT SIZE=-1><B>HISTTIMEFORMAT</B>
7894 variable is set, time stamps are written to the history file, marked
7895 with the history comment character, so
7896 they may be preserved across shell sessions.
7897 This uses the history comment character to distinguish timestamps from
7898 other history lines.
7899 After saving the history, the history file is truncated
7900 to contain no more than
7901 <FONT SIZE=-1><B>HISTFILESIZE</B>
7905 <FONT SIZE=-1><B>HISTFILESIZE</B>
7908 is not set, no truncation is performed.
7915 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
7918 below) may be used to list or edit and re-execute a portion of
7923 builtin may be used to display or modify the history list and
7924 manipulate the history file.
7925 When using command-line editing, search commands
7926 are available in each editing mode that provide access to the
7930 The shell allows control over which commands are saved on the history
7932 <FONT SIZE=-1><B>HISTCONTROL</B>
7936 <FONT SIZE=-1><B>HISTIGNORE</B>
7939 variables may be set to cause the shell to save only a subset of the
7944 shell option, if enabled, causes the shell to attempt to save each
7945 line of a multi-line command in the same history entry, adding
7946 semicolons where necessary to preserve syntactic correctness.
7950 shell option causes the shell to save the command with embedded newlines
7951 instead of semicolons. See the description of the
7955 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
7958 for information on setting and unsetting shell options.
7959 <A NAME="lbCX"> </A>
7960 <H3>HISTORY EXPANSION</H3>
7964 The shell supports a history expansion feature that
7965 is similar to the history expansion in
7968 This section describes what syntax features are available. This
7969 feature is enabled by default for interactive shells, and can be
7976 builtin command (see
7977 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
7980 below). Non-interactive shells do not perform history expansion
7984 History expansions introduce words from the history list into
7985 the input stream, making it easy to repeat commands, insert the
7986 arguments to a previous command into the current input line, or
7987 fix errors in previous commands quickly.
7990 History expansion is performed immediately after a complete line
7991 is read, before the shell breaks it into words.
7992 It takes place in two parts.
7993 The first is to determine which line from the history list
7994 to use during substitution.
7995 The second is to select portions of that line for inclusion into
7997 The line selected from the history is the <I>event</I>,
7998 and the portions of that line that are acted upon are <I>words</I>.
7999 Various <I>modifiers</I> are available to manipulate the selected words.
8000 The line is broken into words in the same fashion as when reading input,
8001 so that several <I>metacharacter</I>-separated words surrounded by
8002 quotes are considered one word.
8003 History expansions are introduced by the appearance of the
8004 history expansion character, which is <B>!</B> by default.
8005 Only backslash (<B>\</B>) and single quotes can quote
8006 the history expansion character.
8009 Several characters inhibit history expansion if found immediately
8010 following the history expansion character, even if it is unquoted:
8011 space, tab, newline, carriage return, and <B>=</B>.
8012 If the <B>extglob</B> shell option is enabled, <B>(</B> will also
8016 Several shell options settable with the
8019 builtin may be used to tailor the behavior of history expansion.
8023 shell option is enabled (see the description of the
8029 is being used, history substitutions are not immediately passed to
8031 Instead, the expanded line is reloaded into the
8034 editing buffer for further modification.
8038 is being used, and the
8041 shell option is enabled, a failed history substitution will be reloaded
8045 editing buffer for correction.
8052 builtin command may be used to see what a history expansion will
8060 builtin may be used to add commands to the end of the history list
8061 without actually executing them, so that they are available for
8065 The shell allows control of the various characters used by the
8066 history expansion mechanism (see the description of
8070 <B>Shell Variables</B>).
8073 the history comment character to mark history timestamps when
8074 writing the history file.
8075 <A NAME="lbCY"> </A>
8076 <H4>Event Designators</H4>
8080 An event designator is a reference to a command line entry in the
8089 Start a history substitution, except when followed by a
8092 newline, carriage return, =
8093 or ( (when the <B>extglob</B> shell option is enabled using
8094 the <B>shopt</B> builtin).
8095 <DT><B>!</B><I>n</I>
8098 Refer to command line
8101 <DT><B>!-</B><I>n</I>
8104 Refer to the current command line minus
8110 Refer to the previous command. This is a synonym for `!-1'.
8111 <DT><B>!</B><I>string</I>
8114 Refer to the most recent command starting with
8117 <DT><B>!?</B><I>string</I><B>[?]</B>
8120 Refer to the most recent command containing
8123 The trailing <B>?</B> may be omitted if
8126 is followed immediately by a newline.
8127 <DT><B></B><FONT SIZE=+2><B>^</B></FONT><B></B><I>string1</I><FONT SIZE=+2>^</FONT><I>string2</I><FONT SIZE=+2>^</FONT>
8130 Quick substitution. Repeat the last command, replacing
8137 ``!!:s/<I>string1</I>/<I>string2</I>/''
8138 (see <B>Modifiers</B> below).
8142 The entire command line typed so far.
8145 <A NAME="lbCZ"> </A>
8146 <H4>Word Designators</H4>
8150 Word designators are used to select desired words from the event.
8154 separates the event specification from the word designator.
8155 It may be omitted if the word designator begins with a
8167 Words are numbered from the beginning of the line,
8168 with the first word being denoted by 0 (zero).
8169 Words are inserted into the current line separated by single spaces.
8177 The zeroth word. For the shell, this is the command
8182 The <I>n</I>th word.
8186 The first argument. That is, word 1.
8194 The word matched by the most recent `?<I>string</I>?' search.
8195 <DT><I>x</I><B>-</B>y
8198 A range of words; `-<I>y</I>' abbreviates `0-<I>y</I>'.
8202 All of the words but the zeroth. This is a synonym
8203 for `<I>1-$</I>'. It is not an error to use
8206 if there is just one
8207 word in the event; the empty string is returned in that case.
8211 Abbreviates <I>x-$</I>.
8215 Abbreviates <I>x-$</I> like <B>x*</B>, but omits the last word.
8220 If a word designator is supplied without an event specification, the
8221 previous command is used as the event.
8222 <A NAME="lbDA"> </A>
8227 After the optional word designator, there may appear a sequence of
8228 one or more of the following modifiers, each preceded by a `:'.
8238 Remove a trailing file name component, leaving only the head.
8242 Remove all leading file name components, leaving the tail.
8246 Remove a trailing suffix of the form <I>.xxx</I>, leaving the
8251 Remove all but the trailing suffix.
8255 Print the new command but do not execute it.
8259 Quote the substituted words, escaping further substitutions.
8263 Quote the substituted words as with
8266 but break into words at
8270 <DT><B>s/</B><I>old</I>/<I>new</I>/
8276 for the first occurrence of
8279 in the event line. Any delimiter can be used in place of /. The
8280 final delimiter is optional if it is the last character of the
8281 event line. The delimiter may be quoted in
8287 with a single backslash. If & appears in
8293 A single backslash will quote the &. If
8296 is null, it is set to the last
8299 substituted, or, if no previous history substitutions took place,
8304 <B>!?</B><I>string</I><B>[?]</B>
8310 Repeat the previous substitution.
8314 Cause changes to be applied over the entire event line. This is
8315 used in conjunction with `<B>:s</B>' (e.g., `<B>:gs/</B><I>old</I>/<I>new</I>/')
8316 or `<B>:&</B>'. If used with
8317 `<B>:s</B>', any delimiter can be used
8318 in place of /, and the final delimiter is optional
8319 if it is the last character of the event line.
8320 An <B>a</B> may be used as a synonym for <B>g</B>.
8324 Apply the following `<B>s</B>' modifier once to each word in the event line.
8327 <A NAME="lbDB"> </A>
8328 <H3>SHELL BUILTIN COMMANDS</H3>
8334 Unless otherwise noted, each builtin command documented in this
8335 section as accepting options preceded by
8341 to signify the end of the options.
8342 The <B>:</B>, <B>true</B>, <B>false</B>, and <B>test</B> builtins
8343 do not accept options and do not treat <B>--</B> specially.
8344 The <B>exit</B>, <B>logout</B>, <B>break</B>, <B>continue</B>, <B>let</B>,
8345 and <B>shift</B> builtins accept and process arguments beginning with
8346 <B>-</B> without requiring <B>--</B>.
8347 Other builtins that accept arguments but are not specified as accepting
8348 options interpret arguments beginning with <B>-</B> as invalid options and
8349 require <B>--</B> to prevent this interpretation.
8353 <DT><B>:</B> [<I>arguments</I>]<DD>
8355 No effect; the command does nothing beyond expanding
8358 and performing any specified
8359 redirections. A zero exit code is returned.
8360 <DT><B> . </B> <I>filename</I> [<I>arguments</I>]<DD>
8362 <DT><B>source</B> <I>filename</I> [<I>arguments</I>]<DD>
8364 Read and execute commands from
8368 shell environment and return the exit status of the last command
8375 does not contain a slash, file names in
8376 <FONT SIZE=-1><B>PATH</B>
8379 are used to find the directory containing
8382 The file searched for in
8383 <FONT SIZE=-1><B>PATH</B>
8386 need not be executable.
8387 When <B>bash</B> is not in <I>posix mode</I>, the current directory is
8388 searched if no file is found in
8389 <FONT SIZE=-1><B>PATH</B>.
8398 builtin command is turned off, the
8399 <FONT SIZE=-1><B>PATH</B>
8403 If any <I>arguments</I> are supplied, they become the positional
8404 parameters when <I>filename</I> is executed. Otherwise the positional
8405 parameters are unchanged.
8406 The return status is the status of the last command exited within
8407 the script (0 if no commands are executed), and false if
8410 is not found or cannot be read.
8411 <DT><B>alias</B> [<B>-p</B>] [<I>name</I>[=<I>value</I>] ...]<DD>
8412 <B>Alias</B> with no arguments or with the
8415 option prints the list of aliases in the form
8416 <B>alias</B> <I>name</I>=<I>value</I> on standard output.
8417 When arguments are supplied, an alias is defined for
8418 each <I>name</I> whose <I>value</I> is given.
8419 A trailing space in <I>value</I> causes the next word to be
8420 checked for alias substitution when the alias is expanded.
8421 For each <I>name</I> in the argument list for which no <I>value</I>
8422 is supplied, the name and value of the alias is printed.
8423 <B>Alias</B> returns true unless a <I>name</I> is given for which
8424 no alias has been defined.
8425 <DT><B>bg</B> [<I>jobspec</I> ...]<DD>
8426 Resume each suspended job <I>jobspec</I> in the background, as if it
8427 had been started with
8433 is not present, the shell's notion of the <I>current job</I> is used.
8438 returns 0 unless run when job control is disabled or, when run with
8439 job control enabled, any specified <I>jobspec</I> was not found
8440 or was started without job control.
8441 <DT><B>bind</B> [<B>-m</B> <I>keymap</I>] [<B>-lpsvPSV</B>]<DD>
8443 <DT><B>bind</B> [<B>-m</B> <I>keymap</I>] [<B>-q</B> <I>function</I>] [<B>-u</B> <I>function</I>] [<B>-r</B> <I>keyseq</I>]<DD>
8444 <DT><B>bind</B> [<B>-m</B> <I>keymap</I>] <B>-f</B> <I>filename</I><DD>
8445 <DT><B>bind</B> [<B>-m</B> <I>keymap</I>] <B>-x</B> <I>keyseq</I>:<I>shell-command</I><DD>
8446 <DT><B>bind</B> [<B>-m</B> <I>keymap</I>] <I>keyseq</I>:<I>function-name</I><DD>
8447 <DT><B>bind</B> <I>readline-command</I><DD>
8452 key and function bindings, bind a key sequence to a
8455 function or macro, or set a
8459 Each non-option argument is a command as it would appear in
8462 but each binding or command must be passed as a separate argument;
8463 e.g., '"\C-x\C-r": re-read-init-file'.
8464 Options, if supplied, have the following meanings:
8465 <DL COMPACT><DT><DD>
8468 <DT><B>-m </B><I>keymap</I>
8474 as the keymap to be affected by the subsequent bindings.
8479 <I>emacs, emacs-standard, emacs-meta, emacs-ctlx, vi,
8480 vi-move, vi-command</I>, and
8483 <I>vi</I> is equivalent to <I>vi-command</I>; <I>emacs</I> is
8484 equivalent to <I>emacs-standard</I>.
8488 List the names of all <B>readline</B> functions.
8492 Display <B>readline</B> function names and bindings in such a way
8493 that they can be re-read.
8497 List current <B>readline</B> function names and bindings.
8501 Display <B>readline</B> key sequences bound to macros and the strings
8502 they output in such a way that they can be re-read.
8506 Display <B>readline</B> key sequences bound to macros and the strings
8511 Display <B>readline</B> variable names and values in such a way that they
8516 List current <B>readline</B> variable names and values.
8517 <DT><B>-f </B><I>filename</I>
8520 Read key bindings from <I>filename</I>.
8521 <DT><B>-q </B><I>function</I>
8524 Query about which keys invoke the named <I>function</I>.
8525 <DT><B>-u </B><I>function</I>
8528 Unbind all keys bound to the named <I>function</I>.
8529 <DT><B>-r </B><I>keyseq</I>
8532 Remove any current binding for <I>keyseq</I>.
8533 <DT><B>-x </B><I>keyseq</I>:<I>shell-command</I>
8536 Cause <I>shell-command</I> to be executed whenever <I>keyseq</I> is
8538 When <I>shell-command</I> is executed, the shell sets the
8539 <FONT SIZE=-1><B>READLINE_LINE</B>
8542 variable to the contents of the <B>readline</B> line buffer and the
8543 <FONT SIZE=-1><B>READLINE_POINT</B>
8546 variable to the current location of the insertion point.
8547 If the executed command changes the value of
8548 <FONT SIZE=-1><B>READLINE_LINE</B>
8552 <FONT SIZE=-1><B>READLINE_POINT</B>,
8555 those new values will be reflected in the editing state.
8560 The return value is 0 unless an unrecognized option is given or an
8564 <DT><B>break</B> [<I>n</I>]<DD>
8575 loop. If <I>n</I> is specified, break <I>n</I> levels.
8581 is greater than the number of enclosing loops, all enclosing loops
8583 The return value is 0 unless <I>n</I> is not greater than or equal to 1.
8584 <DT><B>builtin</B> <I>shell-builtin</I> [<I>arguments</I>]<DD>
8585 Execute the specified shell builtin, passing it
8588 and return its exit status.
8589 This is useful when defining a
8590 function whose name is the same as a shell builtin,
8591 retaining the functionality of the builtin within the function.
8592 The <B>cd</B> builtin is commonly redefined this way.
8593 The return status is false if
8594 <I>shell-builtin</I>
8596 is not a shell builtin command.
8597 <DT><B>caller</B> [<I>expr</I>]<DD>
8598 Returns the context of any active subroutine call (a shell function or
8599 a script executed with the <B>.</B> or <B>source</B> builtins.
8600 Without <I>expr</I>, <B>caller</B> displays the line number and source
8601 filename of the current subroutine call.
8602 If a non-negative integer is supplied as <I>expr</I>, <B>caller</B>
8603 displays the line number, subroutine name, and source file corresponding
8604 to that position in the current execution call stack. This extra
8605 information may be used, for example, to print a stack trace. The
8606 current frame is frame 0.
8607 The return value is 0 unless the shell is not executing a subroutine
8608 call or <I>expr</I> does not correspond to a valid position in the
8610 <DT><B>cd</B> [<B>-L|-P</B>] [<I>dir</I>]<DD>
8611 Change the current directory to <I>dir</I>. The variable
8612 <FONT SIZE=-1><B>HOME</B>
8620 <FONT SIZE=-1><B>CDPATH</B>
8623 defines the search path for the directory containing
8626 Alternative directory names in
8627 <FONT SIZE=-1><B>CDPATH</B>
8630 are separated by a colon (:). A null directory name in
8631 <FONT SIZE=-1><B>CDPATH</B>
8634 is the same as the current directory, i.e., ``<B>.</B>''. If
8637 begins with a slash (/),
8639 <FONT SIZE=-1><B>CDPATH</B>
8645 option says to use the physical directory structure instead of
8646 following symbolic links (see also the
8652 builtin command); the
8655 option forces symbolic links to be followed. An argument of
8659 <FONT SIZE=-1><B>$OLDPWD</B>.
8662 If a non-empty directory name from
8663 <FONT SIZE=-1><B>CDPATH</B>
8667 <B>-</B> is the first argument, and the directory change is
8668 successful, the absolute pathname of the new working directory is
8669 written to the standard output.
8670 The return value is true if the directory was successfully changed;
8672 <DT><B>command</B> [<B>-pVv</B>] <I>command</I> [<I>arg</I> ...]<DD>
8679 suppressing the normal shell function lookup. Only builtin
8680 commands or commands found in the
8681 <FONT SIZE=-1><B>PATH</B>
8684 are executed. If the
8687 option is given, the search for
8690 is performed using a default value for
8691 <FONT SIZE=-1><B>PATH</B>
8694 that is guaranteed to find all of the standard utilities.
8701 option is supplied, a description of
8707 option causes a single word indicating the command or file name
8711 to be displayed; the
8714 option produces a more verbose description.
8721 option is supplied, the exit status is 0 if
8724 was found, and 1 if not. If neither option is supplied and
8725 an error occurred or
8728 cannot be found, the exit status is 127. Otherwise, the exit status of the
8731 builtin is the exit status of
8734 <DT><B>compgen</B> [<I>option</I>] [<I>word</I>]<DD>
8735 Generate possible completion matches for <I>word</I> according to
8736 the <I>option</I>s, which may be any option accepted by the
8739 builtin with the exception of <B>-p</B> and <B>-r</B>, and write
8740 the matches to the standard output.
8741 When using the <B>-F</B> or <B>-C</B> options, the various shell variables
8742 set by the programmable completion facilities, while available, will not
8745 The matches will be generated in the same way as if the programmable
8746 completion code had generated them directly from a completion specification
8747 with the same flags.
8748 If <I>word</I> is specified, only those completions matching <I>word</I>
8751 The return value is true unless an invalid option is supplied, or no
8752 matches were generated.
8753 <DT><B>complete</B> [<B>-abcdefgjksuv</B>] [<B>-o</B> <I>comp-option</I>] [<B>-DE</B>] [<B>-A</B> <I>action</I>] [<B>-G</B> <I>globpat</I>] [<B>-W</B> <I>wordlist</I>] [<B>-F</B> <I>function</I>] [<B>-C</B> <I>command</I>]<DD>
8756 [<B>-X</B> <I>filterpat</I>] [<B>-P</B> <I>prefix</I>] [<B>-S</B> <I>suffix</I>] <I>name</I> [<I>name ...</I>]
8758 <DT><B>complete</B> <B>-pr</B> [<B>-DE</B>] [<I>name</I> ...]<DD>
8760 Specify how arguments to each <I>name</I> should be completed.
8761 If the <B>-p</B> option is supplied, or if no options are supplied,
8762 existing completion specifications are printed in a way that allows
8763 them to be reused as input.
8764 The <B>-r</B> option removes a completion specification for
8765 each <I>name</I>, or, if no <I>name</I>s are supplied, all
8766 completion specifications.
8767 The <B>-D</B> option indicates that the remaining options and actions should
8768 apply to the ``default'' command completion; that is, completion attempted
8769 on a command for which no completion has previously been defined.
8770 The <B>-E</B> option indicates that the remaining options and actions should
8771 apply to ``empty'' command completion; that is, completion attempted on a
8774 The process of applying these completion specifications when word completion
8775 is attempted is described above under <B>Programmable Completion</B>.
8777 Other options, if specified, have the following meanings.
8778 The arguments to the <B>-G</B>, <B>-W</B>, and <B>-X</B> options
8779 (and, if necessary, the <B>-P</B> and <B>-S</B> options)
8780 should be quoted to protect them from expansion before the
8784 <DL COMPACT><DT><DD>
8787 <DT><B>-o</B> <I>comp-option</I><DD>
8788 The <I>comp-option</I> controls several aspects of the compspec's behavior
8789 beyond the simple generation of completions.
8790 <I>comp-option</I> may be one of:
8791 <DL COMPACT><DT><DD>
8793 <DT><B>bashdefault</B>
8796 Perform the rest of the default <B>bash</B> completions if the compspec
8797 generates no matches.
8801 Use readline's default filename completion if the compspec generates
8806 Perform directory name completion if the compspec generates no matches.
8807 <DT><B>filenames</B>
8810 Tell readline that the compspec generates filenames, so it can perform any
8811 filename-specific processing (like adding a slash to directory names,
8812 quoting special characters, or suppressing trailing spaces).
8813 Intended to be used with shell functions.
8817 Tell readline not to append a space (the default) to words completed at
8818 the end of the line.
8822 After any matches defined by the compspec are generated,
8823 directory name completion is attempted and any
8824 matches are added to the results of the other actions.
8827 <DT><B>-A</B> <I>action</I><DD>
8828 The <I>action</I> may be one of the following to generate a list of possible
8830 <DL COMPACT><DT><DD>
8835 Alias names. May also be specified as <B>-a</B>.
8839 Array variable names.
8843 <B>Readline</B> key binding names.
8847 Names of shell builtin commands. May also be specified as <B>-b</B>.
8851 Command names. May also be specified as <B>-c</B>.
8852 <DT><B>directory</B>
8855 Directory names. May also be specified as <B>-d</B>.
8859 Names of disabled shell builtins.
8863 Names of enabled shell builtins.
8867 Names of exported shell variables. May also be specified as <B>-e</B>.
8871 File names. May also be specified as <B>-f</B>.
8875 Names of shell functions.
8879 Group names. May also be specified as <B>-g</B>.
8880 <DT><B>helptopic</B>
8883 Help topics as accepted by the <B>help</B> builtin.
8887 Hostnames, as taken from the file specified by the
8888 <FONT SIZE=-1><B>HOSTFILE</B>
8895 Job names, if job control is active. May also be specified as <B>-j</B>.
8899 Shell reserved words. May also be specified as <B>-k</B>.
8903 Names of running jobs, if job control is active.
8907 Service names. May also be specified as <B>-s</B>.
8911 Valid arguments for the <B>-o</B> option to the <B>set</B> builtin.
8915 Shell option names as accepted by the <B>shopt</B> builtin.
8923 Names of stopped jobs, if job control is active.
8927 User names. May also be specified as <B>-u</B>.
8931 Names of all shell variables. May also be specified as <B>-v</B>.
8934 <DT><B>-G</B> <I>globpat</I><DD>
8935 The pathname expansion pattern <I>globpat</I> is expanded to generate
8936 the possible completions.
8937 <DT><B>-W</B> <I>wordlist</I><DD>
8938 The <I>wordlist</I> is split using the characters in the
8939 <FONT SIZE=-1><B>IFS</B>
8942 special variable as delimiters, and each resultant word is expanded.
8943 The possible completions are the members of the resultant list which
8944 match the word being completed.
8945 <DT><B>-C</B> <I>command</I><DD>
8946 <I>command</I> is executed in a subshell environment, and its output is
8947 used as the possible completions.
8948 <DT><B>-F</B> <I>function</I><DD>
8949 The shell function <I>function</I> is executed in the current shell
8951 When it finishes, the possible completions are retrieved from the value
8953 <FONT SIZE=-1><B>COMPREPLY</B>
8957 <DT><B>-X</B> <I>filterpat</I><DD>
8958 <I>filterpat</I> is a pattern as used for pathname expansion.
8959 It is applied to the list of possible completions generated by the
8960 preceding options and arguments, and each completion matching
8961 <I>filterpat</I> is removed from the list.
8962 A leading <B>!</B> in <I>filterpat</I> negates the pattern; in this
8963 case, any completion not matching <I>filterpat</I> is removed.
8964 <DT><B>-P</B> <I>prefix</I><DD>
8965 <I>prefix</I> is added at the beginning of each possible completion
8966 after all other options have been applied.
8967 <DT><B>-S</B> <I>suffix</I><DD>
8968 <I>suffix</I> is appended to each possible completion
8969 after all other options have been applied.
8974 The return value is true unless an invalid option is supplied, an option
8975 other than <B>-p</B> or <B>-r</B> is supplied without a <I>name</I>
8976 argument, an attempt is made to remove a completion specification for
8977 a <I>name</I> for which no specification exists, or
8978 an error occurs adding a completion specification.
8981 <DT><B>compopt</B> [<B>-o</B> <I>option</I>] [<B>-DE</B>] [<B>+o</B> <I>option</I>] [<I>name</I>]<DD>
8982 Modify completion options for each <I>name</I> according to the
8983 <I>option</I>s, or for the
8984 currently-execution completion if no <I>name</I>s are supplied.
8985 If no <I>option</I>s are given, display the completion options for each
8986 <I>name</I> or the current completion.
8987 The possible values of <I>option</I> are those valid for the <B>complete</B>
8988 builtin described above.
8989 The <B>-D</B> option indicates that the remaining options should
8990 apply to the ``default'' command completion; that is, completion attempted
8991 on a command for which no completion has previously been defined.
8992 The <B>-E</B> option indicates that the remaining options should
8993 apply to ``empty'' command completion; that is, completion attempted on a
8998 The return value is true unless an invalid option is supplied, an attempt
8999 is made to modify the options for a <I>name</I> for which no completion
9000 specification exists, or an output error occurs.
9002 <DT><B>continue</B> [<I>n</I>]<DD>
9003 Resume the next iteration of the enclosing
9017 is specified, resume at the <I>n</I>th enclosing loop.
9023 is greater than the number of enclosing loops, the last enclosing loop
9024 (the ``top-level'' loop) is resumed.
9025 The return value is 0 unless <I>n</I> is not greater than or equal to 1.
9026 <DT><B>declare</B> [<B>-aAfFilrtux</B>] [<B>-p</B>] [<I>name</I>[=<I>value</I>] ...]<DD>
9028 <DT><B>typeset</B> [<B>-aAfFilrtux</B>] [<B>-p</B>] [<I>name</I>[=<I>value</I>] ...]<DD>
9030 Declare variables and/or give them attributes.
9031 If no <I>name</I>s are given then display the values of variables.
9035 option will display the attributes and values of each
9041 is used with <I>name</I> arguments, additional options are ignored.
9045 is supplied without <I>name</I> arguments, it will display the attributes
9046 and values of all variables having the attributes specified by the
9048 If no other options are supplied with <B>-p</B>, <B>declare</B> will display
9049 the attributes and values of all shell variables. The <B>-f</B> option
9050 will restrict the display to shell functions.
9054 option inhibits the display of function definitions; only the
9055 function name and attributes are printed.
9056 If the <B>extdebug</B> shell option is enabled using <B>shopt</B>,
9057 the source file name and line number where the function is defined
9058 are displayed as well. The
9064 The following options can
9065 be used to restrict output to variables with the specified attribute or
9066 to give variables attributes:
9067 <DL COMPACT><DT><DD>
9073 Each <I>name</I> is an indexed array variable (see
9080 Each <I>name</I> is an associative array variable (see
9087 Use function names only.
9091 The variable is treated as an integer; arithmetic evaluation (see
9092 <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>
9095 above) is performed when the variable is assigned a value.
9099 When the variable is assigned a value, all upper-case characters are
9100 converted to lower-case.
9101 The upper-case attribute is disabled.
9105 Make <I>name</I>s readonly. These names cannot then be assigned values
9106 by subsequent assignment statements or unset.
9110 Give each <I>name</I> the <I>trace</I> attribute.
9111 Traced functions inherit the <B>DEBUG</B> and <B>RETURN</B> traps from
9113 The trace attribute has no special meaning for variables.
9117 When the variable is assigned a value, all lower-case characters are
9118 converted to upper-case.
9119 The lower-case attribute is disabled.
9123 Mark <I>name</I>s for export to subsequent commands via the environment.
9128 Using `+' instead of `-'
9129 turns off the attribute instead,
9130 with the exceptions that <B>+a</B>
9131 may not be used to destroy an array variable and <B>+r</B> will not
9132 remove the readonly attribute.
9133 When used in a function,
9135 <I>name</I> local, as with the
9139 If a variable name is followed by =<I>value</I>, the value of
9140 the variable is set to <I>value</I>.
9141 The return value is 0 unless an invalid option is encountered,
9142 an attempt is made to define a function using
9144 <TT>-f foo=bar</TT>,
9145 an attempt is made to assign a value to a readonly variable,
9146 an attempt is made to assign a value to an array variable without
9147 using the compound assignment syntax (see
9150 above), one of the <I>names</I> is not a valid shell variable name,
9151 an attempt is made to turn off readonly status for a readonly variable,
9152 an attempt is made to turn off array status for an array variable,
9153 or an attempt is made to display a non-existent function with <B>-f</B>.
9156 <DT><B>dirs [+</B><I>n</I>] [-<I>n</I>] [<B>-cplv</B>]
9159 Without options, displays the list of currently remembered directories.
9160 The default display is on a single line with directory names separated
9162 Directories are added to the list with the
9168 command removes entries from the list.
9169 <DL COMPACT><DT><DD>
9172 <DT><B>+</B><I>n</I><DD>
9173 Displays the <I>n</I>th entry counting from the left of the list
9177 when invoked without options, starting with zero.
9178 <DT><B>-</B><I>n</I><DD>
9179 Displays the <I>n</I>th entry counting from the right of the list
9183 when invoked without options, starting with zero.
9187 Clears the directory stack by deleting all of the entries.
9191 Produces a longer listing; the default listing format uses a
9192 tilde to denote the home directory.
9196 Print the directory stack with one entry per line.
9200 Print the directory stack with one entry per line,
9201 prefixing each entry with its index in the stack.
9206 The return value is 0 unless an
9207 invalid option is supplied or <I>n</I> indexes beyond the end
9208 of the directory stack.
9211 <DT><B>disown</B> [<B>-ar</B>] [<B>-h</B>] [<I>jobspec</I> ...]<DD>
9212 Without options, each
9215 is removed from the table of active jobs.
9219 is not present, and neither <B>-a</B> nor <B>-r</B> is supplied,
9220 the shell's notion of the <I>current job</I> is used.
9221 If the <B>-h</B> option is given, each
9224 is not removed from the table, but is marked so that
9225 <FONT SIZE=-1><B>SIGHUP</B>
9228 is not sent to the job if the shell receives a
9229 <FONT SIZE=-1><B>SIGHUP</B>.
9235 is present, and neither the
9241 option is supplied, the <I>current job</I> is used.
9248 option means to remove or mark all jobs; the
9254 argument restricts operation to running jobs.
9255 The return value is 0 unless a
9258 does not specify a valid job.
9259 <DT><B>echo</B> [<B>-neE</B>] [<I>arg</I> ...]<DD>
9260 Output the <I>arg</I>s, separated by spaces, followed by a newline.
9261 The return status is always 0.
9262 If <B>-n</B> is specified, the trailing newline is
9263 suppressed. If the <B>-e</B> option is given, interpretation of
9264 the following backslash-escaped characters is enabled. The
9267 option disables the interpretation of these escape characters,
9268 even on systems where they are interpreted by default.
9269 The <B>xpg_echo</B> shell option may be used to
9270 dynamically determine whether or not <B>echo</B> expands these
9271 escape characters by default.
9274 does not interpret <B>--</B> to mean the end of options.
9277 interprets the following escape sequences:
9278 <DL COMPACT><DT><DD>
9292 suppress further output
9321 <DT><B>\0</B><I>nnn</I>
9324 the eight-bit character whose value is the octal value <I>nnn</I>
9325 (zero to three octal digits)
9326 <DT><B>\x</B><I>HH</I>
9329 the eight-bit character whose value is the hexadecimal value <I>HH</I>
9330 (one or two hex digits)
9334 <DT><B>enable</B> [<B>-a</B>] [<B>-dnps</B>] [<B>-f</B> <I>filename</I>] [<I>name</I> ...]<DD>
9335 Enable and disable builtin shell commands.
9336 Disabling a builtin allows a disk command which has the same name
9337 as a shell builtin to be executed without specifying a full pathname,
9338 even though the shell normally searches for builtins before disk commands.
9339 If <B>-n</B> is used, each <I>name</I>
9340 is disabled; otherwise,
9341 <I>names</I> are enabled. For example, to use the
9344 binary found via the
9345 <FONT SIZE=-1><B>PATH</B>
9348 instead of the shell builtin version, run
9349 <TT>enable -n test</TT>.
9354 option means to load the new builtin command
9360 on systems that support dynamic loading. The
9363 option will delete a builtin previously loaded with
9366 If no <I>name</I> arguments are given, or if the
9369 option is supplied, a list of shell builtins is printed.
9370 With no other option arguments, the list consists of all enabled
9372 If <B>-n</B> is supplied, only disabled builtins are printed.
9373 If <B>-a</B> is supplied, the list printed includes all builtins, with an
9374 indication of whether or not each is enabled.
9375 If <B>-s</B> is supplied, the output is restricted to the POSIX
9376 <I>special</I> builtins.
9377 The return value is 0 unless a
9380 is not a shell builtin or there is an error loading a new builtin
9381 from a shared object.
9382 <DT><B>eval</B> [<I>arg</I> ...]<DD>
9383 The <I>arg</I>s are read and concatenated together into a single
9384 command. This command is then read and executed by the shell, and
9385 its exit status is returned as the value of
9391 or only null arguments,
9395 <DT><B>exec</B> [<B>-cl</B>] [<B>-a</B> <I>name</I>] [<I>command</I> [<I>arguments</I>]]<DD>
9399 is specified, it replaces the shell.
9400 No new process is created. The
9403 become the arguments to <I>command</I>.
9408 the shell places a dash at the beginning of the zeroth argument passed to
9420 to be executed with an empty environment. If
9423 is supplied, the shell passes
9426 as the zeroth argument to the executed command. If
9429 cannot be executed for some reason, a non-interactive shell exits,
9430 unless the shell option
9433 is enabled, in which case it returns failure.
9434 An interactive shell returns failure if the file cannot be executed.
9438 is not specified, any redirections take effect in the current shell,
9439 and the return status is 0. If there is a redirection error, the
9441 <DT><B>exit</B> [<I>n</I>]<DD>
9442 Cause the shell to exit
9443 with a status of <I>n</I>. If
9446 is omitted, the exit status
9447 is that of the last command executed.
9449 <FONT SIZE=-1><B>EXIT</B>
9452 is executed before the shell terminates.
9453 <DT><B>export</B> [<B>-fn</B>] [<I>name</I>[=<I>word</I>]] ...<DD>
9455 <DT><B>export -p</B>
9462 are marked for automatic export to the environment of
9463 subsequently executed commands. If the
9474 are given, or if the
9477 option is supplied, a list
9478 of all names that are exported in this shell is printed.
9482 option causes the export property to be removed from each
9484 If a variable name is followed by =<I>word</I>, the value of
9485 the variable is set to <I>word</I>.
9488 returns an exit status of 0 unless an invalid option is
9490 one of the <I>names</I> is not a valid shell variable name, or
9496 that is not a function.
9497 <DT><B>fc</B> [<B>-e</B> <I>ename</I>] [<B>-lnr</B>] [<I>first</I>] [<I>last</I>]<DD>
9499 <DT><B>fc</B> <B>-s</B> [<I>pat</I>=<I>rep</I>] [<I>cmd</I>]<DD>
9501 Fix Command. In the first form, a range of commands from
9507 is selected from the history list.
9513 may be specified as a string (to locate the last command beginning
9514 with that string) or as a number (an index into the history list,
9515 where a negative number is used as an offset from the current
9519 is not specified it is set to
9520 the current command for listing (so that
9523 prints the last 10 commands) and to
9530 is not specified it is set to the previous
9531 command for editing and -16 for listing.
9537 the command numbers when listing. The
9540 option reverses the order of
9541 the commands. If the
9545 the commands are listed on
9546 standard output. Otherwise, the editor given by
9550 on a file containing those commands. If
9555 <FONT SIZE=-1><B>FCEDIT</B>
9558 variable is used, and
9560 <FONT SIZE=-1><B>EDITOR</B>
9564 <FONT SIZE=-1><B>FCEDIT</B>
9567 is not set. If neither variable is set,
9571 is used. When editing is complete, the edited commands are
9572 echoed and executed.
9574 In the second form, <I>command</I> is re-executed after each instance
9575 of <I>pat</I> is replaced by <I>rep</I>.
9576 A useful alias to use with this is
9582 runs the last command beginning with
9588 re-executes the last command.
9590 If the first form is used, the return value is 0 unless an invalid
9591 option is encountered or
9597 specify history lines out of range.
9601 option is supplied, the return value is the value of the last
9602 command executed or failure if an error occurs with the temporary
9603 file of commands. If the second form is used, the return status
9604 is that of the command re-executed, unless
9607 does not specify a valid history line, in which case
9611 <DT><B>fg</B> [<I>jobspec</I>]<DD>
9615 in the foreground, and make it the current job.
9619 is not present, the shell's notion of the <I>current job</I> is used.
9620 The return value is that of the command placed into the foreground,
9621 or failure if run when job control is disabled or, when run with
9622 job control enabled, if
9625 does not specify a valid job or
9628 specifies a job that was started without job control.
9629 <DT><B>getopts</B> <I>optstring</I> <I>name</I> [<I>args</I>]<DD>
9632 is used by shell procedures to parse positional parameters.
9635 contains the option characters to be recognized; if a character
9636 is followed by a colon, the option is expected to have an
9637 argument, which should be separated from it by white space.
9638 The colon and question mark characters may not be used as
9640 Each time it is invoked,
9643 places the next option in the shell variable
9649 if it does not exist,
9650 and the index of the next argument to be processed into the
9652 <FONT SIZE=-1><B>OPTIND</B>.
9655 <FONT SIZE=-1><B>OPTIND</B>
9658 is initialized to 1 each time the shell or a shell script
9659 is invoked. When an option requires an argument,
9662 places that argument into the variable
9663 <FONT SIZE=-1><B>OPTARG</B>.
9666 The shell does not reset
9667 <FONT SIZE=-1><B>OPTIND</B>
9670 automatically; it must be manually reset between multiple
9674 within the same shell invocation if a new set of parameters
9677 When the end of options is encountered, <B>getopts</B> exits with a
9678 return value greater than zero.
9679 <FONT SIZE=-1><B>OPTIND</B>
9682 is set to the index of the first non-option argument,
9683 and <B>name</B> is set to ?.
9687 normally parses the positional parameters, but if more arguments are
9693 parses those instead.
9697 can report errors in two ways. If the first character of
9703 error reporting is used. In normal operation diagnostic messages
9704 are printed when invalid options or missing option arguments are
9707 <FONT SIZE=-1><B>OPTERR</B>
9710 is set to 0, no error messages will be displayed, even if the first
9716 If an invalid option is seen,
9723 prints an error message and unsets
9724 <FONT SIZE=-1><B>OPTARG</B>.
9731 the option character found is placed in
9732 <FONT SIZE=-1><B>OPTARG</B>
9735 and no diagnostic message is printed.
9737 If a required argument is not found, and
9741 a question mark (<B>?</B>) is placed in
9744 <FONT SIZE=-1><B>OPTARG</B>
9747 is unset, and a diagnostic message is printed.
9751 is silent, then a colon (<B>:</B>) is placed in
9755 <FONT SIZE=-1><B>OPTARG</B>
9758 is set to the option character found.
9762 returns true if an option, specified or unspecified, is found.
9763 It returns false if the end of options is encountered or an
9765 <DT><B>hash</B> [<B>-lr</B>] [<B>-p</B> <I>filename</I>] [<B>-dt</B>] [<I>name</I>]<DD>
9769 the full file name of the command is determined by searching
9777 option is supplied, no path search is performed, and
9780 is used as the full file name of the command.
9784 option causes the shell to forget all
9785 remembered locations.
9789 option causes the shell to forget the remembered location of each <I>name</I>.
9793 option is supplied, the full pathname to which each <I>name</I> corresponds
9794 is printed. If multiple <I>name</I> arguments are supplied with <B>-t</B>,
9795 the <I>name</I> is printed before the hashed full pathname.
9799 option causes output to be displayed in a format that may be reused as input.
9800 If no arguments are given, or if only <B>-l</B> is supplied,
9801 information about remembered commands is printed.
9802 The return status is true unless a
9805 is not found or an invalid option is supplied.
9806 <DT><B>help</B> [<B>-dms</B>] [<I>pattern</I>]<DD>
9807 Display helpful information about builtin commands. If
9813 gives detailed help on all commands matching
9816 otherwise help for all the builtins and shell control structures
9818 <DL COMPACT><DT><DD>
9824 Display a short description of each <I>pattern</I>
9828 Display the description of each <I>pattern</I> in a manpage-like format
9832 Display only a short usage synopsis for each <I>pattern</I>
9836 The return status is 0 unless no command matches
9839 <DT><B>history [</B><I>n</I>]<DD>
9841 <DT><B>history</B> <B>-c</B><DD>
9842 <DT><B>history -d</B> <I>offset</I><DD>
9843 <DT><B>history</B> <B>-anrw</B> [<I>filename</I>]<DD>
9844 <DT><B>history</B> <B>-p</B> <I>arg</I> [<I>arg ...</I>]<DD>
9845 <DT><B>history</B> <B>-s</B> <I>arg</I> [<I>arg ...</I>]<DD>
9847 With no options, display the command
9848 history list with line numbers. Lines listed
9852 have been modified. An argument of
9859 If the shell variable
9860 <FONT SIZE=-1><B>HISTTIMEFORMAT</B>
9863 is set and not null,
9864 it is used as a format string for <I>strftime</I>(3) to display
9865 the time stamp associated with each displayed history entry.
9866 No intervening blank is printed between the formatted time stamp
9867 and the history line.
9868 If <I>filename</I> is supplied, it is used as the
9869 name of the history file; if not, the value of
9870 <FONT SIZE=-1><B>HISTFILE</B>
9873 is used. Options, if supplied, have the following meanings:
9874 <DL COMPACT><DT><DD>
9880 Clear the history list by deleting all the entries.
9881 <DT><B>-d</B> <I>offset</I><DD>
9882 Delete the history entry at position <I>offset</I>.
9886 Append the ``new'' history lines (history lines entered since the
9887 beginning of the current <B>bash</B> session) to the history file.
9891 Read the history lines not already read from the history
9892 file into the current history list. These are lines
9893 appended to the history file since the beginning of the
9894 current <B>bash</B> session.
9898 Read the contents of the history file
9899 and use them as the current history.
9903 Write the current history to the history file, overwriting the
9904 history file's contents.
9908 Perform history substitution on the following <I>args</I> and display
9909 the result on the standard output.
9910 Does not store the results in the history list.
9911 Each <I>arg</I> must be quoted to disable normal history expansion.
9918 in the history list as a single entry. The last command in the
9919 history list is removed before the
9928 <FONT SIZE=-1><B>HISTTIMEFORMAT</B>
9931 variable is set, the time stamp information
9932 associated with each history entry is written to the history file,
9933 marked with the history comment character.
9934 When the history file is read, lines beginning with the history
9935 comment character followed immediately by a digit are interpreted
9936 as timestamps for the previous history line.
9937 The return value is 0 unless an invalid option is encountered, an
9938 error occurs while reading or writing the history file, an invalid
9939 <I>offset</I> is supplied as an argument to <B>-d</B>, or the
9940 history expansion supplied as an argument to <B>-p</B> fails.
9943 <DT><B>jobs</B> [<B>-lnprs</B>] [ <I>jobspec</I> ... ]<DD>
9945 <DT><B>jobs</B> <B>-x</B> <I>command</I> [ <I>args</I> ... ]<DD>
9947 The first form lists the active jobs. The options have the following
9949 <DL COMPACT><DT><DD>
9956 in addition to the normal information.
9960 List only the process ID of the job's process group
9965 Display information only about jobs that have changed status since
9966 the user was last notified of their status.
9970 Restrict output to running jobs.
9974 Restrict output to stopped jobs.
9982 is given, output is restricted to information about that job.
9983 The return status is 0 unless an invalid option is encountered
10005 with the corresponding process group ID, and executes
10011 returning its exit status.
10014 <DT><B>kill</B> [<B>-s</B> <I>sigspec</I> | <B>-n</B> <I>signum</I> | <B>-</B><I>sigspec</I>] [<I>pid</I> | <I>jobspec</I>] ...<DD>
10016 <DT><B>kill</B> <B>-l</B> [<I>sigspec</I> | <I>exit_status</I>]<DD>
10018 Send the signal named by
10024 to the processes named by
10032 is either a case-insensitive signal name such as
10033 <FONT SIZE=-1><B>SIGKILL</B>
10036 (with or without the
10037 <FONT SIZE=-1><B>SIG</B>
10040 prefix) or a signal number;
10043 is a signal number.
10047 is not present, then
10048 <FONT SIZE=-1><B>SIGTERM</B>
10055 lists the signal names.
10056 If any arguments are supplied when
10059 is given, the names of the signals corresponding to the arguments are
10060 listed, and the return status is 0.
10061 The <I>exit_status</I> argument to
10064 is a number specifying either a signal number or the exit status of
10065 a process terminated by a signal.
10068 returns true if at least one signal was successfully sent, or false
10069 if an error occurs or an invalid option is encountered.
10070 <DT><B>let</B> <I>arg</I> [<I>arg</I> ...]<DD>
10074 is an arithmetic expression to be evaluated (see
10075 <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>
10085 returns 1; 0 is returned otherwise.
10086 <DT><B>local</B> [<I>option</I>] [<I>name</I>[=<I>value</I>] ...]<DD>
10087 For each argument, a local variable named
10090 is created, and assigned
10093 The <I>option</I> can be any of the options accepted by <B>declare</B>.
10097 is used within a function, it causes the variable
10100 to have a visible scope restricted to that function and its children.
10104 writes a list of local variables to the standard output. It is
10108 when not within a function. The return status is 0 unless
10111 is used outside a function, an invalid
10115 <I>name</I> is a readonly variable.
10119 Exit a login shell.
10120 <DT><B>mapfile</B> [<B>-n</B> <I>count</I>] [<B>-O</B> <I>origin</I>] [<B>-s</B> <I>count</I>] [<B>-t</B>] [<B>-u</B> <I>fd</I>] [<B>-C</B> <I>callback</I>] [<B>-c</B> <I>quantum</I>] [<I>array</I>]<DD>
10122 <DT><B>readarray</B> [<B>-n</B> <I>count</I>] [<B>-O</B> <I>origin</I>] [<B>-s</B> <I>count</I>] [<B>-t</B>] [<B>-u</B> <I>fd</I>] [<B>-C</B> <I>callback</I>] [<B>-c</B> <I>quantum</I>] [<I>array</I>]<DD>
10124 Read lines from the standard input into the indexed array variable
10127 or from file descriptor
10133 option is supplied.
10135 <FONT SIZE=-1><B>MAPFILE</B>
10138 is the default <I>array</I>.
10139 Options, if supplied, have the following meanings:
10140 <DL COMPACT><DT><DD>
10149 lines. If <I>count</I> is 0, all lines are copied.
10159 The default index is 0.
10163 Discard the first <I>count</I> lines read.
10167 Remove a trailing newline from each line read.
10171 Read lines from file descriptor <I>fd</I> instead of the standard input.
10178 each time <I>quantum</I> lines are read. The <B>-c</B> option specifies
10184 Specify the number of lines read between each call to
10194 is specified without
10197 the default quantum is 5000.
10198 When <I>callback</I> is evaluated, it is supplied the index of the next
10199 array element to be assigned as an additional argument.
10200 <I>callback</I> is evaluated after the line is read but before the
10201 array element is assigned.
10204 If not supplied with an explicit origin, <B>mapfile</B> will clear <I>array</I>
10205 before assigning to it.
10208 <B>mapfile</B> returns successfully unless an invalid option or option
10209 argument is supplied, <I>array</I> is invalid or unassignable, or if
10210 <I>array</I> is not an indexed array.
10213 <DT><B>popd</B> [-<B>n</B>] [+<I>n</I>] [-<I>n</I>]<DD>
10214 Removes entries from the directory stack. With no arguments,
10215 removes the top directory from the stack, and performs a
10218 to the new top directory.
10219 Arguments, if supplied, have the following meanings:
10220 <DL COMPACT><DT><DD>
10226 Suppresses the normal change of directory when removing directories
10227 from the stack, so that only the stack is manipulated.
10228 <DT><B>+</B><I>n</I><DD>
10229 Removes the <I>n</I>th entry counting from the left of the list
10233 starting with zero. For example:
10236 removes the first directory,
10240 <DT><B>-</B><I>n</I><DD>
10241 Removes the <I>n</I>th entry counting from the right of the list
10245 starting with zero. For example:
10248 removes the last directory,
10259 command is successful, a
10262 is performed as well, and the return status is 0.
10265 returns false if an invalid option is encountered, the directory stack
10266 is empty, a non-existent directory stack entry is specified, or the
10267 directory change fails.
10270 <DT><B>printf</B> [<B>-v</B> <I>var</I>] <I>format</I> [<I>arguments</I>]<DD>
10271 Write the formatted <I>arguments</I> to the standard output under the
10272 control of the <I>format</I>.
10273 The <I>format</I> is a character string which contains three types of objects:
10274 plain characters, which are simply copied to standard output, character
10275 escape sequences, which are converted and copied to the standard output, and
10276 format specifications, each of which causes printing of the next successive
10278 In addition to the standard <I>printf</I>(1) formats, <B>%b</B> causes
10279 <B>printf</B> to expand backslash escape sequences in the corresponding
10280 <I>argument</I> (except that <B>\c</B> terminates output, backslashes in
10281 <B>\aq</B>, <B>\"</B>, and <B>\?</B> are not removed, and octal escapes
10282 beginning with <B>\0</B> may contain up to four digits),
10283 and <B>%q</B> causes <B>printf</B> to output the corresponding
10284 <I>argument</I> in a format that can be reused as shell input.
10286 The <B>-v</B> option causes the output to be assigned to the variable
10287 <I>var</I> rather than being printed to the standard output.
10289 The <I>format</I> is reused as necessary to consume all of the <I>arguments</I>.
10290 If the <I>format</I> requires more <I>arguments</I> than are supplied, the
10291 extra format specifications behave as if a zero value or null string, as
10292 appropriate, had been supplied. The return value is zero on success,
10293 non-zero on failure.
10294 <DT><B>pushd</B> [<B>-n</B>] [+<I>n</I>] [-<I>n</I>]<DD>
10296 <DT><B>pushd</B> [<B>-n</B>] [<I>dir</I>]<DD>
10298 Adds a directory to the top of the directory stack, or rotates
10299 the stack, making the new top of the stack the current working
10300 directory. With no arguments, exchanges the top two directories
10301 and returns 0, unless the directory stack is empty.
10302 Arguments, if supplied, have the following meanings:
10303 <DL COMPACT><DT><DD>
10309 Suppresses the normal change of directory when adding directories
10310 to the stack, so that only the stack is manipulated.
10311 <DT><B>+</B><I>n</I><DD>
10312 Rotates the stack so that the <I>n</I>th directory
10313 (counting from the left of the list shown by
10316 starting with zero)
10318 <DT><B>-</B><I>n</I><DD>
10319 Rotates the stack so that the <I>n</I>th directory
10320 (counting from the right of the list shown by
10323 starting with zero) is at the top.
10330 to the directory stack at the top, making it the
10331 new current working directory.
10339 command is successful, a
10342 is performed as well.
10343 If the first form is used,
10346 returns 0 unless the cd to
10349 fails. With the second form,
10352 returns 0 unless the directory stack is empty,
10353 a non-existent directory stack element is specified,
10354 or the directory change to the specified new current directory
10358 <DT><B>pwd</B> [<B>-LP</B>]<DD>
10359 Print the absolute pathname of the current working directory.
10360 The pathname printed contains no symbolic links if the
10363 option is supplied or the
10369 builtin command is enabled.
10373 option is used, the pathname printed may contain symbolic links.
10374 The return status is 0 unless an error occurs while
10375 reading the name of the current directory or an
10376 invalid option is supplied.
10377 <DT><B>read</B> [<B>-ers</B>] [<B>-a</B> <I>aname</I>] [<B>-d</B> <I>delim</I>] [<B>-i</B> <I>text</I>] [<B>-n</B> <I>nchars</I>] [<B>-N</B> <I>nchars</I>] [<B>-p</B> <I>prompt</I>] [<B>-t</B> <I>timeout</I>] [<B>-u</B> <I>fd</I>] [<I>name</I> ...]<DD>
10378 One line is read from the standard input, or from the file descriptor
10379 <I>fd</I> supplied as an argument to the <B>-u</B> option, and the first word
10380 is assigned to the first
10383 the second word to the second
10386 and so on, with leftover words and their intervening separators assigned
10390 If there are fewer words read from the input stream than names,
10391 the remaining names are assigned empty values.
10393 <FONT SIZE=-1><B>IFS</B>
10396 are used to split the line into words.
10397 The backslash character (<B>\</B>) may be used to remove any special
10398 meaning for the next character read and for line continuation.
10399 Options, if supplied, have the following meanings:
10400 <DL COMPACT><DT><DD>
10403 <DT><B>-a </B><I>aname</I>
10406 The words are assigned to sequential indices
10407 of the array variable
10413 is unset before any new values are assigned.
10414 Other <I>name</I> arguments are ignored.
10415 <DT><B>-d </B><I>delim</I>
10418 The first character of <I>delim</I> is used to terminate the input line,
10419 rather than newline.
10423 If the standard input
10424 is coming from a terminal,
10428 <FONT SIZE=-1><B>READLINE</B>
10431 above) is used to obtain the line.
10432 Readline uses the current (or default, if line editing was not previously
10433 active) editing settings.
10434 <DT><B>-i </B><I>text</I>
10440 is being used to read the line, <I>text</I> is placed into the editing
10441 buffer before editing begins.
10442 <DT><B>-n </B><I>nchars</I>
10445 <B>read</B> returns after reading <I>nchars</I> characters rather than
10446 waiting for a complete line of input, but honor a delimiter if fewer
10447 than <I>nchars</I> characters are read before the delimiter.
10448 <DT><B>-N </B><I>nchars</I>
10451 <B>read</B> returns after reading exactly <I>nchars</I> characters rather
10452 than waiting for a complete line of input, unless EOF is encountered or
10453 <B>read</B> times out.
10454 Delimiter characters encountered in the input are
10455 not treated specially and do not cause <B>read</B> to return until
10456 <I>nchars</I> characters are read.
10457 <DT><B>-p </B><I>prompt</I>
10460 Display <I>prompt</I> on standard error, without a
10461 trailing newline, before attempting to read any input. The prompt
10462 is displayed only if input is coming from a terminal.
10466 Backslash does not act as an escape character.
10467 The backslash is considered to be part of the line.
10468 In particular, a backslash-newline pair may not be used as a line
10473 Silent mode. If input is coming from a terminal, characters are
10475 <DT><B>-t </B><I>timeout</I>
10478 Cause <B>read</B> to time out and return failure if a complete line of
10479 input is not read within <I>timeout</I> seconds.
10480 <I>timeout</I> may be a decimal number with a fractional portion following
10482 This option is only effective if <B>read</B> is reading input from a
10483 terminal, pipe, or other special file; it has no effect when reading
10484 from regular files.
10485 If <I>timeout</I> is 0, <B>read</B> returns success if input is available on
10486 the specified file descriptor, failure otherwise.
10487 The exit status is greater than 128 if the timeout is exceeded.
10488 <DT><B>-u </B><I>fd</I>
10491 Read input from file descriptor <I>fd</I>.
10499 are supplied, the line read is assigned to the variable
10500 <FONT SIZE=-1><B>REPLY</B>.
10503 The return code is zero, unless end-of-file is encountered, <B>read</B>
10504 times out (in which case the return code is greater than 128), or an
10505 invalid file descriptor is supplied as the argument to <B>-u</B>.
10508 <DT><B>readonly</B> [<B>-aApf</B>] [<I>name</I>[=<I>word</I>] ...]<DD>
10511 <I>names</I> are marked readonly; the values of these
10514 may not be changed by subsequent assignment.
10518 option is supplied, the functions corresponding to the
10519 <I>names</I> are so
10524 option restricts the variables to indexed arrays; the
10527 option restricts the variables to associative arrays.
10531 arguments are given, or if the
10534 option is supplied, a list of all readonly names is printed.
10538 option causes output to be displayed in a format that
10539 may be reused as input.
10540 If a variable name is followed by =<I>word</I>, the value of
10541 the variable is set to <I>word</I>.
10542 The return status is 0 unless an invalid option is encountered,
10546 is not a valid shell variable name, or
10552 that is not a function.
10553 <DT><B>return</B> [<I>n</I>]<DD>
10554 Causes a function to exit with the return value specified by
10560 is omitted, the return status is that of the last command
10561 executed in the function body. If used outside a function,
10562 but during execution of a script by the
10565 (<B>source</B>) command, it causes the shell to stop executing
10566 that script and return either
10569 or the exit status of the last command executed within the
10570 script as the exit status of the script. If used outside a
10571 function and not during execution of a script by <B>.</B>,
10572 the return status is false.
10573 Any command associated with the <B>RETURN</B> trap is executed
10574 before execution resumes after the function or script.
10575 <DT><B>set</B> [<B>--abefhkmnptuvxBCEHPT</B>] [<B>-o</B> <I>option</I>] [<I>arg</I> ...]<DD>
10577 <DT><B>set</B> [<B>+abefhkmnptuvxBCEHPT</B>] [<B>+o</B> <I>option</I>] [<I>arg</I> ...]<DD>
10579 Without options, the name and value of each shell variable are displayed
10580 in a format that can be reused as input
10581 for setting or resetting the currently-set variables.
10582 Read-only variables cannot be reset.
10583 In <I>posix mode</I>, only shell variables are listed.
10584 The output is sorted according to the current locale.
10585 When options are specified, they set or unset shell attributes.
10586 Any arguments remaining after option processing are treated
10587 as values for the positional parameters and are assigned, in order, to
10596 Options, if specified, have the following meanings:
10597 <DL COMPACT><DT><DD>
10603 Automatically mark variables and functions which are modified or
10604 created for export to the environment of subsequent commands.
10608 Report the status of terminated background jobs
10609 immediately, rather than before the next primary prompt. This is
10610 effective only when job control is enabled.
10614 Exit immediately if a <I>pipeline</I> (which may consist of a single
10615 <I>simple command</I>), a <I>subshell</I> command enclosed in parentheses,
10616 or one of the commands executed as part of a command list enclosed
10618 <FONT SIZE=-1><B>SHELL GRAMMAR</B>
10621 above) exits with a non-zero status.
10622 The shell does not exit if the
10623 command that fails is part of the command list immediately following a
10630 part of the test following the
10636 reserved words, part of any command executed in a
10642 list except the command following the final <B>&&</B> or <B>||</B>,
10643 any command in a pipeline but the last,
10644 or if the command's return value is
10645 being inverted with
10648 A trap on <B>ERR</B>, if set, is executed before the shell exits.
10649 This option applies to the shell environment and each subshell environment
10651 <FONT SIZE=-1><B>COMMAND EXECUTION ENVIRONMENT</B>
10654 above), and may cause
10655 subshells to exit before executing all the commands in the subshell.
10659 Disable pathname expansion.
10663 Remember the location of commands as they are looked up for execution.
10664 This is enabled by default.
10668 All arguments in the form of assignment statements
10669 are placed in the environment for a command, not just
10670 those that precede the command name.
10674 Monitor mode. Job control is enabled. This option is on
10675 by default for interactive shells on systems that support
10677 <FONT SIZE=-1><B>JOB CONTROL</B>
10680 above). Background processes run in a separate process
10681 group and a line containing their exit status is printed
10682 upon their completion.
10686 Read commands but do not execute them. This may be used to
10687 check a shell script for syntax errors. This is ignored by
10688 interactive shells.
10689 <DT><B>-o </B><I>option-name</I>
10692 The <I>option-name</I> can be one of the following:
10693 <DL COMPACT><DT><DD>
10695 <DT><B>allexport</B>
10701 <DT><B>braceexpand</B>
10710 Use an emacs-style command line editing interface. This is enabled
10711 by default when the shell is interactive, unless the shell is started
10716 This also affects the editing interface used for <B>read -e</B>.
10723 <DT><B>errtrace</B>
10729 <DT><B>functrace</B>
10741 <DT><B>histexpand</B>
10750 Enable command history, as described above under
10751 <FONT SIZE=-1><B>HISTORY</B>.
10754 This option is on by default in interactive shells.
10755 <DT><B>ignoreeof</B>
10758 The effect is as if the shell command
10759 <TT>IGNOREEOF=10</TT>
10763 <B>Shell Variables</B>
10778 <DT><B>noclobber</B>
10818 <DT><B>physical</B>
10824 <DT><B>pipefail</B>
10827 If set, the return value of a pipeline is the value of the last
10828 (rightmost) command to exit with a non-zero status, or zero if all
10829 commands in the pipeline exit successfully.
10830 This option is disabled by default.
10834 Change the behavior of
10837 where the default operation differs
10838 from the POSIX standard to match the standard (<I>posix mode</I>).
10839 <DT><B>privileged</B>
10854 Use a vi-style command line editing interface.
10855 This also affects the editing interface used for <B>read -e</B>.
10869 is supplied with no <I>option-name</I>, the values of the current options are
10874 is supplied with no <I>option-name</I>, a series of
10877 commands to recreate the current option settings is displayed on
10878 the standard output.
10887 mode. In this mode, the
10888 <FONT SIZE=-1><B>$ENV</B>
10892 <FONT SIZE=-1><B>$BASH_ENV</B>
10895 files are not processed, shell functions are not inherited from the
10896 environment, and the
10897 <FONT SIZE=-1><B>SHELLOPTS</B>,
10900 <FONT SIZE=-1><B>BASHOPTS</B>,
10903 <FONT SIZE=-1><B>CDPATH</B>,
10907 <FONT SIZE=-1><B>GLOBIGNORE</B>
10910 variables, if they appear in the environment, are ignored.
10911 If the shell is started with the effective user (group) id not equal to the
10912 real user (group) id, and the <B>-p</B> option is not supplied, these actions
10913 are taken and the effective user id is set to the real user id.
10914 If the <B>-p</B> option is supplied at startup, the effective user id is
10916 Turning this option off causes the effective user
10917 and group ids to be set to the real user and group ids.
10921 Exit after reading and executing one command.
10925 Treat unset variables and parameters other than the special
10926 parameters "@" and "*" as an error when performing
10927 parameter expansion. If expansion is attempted on an
10928 unset variable or parameter, the shell prints an error message, and,
10929 if not interactive, exits with a non-zero status.
10933 Print shell input lines as they are read.
10937 After expanding each <I>simple command</I>,
10938 <B>for</B> command, <B>case</B> command, <B>select</B> command, or
10939 arithmetic <B>for</B> command, display the expanded value of
10940 <FONT SIZE=-1><B>PS4</B>,
10943 followed by the command and its expanded arguments
10944 or associated word list.
10948 The shell performs brace expansion (see
10949 <B>Brace Expansion</B>
10951 above). This is on by default.
10958 does not overwrite an existing file with the
10966 redirection operators. This may be overridden when
10967 creating output files by using the redirection operator
10976 If set, any trap on <B>ERR</B> is inherited by shell functions, command
10977 substitutions, and commands executed in a subshell environment.
10978 The <B>ERR</B> trap is normally not inherited in such cases.
10985 style history substitution. This option is on by
10986 default when the shell is interactive.
10990 If set, the shell does not follow symbolic links when executing
10994 that change the current working directory. It uses the
10995 physical directory structure instead. By default,
10998 follows the logical chain of directories when performing commands
10999 which change the current directory.
11003 If set, any traps on <B>DEBUG</B> and <B>RETURN</B> are inherited by shell
11004 functions, command substitutions, and commands executed in a
11005 subshell environment.
11006 The <B>DEBUG</B> and <B>RETURN</B> traps are normally not inherited
11011 If no arguments follow this option, then the positional parameters are
11012 unset. Otherwise, the positional parameters are set to the
11013 <I>arg</I>s, even if some of them begin with a
11019 Signal the end of options, cause all remaining <I>arg</I>s to be
11020 assigned to the positional parameters. The
11026 options are turned off.
11027 If there are no <I>arg</I>s,
11028 the positional parameters remain unchanged.
11033 The options are off by default unless otherwise noted.
11034 Using + rather than - causes these options to be turned off.
11035 The options can also be specified as arguments to an invocation of
11037 The current set of options may be found in
11040 The return status is always true unless an invalid option is encountered.
11043 <DT><B>shift</B> [<I>n</I>]<DD>
11044 The positional parameters from <I>n</I>+1 ... are renamed to
11049 Parameters represented by the numbers <B>$#</B>
11050 down to <B>$#</B>-<I>n</I>+1 are unset.
11053 must be a non-negative number less than or equal to <B>$#</B>.
11057 is 0, no parameters are changed.
11061 is not given, it is assumed to be 1.
11065 is greater than <B>$#</B>, the positional parameters are not changed.
11066 The return status is greater than zero if
11072 or less than zero; otherwise 0.
11073 <DT><B>shopt</B> [<B>-pqsu</B>] [<B>-o</B>] [<I>optname</I> ...]<DD>
11074 Toggle the values of variables controlling optional shell behavior.
11075 With no options, or with the
11078 option, a list of all settable options is displayed, with
11079 an indication of whether or not each is set.
11080 The <B>-p</B> option causes output to be displayed in a form that
11081 may be reused as input.
11082 Other options have the following meanings:
11083 <DL COMPACT><DT><DD>
11089 Enable (set) each <I>optname</I>.
11093 Disable (unset) each <I>optname</I>.
11097 Suppresses normal output (quiet mode); the return status indicates
11098 whether the <I>optname</I> is set or unset.
11099 If multiple <I>optname</I> arguments are given with
11102 the return status is zero if all <I>optnames</I> are enabled; non-zero
11107 Restricts the values of <I>optname</I> to be those defined for the
11124 is used with no <I>optname</I> arguments, the display is limited to
11125 those options which are set or unset, respectively.
11126 Unless otherwise noted, the <B>shopt</B> options are disabled (unset)
11130 The return status when listing options is zero if all <I>optnames</I>
11131 are enabled, non-zero otherwise. When setting or unsetting options,
11132 the return status is zero unless an <I>optname</I> is not a valid shell
11136 The list of <B>shopt</B> options is:
11145 If set, a command name that is the name of a directory is executed as if
11146 it were the argument to the <B>cd</B> command.
11147 This option is only used by interactive shells.
11148 <DT><B>cdable_vars</B>
11151 If set, an argument to the
11154 builtin command that
11155 is not a directory is assumed to be the name of a variable whose
11156 value is the directory to change to.
11160 If set, minor errors in the spelling of a directory component in a
11163 command will be corrected.
11164 The errors checked for are transposed characters,
11165 a missing character, and one character too many.
11166 If a correction is found, the corrected file name is printed,
11167 and the command proceeds.
11168 This option is only used by interactive shells.
11169 <DT><B>checkhash</B>
11172 If set, <B>bash</B> checks that a command found in the hash
11173 table exists before trying to execute it. If a hashed command no
11174 longer exists, a normal path search is performed.
11175 <DT><B>checkjobs</B>
11178 If set, <B>bash</B> lists the status of any stopped and running jobs before
11179 exiting an interactive shell. If any jobs are running, this causes
11180 the exit to be deferred until a second exit is attempted without an
11181 intervening command (see
11182 <FONT SIZE=-1><B>JOB CONTROL</B>
11185 above). The shell always
11186 postpones exiting if any jobs are stopped.
11187 <DT><B>checkwinsize</B>
11190 If set, <B>bash</B> checks the window size after each command
11191 and, if necessary, updates the values of
11192 <FONT SIZE=-1><B>LINES</B>
11196 <FONT SIZE=-1><B>COLUMNS</B>.
11205 attempts to save all lines of a multiple-line
11206 command in the same history entry. This allows
11207 easy re-editing of multi-line commands.
11208 <DT><B>compat31</B>
11214 changes its behavior to that of version 3.1 with respect to quoted
11215 arguments to the conditional command's =~ operator.
11216 <DT><B>compat32</B>
11222 changes its behavior to that of version 3.2 with respect to locale-specific
11223 string comparison when using the conditional command's < and > operators.
11224 <DT><B>compat40</B>
11230 changes its behavior to that of version 4.0 with respect to locale-specific
11231 string comparison when using the conditional command's < and > operators
11232 and the effect of interrupting a command list.
11233 <DT><B>dirspell</B>
11239 attempts spelling correction on directory names during word completion
11240 if the directory name initially supplied does not exist.
11247 includes filenames beginning with a `.' in the results of pathname
11249 <DT><B>execfail</B>
11252 If set, a non-interactive shell will not exit if
11253 it cannot execute the file specified as an argument to the
11256 builtin command. An interactive shell does not exit if
11260 <DT><B>expand_aliases</B>
11263 If set, aliases are expanded as described above under
11264 <FONT SIZE=-1><B>ALIASES</B>.
11267 This option is enabled by default for interactive shells.
11268 <DT><B>extdebug</B>
11271 If set, behavior intended for use by debuggers is enabled:
11272 <DL COMPACT><DT><DD>
11277 The <B>-F</B> option to the <B>declare</B> builtin displays the source
11278 file name and line number corresponding to each function name supplied
11283 If the command run by the <B>DEBUG</B> trap returns a non-zero value, the
11284 next command is skipped and not executed.
11288 If the command run by the <B>DEBUG</B> trap returns a value of 2, and the
11289 shell is executing in a subroutine (a shell function or a shell script
11290 executed by the <B>.</B> or <B>source</B> builtins), a call to
11291 <B>return</B> is simulated.
11295 <FONT SIZE=-1><B>BASH_ARGC</B>
11299 <FONT SIZE=-1><B>BASH_ARGV</B>
11302 are updated as described in their descriptions above.
11306 Function tracing is enabled: command substitution, shell functions, and
11307 subshells invoked with <B>(</B> <I>command</I> <B>)</B> inherit the
11308 <B>DEBUG</B> and <B>RETURN</B> traps.
11312 Error tracing is enabled: command substitution, shell functions, and
11313 subshells invoked with <B>(</B> <I>command</I> <B>)</B> inherit the
11320 If set, the extended pattern matching features described above under
11321 <B>Pathname Expansion</B> are enabled.
11322 <DT><B>extquote</B>
11325 If set, <B>$</B>aq<I>string</I>aq and <B>$</B>"<I>string</I>" quoting is
11326 performed within <B>${</B><I>parameter</I><B>}</B> expansions
11327 enclosed in double quotes. This option is enabled by default.
11328 <DT><B>failglob</B>
11331 If set, patterns which fail to match filenames during pathname expansion
11332 result in an expansion error.
11333 <DT><B>force_fignore</B>
11336 If set, the suffixes specified by the
11337 <FONT SIZE=-1><B>FIGNORE</B>
11341 cause words to be ignored when performing word completion even if
11342 the ignored words are the only possible completions.
11344 <FONT SIZE=-1><B>SHELL VARIABLES</B></FONT>
11345 above for a description of
11346 <FONT SIZE=-1><B>FIGNORE</B>.
11349 This option is enabled by default.
11350 <DT><B>globstar</B>
11353 If set, the pattern <B>**</B> used in a pathname expansion context will
11354 match a files and zero or more directories and subdirectories.
11355 If the pattern is followed by a <B>/</B>, only directories and
11356 subdirectories match.
11357 <DT><B>gnu_errfmt</B>
11360 If set, shell error messages are written in the standard GNU error
11362 <DT><B>histappend</B>
11365 If set, the history list is appended to the file named by the value
11367 <FONT SIZE=-1><B>HISTFILE</B>
11370 variable when the shell exits, rather than overwriting the file.
11371 <DT><B>histreedit</B>
11377 is being used, a user is given the opportunity to re-edit a
11378 failed history substitution.
11379 <DT><B>histverify</B>
11385 is being used, the results of history substitution are not immediately
11386 passed to the shell parser. Instead, the resulting line is loaded into
11387 the <B>readline</B> editing buffer, allowing further modification.
11388 <DT><B>hostcomplete</B>
11394 is being used, <B>bash</B> will attempt to perform hostname completion when a
11395 word containing a <B>@</B> is being completed (see
11399 <FONT SIZE=-1><B>READLINE</B>
11403 This is enabled by default.
11404 <DT><B>huponexit</B>
11407 If set, <B>bash</B> will send
11408 <FONT SIZE=-1><B>SIGHUP</B>
11411 to all jobs when an interactive login shell exits.
11412 <DT><B>interactive_comments</B>
11415 If set, allow a word beginning with
11418 to cause that word and all remaining characters on that
11419 line to be ignored in an interactive shell (see
11420 <FONT SIZE=-1><B>COMMENTS</B>
11423 above). This option is enabled by default.
11430 option is enabled, multi-line commands are saved to the history with
11431 embedded newlines rather than using semicolon separators where possible.
11432 <DT><B>login_shell</B>
11435 The shell sets this option if it is started as a login shell (see
11436 <FONT SIZE=-1><B>INVOCATION</B>
11440 The value may not be changed.
11441 <DT><B>mailwarn</B>
11444 If set, and a file that <B>bash</B> is checking for mail has been
11445 accessed since the last time it was checked, the message ``The mail in
11446 <I>mailfile</I> has been read'' is displayed.
11447 <DT><B>no_empty_cmd_completion</B>
11456 will not attempt to search the
11457 <FONT SIZE=-1><B>PATH</B>
11460 for possible completions when
11461 completion is attempted on an empty line.
11462 <DT><B>nocaseglob</B>
11468 matches filenames in a case-insensitive fashion when performing pathname
11470 <B>Pathname Expansion</B>
11473 <DT><B>nocasematch</B>
11479 matches patterns in a case-insensitive fashion when performing matching
11480 while executing <B>case</B> or <B>[[</B> conditional commands.
11481 <DT><B>nullglob</B>
11487 allows patterns which match no
11489 <B>Pathname Expansion</B>
11492 to expand to a null string, rather than themselves.
11493 <DT><B>progcomp</B>
11496 If set, the programmable completion facilities (see
11497 <B>Programmable Completion</B> above) are enabled.
11498 This option is enabled by default.
11499 <DT><B>promptvars</B>
11502 If set, prompt strings undergo
11503 parameter expansion, command substitution, arithmetic
11504 expansion, and quote removal after being expanded as described in
11505 <FONT SIZE=-1><B>PROMPTING</B>
11508 above. This option is enabled by default.
11509 <DT><B>restricted_shell</B>
11512 The shell sets this option if it is started in restricted mode (see
11513 <FONT SIZE=-1><B>RESTRICTED SHELL</B>
11517 The value may not be changed.
11518 This is not reset when the startup files are executed, allowing
11519 the startup files to discover whether or not a shell is restricted.
11520 <DT><B>shift_verbose</B>
11526 builtin prints an error message when the shift count exceeds the
11527 number of positional parameters.
11528 <DT><B>sourcepath</B>
11532 <B>source</B> (<B>.</B>) builtin uses the value of
11533 <FONT SIZE=-1><B>PATH</B>
11536 to find the directory containing the file supplied as an argument.
11537 This option is enabled by default.
11538 <DT><B>xpg_echo</B>
11541 If set, the <B>echo</B> builtin expands backslash-escape sequences
11545 <DT><B>suspend</B> [<B>-f</B>]<DD>
11546 Suspend the execution of this shell until it receives a
11547 <FONT SIZE=-1><B>SIGCONT</B>
11550 signal. A login shell cannot be suspended; the
11553 option can be used to override this and force the suspension.
11554 The return status is 0 unless the shell is a login shell and
11557 is not supplied, or if job control is not enabled.
11558 <DT><B>test</B> <I>expr</I><DD>
11560 <DT><B>[</B> <I>expr</I> <B>]</B><DD>
11561 Return a status of 0 or 1 depending on
11562 the evaluation of the conditional expression
11565 Each operator and operand must be a separate argument.
11566 Expressions are composed of the primaries described above under
11567 <FONT SIZE=-1><B>CONDITIONAL EXPRESSIONS</B>.
11570 <B>test</B> does not accept any options, nor does it accept and ignore
11571 an argument of <B>--</B> as signifying the end of options.
11575 Expressions may be combined using the following operators, listed
11576 in decreasing order of precedence.
11577 The evaluation depends on the number of arguments; see below.
11578 <DL COMPACT><DT><DD>
11581 <DT><B>! </B><I>expr</I>
11588 <DT><B>( </B><I>expr</I> )
11591 Returns the value of <I>expr</I>.
11592 This may be used to override the normal precedence of operators.
11593 <DT><I>expr1</I> -<B>a</B> <I>expr2</I><DD>
11601 <DT><I>expr1</I> -<B>o</B> <I>expr2</I><DD>
11613 <B>test</B> and <B>[</B> evaluate conditional
11614 expressions using a set of rules based on the number of arguments.
11620 <DT>0 arguments<DD>
11621 The expression is false.
11623 The expression is true if and only if the argument is not null.
11624 <DT>2 arguments<DD>
11625 If the first argument is <B>!</B>, the expression is true if and
11626 only if the second argument is null.
11627 If the first argument is one of the unary conditional operators listed above
11629 <FONT SIZE=-1><B>CONDITIONAL EXPRESSIONS</B>,
11632 the expression is true if the unary test is true.
11633 If the first argument is not a valid unary conditional operator, the expression
11635 <DT>3 arguments<DD>
11636 If the second argument is one of the binary conditional operators listed above
11638 <FONT SIZE=-1><B>CONDITIONAL EXPRESSIONS</B>,
11641 the result of the expression is the result of the binary test using
11642 the first and third arguments as operands.
11643 The <B>-a</B> and <B>-o</B> operators are considered binary operators
11644 when there are three arguments.
11645 If the first argument is <B>!</B>, the value is the negation of
11646 the two-argument test using the second and third arguments.
11647 If the first argument is exactly <B>(</B> and the third argument is
11648 exactly <B>)</B>, the result is the one-argument test of the second
11650 Otherwise, the expression is false.
11651 <DT>4 arguments<DD>
11652 If the first argument is <B>!</B>, the result is the negation of
11653 the three-argument expression composed of the remaining arguments.
11654 Otherwise, the expression is parsed and evaluated according to
11655 precedence using the rules listed above.
11656 <DT>5 or more arguments<DD>
11657 The expression is parsed and evaluated according to precedence
11658 using the rules listed above.
11665 Print the accumulated user and system times for the shell and
11666 for processes run from the shell. The return status is 0.
11667 <DT><B>trap</B> [<B>-lp</B>] [[<I>arg</I>] <I>sigspec</I> ...]<DD>
11671 is to be read and executed when the shell receives
11678 is absent (and there is a single <I>sigspec</I>) or
11681 each specified signal is
11682 reset to its original disposition (the value it had
11683 upon entrance to the shell).
11687 is the null string the signal specified by each
11690 is ignored by the shell and by the commands it invokes.
11697 has been supplied, then the trap commands associated with each
11701 If no arguments are supplied or if only
11707 prints the list of commands associated with each signal.
11711 option causes the shell to print a list of signal names and
11712 their corresponding numbers.
11717 a signal name defined in <<I>signal.h</I>>, or a signal number.
11718 Signal names are case insensitive and the SIG prefix is optional.
11726 <FONT SIZE=-1><B>EXIT</B>
11732 is executed on exit from the shell.
11737 <FONT SIZE=-1><B>DEBUG</B>,
11743 is executed before every <I>simple command</I>, <I>for</I> command,
11744 <I>case</I> command, <I>select</I> command, every arithmetic <I>for</I>
11745 command, and before the first command executes in a shell function (see
11746 <FONT SIZE=-1><B>SHELL GRAMMAR</B>
11750 Refer to the description of the <B>extdebug</B> option to the
11751 <B>shopt</B> builtin for details of its effect on the <B>DEBUG</B> trap.
11756 <FONT SIZE=-1><B>RETURN</B>,
11762 is executed each time a shell function or a script executed with the
11763 <B>.</B> or <B>source</B> builtins finishes executing.
11771 <FONT SIZE=-1><B>ERR</B>,
11777 is executed whenever a simple command has a non-zero exit status,
11778 subject to the following conditions.
11780 <FONT SIZE=-1><B>ERR</B>
11783 trap is not executed if the failed
11784 command is part of the command list immediately following a
11791 part of the test in an
11794 statement, part of a command executed in a
11800 list, or if the command's return value is
11804 These are the same conditions obeyed by the <B>errexit</B> option.
11808 Signals ignored upon entry to the shell cannot be trapped or reset.
11809 Trapped signals that are not being ignored are reset to their original
11810 values in a subshell or subshell environment when one is created.
11811 The return status is false if any
11814 is invalid; otherwise
11818 <DT><B>type</B> [<B>-aftpP</B>] <I>name</I> [<I>name</I> ...]<DD>
11823 would be interpreted if used as a command name.
11830 prints a string which is one of
11845 is an alias, shell reserved word, function, builtin, or disk file,
11850 is not found, then nothing is printed, and an exit status of false
11858 either returns the name of the disk file
11859 that would be executed if
11862 were specified as a command name,
11864 <TT>type -t name</TT>
11873 <FONT SIZE=-1><B>PATH</B>
11876 search for each <I>name</I>, even if
11877 <TT>type -t name</TT>
11882 If a command is hashed,
11888 print the hashed value, not necessarily the file that appears
11890 <FONT SIZE=-1><B>PATH</B>.
11899 prints all of the places that contain
11900 an executable named
11903 This includes aliases and functions,
11907 option is not also used.
11908 The table of hashed commands is not consulted
11915 option suppresses shell function lookup, as with the <B>command</B> builtin.
11918 returns true if all of the arguments are found, false if
11920 <DT><B>ulimit</B> [<B>-HSTabcdefilmnpqrstuvx</B> [<I>limit</I>]]<DD>
11921 Provides control over the resources available to the shell and to
11922 processes started by it, on systems that allow such control.
11923 The <B>-H</B> and <B>-S</B> options specify that the hard or soft limit is
11924 set for the given resource.
11925 A hard limit cannot be increased by a non-root user once it is set;
11926 a soft limit may be increased up to the value of the hard limit.
11927 If neither <B>-H</B> nor <B>-S</B> is specified, both the soft and hard
11932 can be a number in the unit specified for the resource
11933 or one of the special values
11941 which stand for the current hard limit, the current soft limit, and
11942 no limit, respectively.
11946 is omitted, the current value of the soft limit of the resource is
11947 printed, unless the <B>-H</B> option is given. When more than one
11948 resource is specified, the limit name and unit are printed before the value.
11949 Other options are interpreted as follows:
11950 <DL COMPACT><DT><DD>
11956 All current limits are reported
11960 The maximum socket buffer size
11964 The maximum size of core files created
11968 The maximum size of a process's data segment
11972 The maximum scheduling priority ("nice")
11976 The maximum size of files written by the shell and its children
11980 The maximum number of pending signals
11984 The maximum size that may be locked into memory
11988 The maximum resident set size (many systems do not honor this limit)
11992 The maximum number of open file descriptors (most systems do not
11993 allow this value to be set)
11997 The pipe size in 512-byte blocks (this may not be set)
12001 The maximum number of bytes in POSIX message queues
12005 The maximum real-time scheduling priority
12009 The maximum stack size
12013 The maximum amount of cpu time in seconds
12017 The maximum number of processes available to a single user
12021 The maximum amount of virtual memory available to the shell
12025 The maximum number of file locks
12029 The maximum number of threads
12037 is given, it is the new value of the specified resource (the
12040 option is display only).
12041 If no option is given, then
12044 is assumed. Values are in 1024-byte increments, except for
12047 which is in seconds,
12050 which is in units of 512-byte blocks,
12061 which are unscaled values.
12062 The return status is 0 unless an invalid option or argument is supplied,
12063 or an error occurs while setting a new limit.
12066 <DT><B>umask</B> [<B>-p</B>] [<B>-S</B>] [<I>mode</I>]<DD>
12067 The user file-creation mask is set to
12073 begins with a digit, it
12074 is interpreted as an octal number; otherwise
12075 it is interpreted as a symbolic mode mask similar
12076 to that accepted by
12082 is omitted, the current value of the mask is printed.
12086 option causes the mask to be printed in symbolic form; the
12087 default output is an octal number.
12091 option is supplied, and
12094 is omitted, the output is in a form that may be reused as input.
12095 The return status is 0 if the mode was successfully changed or if
12096 no <I>mode</I> argument was supplied, and false otherwise.
12097 <DT><B>unalias</B> [-<B>a</B>] [<I>name</I> ...]<DD>
12098 Remove each <I>name</I> from the list of defined aliases. If
12101 is supplied, all alias definitions are removed. The return
12102 value is true unless a supplied
12105 is not a defined alias.
12106 <DT><B>unset</B> [-<B>fv</B>] [<I>name</I> ...]<DD>
12110 remove the corresponding variable or function.
12111 If no options are supplied, or the
12114 option is given, each
12117 refers to a shell variable.
12118 Read-only variables may not be unset.
12125 refers to a shell function, and the function definition
12127 Each unset variable or function is removed from the environment
12128 passed to subsequent commands.
12130 <FONT SIZE=-1><B>COMP_WORDBREAKS</B>,
12133 <FONT SIZE=-1><B>RANDOM</B>,
12136 <FONT SIZE=-1><B>SECONDS</B>,
12139 <FONT SIZE=-1><B>LINENO</B>,
12142 <FONT SIZE=-1><B>HISTCMD</B>,
12145 <FONT SIZE=-1><B>FUNCNAME</B>,
12148 <FONT SIZE=-1><B>GROUPS</B>,
12152 <FONT SIZE=-1><B>DIRSTACK</B>
12155 are unset, they lose their special properties, even if they are
12156 subsequently reset. The exit status is true unless a
12160 <DT><B>wait</B> [<I>n ...</I>]<DD>
12161 Wait for each specified process and return its termination status.
12166 ID or a job specification; if a job spec is given, all processes
12167 in that job's pipeline are waited for. If
12170 is not given, all currently active child processes
12171 are waited for, and the return status is zero. If
12174 specifies a non-existent process or job, the return status is
12175 127. Otherwise, the return status is the exit status of the last
12176 process or job waited for.
12180 <A NAME="lbDC"> </A>
12181 <H3>RESTRICTED SHELL</H3>
12190 is started with the name
12196 option is supplied at invocation,
12197 the shell becomes restricted.
12198 A restricted shell is used to
12199 set up an environment more controlled than the standard shell.
12200 It behaves identically to
12203 with the exception that the following are disallowed or not performed:
12206 changing directories with <B>cd</B>
12208 setting or unsetting the values of
12209 <FONT SIZE=-1><B>SHELL</B>,
12212 <FONT SIZE=-1><B>PATH</B>,
12215 <FONT SIZE=-1><B>ENV</B>,
12219 <FONT SIZE=-1><B>BASH_ENV</B>
12223 specifying command names containing
12227 specifying a file name containing a
12230 as an argument to the
12235 Specifying a filename containing a slash as an argument to the
12243 importing function definitions from the shell environment at startup
12245 parsing the value of
12246 <FONT SIZE=-1><B>SHELLOPTS</B>
12249 from the shell environment at startup
12251 redirecting output using the >, >|, <>, >&, &>, and >> redirection operators
12256 builtin command to replace the shell with another command
12258 adding or deleting builtin commands with the
12269 Using the <B>enable</B> builtin command to enable disabled shell builtins
12279 turning off restricted mode with
12280 <B>set +r</B> or <B>set +o restricted</B>.
12284 These restrictions are enforced after any startup files are read.
12288 When a command that is found to be a shell script is executed
12290 <FONT SIZE=-1><B>COMMAND EXECUTION</B>
12298 turns off any restrictions in the shell spawned to execute the
12302 <A NAME="lbDD"> </A>
12307 <DT><I>Bash Reference Manual</I>, Brian Fox and Chet Ramey<DD>
12308 <DT><I>The Gnu Readline Library</I>, Brian Fox and Chet Ramey<DD>
12309 <DT><I>The Gnu History Library</I>, Brian Fox and Chet Ramey<DD>
12310 <DT><I>Portable Operating System Interface (POSIX) Part 2: Shell and Utilities</I>, IEEE<DD>
12311 <DT><I>sh</I>(1), <I>ksh</I>(1), <I>csh</I>(1)<DD>
12312 <DT><I>emacs</I>(1), <I>vi</I>(1)<DD>
12313 <DT><I>readline</I>(3)<DD>
12316 <A NAME="lbDE"> </A>
12322 <A HREF="file:/bin/bash"><I>/bin/bash</I></A>
12325 The <B>bash</B> executable
12327 <A HREF="file:/etc/profile"><I>/etc/profile</I></A>
12330 The systemwide initialization file, executed for login shells
12332 <A HREF="file:~/.bash_profile"><I>~/.bash_profile</I></A>
12335 The personal initialization file, executed for login shells
12337 <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>
12340 The individual per-interactive-shell startup file
12342 <A HREF="file:~/.bash_logout"><I>~/.bash_logout</I></A>
12345 The individual login shell cleanup file, executed when a login shell exits
12347 <A HREF="file:~/.inputrc"><I>~/.inputrc</I></A>
12350 Individual <I>readline</I> initialization file
12353 <A NAME="lbDF"> </A>
12356 Brian Fox, Free Software Foundation
12359 <A HREF="mailto:bfox@gnu.org">bfox@gnu.org</A>
12362 Chet Ramey, Case Western Reserve University
12365 <A HREF="mailto:chet.ramey@case.edu">chet.ramey@case.edu</A>
12366 <A NAME="lbDG"> </A>
12367 <H3>BUG REPORTS</H3>
12369 If you find a bug in
12372 you should report it. But first, you should
12373 make sure that it really is a bug, and that it appears in the latest
12377 The latest version is always available from
12378 <I><A HREF="ftp://ftp.gnu.org/pub/bash/">ftp://ftp.gnu.org/pub/bash/</A></I>.
12381 Once you have determined that a bug actually exists, use the
12384 command to submit a bug report.
12385 If you have a fix, you are encouraged to mail that as well!
12386 Suggestions and `philosophical' bug reports may be mailed
12387 to <I><A HREF="mailto:bug-bash@gnu.org">bug-bash@gnu.org</A></I> or posted to the Usenet
12389 <A HREF="news:gnu.bash.bug">gnu.bash.bug</A>.
12393 ALL bug reports should include:
12398 <DT>The version number of <B>bash</B><DD>
12399 <DT>The hardware and operating system<DD>
12400 <DT>The compiler used to compile<DD>
12401 <DT>A description of the bug behaviour<DD>
12402 <DT>A short script or `recipe' which exercises the bug<DD>
12409 inserts the first three items automatically into the template
12410 it provides for filing a bug report.
12413 Comments and bug reports concerning
12414 this manual page should be directed to
12415 <I><A HREF="mailto:chet@po.cwru.edu">chet@po.cwru.edu</A></I>.
12417 <A NAME="lbDH"> </A>
12422 It's too big and too slow.
12425 There are some subtle differences between
12428 and traditional versions of
12431 mostly because of the
12432 <FONT SIZE=-1><B>POSIX</B>
12438 Aliases are confusing in some uses.
12441 Shell builtin commands and functions are not stoppable/restartable.
12444 Compound commands and command sequences of the form `a ; b ; c'
12445 are not handled gracefully when process suspension is attempted.
12446 When a process is stopped, the shell immediately executes the next
12447 command in the sequence.
12448 It suffices to place the sequence of commands between
12449 parentheses to force it into a subshell, which may be stopped as
12453 Array variables may not (yet) be exported.
12456 There may be only one active coprocess at a time.
12463 <TH ALIGN=LEFT width=33%>GNU Bash-4.1<TH ALIGN=CENTER width=33%>2009 December 29<TH ALIGN=RIGHT width=33%>BASH(1)
12467 <A NAME="index"> </A><H2>Index</H2>
12469 <DT><A HREF="#lbAB">NAME</A><DD>
12470 <DT><A HREF="#lbAC">SYNOPSIS</A><DD>
12471 <DT><A HREF="#lbAD">COPYRIGHT</A><DD>
12472 <DT><A HREF="#lbAE">DESCRIPTION</A><DD>
12473 <DT><A HREF="#lbAF">OPTIONS</A><DD>
12474 <DT><A HREF="#lbAG">ARGUMENTS</A><DD>
12475 <DT><A HREF="#lbAH">INVOCATION</A><DD>
12476 <DT><A HREF="#lbAI">DEFINITIONS</A><DD>
12477 <DT><A HREF="#lbAJ">RESERVED WORDS</A><DD>
12478 <DT><A HREF="#lbAK">SHELL GRAMMAR</A><DD>
12480 <DT><A HREF="#lbAL">Simple Commands</A><DD>
12481 <DT><A HREF="#lbAM">Pipelines</A><DD>
12482 <DT><A HREF="#lbAN">Lists</A><DD>
12483 <DT><A HREF="#lbAO">Compound Commands</A><DD>
12484 <DT><A HREF="#lbAP">Coprocesses</A><DD>
12485 <DT><A HREF="#lbAQ">Shell Function Definitions</A><DD>
12487 <DT><A HREF="#lbAR">COMMENTS</A><DD>
12488 <DT><A HREF="#lbAS">QUOTING</A><DD>
12489 <DT><A HREF="#lbAT">PARAMETERS</A><DD>
12491 <DT><A HREF="#lbAU">Positional Parameters</A><DD>
12492 <DT><A HREF="#lbAV">Special Parameters</A><DD>
12493 <DT><A HREF="#lbAW">Shell Variables</A><DD>
12494 <DT><A HREF="#lbAX">Arrays</A><DD>
12496 <DT><A HREF="#lbAY">EXPANSION</A><DD>
12498 <DT><A HREF="#lbAZ">Brace Expansion</A><DD>
12499 <DT><A HREF="#lbBA">Tilde Expansion</A><DD>
12500 <DT><A HREF="#lbBB">Parameter Expansion</A><DD>
12501 <DT><A HREF="#lbBC">Command Substitution</A><DD>
12502 <DT><A HREF="#lbBD">Arithmetic Expansion</A><DD>
12503 <DT><A HREF="#lbBE">Process Substitution</A><DD>
12504 <DT><A HREF="#lbBF">Word Splitting</A><DD>
12505 <DT><A HREF="#lbBG">Pathname Expansion</A><DD>
12506 <DT><A HREF="#lbBH">Quote Removal</A><DD>
12508 <DT><A HREF="#lbBI">REDIRECTION</A><DD>
12510 <DT><A HREF="#lbBJ">Redirecting Input</A><DD>
12511 <DT><A HREF="#lbBK">Redirecting Output</A><DD>
12512 <DT><A HREF="#lbBL">Appending Redirected Output</A><DD>
12513 <DT><A HREF="#lbBM">Redirecting Standard Output and Standard Error</A><DD>
12514 <DT><A HREF="#lbBN">Appending Standard Output and Standard Error</A><DD>
12515 <DT><A HREF="#lbBO">Here Documents</A><DD>
12516 <DT><A HREF="#lbBP">Here Strings</A><DD>
12517 <DT><A HREF="#lbBQ">Duplicating File Descriptors</A><DD>
12518 <DT><A HREF="#lbBR">Moving File Descriptors</A><DD>
12519 <DT><A HREF="#lbBS">Opening File Descriptors for Reading and Writing</A><DD>
12521 <DT><A HREF="#lbBT">ALIASES</A><DD>
12522 <DT><A HREF="#lbBU">FUNCTIONS</A><DD>
12523 <DT><A HREF="#lbBV">ARITHMETIC EVALUATION</A><DD>
12524 <DT><A HREF="#lbBW">CONDITIONAL EXPRESSIONS</A><DD>
12525 <DT><A HREF="#lbBX">SIMPLE COMMAND EXPANSION</A><DD>
12526 <DT><A HREF="#lbBY">COMMAND EXECUTION</A><DD>
12527 <DT><A HREF="#lbBZ">COMMAND EXECUTION ENVIRONMENT</A><DD>
12528 <DT><A HREF="#lbCA">ENVIRONMENT</A><DD>
12529 <DT><A HREF="#lbCB">EXIT STATUS</A><DD>
12530 <DT><A HREF="#lbCC">SIGNALS</A><DD>
12531 <DT><A HREF="#lbCD">JOB CONTROL</A><DD>
12532 <DT><A HREF="#lbCE">PROMPTING</A><DD>
12533 <DT><A HREF="#lbCF">READLINE</A><DD>
12535 <DT><A HREF="#lbCG">Readline Notation</A><DD>
12536 <DT><A HREF="#lbCH">Readline Initialization</A><DD>
12537 <DT><A HREF="#lbCI">Readline Key Bindings</A><DD>
12538 <DT><A HREF="#lbCJ">Readline Variables</A><DD>
12539 <DT><A HREF="#lbCK">Readline Conditional Constructs</A><DD>
12540 <DT><A HREF="#lbCL">Searching</A><DD>
12541 <DT><A HREF="#lbCM">Readline Command Names</A><DD>
12542 <DT><A HREF="#lbCN">Commands for Moving</A><DD>
12543 <DT><A HREF="#lbCO">Commands for Manipulating the History</A><DD>
12544 <DT><A HREF="#lbCP">Commands for Changing Text</A><DD>
12545 <DT><A HREF="#lbCQ">Killing and Yanking</A><DD>
12546 <DT><A HREF="#lbCR">Numeric Arguments</A><DD>
12547 <DT><A HREF="#lbCS">Completing</A><DD>
12548 <DT><A HREF="#lbCT">Keyboard Macros</A><DD>
12549 <DT><A HREF="#lbCU">Miscellaneous</A><DD>
12550 <DT><A HREF="#lbCV">Programmable Completion</A><DD>
12552 <DT><A HREF="#lbCW">HISTORY</A><DD>
12553 <DT><A HREF="#lbCX">HISTORY EXPANSION</A><DD>
12555 <DT><A HREF="#lbCY">Event Designators</A><DD>
12556 <DT><A HREF="#lbCZ">Word Designators</A><DD>
12557 <DT><A HREF="#lbDA">Modifiers</A><DD>
12559 <DT><A HREF="#lbDB">SHELL BUILTIN COMMANDS</A><DD>
12560 <DT><A HREF="#lbDC">RESTRICTED SHELL</A><DD>
12561 <DT><A HREF="#lbDD">SEE ALSO</A><DD>
12562 <DT><A HREF="#lbDE">FILES</A><DD>
12563 <DT><A HREF="#lbDF">AUTHORS</A><DD>
12564 <DT><A HREF="#lbDG">BUG REPORTS</A><DD>
12565 <DT><A HREF="#lbDH">BUGS</A><DD>
12568 This document was created by man2html from bash.1.<BR>
12569 Time: 30 December 2009 13:07:38 EST