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%>2014 February 2<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>
40 [command_string | file]
41 <A NAME="lbAD"> </A>
45 Bash is Copyright © 1989-2013 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 All of the single-character shell options documented in the
71 description of the <B>set</B> builtin command can be used as options
72 when the shell is invoked.
73 In addition, <B>bash</B>
74 interprets the following options when it is invoked:
85 option is present, then commands are read from the first non-option argument
86 <I>command_string</I>.
88 If there are arguments after the
89 <I>command_string</I>,
91 they are assigned to the positional parameters, starting with
100 option is present, the shell is
109 act as if it had been invoked as a login shell (see
110 <FONT SIZE=-1><B>INVOCATION</B>
120 option is present, the shell becomes
124 <FONT SIZE=-1><B>RESTRICTED SHELL</B>
134 option is present, or if no arguments remain after option
135 processing, then commands are read from the standard input.
136 This option allows the positional parameters to be set
137 when invoking an interactive shell.
141 A list of all double-quoted strings preceded by <B>$</B>
142 is printed on the standard output.
143 These are the strings that
144 are subject to language translation when the current locale
145 is not <B>C</B> or <B>POSIX</B>.
146 This implies the <B>-n</B> option; no commands will be executed.
147 <DT><B>[-+]O [</B><I>shopt_option</I>]
150 <I>shopt_option</I> is one of the shell options accepted by the
151 <B>shopt</B> builtin (see
152 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
156 If <I>shopt_option</I> is present, <B>-O</B> sets the value of that option;
158 If <I>shopt_option</I> is not supplied, the names and values of the shell
159 options accepted by <B>shopt</B> are printed on the standard output.
160 If the invocation option is <B>+O</B>, the output is displayed in a format
161 that may be reused as input.
168 signals the end of options and disables further option processing.
169 Any arguments after the
172 are treated as filenames and arguments. An argument of
175 is equivalent to <B>--</B>.
182 also interprets a number of multi-character options.
183 These options must appear on the command line before the
184 single-character options to be recognized.
189 <DT><B>--debugger</B>
192 Arrange for the debugger profile to be executed before the shell
194 Turns on extended debugging mode (see the description of the
201 <DT><B>--dump-po-strings</B>
204 Equivalent to <B>-D</B>, but the output is in the GNU <I>gettext</I>
205 <B>po</B> (portable object) file format.
206 <DT><B>--dump-strings</B>
209 Equivalent to <B>-D</B>.
213 Display a usage message on standard output and exit successfully.
214 <DT><B>--init-file</B> <I>file</I><DD>
216 <DT><B>--rcfile</B> <I>file</I><DD>
218 Execute commands from
221 instead of the standard personal initialization file
222 <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>
224 if the shell is interactive (see
225 <FONT SIZE=-1><B>INVOCATION</B>
232 Equivalent to <B>-l</B>.
233 <DT><B>--noediting</B>
239 library to read command lines when the shell is interactive.
240 <DT><B>--noprofile</B>
243 Do not read either the system-wide startup file
245 <A HREF="file:/etc/profile"><I>/etc/profile</I></A>
247 or any of the personal initialization files
248 <A HREF="file:~/.bash_profile"><I>~/.bash_profile</I></A>,
250 <A HREF="file:~/.bash_login"><I>~/.bash_login</I></A>,
253 <A HREF="file:~/.profile"><I>~/.profile</I></A>.
258 reads these files when it is invoked as a login shell (see
259 <FONT SIZE=-1><B>INVOCATION</B>
266 Do not read and execute the personal initialization file
267 <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>
269 if the shell is interactive.
270 This option is on by default if the shell is invoked as
276 Change the behavior of <B>bash</B> where the default operation differs
277 from the POSIX standard to match the standard (<I>posix mode</I>).
279 <FONT SIZE=-1><B>SEE ALSO</B>
282 below for a reference to a document that details how posix mode affects
284 <DT><B>--restricted</B>
287 The shell becomes restricted (see
288 <FONT SIZE=-1><B>RESTRICTED SHELL</B>
295 Equivalent to <B>-v</B>.
299 Show version information for this instance of
302 on the standard output and exit successfully.
305 <A NAME="lbAG"> </A>
308 If arguments remain after option processing, and neither the
314 option has been supplied, the first argument is assumed to
315 be the name of a file containing shell commands.
319 is invoked in this fashion,
322 is set to the name of the file, and the positional parameters
323 are set to the remaining arguments.
326 reads and executes commands from this file, then exits.
327 <B>Bash</B>'s exit status is the exit status of the last command
328 executed in the script.
329 If no commands are executed, the exit status is 0.
330 An attempt is first made to open the file in the current directory, and,
331 if no file is found, then the shell searches the directories in
332 <FONT SIZE=-1><B>PATH</B>
336 <A NAME="lbAH"> </A>
339 A <I>login shell</I> is one whose first character of argument zero is a
342 or one started with the
348 An <I>interactive</I> shell is one started without non-option arguments
353 whose standard input and error are
354 both connected to terminals (as determined by
357 or one started with the
361 <FONT SIZE=-1><B>PS1</B>
374 allowing a shell script or a startup file to test this state.
377 The following paragraphs describe how
380 executes its startup files.
381 If any of the files exist but cannot be read,
385 Tildes are expanded in filenames as described below under
386 <B>Tilde Expansion</B>
389 <FONT SIZE=-1><B>EXPANSION</B>
398 is invoked as an interactive login shell, or as a non-interactive shell
399 with the <B>--login</B> option, it first reads and
400 executes commands from the file <A HREF="file:/etc/profile"><I>/etc/profile</I></A>, if that
402 After reading that file, it looks for <A HREF="file:~/.bash_profile"><I>~/.bash_profile</I></A>,
403 <A HREF="file:~/.bash_login"><I>~/.bash_login</I></A>, and <A HREF="file:~/.profile"><I>~/.profile</I></A>, in that order, and reads
404 and executes commands from the first one that exists and is readable.
408 option may be used when the shell is started to inhibit this behavior.
411 When a login shell exits,
414 reads and executes commands from the file <A HREF="file:~/.bash_logout"><I>~/.bash_logout</I></A>, if it
418 When an interactive shell that is not a login shell is started,
421 reads and executes commands from <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>, if that file exists.
422 This may be inhibited by using the
426 The <B>--rcfile</B> <I>file</I> option will force
429 to read and execute commands from <I>file</I> instead of <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>.
435 is started non-interactively, to run a shell script, for example, it
436 looks for the variable
437 <FONT SIZE=-1><B>BASH_ENV</B>
440 in the environment, expands its value if it appears there, and uses the
441 expanded value as the name of a file to read and execute.
444 behaves as if the following command were executed:
447 <TT>if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi</TT>
453 <FONT SIZE=-1><B>PATH</B>
456 variable is not used to search for the filename.
462 is invoked with the name
465 it tries to mimic the startup behavior of historical versions of
468 as closely as possible,
469 while conforming to the POSIX standard as well.
470 When invoked as an interactive login shell, or a non-interactive
471 shell with the <B>--login</B> option, it first attempts to
472 read and execute commands from
473 <A HREF="file:/etc/profile"><I>/etc/profile</I></A>
476 <A HREF="file:~/.profile"><I>~/.profile</I></A>,
482 option may be used to inhibit this behavior.
483 When invoked as an interactive shell with the name
488 looks for the variable
489 <FONT SIZE=-1><B>ENV</B>,
492 expands its value if it is defined, and uses the
493 expanded value as the name of a file to read and execute.
494 Since a shell invoked as
497 does not attempt to read and execute commands from any other startup
501 option has no effect.
502 A non-interactive shell invoked with the name
505 does not attempt to read any other startup files.
514 mode after the startup files are read.
526 command line option, it follows the POSIX standard for startup files.
527 In this mode, interactive shells expand the
528 <FONT SIZE=-1><B>ENV</B>
531 variable and commands are read and executed from the file
532 whose name is the expanded value.
533 No other startup files are read.
538 attempts to determine when it is being run with its standard input
539 connected to a network connection, as when executed by the remote shell
540 daemon, usually <I>rshd</I>, or the secure shell daemon <I>sshd</I>.
544 determines it is being run in this fashion, it reads and executes
545 commands from <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>, if that file exists and is readable.
546 It will not do this if invoked as <B>sh</B>.
550 option may be used to inhibit this behavior, and the
553 option may be used to force another file to be read, but neither
554 <I>rshd</I> nor <I>sshd</I> generally invoke the shell with those options
555 or allow them to be specified.
558 If the shell is started with the effective user (group) id not equal to the
559 real user (group) id, and the <B>-p</B> option is not supplied, no startup
560 files are read, shell functions are not inherited from the environment, the
561 <FONT SIZE=-1><B>SHELLOPTS</B>,
564 <FONT SIZE=-1><B>BASHOPTS</B>,
567 <FONT SIZE=-1><B>CDPATH</B>,
571 <FONT SIZE=-1><B>GLOBIGNORE</B>
574 variables, if they appear in the environment, are ignored,
575 and the effective user id is set to the real user id.
576 If the <B>-p</B> option is supplied at invocation, the startup behavior is
577 the same, but the effective user id is not reset.
578 <A NAME="lbAI"> </A>
583 The following definitions are used throughout the rest of this
594 A sequence of characters considered as a single unit by the shell.
604 consisting only of alphanumeric characters and underscores, and
605 beginning with an alphabetic character or an underscore. Also
609 <DT><B>metacharacter</B>
612 A character that, when unquoted, separates words. One of the following:
618 <B>| & ; ( ) < > space tab</B>
626 <DT><B>control operator</B>
629 A <I>token</I> that performs a control function. It is one of the following
634 <B>|| & && ; ;; ( ) | |& <newline></B>
640 <A NAME="lbAJ"> </A>
641 <H3>RESERVED WORDS</H3>
643 <I>Reserved words</I> are words that have a special meaning to the shell.
644 The following words are recognized as reserved when unquoted and either
645 the first word of a simple command (see
646 <FONT SIZE=-1><B>SHELL GRAMMAR</B>
649 below) or the third word of a
663 ! case coproc do done elif else esac fi for function if in select then until while { } time [[ ]]
667 <A NAME="lbAK"> </A>
668 <H3>SHELL GRAMMAR</H3>
670 <A NAME="lbAL"> </A>
671 <H4>Simple Commands</H4>
675 A <I>simple command</I> is a sequence of optional variable assignments
676 followed by <B>blank</B>-separated words and redirections, and
677 terminated by a <I>control operator</I>. The first word
678 specifies the command to be executed, and is passed as argument zero.
679 The remaining words are passed as arguments to the invoked command.
682 The return value of a <I>simple command</I> is its exit status, or
683 128+<I>n</I> if the command is terminated by signal
686 <A NAME="lbAM"> </A>
691 A <I>pipeline</I> is a sequence of one or more commands separated by
692 one of the control operators
696 The format for a pipeline is:
700 [<B>time</B> [<B>-p</B>]] [ ! ] <I>command</I> [ [<B>|</B>|<B>|&</B>] <I>command2</I> ... ]
705 The standard output of
708 is connected via a pipe to the standard input of
711 This connection is performed before any redirections specified by the
713 <FONT SIZE=-1><B>REDIRECTION</B>
717 If <B>|&</B> is used, <I>command</I>'s standard error, in addition to its
718 standard output, is connected to
719 <I>command2</I>'s standard input through the pipe;
720 it is shorthand for <B>2>&1 |</B>.
721 This implicit redirection of the standard error to the standard output is
722 performed after any redirections specified by the command.
725 The return status of a pipeline is the exit status of the last
726 command, unless the <B>pipefail</B> option is enabled.
727 If <B>pipefail</B> is enabled, the pipeline's return status is the
728 value of the last (rightmost) command to exit with a non-zero status,
729 or zero if all commands exit successfully.
733 precedes a pipeline, the exit status of that pipeline is the logical
734 negation of the exit status as described above.
735 The shell waits for all commands in the pipeline to
736 terminate before returning a value.
742 reserved word precedes a pipeline, the elapsed as well as user and
743 system time consumed by its execution are reported when the pipeline
745 The <B>-p</B> option changes the output format to that specified by POSIX.
746 When the shell is in <I>posix mode</I>, it does not recognize
747 <B>time</B> as a reserved word if the next token begins with a `-'.
749 <FONT SIZE=-1><B>TIMEFORMAT</B>
752 variable may be set to a format string that specifies how the timing
753 information should be displayed; see the description of
754 <FONT SIZE=-1><B>TIMEFORMAT</B>
758 <B>Shell Variables</B>
763 When the shell is in <I>posix mode</I>, <B>time</B>
764 may be followed by a newline. In this case, the shell displays the
765 total user and system time consumed by the shell and its children.
767 <FONT SIZE=-1><B>TIMEFORMAT</B>
770 variable may be used to specify the format of
771 the time information.
774 Each command in a pipeline is executed as a separate process (i.e., in a
776 <A NAME="lbAN"> </A>
781 A <I>list</I> is a sequence of one or more pipelines separated by one
792 and optionally terminated by one of
798 <B><newline></B>.
802 Of these list operators,
808 have equal precedence, followed by
814 which have equal precedence.
817 A sequence of one or more newlines may appear in a <I>list</I> instead
818 of a semicolon to delimit commands.
821 If a command is terminated by the control operator
824 the shell executes the command in the <I>background</I>
825 in a subshell. The shell does not wait for the command to
826 finish, and the return status is 0. Commands separated by a
829 are executed sequentially; the shell waits for each
830 command to terminate in turn. The return status is the
831 exit status of the last command executed.
834 AND and OR lists are sequences of one of more pipelines separated by the
835 <B>&&</B> and <B>||</B> control operators, respectively.
836 AND and OR lists are executed with left associativity.
837 An AND list has the form
841 <I>command1</I> <B>&&</B> <I>command2</I>
848 is executed if, and only if,
851 returns an exit status of zero.
854 An OR list has the form
858 <I>command1</I> <B>||</B> <I>command2</I>
867 is executed if and only if
870 returns a non-zero exit status.
872 AND and OR lists is the exit status of the last command
873 executed in the list.
874 <A NAME="lbAO"> </A>
875 <H4>Compound Commands</H4>
879 A <I>compound command</I> is one of the following.
880 In most cases a <I>list</I> in a command's description may be separated from
881 the rest of the command by one or more newlines, and may be followed by a
882 newline in place of a semicolon.
884 <DT>(<I>list</I>)<DD>
885 <I>list</I> is executed in a subshell environment (see
886 <FONT SIZE=-1><B>COMMAND EXECUTION ENVIRONMENT</B></FONT>
888 Variable assignments and builtin
889 commands that affect the shell's environment do not remain in effect
890 after the command completes. The return status is the exit status of
892 <DT>{ <I>list</I>; }<DD>
893 <I>list</I> is simply executed in the current shell environment.
894 <I>list</I> must be terminated with a newline or semicolon.
895 This is known as a <I>group command</I>.
896 The return status is the exit status of
898 Note that unlike the metacharacters <B>(</B> and <B>)</B>, <B>{</B> and
899 <B>}</B> are <I>reserved words</I> and must occur where a reserved
900 word is permitted to be recognized. Since they do not cause a word
901 break, they must be separated from <I>list</I> by whitespace or another
903 <DT>((<I>expression</I>))<DD>
904 The <I>expression</I> is evaluated according to the rules described
906 <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>.
909 If the value of the expression is non-zero, the return status is 0;
910 otherwise the return status is 1. This is exactly equivalent to
911 <B>let "</B><I>expression</I>".
912 <DT><B>[[</B> <I>expression</I> <B>]]</B><DD>
913 Return a status of 0 or 1 depending on the evaluation of
914 the conditional expression <I>expression</I>.
915 Expressions are composed of the primaries described below under
916 <FONT SIZE=-1><B>CONDITIONAL EXPRESSIONS</B>.
919 Word splitting and pathname expansion are not performed on the words
920 between the <B>[[</B> and <B>]]</B>; tilde expansion,
921 parameter and variable expansion,
922 arithmetic expansion, command substitution, process
923 substitution, and quote removal are performed.
924 Conditional operators such as <B>-f</B> must be unquoted to be recognized
929 When used with <B>[[</B>, the <B><</B> and <B>></B> operators sort
930 lexicographically using the current locale.
934 When the <B>==</B> and <B>!=</B> operators are used, the string to the
935 right of the operator is considered a pattern and matched according
936 to the rules described below under <B>Pattern Matching</B>,
937 as if the <B>extglob</B> shell option were enabled.
938 The <B>=</B> operator is equivalent to <B>==</B>.
942 is enabled, the match is performed without regard to the case
943 of alphabetic characters.
944 The return value is 0 if the string matches (<B>==</B>) or does not match
945 (<B>!=</B>) the pattern, and 1 otherwise.
946 Any part of the pattern may be quoted to force the quoted portion
947 to be matched as a string.
951 An additional binary operator, <B>=~</B>, is available, with the same
952 precedence as <B>==</B> and <B>!=</B>.
953 When it is used, the string to the right of the operator is considered
954 an extended regular expression and matched accordingly (as in <I>regex</I>(3)).
955 The return value is 0 if the string matches
956 the pattern, and 1 otherwise.
957 If the regular expression is syntactically incorrect, the conditional
958 expression's return value is 2.
962 is enabled, the match is performed without regard to the case
963 of alphabetic characters.
964 Any part of the pattern may be quoted to force the quoted portion
965 to be matched as a string.
966 Bracket expressions in regular expressions must be treated carefully,
967 since normal quoting characters lose their meanings between brackets.
968 If the pattern is stored in a shell variable, quoting the variable
969 expansion forces the entire pattern to be matched as a string.
970 Substrings matched by parenthesized subexpressions within the regular
971 expression are saved in the array variable
972 <FONT SIZE=-1><B>BASH_REMATCH</B>.
976 <FONT SIZE=-1><B>BASH_REMATCH</B>
979 with index 0 is the portion of the string
980 matching the entire regular expression.
982 <FONT SIZE=-1><B>BASH_REMATCH</B>
985 with index <I>n</I> is the portion of the
986 string matching the <I>n</I>th parenthesized subexpression.
990 Expressions may be combined using the following operators, listed
991 in decreasing order of precedence:
998 <DT><B>( </B><I>expression</I> )
1001 Returns the value of <I>expression</I>.
1002 This may be used to override the normal precedence of operators.
1003 <DT><B>! </B><I>expression</I>
1010 <DT><I>expression1</I> <B>&&</B> <I>expression2</I><DD>
1018 <DT><I>expression1</I> <B>||</B> <I>expression2</I><DD>
1030 The <B>&&</B> and <B>||</B>
1031 operators do not evaluate <I>expression2</I> if the value of
1032 <I>expression1</I> is sufficient to determine the return value of
1033 the entire conditional expression.
1036 <DT><B>for</B> <I>name</I> [ [ <B>in</B> [ <I>word ...</I> ] ] ; ] <B>do</B> <I>list</I> ; <B>done</B><DD>
1037 The list of words following <B>in</B> is expanded, generating a list
1039 The variable <I>name</I> is set to each element of this list
1040 in turn, and <I>list</I> is executed each time.
1041 If the <B>in</B> <I>word</I> is omitted, the <B>for</B> command executes
1042 <I>list</I> once for each positional parameter that is set (see
1043 <FONT SIZE=-1><B>PARAMETERS</B>
1047 The return status is the exit status of the last command that executes.
1048 If the expansion of the items following <B>in</B> results in an empty
1049 list, no commands are executed, and the return status is 0.
1050 <DT><B>for</B> (( <I>expr1</I> ; <I>expr2</I> ; <I>expr3</I> )) ; <B>do</B> <I>list</I> ; <B>done</B><DD>
1051 First, the arithmetic expression <I>expr1</I> is evaluated according
1052 to the rules described below under
1053 <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>.
1056 The arithmetic expression <I>expr2</I> is then evaluated repeatedly
1057 until it evaluates to zero.
1058 Each time <I>expr2</I> evaluates to a non-zero value, <I>list</I> is
1059 executed and the arithmetic expression <I>expr3</I> is evaluated.
1060 If any expression is omitted, it behaves as if it evaluates to 1.
1061 The return value is the exit status of the last command in <I>list</I>
1062 that is executed, or false if any of the expressions is invalid.
1063 <DT><B>select</B> <I>name</I> [ <B>in</B> <I>word</I> ] ; <B>do</B> <I>list</I> ; <B>done</B><DD>
1064 The list of words following <B>in</B> is expanded, generating a list
1065 of items. The set of expanded words is printed on the standard
1066 error, each preceded by a number. If the <B>in</B>
1067 <I>word</I> is omitted, the positional parameters are printed (see
1068 <FONT SIZE=-1><B>PARAMETERS</B>
1072 <FONT SIZE=-1><B>PS3</B>
1075 prompt is then displayed and a line read from the standard input.
1076 If the line consists of a number corresponding to one of
1077 the displayed words, then the value of
1080 is set to that word. If the line is empty, the words and prompt
1081 are displayed again. If EOF is read, the command completes. Any
1082 other value read causes
1085 to be set to null. The line read is saved in the variable
1086 <FONT SIZE=-1><B>REPLY</B>.
1092 is executed after each selection until a
1095 command is executed.
1099 is the exit status of the last command executed in
1102 or zero if no commands were executed.
1103 <DT><B>case</B> <I>word</I> <B>in</B> [ [(] <I>pattern</I> [ <B>|</B> <I>pattern</I> ]
1105 A <B>case</B> command first expands <I>word</I>, and tries to match
1106 it against each <I>pattern</I> in turn, using the same matching rules
1107 as for pathname expansion (see
1108 <B>Pathname Expansion</B>
1111 The <I>word</I> is expanded using tilde
1112 expansion, parameter and variable expansion, arithmetic substitution,
1113 command substitution, process substitution and quote removal.
1114 Each <I>pattern</I> examined is expanded using tilde
1115 expansion, parameter and variable expansion, arithmetic substitution,
1116 command substitution, and process substitution.
1120 is enabled, the match is performed without regard to the case
1121 of alphabetic characters.
1122 When a match is found, the corresponding <I>list</I> is executed.
1123 If the <B>;;</B> operator is used, no subsequent matches are attempted after
1124 the first pattern match.
1125 Using <B>;&</B> in place of <B>;;</B> causes execution to continue with
1126 the <I>list</I> associated with the next set of patterns.
1127 Using <B>;;&</B> in place of <B>;;</B> causes the shell to test the next
1128 pattern list in the statement, if any, and execute any associated <I>list</I>
1129 on a successful match.
1130 The exit status is zero if no
1131 pattern matches. Otherwise, it is the exit status of the
1132 last command executed in <I>list</I>.
1133 <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>
1139 is executed. If its exit status is zero, the
1140 <B>then</B> <I>list</I> is executed. Otherwise, each <B>elif</B>
1141 <I>list</I> is executed in turn, and if its exit status is zero,
1142 the corresponding <B>then</B> <I>list</I> is executed and the
1143 command completes. Otherwise, the <B>else</B> <I>list</I> is
1144 executed, if present. The exit status is the exit status of the
1145 last command executed, or zero if no condition tested true.
1146 <DT><B>while</B> <I>list-1</I>; <B>do</B> <I>list-2</I>; <B>done</B><DD>
1148 <DT><B>until</B> <I>list-1</I>; <B>do</B> <I>list-2</I>; <B>done</B><DD>
1150 The <B>while</B> command continuously executes the list
1151 <I>list-2</I> as long as the last command in the list <I>list-1</I> returns
1152 an exit status of zero. The <B>until</B> command is identical
1153 to the <B>while</B> command, except that the test is negated;
1156 is executed as long as the last command in
1159 returns a non-zero exit status.
1160 The exit status of the <B>while</B> and <B>until</B> commands
1162 of the last command executed in <I>list-2</I>, or zero if
1165 <A NAME="lbAP"> </A>
1166 <H4>Coprocesses</H4>
1170 A <I>coprocess</I> is a shell command preceded by the <B>coproc</B> reserved
1172 A coprocess is executed asynchronously in a subshell, as if the command
1173 had been terminated with the <B>&</B> control operator, with a two-way pipe
1174 established between the executing shell and the coprocess.
1177 The format for a coprocess is:
1178 <DL COMPACT><DT><DD>
1181 <B>coproc</B> [<I>NAME</I>] <I>command</I> [<I>redirections</I>]
1186 This creates a coprocess named <I>NAME</I>.
1187 If <I>NAME</I> is not supplied, the default name is <B>COPROC</B>.
1188 <I>NAME</I> must not be supplied if <I>command</I> is a <I>simple
1189 command</I> (see above); otherwise, it is interpreted as the first word
1190 of the simple command.
1191 When the coprocess is executed, the shell creates an array variable (see
1194 below) named <I>NAME</I> in the context of the executing shell.
1195 The standard output of
1198 is connected via a pipe to a file descriptor in the executing shell,
1199 and that file descriptor is assigned to <I>NAME</I>[0].
1200 The standard input of
1203 is connected via a pipe to a file descriptor in the executing shell,
1204 and that file descriptor is assigned to <I>NAME</I>[1].
1205 This pipe is established before any redirections specified by the
1207 <FONT SIZE=-1><B>REDIRECTION</B>
1211 The file descriptors can be utilized as arguments to shell commands
1212 and redirections using standard word expansions.
1213 The file descriptors are not available in subshells.
1214 The process ID of the shell spawned to execute the coprocess is
1215 available as the value of the variable <I>NAME</I>_PID.
1217 builtin command may be used to wait for the coprocess to terminate.
1220 Since the coprocess is created as an asynchronous command,
1221 the <B>coproc</B> command always returns success.
1222 The return status of a coprocess is the exit status of <I>command</I>.
1223 <A NAME="lbAQ"> </A>
1224 <H4>Shell Function Definitions</H4>
1228 A shell function is an object that is called like a simple command and
1229 executes a compound command with a new set of positional parameters.
1230 Shell functions are declared as follows:
1232 <DT><I>name</I> () <I>compound-command</I> [<I>redirection</I>]<DD>
1234 <DT><B>function</B> <I>name</I> [()] <I>compound-command</I> [<I>redirection</I>]<DD>
1236 This defines a function named <I>name</I>.
1237 The reserved word <B>function</B> is optional.
1238 If the <B>function</B> reserved word is supplied, the parentheses are optional.
1239 The <I>body</I> of the function is the compound command
1240 <I>compound-command </I>
1242 (see <B>Compound Commands</B> above).
1243 That command is usually a <I>list</I> of commands between { and }, but
1244 may be any command listed under <B>Compound Commands</B> above.
1245 <I>compound-command</I> is executed whenever <I>name</I> is specified as the
1246 name of a simple command.
1247 When in <I>posix mode</I>, <I>name</I> may not be the name of one of the
1248 POSIX <I>special builtins</I>.
1249 Any redirections (see
1250 <FONT SIZE=-1><B>REDIRECTION</B>
1253 below) specified when a function is defined are performed
1254 when the function is executed.
1255 The exit status of a function definition is zero unless a syntax error
1256 occurs or a readonly function with the same name already exists.
1257 When executed, the exit status of a function is the exit status of the
1258 last command executed in the body. (See
1259 <FONT SIZE=-1><B>FUNCTIONS</B>
1264 <A NAME="lbAR"> </A>
1267 In a non-interactive shell, or an interactive shell in which the
1268 <B>interactive_comments</B>
1273 builtin is enabled (see
1274 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
1277 below), a word beginning with
1280 causes that word and all remaining characters on that line to
1281 be ignored. An interactive shell without the
1282 <B>interactive_comments</B>
1284 option enabled does not allow comments. The
1285 <B>interactive_comments</B>
1287 option is on by default in interactive shells.
1288 <A NAME="lbAS"> </A>
1291 <I>Quoting</I> is used to remove the special meaning of certain
1292 characters or words to the shell. Quoting can be used to
1293 disable special treatment for special characters, to prevent
1294 reserved words from being recognized as such, and to prevent
1295 parameter expansion.
1298 Each of the <I>metacharacters</I> listed above under
1299 <FONT SIZE=-1><B>DEFINITIONS</B>
1302 has special meaning to the shell and must be quoted if it is to
1306 When the command history expansion facilities are being used
1308 <FONT SIZE=-1><B>HISTORY EXPANSION</B>
1312 <I>history expansion</I> character, usually <B>!</B>, must be quoted
1313 to prevent history expansion.
1316 There are three quoting mechanisms: the
1317 <I>escape character</I>,
1319 single quotes, and double quotes.
1322 A non-quoted backslash (<B>\</B>) is the
1323 <I>escape character</I>.
1325 It preserves the literal value of the next character that follows,
1326 with the exception of <newline>. If a <B>\</B><newline> pair
1327 appears, and the backslash is not itself quoted, the <B>\</B><newline>
1328 is treated as a line continuation (that is, it is removed from the
1329 input stream and effectively ignored).
1332 Enclosing characters in single quotes preserves the literal value
1333 of each character within the quotes. A single quote may not occur
1334 between single quotes, even when preceded by a backslash.
1337 Enclosing characters in double quotes preserves the literal value
1338 of all characters within the quotes, with the exception of
1345 and, when history expansion is enabled,
1354 retain their special meaning within double quotes. The backslash
1355 retains its special meaning only when followed by one of the following
1365 <B><newline></B>.
1367 A double quote may be quoted within double quotes by preceding it with
1369 If enabled, history expansion will be performed unless an
1372 appearing in double quotes is escaped using a backslash.
1373 The backslash preceding the
1379 The special parameters
1385 have special meaning when in double
1387 <FONT SIZE=-1><B>PARAMETERS</B>
1393 Words of the form <B>$</B>aq<I>string</I>aq are treated specially. The
1394 word expands to <I>string</I>, with backslash-escaped characters replaced
1395 as specified by the ANSI C standard. Backslash escape sequences, if
1396 present, are decoded as follows:
1397 <DL COMPACT><DT><DD>
1447 <DT><B>\</B><I>nnn</I>
1450 the eight-bit character whose value is the octal value <I>nnn</I>
1451 (one to three digits)
1452 <DT><B>\x</B><I>HH</I>
1455 the eight-bit character whose value is the hexadecimal value <I>HH</I>
1456 (one or two hex digits)
1457 <DT><B>\u</B><I>HHHH</I>
1460 the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value
1461 <I>HHHH</I> (one to four hex digits)
1462 <DT><B>\U</B><I>HHHHHHHH</I>
1465 the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value
1466 <I>HHHHHHHH</I> (one to eight hex digits)
1467 <DT><B>\c</B><I>x</I>
1470 a control-<I>x</I> character
1476 The expanded result is single-quoted, as if the dollar sign had
1480 A double-quoted string preceded by a dollar sign (<B>$</B>dq<I>string</I>dq)
1481 will cause the string to be translated according to the current locale.
1482 If the current locale is <B>C</B> or <B>POSIX</B>, the dollar sign
1484 If the string is translated and replaced, the replacement is
1486 <A NAME="lbAT"> </A>
1492 is an entity that stores values.
1496 a number, or one of the special characters listed below under
1497 <B>Special Parameters</B>.
1502 is a parameter denoted by a
1505 A variable has a <I>value</I> and zero or more <I>attributes</I>.
1506 Attributes are assigned using the
1509 builtin command (see
1513 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>).
1518 A parameter is set if it has been assigned a value. The null string is
1519 a valid value. Once a variable is set, it may be unset only by using
1523 builtin command (see
1524 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
1533 may be assigned to by a statement of the form
1534 <DL COMPACT><DT><DD>
1537 <I>name</I>=[<I>value</I>]
1545 is not given, the variable is assigned the null string. All
1548 undergo tilde expansion, parameter and variable expansion,
1549 command substitution, arithmetic expansion, and quote
1551 <FONT SIZE=-1><B>EXPANSION</B>
1554 below). If the variable has its
1560 is evaluated as an arithmetic expression even if the $((...)) expansion is
1562 <B>Arithmetic Expansion</B>
1565 Word splitting is not performed, with the exception
1566 of <B>"$@"</B> as explained below under
1567 <B>Special Parameters</B>.
1569 Pathname expansion is not performed.
1570 Assignment statements may also appear as arguments to the
1585 When in <I>posix mode</I>, these builtins may appear in a command after
1586 one or more instances of the <B>command</B> builtin and retain these
1587 assignment statement properties.
1590 In the context where an assignment statement is assigning a value
1591 to a shell variable or array index, the += operator can be used to
1592 append to or add to the variable's previous value.
1593 When += is applied to a variable for which the <I>integer</I> attribute has been
1594 set, <I>value</I> is evaluated as an arithmetic expression and added to the
1595 variable's current value, which is also evaluated.
1596 When += is applied to an array variable using compound assignment (see
1600 variable's value is not unset (as it is when using =), and new values are
1601 appended to the array beginning at one greater than the array's maximum index
1602 (for indexed arrays) or added as additional key-value pairs in an
1604 When applied to a string-valued variable, <I>value</I> is expanded and
1605 appended to the variable's value.
1608 A variable can be assigned the <I>nameref</I> attribute using the
1609 <B>-n</B> option to the <B>declare</B> or <B>local</B> builtin commands
1610 (see the descriptions of <B>declare</B> and <B>local</B> below)
1611 to create a <I>nameref</I>, or a reference to another variable.
1612 This allows variables to be manipulated indirectly.
1613 Whenever the nameref variable is referenced or assigned to, the operation
1614 is actually performed on the variable specified by the nameref variable's
1616 A nameref is commonly used within shell functions to refer to a variable
1617 whose name is passed as an argument to the function.
1618 For instance, if a variable name is passed to a shell function as its first
1621 <DL COMPACT><DT><DD>
1622 <TT>declare -n ref=$1</TT>
1627 inside the function creates a nameref variable <B>ref</B> whose value is
1628 the variable name passed as the first argument.
1629 References and assignments to <B>ref</B> are treated as references and
1630 assignments to the variable whose name was passed as <B>$1</B>.
1631 If the control variable in a <B>for</B> loop has the nameref attribute,
1632 the list of words can be a list of shell variables, and a name reference
1633 will be established for each word in the list, in turn, when the loop is
1635 Array variables cannot be given the <B>-n</B> attribute.
1636 However, nameref variables can reference array variables and subscripted
1638 Namerefs can be unset using the <B>-n</B> option to the <B>unset</B> builtin.
1639 Otherwise, if <B>unset</B> is executed with the name of a nameref variable
1640 as an argument, the variable referenced by the nameref variable will be unset.
1641 <A NAME="lbAU"> </A>
1642 <H4>Positional Parameters</H4>
1647 <I>positional parameter</I>
1649 is a parameter denoted by one or more
1650 digits, other than the single digit 0. Positional parameters are
1651 assigned from the shell's arguments when it is invoked,
1652 and may be reassigned using the
1655 builtin command. Positional parameters may not be assigned to
1656 with assignment statements. The positional parameters are
1657 temporarily replaced when a shell function is executed (see
1658 <FONT SIZE=-1><B>FUNCTIONS</B>
1664 When a positional parameter consisting of more than a single
1665 digit is expanded, it must be enclosed in braces (see
1666 <FONT SIZE=-1><B>EXPANSION</B>
1670 <A NAME="lbAV"> </A>
1671 <H4>Special Parameters</H4>
1675 The shell treats several parameters specially. These parameters may
1676 only be referenced; assignment to them is not allowed.
1682 Expands to the positional parameters, starting from one.
1683 When the expansion is not within double quotes, each positional parameter
1684 expands to a separate word.
1685 In contexts where it is performed, those words
1686 are subject to further word splitting and pathname expansion.
1687 When the expansion occurs within double quotes, it expands to a single word
1688 with the value of each parameter separated by the first character
1690 <FONT SIZE=-1><B>IFS</B>
1693 special variable. That is, "<B>$*</B>" is equivalent
1694 to "<B>$1</B><I>c</I><B>$2</B><I>c</I><B>...</B>", where
1697 is the first character of the value of the
1698 <FONT SIZE=-1><B>IFS</B>
1702 <FONT SIZE=-1><B>IFS</B>
1705 is unset, the parameters are separated by spaces.
1707 <FONT SIZE=-1><B>IFS</B>
1710 is null, the parameters are joined without intervening separators.
1714 Expands to the positional parameters, starting from one. When the
1715 expansion occurs within double quotes, each parameter expands to a
1716 separate word. That is, "<B>$@</B>" is equivalent to
1717 "<B>$1</B>" "<B>$2</B>" ...
1718 If the double-quoted expansion occurs within a word, the expansion of
1719 the first parameter is joined with the beginning part of the original
1720 word, and the expansion of the last parameter is joined with the last
1721 part of the original word.
1722 When there are no positional parameters, "<B>$@</B>" and
1725 expand to nothing (i.e., they are removed).
1729 Expands to the number of positional parameters in decimal.
1733 Expands to the exit status of the most recently executed foreground
1738 Expands to the current option flags as specified upon invocation,
1742 builtin command, or those set by the shell itself
1750 Expands to the process ID of the shell. In a () subshell, it
1751 expands to the process ID of the current shell, not the
1756 Expands to the process ID of the job most recently placed into the
1757 background, whether executed as an asynchronous command or using
1758 the <B>bg</B> builtin (see
1759 <FONT SIZE=-1><B>JOB CONTROL</B>
1766 Expands to the name of the shell or shell script. This is set at
1767 shell initialization. If
1770 is invoked with a file of commands,
1773 is set to the name of that file. If
1782 is set to the first argument after the string to be
1783 executed, if one is present. Otherwise, it is set
1784 to the filename used to invoke
1787 as given by argument zero.
1791 At shell startup, set to the absolute pathname used to invoke the
1792 shell or shell script being executed as passed in the environment
1794 Subsequently, expands to the last argument to the previous command,
1796 Also set to the full pathname used to invoke each command executed
1797 and placed in the environment exported to that command.
1798 When checking mail, this parameter holds the name of the mail file
1799 currently being checked.
1802 <A NAME="lbAW"> </A>
1803 <H4>Shell Variables</H4>
1807 The following variables are set by the shell:
1815 Expands to the full filename used to invoke this instance of
1821 A colon-separated list of enabled shell options. Each word in
1822 the list is a valid argument for the
1828 builtin command (see
1829 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
1832 below). The options appearing in
1833 <FONT SIZE=-1><B>BASHOPTS</B>
1836 are those reported as
1840 If this variable is in the environment when
1843 starts up, each shell option in the list will be enabled before
1844 reading any startup files.
1845 This variable is read-only.
1849 Expands to the process ID of the current <B>bash</B> process.
1850 This differs from <B>$$</B> under certain circumstances, such as subshells
1851 that do not require <B>bash</B> to be re-initialized.
1852 <DT><B>BASH_ALIASES</B>
1855 An associative array variable whose members correspond to the internal
1856 list of aliases as maintained by the <B>alias</B> builtin.
1857 Elements added to this array appear in the alias list; unsetting array
1858 elements cause aliases to be removed from the alias list.
1859 <DT><B>BASH_ARGC</B>
1862 An array variable whose values are the number of parameters in each
1863 frame of the current <B>bash</B> execution call stack.
1865 parameters to the current subroutine (shell function or script executed
1866 with <B>.</B> or <B>source</B>) is at the top of the stack.
1867 When a subroutine is executed, the number of parameters passed is pushed onto
1868 <FONT SIZE=-1><B>BASH_ARGC</B>.
1872 <FONT SIZE=-1><B>BASH_ARGC</B>
1875 only when in extended debugging mode (see the description of the
1882 <DT><B>BASH_ARGV</B>
1885 An array variable containing all of the parameters in the current <B>bash</B>
1886 execution call stack. The final parameter of the last subroutine call
1887 is at the top of the stack; the first parameter of the initial call is
1888 at the bottom. When a subroutine is executed, the parameters supplied
1890 <FONT SIZE=-1><B>BASH_ARGV</B>.
1894 <FONT SIZE=-1><B>BASH_ARGV</B>
1897 only when in extended debugging mode
1898 (see the description of the
1905 <DT><B>BASH_CMDS</B>
1908 An associative array variable whose members correspond to the internal
1909 hash table of commands as maintained by the <B>hash</B> builtin.
1910 Elements added to this array appear in the hash table; unsetting array
1911 elements cause commands to be removed from the hash table.
1912 <DT><B>BASH_COMMAND</B>
1915 The command currently being executed or about to be executed, unless the
1916 shell is executing a command as the result of a trap,
1917 in which case it is the command executing at the time of the trap.
1918 <DT><B>BASH_EXECUTION_STRING</B>
1921 The command argument to the <B>-c</B> invocation option.
1922 <DT><B>BASH_LINENO</B>
1925 An array variable whose members are the line numbers in source files
1926 where each corresponding member of
1927 <FONT SIZE=-1><B>FUNCNAME</B>
1931 <B>${BASH_LINENO[</B><I>$i</I><B>]}</B> is the line number in the source
1932 file (<B>${BASH_SOURCE[</B><I>$i+1</I><B>]}</B>) where
1933 <B>${FUNCNAME[</B><I>$i</I><B>]}</B> was called
1934 (or <B>${BASH_LINENO[</B><I>$i-1</I><B>]}</B> if referenced within another
1937 <FONT SIZE=-1><B>LINENO</B>
1940 to obtain the current line number.
1941 <DT><B>BASH_REMATCH</B>
1944 An array variable whose members are assigned by the <B>=~</B> binary
1945 operator to the <B>[[</B> conditional command.
1946 The element with index 0 is the portion of the string
1947 matching the entire regular expression.
1948 The element with index <I>n</I> is the portion of the
1949 string matching the <I>n</I>th parenthesized subexpression.
1950 This variable is read-only.
1951 <DT><B>BASH_SOURCE</B>
1954 An array variable whose members are the source filenames
1955 where the corresponding shell function names in the
1956 <FONT SIZE=-1><B>FUNCNAME</B>
1959 array variable are defined.
1961 <B>${FUNCNAME[</B><I>$i</I><B>]}</B> is defined in the file
1962 <B>${BASH_SOURCE[</B><I>$i</I><B>]}</B> and called from
1963 <B>${BASH_SOURCE[</B><I>$i+1</I><B>]}</B>.
1964 <DT><B>BASH_SUBSHELL</B>
1967 Incremented by one within each subshell or subshell environment when
1968 the shell begins executing in that environment.
1969 The initial value is 0.
1970 <DT><B>BASH_VERSINFO</B>
1973 A readonly array variable whose members hold version information for
1977 The values assigned to the array members are as follows:
1979 <DL COMPACT><DT><DD>
1981 <DT><B>BASH_VERSINFO[</B>0]
1984 The major version number (the <I>release</I>).
1985 <DT><B>BASH_VERSINFO[</B>1]
1988 The minor version number (the <I>version</I>).
1989 <DT><B>BASH_VERSINFO[</B>2]
1993 <DT><B>BASH_VERSINFO[</B>3]
1997 <DT><B>BASH_VERSINFO[</B>4]
2000 The release status (e.g., <I>beta1</I>).
2001 <DT><B>BASH_VERSINFO[</B>5]
2005 <FONT SIZE=-1><B>MACHTYPE</B>.
2010 <DT><B>BASH_VERSION</B>
2013 Expands to a string describing the version of this instance of
2016 <DT><B>COMP_CWORD</B>
2019 An index into <B>${COMP_WORDS}</B> of the word containing the current
2021 This variable is available only in shell functions invoked by the
2022 programmable completion facilities (see <B>Programmable Completion</B>
2027 The key (or final key of a key sequence) used to invoke the current
2028 completion function.
2029 <DT><B>COMP_LINE</B>
2032 The current command line.
2033 This variable is available only in shell functions and external
2034 commands invoked by the
2035 programmable completion facilities (see <B>Programmable Completion</B>
2037 <DT><B>COMP_POINT</B>
2040 The index of the current cursor position relative to the beginning of
2041 the current command.
2042 If the current cursor position is at the end of the current command,
2043 the value of this variable is equal to <B>${#COMP_LINE}</B>.
2044 This variable is available only in shell functions and external
2045 commands invoked by the
2046 programmable completion facilities (see <B>Programmable Completion</B>
2048 <DT><B>COMP_TYPE</B>
2051 Set to an integer value corresponding to the type of completion attempted
2052 that caused a completion function to be called:
2053 <I>TAB</I>, for normal completion,
2054 <I>?</I>, for listing completions after successive tabs,
2055 <I>!</I>, for listing alternatives on partial word completion,
2056 <I>@</I>, to list completions if the word is not unmodified,
2058 <I>%</I>, for menu completion.
2059 This variable is available only in shell functions and external
2060 commands invoked by the
2061 programmable completion facilities (see <B>Programmable Completion</B>
2063 <DT><B>COMP_WORDBREAKS</B>
2066 The set of characters that the <B>readline</B> library treats as word
2067 separators when performing word completion.
2069 <FONT SIZE=-1><B>COMP_WORDBREAKS</B>
2072 is unset, it loses its special properties, even if it is
2074 <DT><B>COMP_WORDS</B>
2077 An array variable (see <B>Arrays</B> below) consisting of the individual
2078 words in the current command line.
2079 The line is split into words as <B>readline</B> would split it, using
2080 <FONT SIZE=-1><B>COMP_WORDBREAKS</B>
2084 This variable is available only in shell functions invoked by the
2085 programmable completion facilities (see <B>Programmable Completion</B>
2090 An array variable (see <B>Arrays</B> below) created to hold the file descriptors
2091 for output from and input to an unnamed coprocess (see <B>Coprocesses</B>
2096 An array variable (see
2099 below) containing the current contents of the directory stack.
2100 Directories appear in the stack in the order they are displayed by the
2104 Assigning to members of this array variable may be used to modify
2105 directories already in the stack, but the
2111 builtins must be used to add and remove directories.
2112 Assignment to this variable will not change the current directory.
2114 <FONT SIZE=-1><B>DIRSTACK</B>
2117 is unset, it loses its special properties, even if it is
2122 Expands to the effective user ID of the current user, initialized at
2123 shell startup. This variable is readonly.
2127 An array variable containing the names of all shell functions
2128 currently in the execution call stack.
2129 The element with index 0 is the name of any currently-executing
2131 The bottom-most element (the one with the highest index) is
2132 <TT>"main"</TT>.
2134 This variable exists only when a shell function is executing.
2136 <FONT SIZE=-1><B>FUNCNAME</B>
2139 have no effect and return an error status.
2141 <FONT SIZE=-1><B>FUNCNAME</B>
2144 is unset, it loses its special properties, even if it is
2149 This variable can be used with <B>BASH_LINENO</B> and <B>BASH_SOURCE</B>.
2150 Each element of <B>FUNCNAME</B> has corresponding elements in
2151 <B>BASH_LINENO</B> and <B>BASH_SOURCE</B> to describe the call stack.
2152 For instance, <B>${FUNCNAME[</B><I>$i</I><B>]}</B> was called from the file
2153 <B>${BASH_SOURCE[</B><I>$i+1</I><B>]}</B> at line number
2154 <B>${BASH_LINENO[</B><I>$i</I><B>]}</B>.
2155 The <B>caller</B> builtin displays the current call stack using this
2160 An array variable containing the list of groups of which the current
2163 <FONT SIZE=-1><B>GROUPS</B>
2166 have no effect and return an error status.
2168 <FONT SIZE=-1><B>GROUPS</B>
2171 is unset, it loses its special properties, even if it is
2176 The history number, or index in the history list, of the current
2179 <FONT SIZE=-1><B>HISTCMD</B>
2182 is unset, it loses its special properties, even if it is
2187 Automatically set to the name of the current host.
2191 Automatically set to a string that uniquely
2192 describes the type of machine on which
2196 The default is system-dependent.
2200 Each time this parameter is referenced, the shell substitutes
2201 a decimal number representing the current sequential line number
2202 (starting with 1) within a script or function. When not in a
2203 script or function, the value substituted is not guaranteed to
2206 <FONT SIZE=-1><B>LINENO</B>
2209 is unset, it loses its special properties, even if it is
2214 Automatically set to a string that fully describes the system
2218 is executing, in the standard GNU <I>cpu-company-system</I> format.
2219 The default is system-dependent.
2223 An array variable (see <B>Arrays</B> below) created to hold the text
2224 read by the <B>mapfile</B> builtin when no variable name is supplied.
2228 The previous working directory as set by the
2235 The value of the last option argument processed by the
2238 builtin command (see
2239 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
2246 The index of the next argument to be processed by the
2249 builtin command (see
2250 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
2257 Automatically set to a string that
2258 describes the operating system on which
2262 The default is system-dependent.
2263 <DT><B>PIPESTATUS</B>
2266 An array variable (see
2269 below) containing a list of exit status values from the processes
2270 in the most-recently-executed foreground pipeline (which may
2271 contain only a single command).
2275 The process ID of the shell's parent. This variable is readonly.
2279 The current working directory as set by the
2286 Each time this parameter is referenced, a random integer between
2288 generated. The sequence of random numbers may be initialized by assigning
2290 <FONT SIZE=-1><B>RANDOM</B>.
2294 <FONT SIZE=-1><B>RANDOM</B>
2297 is unset, it loses its special properties, even if it is
2299 <DT><B>READLINE_LINE</B>
2305 line buffer, for use with
2309 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
2313 <DT><B>READLINE_POINT</B>
2316 The position of the insertion point in the
2319 line buffer, for use with
2323 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
2330 Set to the line of input read by the
2333 builtin command when no arguments are supplied.
2337 Each time this parameter is
2338 referenced, the number of seconds since shell invocation is returned. If a
2339 value is assigned to
2340 <FONT SIZE=-1><B>SECONDS</B>,
2343 the value returned upon subsequent
2345 the number of seconds since the assignment plus the value assigned.
2347 <FONT SIZE=-1><B>SECONDS</B>
2350 is unset, it loses its special properties, even if it is
2352 <DT><B>SHELLOPTS</B>
2355 A colon-separated list of enabled shell options. Each word in
2356 the list is a valid argument for the
2362 builtin command (see
2363 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
2366 below). The options appearing in
2367 <FONT SIZE=-1><B>SHELLOPTS</B>
2370 are those reported as
2374 If this variable is in the environment when
2377 starts up, each shell option in the list will be enabled before
2378 reading any startup files.
2379 This variable is read-only.
2383 Incremented by one each time an instance of
2390 Expands to the user ID of the current user, initialized at shell startup.
2391 This variable is readonly.
2396 The following variables are used by the shell. In some cases,
2399 assigns a default value to a variable; these cases are noted
2405 <DT><B>BASH_COMPAT</B>
2408 The value is used to set the shell's compatibility level.
2409 See the description of the <B>shopt</B> builtin below under
2410 <B>SHELL BUILTIN COMMANDS</B>
2411 for a description of the various compatibility
2412 levels and their effects.
2413 The value may be a decimal number (e.g., 4.2) or an integer (e.g., 42)
2414 corresponding to the desired compatibility level.
2415 If <B>BASH_COMPAT</B> is unset or set to the empty string, the compatibility
2416 level is set to the default for the current version.
2417 If <B>BASH_COMPAT</B> is set to a value that is not one of the valid
2418 compatibility levels, the shell prints an error message and sets the
2419 compatibility level to the default for the current version.
2420 The valid compatibility levels correspond to the compatibility options
2421 accepted by the <B>shopt</B> builtin described below (for example,
2422 <B>compat42</B> means that 4.2 and 42 are valid values).
2423 The current version is also a valid value.
2427 If this parameter is set when <B>bash</B> is executing a shell script,
2428 its value is interpreted as a filename containing commands to
2429 initialize the shell, as in
2430 <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>.
2433 <FONT SIZE=-1><B>BASH_ENV</B>
2436 is subjected to parameter expansion, command substitution, and arithmetic
2437 expansion before being interpreted as a filename.
2438 <FONT SIZE=-1><B>PATH</B>
2441 is not used to search for the resultant filename.
2442 <DT><B>BASH_XTRACEFD</B>
2445 If set to an integer corresponding to a valid file descriptor, <B>bash</B>
2446 will write the trace output generated when
2449 is enabled to that file descriptor.
2450 The file descriptor is closed when
2451 <FONT SIZE=-1><B>BASH_XTRACEFD</B>
2454 is unset or assigned a new value.
2456 <FONT SIZE=-1><B>BASH_XTRACEFD</B>
2459 or assigning it the empty string causes the
2460 trace output to be sent to the standard error.
2462 <FONT SIZE=-1><B>BASH_XTRACEFD</B>
2465 to 2 (the standard error file
2466 descriptor) and then unsetting it will result in the standard error
2471 The search path for the
2475 This is a colon-separated list of directories in which the shell looks
2476 for destination directories specified by the
2481 <TT>".:~:/usr"</TT>.
2483 <DT><B>CHILD_MAX</B>
2486 Set the number of exited child status values for the shell to remember.
2487 Bash will not allow this value to be decreased below a POSIX-mandated
2488 minimum, and there is a maximum value (currently 8192) that this may
2490 The minimum value is system-dependent.
2494 Used by the <B>select</B> compound command to determine the terminal width
2495 when printing selection lists.
2496 Automatically set if the
2499 option is enabled or in an interactive shell upon receipt of a
2500 <FONT SIZE=-1><B>SIGWINCH</B>.
2503 <DT><B>COMPREPLY</B>
2506 An array variable from which <B>bash</B> reads the possible completions
2507 generated by a shell function invoked by the programmable completion
2508 facility (see <B>Programmable Completion</B> below).
2509 Each array element contains one possible completion.
2513 If <B>bash</B> finds this variable in the environment when the shell starts
2517 it assumes that the shell is running in an Emacs shell buffer and disables
2523 <FONT SIZE=-1><B>BASH_ENV</B>;
2526 used when the shell is invoked in POSIX mode.
2530 The default editor for the
2537 A colon-separated list of suffixes to ignore when performing
2538 filename completion (see
2539 <FONT SIZE=-1><B>READLINE</B>
2543 A filename whose suffix matches one of the entries in
2544 <FONT SIZE=-1><B>FIGNORE</B>
2547 is excluded from the list of matched filenames.
2549 <TT>".o:~"</TT>.
2554 If set to a numeric value greater than 0, defines a maximum function
2555 nesting level. Function invocations that exceed this nesting level
2556 will cause the current command to abort.
2557 <DT><B>GLOBIGNORE</B>
2560 A colon-separated list of patterns defining the set of filenames to
2561 be ignored by pathname expansion.
2562 If a filename matched by a pathname expansion pattern also matches one
2564 <FONT SIZE=-1><B>GLOBIGNORE</B>,
2567 it is removed from the list of matches.
2568 <DT><B>HISTCONTROL</B>
2571 A colon-separated list of values controlling how commands are saved on
2573 If the list of values includes
2576 lines which begin with a
2579 character are not saved in the history list.
2583 causes lines matching the previous history entry to not be saved.
2587 is shorthand for <I>ignorespace</I> and <I>ignoredups</I>.
2591 causes all previous lines matching the current line to be removed from
2592 the history list before that line is saved.
2593 Any value not in the above list is ignored.
2595 <FONT SIZE=-1><B>HISTCONTROL</B>
2598 is unset, or does not include a valid value,
2599 all lines read by the shell parser are saved on the history list,
2600 subject to the value of
2601 <FONT SIZE=-1><B>HISTIGNORE</B>.
2604 The second and subsequent lines of a multi-line compound command are
2605 not tested, and are added to the history regardless of the value of
2606 <FONT SIZE=-1><B>HISTCONTROL</B>.
2612 The name of the file in which command history is saved (see
2613 <FONT SIZE=-1><B>HISTORY</B>
2616 below). The default value is <A HREF="file:~/.bash_history"><I>~/.bash_history</I></A>. If unset, the
2617 command history is not saved when a shell exits.
2618 <DT><B>HISTFILESIZE</B>
2621 The maximum number of lines contained in the history file. When this
2622 variable is assigned a value, the history file is truncated, if
2624 to contain no more than that number of lines by removing the oldest entries.
2625 The history file is also truncated to this size after
2626 writing it when a shell exits.
2627 If the value is 0, the history file is truncated to zero size.
2628 Non-numeric values and numeric values less than zero inhibit truncation.
2629 The shell sets the default value to the value of <B>HISTSIZE</B>
2630 after reading any startup files.
2631 <DT><B>HISTIGNORE</B>
2634 A colon-separated list of patterns used to decide which command lines
2635 should be saved on the history list. Each pattern is anchored at the
2636 beginning of the line and must match the complete line (no implicit
2637 `<B>*</B>' is appended). Each pattern is tested against the line
2638 after the checks specified by
2639 <FONT SIZE=-1><B>HISTCONTROL</B>
2643 In addition to the normal shell pattern matching characters, `<B>&</B>'
2644 matches the previous history line. `<B>&</B>' may be escaped using a
2645 backslash; the backslash is removed before attempting a match.
2646 The second and subsequent lines of a multi-line compound command are
2647 not tested, and are added to the history regardless of the value of
2648 <FONT SIZE=-1><B>HISTIGNORE</B>.
2654 The number of commands to remember in the command history (see
2655 <FONT SIZE=-1><B>HISTORY</B>
2659 If the value is 0, commands are not saved in the history list.
2660 Numeric values less than zero result in every command being saved
2661 on the history list (there is no limit).
2662 The shell sets the default value to 500 after reading any startup files.
2663 <DT><B>HISTTIMEFORMAT</B>
2666 If this variable is set and not null, its value is used as a format string
2667 for <I>strftime</I>(3) to print the time stamp associated with each history
2668 entry displayed by the <B>history</B> builtin.
2669 If this variable is set, time stamps are written to the history file so
2670 they may be preserved across shell sessions.
2671 This uses the history comment character to distinguish timestamps from
2672 other history lines.
2676 The home directory of the current user; the default argument for the
2677 <B>cd</B> builtin command.
2678 The value of this variable is also used when performing tilde expansion.
2682 Contains the name of a file in the same format as
2686 that should be read when the shell needs to complete a
2688 The list of possible hostname completions may be changed while the
2690 the next time hostname completion is attempted after the
2694 adds the contents of the new file to the existing list.
2696 <FONT SIZE=-1><B>HOSTFILE</B>
2699 is set, but has no value, or does not name a readable file,
2700 <B>bash</B> attempts to read
2704 to obtain the list of possible hostname completions.
2706 <FONT SIZE=-1><B>HOSTFILE</B>
2709 is unset, the hostname list is cleared.
2714 <I>Internal Field Separator</I>
2717 for word splitting after expansion and to
2718 split lines into words with the
2721 builtin command. The default value is
2722 ``<space><tab><newline>''.
2723 <DT><B>IGNOREEOF</B>
2727 action of an interactive shell on receipt of an
2728 <FONT SIZE=-1><B>EOF</B>
2731 character as the sole input. If set, the value is the number of
2733 <FONT SIZE=-1><B>EOF</B>
2736 characters which must be
2737 typed as the first characters on an input line before
2740 exits. If the variable exists but does not have a numeric value, or
2741 has no value, the default value is 10. If it does not exist,
2742 <FONT SIZE=-1><B>EOF</B>
2745 signifies the end of input to the shell.
2749 The filename for the
2752 startup file, overriding the default of
2754 <A HREF="file:~/.inputrc"><I>~/.inputrc</I></A>
2757 <FONT SIZE=-1><B>READLINE</B>
2764 Used to determine the locale category for any category not specifically
2765 selected with a variable starting with <B>LC_</B>.
2769 This variable overrides the value of
2770 <FONT SIZE=-1><B>LANG</B>
2774 <B>LC_</B> variable specifying a locale category.
2775 <DT><B>LC_COLLATE</B>
2778 This variable determines the collation order used when sorting the
2779 results of pathname expansion, and determines the behavior of range
2780 expressions, equivalence classes, and collating sequences within
2781 pathname expansion and pattern matching.
2785 This variable determines the interpretation of characters and the
2786 behavior of character classes within pathname expansion and pattern
2788 <DT><B>LC_MESSAGES</B>
2791 This variable determines the locale used to translate double-quoted
2792 strings preceded by a <B>$</B>.
2793 <DT><B>LC_NUMERIC</B>
2796 This variable determines the locale category used for number formatting.
2800 Used by the <B>select</B> compound command to determine the column length
2801 for printing selection lists.
2802 Automatically set if the
2805 option is enabled or in an interactive shell upon receipt of a
2806 <FONT SIZE=-1><B>SIGWINCH</B>.
2812 If this parameter is set to a file or directory name and the
2813 <FONT SIZE=-1><B>MAILPATH</B>
2816 variable is not set,
2819 informs the user of the arrival of mail in the specified file or
2820 Maildir-format directory.
2821 <DT><B>MAILCHECK</B>
2828 checks for mail. The default is 60 seconds. When it is time to check
2829 for mail, the shell does so before displaying the primary prompt.
2830 If this variable is unset, or set to a value that is not a number
2831 greater than or equal to zero, the shell disables mail checking.
2835 A colon-separated list of filenames to be checked for mail.
2836 The message to be printed when mail arrives in a particular file
2837 may be specified by separating the filename from the message with a `?'.
2838 When used in the text of the message, <B>$_</B> expands to the name of
2839 the current mailfile.
2841 <DL COMPACT><DT><DD>
2844 <B>MAILPATH</B>=aq/var/mail/bfox?"You have mail":~/shell-mail?"$_ has mail!"aq
2849 supplies a default value for this variable, but the location of the user
2850 mail files that it uses is system dependent (e.g., /var/mail/<B>$USER</B>).
2856 If set to the value 1,
2859 displays error messages generated by the
2862 builtin command (see
2863 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
2867 <FONT SIZE=-1><B>OPTERR</B>
2870 is initialized to 1 each time the shell is invoked or a shell
2875 The search path for commands. It
2876 is a colon-separated list of directories in which
2877 the shell looks for commands (see
2878 <FONT SIZE=-1><B>COMMAND EXECUTION</B>
2882 A zero-length (null) directory name in the value of
2883 <FONT SIZE=-1><B>PATH</B>
2886 indicates the current directory.
2887 A null directory name may appear as two adjacent colons, or as an initial
2889 The default path is system-dependent,
2890 and is set by the administrator who installs
2894 <TT>/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin</TT>.
2896 <DT><B>POSIXLY_CORRECT</B>
2899 If this variable is in the environment when <B>bash</B> starts, the shell
2900 enters <I>posix mode</I> before reading the startup files, as if the
2903 invocation option had been supplied. If it is set while the shell is
2904 running, <B>bash</B> enables <I>posix mode</I>, as if the command
2905 <TT>set -o posix</TT>
2908 <DT><B>PROMPT_COMMAND</B>
2911 If set, the value is executed as a command prior to issuing each primary
2913 <DT><B>PROMPT_DIRTRIM</B>
2916 If set to a number greater than zero, the value is used as the number of
2917 trailing directory components to retain when expanding the <B>\w</B> and
2918 <B>\W</B> prompt string escapes (see
2919 <FONT SIZE=-1><B>PROMPTING</B>
2922 below). Characters removed are replaced with an ellipsis.
2926 The value of this parameter is expanded (see
2927 <FONT SIZE=-1><B>PROMPTING</B>
2930 below) and used as the primary prompt string. The default value is
2931 ``<B>\s-\v\$ </B>''.
2935 The value of this parameter is expanded as with
2936 <FONT SIZE=-1><B>PS1</B>
2939 and used as the secondary prompt string. The default is
2944 The value of this parameter is used as the prompt for the
2948 <FONT SIZE=-1><B>SHELL GRAMMAR</B>
2955 The value of this parameter is expanded as with
2956 <FONT SIZE=-1><B>PS1</B>
2959 and the value is printed before each command
2962 displays during an execution trace. The first character of
2963 <FONT SIZE=-1><B>PS4</B>
2966 is replicated multiple times, as necessary, to indicate multiple
2967 levels of indirection. The default is ``<B>+ </B>''.
2971 The full pathname to the shell is kept in this environment variable.
2972 If it is not set when the shell starts,
2975 assigns to it the full pathname of the current user's login shell.
2976 <DT><B>TIMEFORMAT</B>
2979 The value of this parameter is used as a format string specifying
2980 how the timing information for pipelines prefixed with the
2983 reserved word should be displayed.
2984 The <B>%</B> character introduces an escape sequence that is
2985 expanded to a time value or other information.
2986 The escape sequences and their meanings are as follows; the
2987 braces denote optional portions.
2989 <DL COMPACT><DT><DD>
2996 <DT><B>%[</B><I>p</I>][l]R
2999 The elapsed time in seconds.
3000 <DT><B>%[</B><I>p</I>][l]U
3003 The number of CPU seconds spent in user mode.
3004 <DT><B>%[</B><I>p</I>][l]S
3007 The number of CPU seconds spent in system mode.
3011 The CPU percentage, computed as (%U + %S) / %R.
3016 The optional <I>p</I> is a digit specifying the <I>precision</I>,
3017 the number of fractional digits after a decimal point.
3018 A value of 0 causes no decimal point or fraction to be output.
3019 At most three places after the decimal point may be specified;
3020 values of <I>p</I> greater than 3 are changed to 3.
3021 If <I>p</I> is not specified, the value 3 is used.
3023 The optional <B>l</B> specifies a longer format, including
3024 minutes, of the form <I>MM</I>m<I>SS</I>.<I>FF</I>s.
3025 The value of <I>p</I> determines whether or not the fraction is
3028 If this variable is not set, <B>bash</B> acts as if it had the
3029 value <B>$aq\nreal\t%3lR\nuser\t%3lU\nsys\t%3lSaq</B>.
3030 If the value is null, no timing information is displayed.
3031 A trailing newline is added when the format string is displayed.
3036 If set to a value greater than zero,
3037 <FONT SIZE=-1><B>TMOUT</B>
3041 default timeout for the <B>read</B> builtin.
3042 The <B>select</B> command terminates if input does not arrive
3044 <FONT SIZE=-1><B>TMOUT</B>
3047 seconds when input is coming from a terminal.
3048 In an interactive shell, the value is interpreted as the
3049 number of seconds to wait for a line of input after issuing the
3053 terminates after waiting for that number of seconds if a complete
3054 line of input does not arrive.
3058 If set, <B>bash</B> uses its value as the name of a directory in which
3059 <B>bash</B> creates temporary files for the shell's use.
3060 <DT><B>auto_resume</B>
3063 This variable controls how the shell interacts with the user and
3064 job control. If this variable is set, single word simple
3065 commands without redirections are treated as candidates for resumption
3066 of an existing stopped job. There is no ambiguity allowed; if there is
3067 more than one job beginning with the string typed, the job most recently
3068 accessed is selected. The
3071 of a stopped job, in this context, is the command line used to
3076 the string supplied must match the name of a stopped job exactly;
3080 the string supplied needs to match a substring of the name of a
3084 value provides functionality analogous to the
3088 <FONT SIZE=-1><B>JOB CONTROL</B>
3091 below). If set to any other value, the supplied string must
3092 be a prefix of a stopped job's name; this provides functionality
3093 analogous to the <B>%</B><I>string</I> job identifier.
3094 <DT><B>histchars</B>
3097 The two or three characters which control history expansion
3098 and tokenization (see
3099 <FONT SIZE=-1><B>HISTORY EXPANSION</B>
3102 below). The first character is the <I>history expansion</I> character,
3103 the character which signals the start of a history
3104 expansion, normally `<B>!</B>'.
3105 The second character is the <I>quick substitution</I>
3106 character, which is used as shorthand for re-running the previous
3107 command entered, substituting one string for another in the command.
3108 The default is `<B>^</B>'.
3109 The optional third character is the character
3110 which indicates that the remainder of the line is a comment when found
3111 as the first character of a word, normally `<B>#</B>'. The history
3112 comment character causes history substitution to be skipped for the
3113 remaining words on the line. It does not necessarily cause the shell
3114 parser to treat the rest of the line as a comment.
3117 <A NAME="lbAX"> </A>
3122 provides one-dimensional indexed and associative array variables.
3123 Any variable may be used as an indexed array; the
3126 builtin will explicitly declare an array.
3128 limit on the size of an array, nor any requirement that members
3129 be indexed or assigned contiguously.
3130 Indexed arrays are referenced using integers (including arithmetic
3131 expressions) and are zero-based; associative arrays are referenced
3132 using arbitrary strings.
3133 Unless otherwise noted, indexed array indices must be non-negative integers.
3136 An indexed array is created automatically if any variable is assigned to
3137 using the syntax <I>name</I>[<I>subscript</I>]=<I>value</I>. The
3140 is treated as an arithmetic expression that must evaluate to a number.
3141 To explicitly declare an indexed array, use
3142 <B>declare -a </B><I>name</I>
3145 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
3149 <B>declare -a </B><I>name</I>[<I>subscript</I>]
3151 is also accepted; the <I>subscript</I> is ignored.
3154 Associative arrays are created using
3155 <B>declare -A </B><I>name</I>.
3160 specified for an array variable using the
3166 builtins. Each attribute applies to all members of an array.
3169 Arrays are assigned to using compound assignments of the form
3170 <I>name</I>=<B>(</B>value<I>1</I> ... value<I>n</I><B>)</B>, where each
3171 <I>value</I> is of the form [<I>subscript</I>]=<I>string</I>.
3172 Indexed array assignments do not require anything but <I>string</I>.
3173 When assigning to indexed arrays, if the optional brackets and subscript
3174 are supplied, that index is assigned to;
3175 otherwise the index of the element assigned is the last index assigned
3176 to by the statement plus one. Indexing starts at zero.
3179 When assigning to an associative array, the subscript is required.
3182 This syntax is also accepted by the
3185 builtin. Individual array elements may be assigned to using the
3186 <I>name</I>[<I>subscript</I>]=<I>value</I> syntax introduced above.
3187 When assigning to an indexed array, if
3190 is subscripted by a negative number, that number is
3191 interpreted as relative to one greater than the maximum index of
3192 <I>name</I>, so negative indices count back from the end of the
3193 array, and an index of -1 references the last element.
3196 Any element of an array may be referenced using
3197 ${<I>name</I>[<I>subscript</I>]}. The braces are required to avoid
3198 conflicts with pathname expansion. If
3199 <I>subscript</I> is <B>@</B> or <B>*</B>, the word expands to
3200 all members of <I>name</I>. These subscripts differ only when the
3201 word appears within double quotes. If the word is double-quoted,
3202 ${<I>name</I>[*]} expands to a single
3203 word with the value of each array member separated by the first
3205 <FONT SIZE=-1><B>IFS</B>
3208 special variable, and ${<I>name</I>[@]} expands each element of
3209 <I>name</I> to a separate word. When there are no array members,
3210 ${<I>name</I>[@]} expands to nothing.
3211 If the double-quoted expansion occurs within a word, the expansion of
3212 the first parameter is joined with the beginning part of the original
3213 word, and the expansion of the last parameter is joined with the last
3214 part of the original word.
3215 This is analogous to the expansion
3216 of the special parameters <B>*</B> and <B>@</B> (see
3217 <B>Special Parameters</B>
3219 above). ${#<I>name</I>[<I>subscript</I>]} expands to the length of
3220 ${<I>name</I>[<I>subscript</I>]}. If <I>subscript</I> is <B>*</B> or
3221 <B>@</B>, the expansion is the number of elements in the array.
3222 Referencing an array variable without a subscript is equivalent to
3223 referencing the array with a subscript of 0.
3227 used to reference an element of an indexed array
3228 evaluates to a number less than zero, it is
3229 interpreted as relative to one greater than the maximum index of the array,
3230 so negative indices count back from the end of the
3231 array, and an index of -1 references the last element.
3234 An array variable is considered set if a subscript has been assigned a
3235 value. The null string is a valid value.
3238 It is possible to obtain the keys (indices) of an array as well as the values.
3239 ${<B>!</B><I>name</I>[<I>@</I>]} and ${<B>!</B><I>name</I>[<I>*</I>]}
3240 expand to the indices assigned in array variable <I>name</I>.
3241 The treatment when in double quotes is similar to the expansion of the
3242 special parameters <I>@</I> and <I>*</I> within double quotes.
3248 builtin is used to destroy arrays. <B>unset</B> <I>name</I>[<I>subscript</I>]
3249 destroys the array element at index <I>subscript</I>.
3250 Negative subscripts to indexed arrays are interpreted as described above.
3251 Care must be taken to avoid unwanted side effects caused by pathname
3253 <B>unset</B> <I>name</I>, where <I>name</I> is an array, or
3254 <B>unset</B> <I>name</I>[<I>subscript</I>], where
3255 <I>subscript</I> is <B>*</B> or <B>@</B>, removes the entire array.
3266 builtins each accept a
3269 option to specify an indexed array and a
3272 option to specify an associative array.
3273 If both options are supplied,
3283 option to assign a list of words read from the standard input
3290 builtins display array values in a way that allows them to be
3291 reused as assignments.
3292 <A NAME="lbAY"> </A>
3295 Expansion is performed on the command line after it has been split into
3296 words. There are seven kinds of expansion performed:
3297 <I>brace expansion</I>,
3299 <I>tilde expansion</I>,
3301 <I>parameter and variable expansion</I>,
3303 <I>command substitution</I>,
3305 <I>arithmetic expansion</I>,
3307 <I>word splitting</I>,
3310 <I>pathname expansion</I>.
3314 The order of expansions is:
3316 tilde expansion, parameter and variable expansion, arithmetic expansion,
3317 and command substitution (done in a left-to-right fashion);
3319 and pathname expansion.
3322 On systems that can support it, there is an additional expansion
3323 available: <I>process substitution</I>.
3324 This is performed at the
3325 same time as tilde, parameter, variable, and arithmetic expansion and
3326 command substitution.
3329 Only brace expansion, word splitting, and pathname expansion
3330 can change the number of words of the expansion; other expansions
3331 expand a single word to a single word.
3332 The only exceptions to this are the expansions of
3333 "<B>$@</B>" and "<B>${</B><I>name</I><B>[@]}</B>"
3334 as explained above (see
3335 <FONT SIZE=-1><B>PARAMETERS</B>).
3338 <A NAME="lbAZ"> </A>
3339 <H4>Brace Expansion</H4>
3343 <I>Brace expansion</I>
3345 is a mechanism by which arbitrary strings
3346 may be generated. This mechanism is similar to
3347 <I>pathname expansion</I>, but the filenames generated
3348 need not exist. Patterns to be brace expanded take
3349 the form of an optional
3352 followed by either a series of comma-separated strings or
3353 a sequence expression between a pair of braces, followed by
3357 The preamble is prefixed to each string contained
3358 within the braces, and the postscript is then appended
3359 to each resulting string, expanding left to right.
3362 Brace expansions may be nested. The results of each expanded
3363 string are not sorted; left to right order is preserved.
3364 For example, a<B>{</B>d,c,b<B>}</B>e expands into `ade ace abe'.
3367 A sequence expression takes the form
3368 <B>{</B><I>x</I><B>..</B><I>y</I><B>[..</B><I>incr</I><B>]}</B>,
3369 where <I>x</I> and <I>y</I> are either integers or single characters,
3370 and <I>incr</I>, an optional increment, is an integer.
3371 When integers are supplied, the expression expands to each number between
3372 <I>x</I> and <I>y</I>, inclusive.
3373 Supplied integers may be prefixed with <I>0</I> to force each term to have the
3375 When either <I>x</I> or y begins with a zero, the shell
3376 attempts to force all generated terms to contain the same number of digits,
3377 zero-padding where necessary.
3378 When characters are supplied, the expression expands to each character
3379 lexicographically between <I>x</I> and <I>y</I>, inclusive,
3380 using the default C locale.
3381 Note that both <I>x</I> and <I>y</I> must be of the same type.
3382 When the increment is supplied, it is used as the difference between
3383 each term. The default increment is 1 or -1 as appropriate.
3386 Brace expansion is performed before any other expansions,
3387 and any characters special to other expansions are preserved
3388 in the result. It is strictly textual.
3391 does not apply any syntactic interpretation to the context of the
3392 expansion or the text between the braces.
3395 A correctly-formed brace expansion must contain unquoted opening
3396 and closing braces, and at least one unquoted comma or a valid
3397 sequence expression.
3398 Any incorrectly formed brace expansion is left unchanged.
3399 A <B>{</B> or <B>,</B> may be quoted with a backslash to prevent its
3400 being considered part of a brace expression.
3401 To avoid conflicts with parameter expansion, the string <B>${</B>
3402 is not considered eligible for brace expansion.
3405 This construct is typically used as shorthand when the common
3406 prefix of the strings to be generated is longer than in the
3408 <DL COMPACT><DT><DD>
3411 mkdir /usr/local/src/bash/{old,new,dist,bugs}
3415 <DL COMPACT><DT><DD>
3416 chown root /usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}}
3421 Brace expansion introduces a slight incompatibility with
3422 historical versions of
3427 does not treat opening or closing braces specially when they
3428 appear as part of a word, and preserves them in the output.
3431 removes braces from words as a consequence of brace
3432 expansion. For example, a word entered to
3436 appears identically in the output. The same word is
3443 If strict compatibility with
3452 option or disable brace expansion with the
3459 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
3463 <A NAME="lbBA"> </A>
3464 <H4>Tilde Expansion</H4>
3468 If a word begins with an unquoted tilde character (`<B>~</B>'), all of
3469 the characters preceding the first unquoted slash (or all characters,
3470 if there is no unquoted slash) are considered a <I>tilde-prefix</I>.
3471 If none of the characters in the tilde-prefix are quoted, the
3472 characters in the tilde-prefix following the tilde are treated as a
3473 possible <I>login name</I>.
3474 If this login name is the null string, the tilde is replaced with the
3475 value of the shell parameter
3476 <FONT SIZE=-1><B>HOME</B>.
3480 <FONT SIZE=-1><B>HOME</B>
3483 is unset, the home directory of the user executing the shell is
3484 substituted instead.
3485 Otherwise, the tilde-prefix is replaced with the home directory
3486 associated with the specified login name.
3489 If the tilde-prefix is a `~+', the value of the shell variable
3490 <FONT SIZE=-1><B>PWD</B>
3493 replaces the tilde-prefix.
3494 If the tilde-prefix is a `~-', the value of the shell variable
3495 <FONT SIZE=-1><B>OLDPWD</B>,
3498 if it is set, is substituted.
3499 If the characters following the tilde in the tilde-prefix consist
3500 of a number <I>N</I>, optionally prefixed
3501 by a `+' or a `-', the tilde-prefix is replaced with the corresponding
3502 element from the directory stack, as it would be displayed by the
3505 builtin invoked with the tilde-prefix as an argument.
3506 If the characters following the tilde in the tilde-prefix consist of a
3507 number without a leading `+' or `-', `+' is assumed.
3510 If the login name is invalid, or the tilde expansion fails, the word
3514 Each variable assignment is checked for unquoted tilde-prefixes immediately
3521 In these cases, tilde expansion is also performed.
3522 Consequently, one may use filenames with tildes in assignments to
3523 <FONT SIZE=-1><B>PATH</B>,
3526 <FONT SIZE=-1><B>MAILPATH</B>,
3530 <FONT SIZE=-1><B>CDPATH</B>,
3533 and the shell assigns the expanded value.
3534 <A NAME="lbBB"> </A>
3535 <H4>Parameter Expansion</H4>
3539 The `<B>$</B>' character introduces parameter expansion,
3540 command substitution, or arithmetic expansion. The parameter name
3541 or symbol to be expanded may be enclosed in braces, which
3542 are optional but serve to protect the variable to be expanded from
3543 characters immediately following it which could be
3544 interpreted as part of the name.
3547 When braces are used, the matching ending brace is the first `<B>}</B>'
3548 not escaped by a backslash or within a quoted string, and not within an
3549 embedded arithmetic expansion, command substitution, or parameter
3555 <DT>${<I>parameter</I>}<DD>
3556 The value of <I>parameter</I> is substituted. The braces are required
3560 is a positional parameter with more than one digit,
3564 is followed by a character which is not to be
3565 interpreted as part of its name.
3566 The <I>parameter</I> is a shell parameter as described above
3567 <B>PARAMETERS</B>) or an array reference (<B>Arrays</B>).
3572 If the first character of <I>parameter</I> is an exclamation point (<B>!</B>),
3573 it introduces a level of variable indirection.
3574 <B>Bash</B> uses the value of the variable formed from the rest of
3575 <I>parameter</I> as the name of the variable; this variable is then
3576 expanded and that value is used in the rest of the substitution, rather
3577 than the value of <I>parameter</I> itself.
3578 This is known as <I>indirect expansion</I>.
3579 The exceptions to this are the expansions of ${<B>!</B><I>prefix</I><B>*</B>} and
3580 ${<B>!</B><I>name</I>[<I>@</I>]} described below.
3581 The exclamation point must immediately follow the left brace in order to
3582 introduce indirection.
3585 In each of the cases below, <I>word</I> is subject to tilde expansion,
3586 parameter expansion, command substitution, and arithmetic expansion.
3589 When not performing substring expansion, using the forms documented below
3591 <B>bash</B> tests for a parameter that is unset or null. Omitting the colon
3592 results in a test only for a parameter that is unset.
3597 <DT>${<I>parameter</I><B>:-</B><I>word</I>}<DD>
3598 <B>Use Default Values</B>. If
3601 is unset or null, the expansion of
3604 is substituted. Otherwise, the value of
3608 <DT>${<I>parameter</I><B>:=</B><I>word</I>}<DD>
3609 <B>Assign Default Values</B>.
3613 is unset or null, the expansion of
3622 is then substituted. Positional parameters and special parameters may
3623 not be assigned to in this way.
3624 <DT>${<I>parameter</I><B>:?</B><I>word</I>}<DD>
3625 <B>Display Error if Null or Unset</B>.
3629 is null or unset, the expansion of <I>word</I> (or a message to that effect
3633 is not present) is written to the standard error and the shell, if it
3634 is not interactive, exits. Otherwise, the value of <I>parameter</I> is
3636 <DT>${<I>parameter</I><B>:+</B><I>word</I>}<DD>
3637 <B>Use Alternate Value</B>.
3641 is null or unset, nothing is substituted, otherwise the expansion of
3645 <DT>${<I>parameter</I><B>:</B><I>offset</I>}<DD>
3647 <DT>${<I>parameter</I><B>:</B><I>offset</I><B>:</B><I>length</I>}<DD>
3649 <B>Substring Expansion</B>.
3650 Expands to up to <I>length</I> characters of the value of <I>parameter</I>
3651 starting at the character specified by <I>offset</I>.
3652 If <I>parameter</I> is <B>@</B>, an indexed array subscripted by
3653 <B>@</B> or <B>*</B>, or an associative array name, the results differ as
3655 If <I>length</I> is omitted, expands to the substring of the value of
3656 <I>parameter</I> starting at the character specified by <I>offset</I>
3657 and extending to the end of the value.
3658 <I>length</I> and <I>offset</I> are arithmetic expressions (see
3659 <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>
3664 If <I>offset</I> evaluates to a number less than zero, the value
3665 is used as an offset in characters
3666 from the end of the value of <I>parameter</I>.
3667 If <I>length</I> evaluates to a number less than zero,
3668 it is interpreted as an offset in characters
3669 from the end of the value of <I>parameter</I> rather than
3670 a number of characters, and the expansion is the characters between
3671 <I>offset</I> and that result.
3672 Note that a negative offset must be separated from the colon by at least
3673 one space to avoid being confused with the <B>:-</B> expansion.
3675 If <I>parameter</I> is <B>@</B>, the result is <I>length</I> positional
3676 parameters beginning at <I>offset</I>.
3677 A negative <I>offset</I> is taken relative to one greater than the greatest
3678 positional parameter, so an offset of -1 evaluates to the last positional
3680 It is an expansion error if <I>length</I> evaluates to a number less than
3683 If <I>parameter</I> is an indexed array name subscripted by @ or *,
3684 the result is the <I>length</I>
3685 members of the array beginning with ${<I>parameter</I>[<I>offset</I>]}.
3686 A negative <I>offset</I> is taken relative to one greater than the maximum
3687 index of the specified array.
3688 It is an expansion error if <I>length</I> evaluates to a number less than
3691 Substring expansion applied to an associative array produces undefined
3694 Substring indexing is zero-based unless the positional parameters
3695 are used, in which case the indexing starts at 1 by default.
3696 If <I>offset</I> is 0, and the positional parameters are used, <B>$0</B> is
3697 prefixed to the list.
3698 <DT>${<B>!</B><I>prefix</I><B>*</B>}<DD>
3700 <DT>${<B>!</B><I>prefix</I><B>@</B>}<DD>
3702 <B>Names matching prefix</B>.
3703 Expands to the names of variables whose names begin with <I>prefix</I>,
3704 separated by the first character of the
3705 <FONT SIZE=-1><B>IFS</B>
3709 When <I>@</I> is used and the expansion appears within double quotes, each
3710 variable name expands to a separate word.
3711 <DT>${<B>!</B><I>name</I>[<I>@</I>]}<DD>
3713 <DT>${<B>!</B><I>name</I>[<I>*</I>]}<DD>
3715 <B>List of array keys</B>.
3716 If <I>name</I> is an array variable, expands to the list of array indices
3717 (keys) assigned in <I>name</I>.
3718 If <I>name</I> is not an array, expands to 0 if <I>name</I> is set and null
3720 When <I>@</I> is used and the expansion appears within double quotes, each
3721 key expands to a separate word.
3722 <DT>${<B>#</B><I>parameter</I>}<DD>
3723 <B>Parameter length</B>.
3724 The length in characters of the value of <I>parameter</I> is substituted.
3734 the value substituted is the number of positional parameters.
3738 is an array name subscripted by
3744 the value substituted is the number of elements in the array.
3748 is an indexed array name subscripted by a negative number, that number is
3749 interpreted as relative to one greater than the maximum index of
3750 <I>parameter</I>, so negative indices count back from the end of the
3751 array, and an index of -1 references the last element.
3752 <DT>${<I>parameter</I><B>#</B><I>word</I>}<DD>
3754 <DT>${<I>parameter</I><B>##</B><I>word</I>}<DD>
3756 <B>Remove matching prefix pattern</B>.
3760 is expanded to produce a pattern just as in pathname
3761 expansion. If the pattern matches the beginning of
3765 then the result of the expansion is the expanded value of
3768 with the shortest matching pattern (the ``<B>#</B>'' case) or the
3769 longest matching pattern (the ``<B>##</B>'' case) deleted.
3779 the pattern removal operation is applied to each positional
3780 parameter in turn, and the expansion is the resultant list.
3784 is an array variable subscripted with
3790 the pattern removal operation is applied to each member of the
3791 array in turn, and the expansion is the resultant list.
3792 <DT>${<I>parameter</I><B>%</B><I>word</I>}<DD>
3794 <DT>${<I>parameter</I><B>%%</B><I>word</I>}<DD>
3796 <B>Remove matching suffix pattern</B>.
3797 The <I>word</I> is expanded to produce a pattern just as in
3799 If the pattern matches a trailing portion of the expanded value of
3802 then the result of the expansion is the expanded value of
3805 with the shortest matching pattern (the ``<B>%</B>'' case) or the
3806 longest matching pattern (the ``<B>%%</B>'' case) deleted.
3816 the pattern removal operation is applied to each positional
3817 parameter in turn, and the expansion is the resultant list.
3821 is an array variable subscripted with
3827 the pattern removal operation is applied to each member of the
3828 array in turn, and the expansion is the resultant list.
3829 <DT>${<I>parameter</I><B>/</B><I>pattern</I><B>/</B><I>string</I>}<DD>
3830 <B>Pattern substitution</B>.
3831 The <I>pattern</I> is expanded to produce a pattern just as in
3833 <I>Parameter</I> is expanded and the longest match of <I>pattern</I>
3834 against its value is replaced with <I>string</I>.
3835 If <I>pattern</I> begins with <B>/</B>, all matches of <I>pattern</I> are
3836 replaced with <I>string</I>. Normally only the first match is replaced.
3837 If <I>pattern</I> begins with <B>#</B>, it must match at the beginning
3838 of the expanded value of <I>parameter</I>.
3839 If <I>pattern</I> begins with <B>%</B>, it must match at the end
3840 of the expanded value of <I>parameter</I>.
3841 If <I>string</I> is null, matches of <I>pattern</I> are deleted
3842 and the <B>/</B> following <I>pattern</I> may be omitted.
3852 the substitution operation is applied to each positional
3853 parameter in turn, and the expansion is the resultant list.
3857 is an array variable subscripted with
3863 the substitution operation is applied to each member of the
3864 array in turn, and the expansion is the resultant list.
3865 <DT>${<I>parameter</I><B>^</B><I>pattern</I>}<DD>
3867 <DT>${<I>parameter</I><B>^^</B><I>pattern</I>}<DD>
3868 <DT>${<I>parameter</I><B>,</B><I>pattern</I>}<DD>
3869 <DT>${<I>parameter</I><B>,,</B><I>pattern</I>}<DD>
3871 <B>Case modification</B>.
3872 This expansion modifies the case of alphabetic characters in <I>parameter</I>.
3873 The <I>pattern</I> is expanded to produce a pattern just as in
3875 Each character in the expanded value of <I>parameter</I> is tested against
3876 <I>pattern</I>, and, if it matches the pattern, its case is converted.
3877 The pattern should not attempt to match more than one character.
3878 The <B>^</B> operator converts lowercase letters matching <I>pattern</I>
3879 to uppercase; the <B>,</B> operator converts matching uppercase letters
3881 The <B>^^</B> and <B>,,</B> expansions convert each matched character in the
3882 expanded value; the <B>^</B> and <B>,</B> expansions match and convert only
3883 the first character in the expanded value.
3884 If <I>pattern</I> is omitted, it is treated like a <B>?</B>, which matches
3895 the case modification operation is applied to each positional
3896 parameter in turn, and the expansion is the resultant list.
3900 is an array variable subscripted with
3906 the case modification operation is applied to each member of the
3907 array in turn, and the expansion is the resultant list.
3909 <A NAME="lbBC"> </A>
3910 <H4>Command Substitution</H4>
3914 <I>Command substitution</I> allows the output of a command to replace
3915 the command name. There are two forms:
3916 <DL COMPACT><DT><DD>
3919 <B>$(</B><I>command</I><B>)</B>
3923 <DL COMPACT><DT><DD>
3924 <B>`</B><I>command</I><B>`</B>
3931 performs the expansion by executing <I>command</I> and
3932 replacing the command substitution with the standard output of the
3933 command, with any trailing newlines deleted.
3934 Embedded newlines are not deleted, but they may be removed during
3936 The command substitution <B>$(cat </B><I>file</I>) can be replaced by
3937 the equivalent but faster <B>$(< </B><I>file</I>).
3940 When the old-style backquote form of substitution is used,
3941 backslash retains its literal meaning except when followed by
3949 The first backquote not preceded by a backslash terminates the
3950 command substitution.
3951 When using the $(<I>command</I>) form, all characters between the
3952 parentheses make up the command; none are treated specially.
3955 Command substitutions may be nested. To nest when using the backquoted form,
3956 escape the inner backquotes with backslashes.
3959 If the substitution appears within double quotes, word splitting and
3960 pathname expansion are not performed on the results.
3961 <A NAME="lbBD"> </A>
3962 <H4>Arithmetic Expansion</H4>
3966 Arithmetic expansion allows the evaluation of an arithmetic expression
3967 and the substitution of the result. The format for arithmetic expansion is:
3968 <DL COMPACT><DT><DD>
3971 <B>$((</B><I>expression</I><B>))</B>
3979 is treated as if it were within double quotes, but a double quote
3980 inside the parentheses is not treated specially.
3981 All tokens in the expression undergo parameter and variable expansion,
3982 command substitution, and quote removal.
3983 The result is treated as the arithmetic expression to be evaluated.
3984 Arithmetic expansions may be nested.
3987 The evaluation is performed according to the rules listed below under
3988 <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>.
3997 prints a message indicating failure and no substitution occurs.
3998 <A NAME="lbBE"> </A>
3999 <H4>Process Substitution</H4>
4003 <I>Process substitution</I> is supported on systems that support named
4004 pipes (<I>FIFOs</I>) or the <B>/dev/fd</B> method of naming open files.
4005 It takes the form of
4006 <B><(</B><I>list</I><B>)</B>
4008 <B>>(</B><I>list</I><B>)</B>.
4009 The process <I>list</I> is run with its input or output connected to a
4010 <I>FIFO</I> or some file in <B>/dev/fd</B>. The name of this file is
4011 passed as an argument to the current command as the result of the
4012 expansion. If the <B>>(</B><I>list</I><B>)</B> form is used, writing to
4013 the file will provide input for <I>list</I>. If the
4014 <B><(</B><I>list</I><B>)</B> form is used, the file passed as an
4015 argument should be read to obtain the output of <I>list</I>.
4018 When available, process substitution is performed
4019 simultaneously with parameter and variable expansion,
4020 command substitution,
4021 and arithmetic expansion.
4022 <A NAME="lbBF"> </A>
4023 <H4>Word Splitting</H4>
4027 The shell scans the results of
4028 parameter expansion,
4029 command substitution,
4031 arithmetic expansion
4032 that did not occur within double quotes for
4033 <I>word splitting</I>.
4037 The shell treats each character of
4038 <FONT SIZE=-1><B>IFS</B>
4041 as a delimiter, and splits the results of the other
4042 expansions into words using these characters as field terminators.
4044 <FONT SIZE=-1><B>IFS</B>
4049 <B><space><tab><newline></B>,
4053 <B><space></B>,
4058 <B><newline></B>
4060 at the beginning and end of the results of the previous
4061 expansions are ignored, and
4063 <FONT SIZE=-1><B>IFS</B>
4066 characters not at the beginning or end serves to delimit words.
4068 <FONT SIZE=-1><B>IFS</B>
4071 has a value other than the default, then sequences of
4072 the whitespace characters
4078 are ignored at the beginning and end of the
4079 word, as long as the whitespace character is in the
4081 <FONT SIZE=-1><B>IFS</B>
4085 <FONT SIZE=-1><B>IFS</B>
4088 whitespace character).
4090 <FONT SIZE=-1><B>IFS</B>
4094 <FONT SIZE=-1><B>IFS</B>
4097 whitespace, along with any adjacent
4098 <FONT SIZE=-1><B>IFS</B>
4101 whitespace characters, delimits a field.
4103 <FONT SIZE=-1><B>IFS</B>
4106 whitespace characters is also treated as a delimiter.
4108 <FONT SIZE=-1><B>IFS</B>
4111 is null, no word splitting occurs.
4114 Explicit null arguments (<B>""</B> or <B>aqaq</B>) are retained.
4115 Unquoted implicit null arguments, resulting from the expansion of
4116 parameters that have no values, are removed.
4117 If a parameter with no value is expanded within double quotes, a
4118 null argument results and is retained.
4121 Note that if no expansion occurs, no splitting
4123 <A NAME="lbBG"> </A>
4124 <H4>Pathname Expansion</H4>
4128 After word splitting,
4132 option has been set,
4135 scans each word for the characters
4143 If one of these characters appears, then the word is
4147 and replaced with an alphabetically sorted list of
4148 filenames matching the pattern
4150 <FONT SIZE=-1><B>Pattern Matching</B>
4154 If no matching filenames are found,
4155 and the shell option
4158 is not enabled, the word is left unchanged.
4162 option is set, and no matches are found,
4163 the word is removed.
4167 shell option is set, and no matches are found, an error message
4168 is printed and the command is not executed.
4172 is enabled, the match is performed without regard to the case
4173 of alphabetic characters.
4174 When a pattern is used for pathname expansion,
4178 at the start of a name or immediately following a slash
4179 must be matched explicitly, unless the shell option
4183 When matching a pathname, the slash character must always be
4188 character is not treated specially.
4189 See the description of
4193 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
4196 for a description of the
4210 <FONT SIZE=-1><B>GLOBIGNORE</B>
4213 shell variable may be used to restrict the set of filenames matching a
4217 <FONT SIZE=-1><B>GLOBIGNORE</B>
4220 is set, each matching filename that also matches one of the patterns in
4221 <FONT SIZE=-1><B>GLOBIGNORE</B>
4224 is removed from the list of matches.
4231 are always ignored when
4232 <FONT SIZE=-1><B>GLOBIGNORE</B>
4235 is set and not null. However, setting
4236 <FONT SIZE=-1><B>GLOBIGNORE</B>
4239 to a non-null value has the effect of enabling the
4242 shell option, so all other filenames beginning with a
4246 To get the old behavior of ignoring filenames beginning with a
4252 one of the patterns in
4253 <FONT SIZE=-1><B>GLOBIGNORE</B>.
4259 option is disabled when
4260 <FONT SIZE=-1><B>GLOBIGNORE</B>
4266 <B>Pattern Matching</B>
4269 Any character that appears in a pattern, other than the special pattern
4270 characters described below, matches itself. The NUL character may not
4271 occur in a pattern. A backslash escapes the following character; the
4272 escaping backslash is discarded when matching.
4273 The special pattern characters must be quoted if
4274 they are to be matched literally.
4277 The special pattern characters have the following meanings:
4281 <DL COMPACT><DT><DD>
4286 Matches any string, including the null string.
4287 When the <B>globstar</B> shell option is enabled, and <B>*</B> is used in
4288 a pathname expansion context, two adjacent <B>*</B>s used as a single
4289 pattern will match all files and zero or more directories and
4291 If followed by a <B>/</B>, two adjacent <B>*</B>s will match only directories
4296 Matches any single character.
4300 Matches any one of the enclosed characters. A pair of characters
4301 separated by a hyphen denotes a
4302 <I>range expression</I>;
4303 any character that falls between those two characters, inclusive,
4304 using the current locale's collating sequence and character set,
4305 is matched. If the first character following the
4314 then any character not enclosed is matched.
4315 The sorting order of characters in range expressions is determined by
4316 the current locale and the values of the
4317 <FONT SIZE=-1><B>LC_COLLATE</B>
4321 <FONT SIZE=-1><B>LC_ALL</B>
4324 shell variables, if set.
4325 To obtain the traditional interpretation of range expressions, where
4338 <B>globasciiranges</B>
4344 may be matched by including it as the first or last character
4349 may be matched by including it as the first character
4362 <I>character classes</I> can be specified using the syntax
4363 <B>[:</B><I>class</I><B>:]</B>, where <I>class</I> is one of the
4364 following classes defined in the POSIX standard:
4368 <DL COMPACT><DT><DD>
4372 alnum alpha ascii blank cntrl digit graph lower print punct space upper word xdigit
4375 A character class matches any character belonging to that class.
4376 The <B>word</B> character class matches letters, digits, and the character _.
4388 an <I>equivalence class</I> can be specified using the syntax
4389 <B>[=</B><I>c</I><B>=]</B>, which matches all characters with the
4390 same collation weight (as defined by the current locale) as
4391 the character <I>c</I>.
4403 the syntax <B>[.</B><I>symbol</I><B>.]</B> matches the collating symbol
4412 If the <B>extglob</B> shell option is enabled using the <B>shopt</B>
4413 builtin, several extended pattern matching operators are recognized.
4414 In the following description, a <I>pattern-list</I> is a list of one
4415 or more patterns separated by a <B>|</B>.
4416 Composite patterns may be formed using one or more of the following
4420 <DL COMPACT><DT><DD>
4422 <DT><B>?(</B><I>pattern-list</I><B>)</B><DD>
4423 Matches zero or one occurrence of the given patterns
4424 <DT><B>*(</B><I>pattern-list</I><B>)</B><DD>
4425 Matches zero or more occurrences of the given patterns
4426 <DT><B>+(</B><I>pattern-list</I><B>)</B><DD>
4427 Matches one or more occurrences of the given patterns
4428 <DT><B>@(</B><I>pattern-list</I><B>)</B><DD>
4429 Matches one of the given patterns
4430 <DT><B>!(</B><I>pattern-list</I><B>)</B><DD>
4431 Matches anything except one of the given patterns
4435 <A NAME="lbBH"> </A>
4436 <H4>Quote Removal</H4>
4440 After the preceding expansions, all unquoted occurrences of the
4446 and <B>"</B> that did not result from one of the above
4447 expansions are removed.
4448 <A NAME="lbBI"> </A>
4449 <H3>REDIRECTION</H3>
4451 Before a command is executed, its input and output
4455 using a special notation interpreted by the shell.
4456 Redirection allows commands' file handles to be
4457 duplicated, opened, closed,
4458 made to refer to different files,
4459 and can change the files the command reads from and writes to.
4460 Redirection may also be used to modify file handles in the
4461 current shell execution environment.
4462 The following redirection
4463 operators may precede or appear anywhere within a
4464 <I>simple command</I>
4469 Redirections are processed in the order they appear, from
4473 Each redirection that may be preceded by a file descriptor number
4474 may instead be preceded by a word of the form {<I>varname</I>}.
4475 In this case, for each redirection operator except
4476 >&- and <&-, the shell will allocate a file descriptor greater
4477 than or equal to 10 and assign it to <I>varname</I>.
4478 If >&- or <&- is preceded
4479 by {<I>varname</I>}, the value of <I>varname</I> defines the file
4480 descriptor to close.
4483 In the following descriptions, if the file descriptor number is
4484 omitted, and the first character of the redirection operator is
4487 the redirection refers to the standard input (file descriptor
4488 0). If the first character of the redirection operator is
4491 the redirection refers to the standard output (file descriptor
4495 The word following the redirection operator in the following
4496 descriptions, unless otherwise noted, is subjected to
4497 brace expansion, tilde expansion, parameter and variable expansion,
4498 command substitution, arithmetic expansion, quote removal,
4499 pathname expansion, and word splitting.
4500 If it expands to more than one word,
4506 Note that the order of redirections is significant. For example,
4508 <DL COMPACT><DT><DD>
4511 ls <B>></B> dirlist 2<B>>&</B>1
4516 directs both standard output and standard error to the file
4520 <DL COMPACT><DT><DD>
4523 ls 2<B>>&</B>1 <B>></B> dirlist
4528 directs only the standard output to file
4531 because the standard error was duplicated from the standard output
4532 before the standard output was redirected to
4537 <B>Bash</B> handles several filenames specially when they are used in
4538 redirections, as described in the following table:
4539 <DL COMPACT><DT><DD>
4544 <DT><B>/dev/fd/</B><I>fd</I>
4547 If <I>fd</I> is a valid integer, file descriptor <I>fd</I> is duplicated.
4548 <DT><B>/dev/stdin</B>
4551 File descriptor 0 is duplicated.
4552 <DT><B>/dev/stdout</B>
4555 File descriptor 1 is duplicated.
4556 <DT><B>/dev/stderr</B>
4559 File descriptor 2 is duplicated.
4560 <DT><B>/dev/tcp/</B><I>host</I>/<I>port</I>
4563 If <I>host</I> is a valid hostname or Internet address, and <I>port</I>
4564 is an integer port number or service name, <B>bash</B> attempts to open
4565 the corresponding TCP socket.
4566 <DT><B>/dev/udp/</B><I>host</I>/<I>port</I>
4569 If <I>host</I> is a valid hostname or Internet address, and <I>port</I>
4570 is an integer port number or service name, <B>bash</B> attempts to open
4571 the corresponding UDP socket.
4577 A failure to open or create a file causes the redirection to fail.
4580 Redirections using file descriptors greater than 9 should be used with
4581 care, as they may conflict with file descriptors the shell uses
4583 <A NAME="lbBJ"> </A>
4584 <H4>Redirecting Input</H4>
4588 Redirection of input causes the file whose name results from
4592 to be opened for reading on file descriptor
4595 or the standard input (file descriptor 0) if
4601 The general format for redirecting input is:
4602 <DL COMPACT><DT><DD>
4605 [<I>n</I>]<B><</B><I>word</I>
4608 <A NAME="lbBK"> </A>
4609 <H4>Redirecting Output</H4>
4613 Redirection of output causes the file whose name results from
4617 to be opened for writing on file descriptor
4620 or the standard output (file descriptor 1) if
4623 is not specified. If the file does not exist it is created;
4624 if it does exist it is truncated to zero size.
4627 The general format for redirecting output is:
4628 <DL COMPACT><DT><DD>
4631 [<I>n</I>]<B>></B><I>word</I>
4636 If the redirection operator is
4645 builtin has been enabled, the redirection will fail if the file
4646 whose name results from the expansion of <I>word</I> exists and is
4648 If the redirection operator is
4651 or the redirection operator is
4660 builtin command is not enabled, the redirection is attempted even
4661 if the file named by <I>word</I> exists.
4662 <A NAME="lbBL"> </A>
4663 <H4>Appending Redirected Output</H4>
4667 Redirection of output in this fashion
4668 causes the file whose name results from
4672 to be opened for appending on file descriptor
4675 or the standard output (file descriptor 1) if
4678 is not specified. If the file does not exist it is created.
4681 The general format for appending output is:
4682 <DL COMPACT><DT><DD>
4685 [<I>n</I>]<B>>></B><I>word</I>
4690 <A NAME="lbBM"> </A>
4691 <H4>Redirecting Standard Output and Standard Error</H4>
4695 This construct allows both the
4696 standard output (file descriptor 1) and
4697 the standard error output (file descriptor 2)
4698 to be redirected to the file whose name is the
4704 There are two formats for redirecting standard output and
4706 <DL COMPACT><DT><DD>
4709 <B>&></B><I>word</I>
4713 <DL COMPACT><DT><DD>
4714 <B>>&</B><I>word</I>
4719 Of the two forms, the first is preferred.
4720 This is semantically equivalent to
4721 <DL COMPACT><DT><DD>
4724 <B>></B><I>word</I> 2<B>>&</B>1
4729 When using the second form, <I>word</I> may not expand to a number or
4730 <B>-</B>. If it does, other redirection operators apply
4731 (see <B>Duplicating File Descriptors</B> below) for compatibility
4733 <A NAME="lbBN"> </A>
4734 <H4>Appending Standard Output and Standard Error</H4>
4738 This construct allows both the
4739 standard output (file descriptor 1) and
4740 the standard error output (file descriptor 2)
4741 to be appended to the file whose name is the
4747 The format for appending standard output and standard error is:
4748 <DL COMPACT><DT><DD>
4751 <B>&>></B><I>word</I>
4756 This is semantically equivalent to
4757 <DL COMPACT><DT><DD>
4760 <B>>></B><I>word</I> 2<B>>&</B>1
4765 (see <B>Duplicating File Descriptors</B> below).
4766 <A NAME="lbBO"> </A>
4767 <H4>Here Documents</H4>
4771 This type of redirection instructs the shell to read input from the
4772 current source until a line containing only
4775 (with no trailing blanks)
4777 the lines read up to that point are then used as the standard
4778 input for a command.
4781 The format of here-documents is:
4782 <DL COMPACT><DT><DD>
4786 <B><<</B>[<B>-</B>]<I>word</I>
4787 <I>here-document</I>
4795 No parameter and variable expansion, command substitution,
4796 arithmetic expansion, or pathname expansion is performed on
4799 If any characters in
4805 is the result of quote removal on
4808 and the lines in the here-document are not expanded.
4809 If <I>word</I> is unquoted,
4810 all lines of the here-document are subjected to
4811 parameter expansion, command substitution, and arithmetic expansion,
4812 the character sequence
4813 <B>\<newline></B>
4818 must be used to quote the characters
4828 If the redirection operator is
4831 then all leading tab characters are stripped from input lines and the
4836 here-documents within shell scripts to be indented in a
4838 <A NAME="lbBP"> </A>
4839 <H4>Here Strings</H4>
4841 A variant of here documents, the format is:
4842 <DL COMPACT><DT><DD>
4846 <B><<<</B><I>word</I>
4853 The <I>word</I> undergoes
4854 brace expansion, tilde expansion, parameter and variable expansion,
4855 command substitution, arithmetic expansion, and quote removal.
4856 Pathname expansion and word splitting are not performed.
4857 The result is supplied as a single string to the command on its
4859 <A NAME="lbBQ"> </A>
4860 <H4>Duplicating File Descriptors</H4>
4864 The redirection operator
4865 <DL COMPACT><DT><DD>
4868 [<I>n</I>]<B><&</B><I>word</I>
4873 is used to duplicate input file descriptors.
4877 expands to one or more digits, the file descriptor denoted by
4880 is made to be a copy of that file descriptor.
4884 do not specify a file descriptor open for input, a redirection error occurs.
4897 is not specified, the standard input (file descriptor 0) is used.
4901 <DL COMPACT><DT><DD>
4904 [<I>n</I>]<B>>&</B><I>word</I>
4909 is used similarly to duplicate output file descriptors. If
4912 is not specified, the standard output (file descriptor 1) is used.
4916 do not specify a file descriptor open for output, a redirection error occurs.
4927 As a special case, if <I>n</I> is omitted, and <I>word</I> does not
4928 expand to one or more digits or <B>-</B>, the standard output and standard
4929 error are redirected as described previously.
4930 <A NAME="lbBR"> </A>
4931 <H4>Moving File Descriptors</H4>
4935 The redirection operator
4936 <DL COMPACT><DT><DD>
4939 [<I>n</I>]<B><&</B><I>digit</I><B>-</B>
4944 moves the file descriptor <I>digit</I> to file descriptor
4947 or the standard input (file descriptor 0) if <I>n</I> is not specified.
4948 <I>digit</I> is closed after being duplicated to <I>n</I>.
4951 Similarly, the redirection operator
4952 <DL COMPACT><DT><DD>
4955 [<I>n</I>]<B>>&</B><I>digit</I><B>-</B>
4960 moves the file descriptor <I>digit</I> to file descriptor
4963 or the standard output (file descriptor 1) if <I>n</I> is not specified.
4964 <A NAME="lbBS"> </A>
4965 <H4>Opening File Descriptors for Reading and Writing</H4>
4969 The redirection operator
4970 <DL COMPACT><DT><DD>
4973 [<I>n</I>]<B><></B><I>word</I>
4978 causes the file whose name is the expansion of
4981 to be opened for both reading and writing on file descriptor
4984 or on file descriptor 0 if
4987 is not specified. If the file does not exist, it is created.
4988 <A NAME="lbBT"> </A>
4991 <I>Aliases</I> allow a string to be substituted for a word when it is used
4992 as the first word of a simple command.
4993 The shell maintains a list of aliases that may be set and unset with the
4999 builtin commands (see
5000 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
5004 The first word of each simple command, if unquoted,
5005 is checked to see if it has an
5006 alias. If so, that word is replaced by the text of the alias.
5007 The characters <B>/</B>, <B>$</B>, <B>`</B>, and <B>=</B> and
5008 any of the shell <I>metacharacters</I> or quoting characters
5009 listed above may not appear in an alias name.
5010 The replacement text may contain any valid shell input,
5011 including shell metacharacters.
5012 The first word of the replacement text is tested
5013 for aliases, but a word that is identical to an alias being expanded
5014 is not expanded a second time.
5015 This means that one may alias
5024 does not try to recursively expand the replacement text.
5025 If the last character of the alias value is a
5028 then the next command
5029 word following the alias is also checked for alias expansion.
5032 Aliases are created and listed with the
5035 command, and removed with the
5041 There is no mechanism for using arguments in the replacement text.
5042 If arguments are needed, a shell function should be used (see
5043 <FONT SIZE=-1><B>FUNCTIONS</B>
5049 Aliases are not expanded when the shell is not interactive, unless
5051 <B>expand_aliases</B>
5053 shell option is set using
5056 (see the description of
5060 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B></FONT>
5064 The rules concerning the definition and use of aliases are
5068 always reads at least one complete line
5069 of input before executing any
5070 of the commands on that line. Aliases are expanded when a
5071 command is read, not when it is executed. Therefore, an
5072 alias definition appearing on the same line as another
5073 command does not take effect until the next line of input is read.
5074 The commands following the alias definition
5075 on that line are not affected by the new alias.
5076 This behavior is also an issue when functions are executed.
5077 Aliases are expanded when a function definition is read,
5078 not when the function is executed, because a function definition
5079 is itself a compound command. As a consequence, aliases
5080 defined in a function are not available until after that
5081 function is executed. To be safe, always put
5082 alias definitions on a separate line, and do not use
5085 in compound commands.
5088 For almost every purpose, aliases are superseded by
5090 <A NAME="lbBU"> </A>
5093 A shell function, defined as described above under
5094 <FONT SIZE=-1><B>SHELL GRAMMAR</B>,
5097 stores a series of commands for later execution.
5098 When the name of a shell function is used as a simple command name,
5099 the list of commands associated with that function name is executed.
5100 Functions are executed in the context of the
5101 current shell; no new process is created to interpret
5102 them (contrast this with the execution of a shell script).
5103 When a function is executed, the arguments to the
5104 function become the positional parameters
5105 during its execution.
5106 The special parameter
5109 is updated to reflect the change. Special parameter <B>0</B>
5111 The first element of the
5112 <FONT SIZE=-1><B>FUNCNAME</B>
5115 variable is set to the name of the function while the function
5119 All other aspects of the shell execution
5120 environment are identical between a function and its caller
5121 with these exceptions: the
5122 <FONT SIZE=-1><B>DEBUG</B>
5128 traps (see the description of the
5132 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
5135 below) are not inherited unless the function has been given the
5136 <B>trace</B> attribute (see the description of the
5137 <FONT SIZE=-1><B>declare</B>
5140 builtin below) or the
5141 <B>-o functrace</B> shell option has been enabled with
5142 the <B>set</B> builtin
5143 (in which case all functions inherit the <B>DEBUG</B> and <B>RETURN</B> traps),
5145 <FONT SIZE=-1><B>ERR</B>
5148 trap is not inherited unless the <B>-o errtrace</B> shell option has
5152 Variables local to the function may be declared with the
5155 builtin command. Ordinarily, variables and their values
5156 are shared between the function and its caller.
5159 The <B>FUNCNEST</B> variable, if set to a numeric value greater
5160 than 0, defines a maximum function nesting level. Function
5161 invocations that exceed the limit cause the entire command to
5165 If the builtin command
5168 is executed in a function, the function completes and
5169 execution resumes with the next command after the function
5171 Any command associated with the <B>RETURN</B> trap is executed
5172 before execution resumes.
5173 When a function completes, the values of the
5174 positional parameters and the special parameter
5177 are restored to the values they had prior to the function's
5181 Function names and definitions may be listed with the
5190 builtin commands. The
5199 will list the function names only
5200 (and optionally the source file and line number, if the <B>extdebug</B>
5201 shell option is enabled).
5202 Functions may be exported so that subshells
5203 automatically have them defined with the
5210 A function definition may be deleted using the <B>-f</B> option to
5215 Note that shell functions and variables with the same name may result
5216 in multiple identically-named entries in the environment passed to the
5218 Care should be taken in cases where this may cause a problem.
5221 Functions may be recursive.
5222 The <B>FUNCNEST</B> variable may be used to limit the depth of the
5223 function call stack and restrict the number of function invocations.
5224 By default, no limit is imposed on the number of recursive calls.
5225 <A NAME="lbBV"> </A>
5226 <H3>ARITHMETIC EVALUATION</H3>
5228 The shell allows arithmetic expressions to be evaluated, under
5229 certain circumstances (see the <B>let</B> and <B>declare</B> builtin
5230 commands and <B>Arithmetic Expansion</B>).
5231 Evaluation is done in fixed-width integers with no check for overflow,
5232 though division by 0 is trapped and flagged as an error.
5233 The operators and their precedence, associativity, and values
5234 are the same as in the C language.
5235 The following list of operators is grouped into levels of
5236 equal-precedence operators.
5237 The levels are listed in order of decreasing precedence.
5242 <DT><B></B><I>id</I>++ <I>id</I>--
5245 variable post-increment and post-decrement
5246 <DT><B>++</B><I>id</I> --<I>id</I>
5249 variable pre-increment and pre-decrement
5253 unary minus and plus
5257 logical and bitwise negation
5265 multiplication, division, remainder
5269 addition, subtraction
5270 <DT><B><< >></B>
5273 left and right bitwise shifts
5274 <DT><B><= >= < ></B>
5281 equality and inequality
5289 bitwise exclusive OR
5294 <DT><B>&&</B>
5302 <DT><B></B><I>expr</I>?<I>expr</I>:<I>expr</I>
5305 conditional operator
5306 <DT><B>= *= /= %= += -= <<= >>= &= ^= |=</B>
5310 <DT><B></B><I>expr1</I> , <I>expr2</I>
5318 Shell variables are allowed as operands; parameter expansion is
5319 performed before the expression is evaluated.
5320 Within an expression, shell variables may also be referenced by name
5321 without using the parameter expansion syntax.
5322 A shell variable that is null or unset evaluates to 0 when referenced
5323 by name without using the parameter expansion syntax.
5324 The value of a variable is evaluated as an arithmetic expression
5325 when it is referenced, or when a variable which has been given the
5326 <I>integer</I> attribute using <B>declare -i</B> is assigned a value.
5327 A null value evaluates to 0.
5328 A shell variable need not have its <I>integer</I> attribute
5329 turned on to be used in an expression.
5332 Constants with a leading 0 are interpreted as octal numbers.
5333 A leading 0x or 0X denotes hexadecimal.
5334 Otherwise, numbers take the form [<I>base#</I>]n, where the optional <I>base</I>
5335 is a decimal number between 2 and 64 representing the arithmetic
5336 base, and <I>n</I> is a number in that base.
5337 If <I>base#</I> is omitted, then base 10 is used.
5338 When specifying <I>n</I>,
5339 the digits greater< than 9 are represented by the lowercase letters,
5340 the uppercase letters, @, and _, in that order.
5341 If <I>base</I> is less than or equal to 36, lowercase and uppercase
5342 letters may be used interchangeably to represent numbers between 10
5346 Operators are evaluated in order of precedence. Sub-expressions in
5347 parentheses are evaluated first and may override the precedence
5349 <A NAME="lbBW"> </A>
5350 <H3>CONDITIONAL EXPRESSIONS</H3>
5352 Conditional expressions are used by the <B>[[</B> compound command and
5353 the <B>test</B> and <B>[</B> builtin commands to test file attributes
5354 and perform string and arithmetic comparisons.
5355 Expressions are formed from the following unary or binary primaries.
5356 If any <I>file</I> argument to one of the primaries is of the form
5357 <I>/dev/fd/n</I>, then file descriptor <I>n</I> is checked.
5358 If the <I>file</I> argument to one of the primaries is one of
5359 <I>/dev/stdin</I>, <I>/dev/stdout</I>, or <I>/dev/stderr</I>, file
5360 descriptor 0, 1, or 2, respectively, is checked.
5363 Unless otherwise specified, primaries that operate on files follow symbolic
5364 links and operate on the target of the link, rather than the link itself.
5368 When used with <B>[[</B>, the <B><</B> and <B>></B> operators sort
5369 lexicographically using the current locale.
5370 The <B>test</B> command sorts using ASCII ordering.
5374 <DT><B>-a </B><I>file</I>
5377 True if <I>file</I> exists.
5378 <DT><B>-b </B><I>file</I>
5381 True if <I>file</I> exists and is a block special file.
5382 <DT><B>-c </B><I>file</I>
5385 True if <I>file</I> exists and is a character special file.
5386 <DT><B>-d </B><I>file</I>
5389 True if <I>file</I> exists and is a directory.
5390 <DT><B>-e </B><I>file</I>
5393 True if <I>file</I> exists.
5394 <DT><B>-f </B><I>file</I>
5397 True if <I>file</I> exists and is a regular file.
5398 <DT><B>-g </B><I>file</I>
5401 True if <I>file</I> exists and is set-group-id.
5402 <DT><B>-h </B><I>file</I>
5405 True if <I>file</I> exists and is a symbolic link.
5406 <DT><B>-k </B><I>file</I>
5409 True if <I>file</I> exists and its ``sticky'' bit is set.
5410 <DT><B>-p </B><I>file</I>
5413 True if <I>file</I> exists and is a named pipe (FIFO).
5414 <DT><B>-r </B><I>file</I>
5417 True if <I>file</I> exists and is readable.
5418 <DT><B>-s </B><I>file</I>
5421 True if <I>file</I> exists and has a size greater than zero.
5422 <DT><B>-t </B><I>fd</I>
5425 True if file descriptor
5428 is open and refers to a terminal.
5429 <DT><B>-u </B><I>file</I>
5432 True if <I>file</I> exists and its set-user-id bit is set.
5433 <DT><B>-w </B><I>file</I>
5436 True if <I>file</I> exists and is writable.
5437 <DT><B>-x </B><I>file</I>
5440 True if <I>file</I> exists and is executable.
5441 <DT><B>-G </B><I>file</I>
5444 True if <I>file</I> exists and is owned by the effective group id.
5445 <DT><B>-L </B><I>file</I>
5448 True if <I>file</I> exists and is a symbolic link.
5449 <DT><B>-N </B><I>file</I>
5452 True if <I>file</I> exists and has been modified since it was last read.
5453 <DT><B>-O </B><I>file</I>
5456 True if <I>file</I> exists and is owned by the effective user id.
5457 <DT><B>-S </B><I>file</I>
5460 True if <I>file</I> exists and is a socket.
5461 <DT><I>file1</I> <B>-ef</B> <I>file2</I><DD>
5462 True if <I>file1</I> and <I>file2</I> refer to the same device and
5464 <DT><I>file1</I> -<B>nt</B> <I>file2</I><DD>
5465 True if <I>file1</I> is newer (according to modification date) than <I>file2</I>,
5466 or if <I>file1</I> exists and file2 does not.
5467 <DT><I>file1</I> -<B>ot</B> <I>file2</I><DD>
5468 True if <I>file1</I> is older than <I>file2</I>, or if <I>file2</I> exists
5469 and <I>file1</I> does not.
5470 <DT><B>-o </B><I>optname</I>
5473 True if the shell option
5477 See the list of options under the description of the
5484 <DT><B>-v </B><I>varname</I>
5487 True if the shell variable
5490 is set (has been assigned a value).
5491 <DT><B>-R </B><I>varname</I>
5494 True if the shell variable
5497 is set and is a name reference.
5498 <DT><B>-z </B><I>string</I>
5501 True if the length of <I>string</I> is zero.
5502 <DT><I>string</I><DD>
5504 <DT><B>-n </B><I>string</I>
5508 True if the length of
5512 <DT><I>string1</I> <B>==</B> <I>string2</I><DD>
5514 <DT><I>string1</I> <B>=</B> <I>string2</I><DD>
5516 True if the strings are equal. <B>=</B> should be used
5517 with the <B>test</B> command for POSIX conformance.
5518 When used with the <B>[[</B> command, this performs pattern matching as
5519 described above (<B>Compound Commands</B>).
5520 <DT><I>string1</I> <B>!=</B> <I>string2</I><DD>
5521 True if the strings are not equal.
5522 <DT><I>string1</I> <B><</B> <I>string2</I><DD>
5523 True if <I>string1</I> sorts before <I>string2</I> lexicographically.
5524 <DT><I>string1</I> <B>></B> <I>string2</I><DD>
5525 True if <I>string1</I> sorts after <I>string2</I> lexicographically.
5526 <DT><I>arg1</I> <B>OP</B> <I>arg2</I>
5529 <FONT SIZE=-1><B>OP</B>
5546 These arithmetic binary operators return true if <I>arg1</I>
5547 is equal to, not equal to, less than, less than or equal to,
5548 greater than, or greater than or equal to <I>arg2</I>, respectively.
5554 may be positive or negative integers.
5557 <A NAME="lbBX"> </A>
5558 <H3>SIMPLE COMMAND EXPANSION</H3>
5560 When a simple command is executed, the shell performs the following
5561 expansions, assignments, and redirections, from left to right.
5564 The words that the parser has marked as variable assignments (those
5565 preceding the command name) and redirections are saved for later
5568 The words that are not variable assignments or redirections are
5569 expanded. If any words remain after expansion, the first word
5570 is taken to be the name of the command and the remaining words are
5573 Redirections are performed as described above under
5574 <FONT SIZE=-1><B>REDIRECTION</B>.
5578 The text after the <B>=</B> in each variable assignment undergoes tilde
5579 expansion, parameter expansion, command substitution, arithmetic expansion,
5580 and quote removal before being assigned to the variable.
5584 If no command name results, the variable assignments affect the current
5585 shell environment. Otherwise, the variables are added to the environment
5586 of the executed command and do not affect the current shell environment.
5587 If any of the assignments attempts to assign a value to a readonly variable,
5588 an error occurs, and the command exits with a non-zero status.
5591 If no command name results, redirections are performed, but do not
5592 affect the current shell environment. A redirection error causes the
5593 command to exit with a non-zero status.
5596 If there is a command name left after expansion, execution proceeds as
5597 described below. Otherwise, the command exits. If one of the expansions
5598 contained a command substitution, the exit status of the command is
5599 the exit status of the last command substitution performed. If there
5600 were no command substitutions, the command exits with a status of zero.
5601 <A NAME="lbBY"> </A>
5602 <H3>COMMAND EXECUTION</H3>
5604 After a command has been split into words, if it results in a
5605 simple command and an optional list of arguments, the following
5609 If the command name contains no slashes, the shell attempts to
5610 locate it. If there exists a shell function by that name, that
5611 function is invoked as described above in
5612 <FONT SIZE=-1><B>FUNCTIONS</B>.
5615 If the name does not match a function, the shell searches for
5616 it in the list of shell builtins. If a match is found, that
5620 If the name is neither a shell function nor a builtin,
5621 and contains no slashes,
5624 searches each element of the
5625 <FONT SIZE=-1><B>PATH</B>
5628 for a directory containing an executable file by that name.
5631 uses a hash table to remember the full pathnames of executable
5636 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
5640 A full search of the directories in
5641 <FONT SIZE=-1><B>PATH</B>
5644 is performed only if the command is not found in the hash table.
5645 If the search is unsuccessful, the shell searches for a defined shell
5646 function named <B>command_not_found_handle</B>.
5647 If that function exists, it is invoked with the original command and
5648 the original command's arguments as its arguments, and the function's
5649 exit status becomes the exit status of the shell.
5650 If that function is not defined, the shell prints an error
5651 message and returns an exit status of 127.
5654 If the search is successful, or if the command name contains
5655 one or more slashes, the shell executes the named program in a
5656 separate execution environment.
5657 Argument 0 is set to the name given, and the remaining arguments
5658 to the command are set to the arguments given, if any.
5661 If this execution fails because the file is not in executable
5662 format, and the file is not a directory, it is assumed to be
5663 a <I>shell script</I>, a file
5664 containing shell commands. A subshell is spawned to execute
5665 it. This subshell reinitializes itself, so
5666 that the effect is as if a new shell had been invoked
5667 to handle the script, with the exception that the locations of
5668 commands remembered by the parent (see
5672 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>)</FONT>
5673 are retained by the child.
5676 If the program is a file beginning with
5679 the remainder of the first line specifies an interpreter
5680 for the program. The shell executes the
5681 specified interpreter on operating systems that do not
5682 handle this executable format themselves. The arguments to the
5683 interpreter consist of a single optional argument following the
5684 interpreter name on the first line of the program, followed
5685 by the name of the program, followed by the command
5687 <A NAME="lbBZ"> </A>
5688 <H3>COMMAND EXECUTION ENVIRONMENT</H3>
5690 The shell has an <I>execution environment</I>, which consists of the
5694 open files inherited by the shell at invocation, as modified by
5695 redirections supplied to the <B>exec</B> builtin
5697 the current working directory as set by <B>cd</B>, <B>pushd</B>, or
5698 <B>popd</B>, or inherited by the shell at invocation
5700 the file creation mode mask as set by <B>umask</B> or inherited from
5703 current traps set by <B>trap</B>
5705 shell parameters that are set by variable assignment or with <B>set</B>
5706 or inherited from the shell's parent in the environment
5708 shell functions defined during execution or inherited from the shell's
5709 parent in the environment
5711 options enabled at invocation (either by default or with command-line
5712 arguments) or by <B>set</B>
5714 options enabled by <B>shopt</B>
5716 shell aliases defined with <B>alias</B>
5718 various process IDs, including those of background jobs, the value
5719 of <B>$$</B>, and the value of
5720 <FONT SIZE=-1><B>PPID</B>
5726 When a simple command other than a builtin or shell function
5727 is to be executed, it
5728 is invoked in a separate execution environment that consists of
5729 the following. Unless otherwise noted, the values are inherited
5734 the shell's open files, plus any modifications and additions specified
5735 by redirections to the command
5737 the current working directory
5739 the file creation mode mask
5741 shell variables and functions marked for export, along with variables
5742 exported for the command, passed in the environment
5744 traps caught by the shell are reset to the values inherited from the
5745 shell's parent, and traps ignored by the shell are ignored
5749 A command invoked in this separate environment cannot affect the
5750 shell's execution environment.
5753 Command substitution, commands grouped with parentheses,
5754 and asynchronous commands are invoked in a
5755 subshell environment that is a duplicate of the shell environment,
5756 except that traps caught by the shell are reset to the values
5757 that the shell inherited from its parent at invocation. Builtin
5758 commands that are invoked as part of a pipeline are also executed in a
5759 subshell environment. Changes made to the subshell environment
5760 cannot affect the shell's execution environment.
5763 Subshells spawned to execute command substitutions inherit the value of
5764 the <B>-e</B> option from the parent shell. When not in <I>posix</I> mode,
5765 <B>bash</B> clears the <B>-e</B> option in such subshells.
5768 If a command is followed by a <B>&</B> and job control is not active, the
5769 default standard input for the command is the empty file <I>/dev/null</I>.
5770 Otherwise, the invoked command inherits the file descriptors of the calling
5771 shell as modified by redirections.
5772 <A NAME="lbCA"> </A>
5773 <H3>ENVIRONMENT</H3>
5775 When a program is invoked it is given an array of strings
5780 <I>name</I>-<I>value</I> pairs, of the form
5785 The shell provides several ways to manipulate the environment.
5786 On invocation, the shell scans its own environment and
5787 creates a parameter for each name found, automatically marking
5791 to child processes. Executed commands inherit the environment.
5798 commands allow parameters and functions to be added to and
5799 deleted from the environment. If the value of a parameter
5800 in the environment is modified, the new value becomes part
5801 of the environment, replacing the old. The environment
5802 inherited by any executed command consists of the shell's
5803 initial environment, whose values may be modified in the shell,
5804 less any pairs removed by the
5807 command, plus any additions via the
5816 The environment for any
5817 <I>simple command</I>
5819 or function may be augmented temporarily by prefixing it with
5820 parameter assignments, as described above in
5821 <FONT SIZE=-1><B>PARAMETERS</B>.
5824 These assignment statements affect only the environment seen
5831 option is set (see the
5834 builtin command below), then
5837 parameter assignments are placed in the environment for a command,
5838 not just those that precede the command name.
5844 invokes an external command, the variable
5847 is set to the full filename of the command and passed to that
5848 command in its environment.
5849 <A NAME="lbCB"> </A>
5850 <H3>EXIT STATUS</H3>
5854 The exit status of an executed command is the value returned by the
5855 <I>waitpid</I> system call or equivalent function. Exit statuses
5856 fall between 0 and 255, though, as explained below, the shell may
5857 use values above 125 specially. Exit statuses from shell builtins and
5858 compound commands are also limited to this range. Under certain
5859 circumstances, the shell will use special values to indicate specific
5863 For the shell's purposes, a command which exits with a
5864 zero exit status has succeeded. An exit status of zero
5865 indicates success. A non-zero exit status indicates failure.
5866 When a command terminates on a fatal signal <I>N</I>, <B>bash</B> uses
5867 the value of 128+<I>N</I> as the exit status.
5870 If a command is not found, the child process created to
5871 execute it returns a status of 127. If a command is found
5872 but is not executable, the return status is 126.
5875 If a command fails because of an error during expansion or redirection,
5876 the exit status is greater than zero.
5879 Shell builtin commands return a status of 0 (<I>true</I>) if
5880 successful, and non-zero (<I>false</I>) if an error occurs
5882 All builtins return an exit status of 2 to indicate incorrect usage.
5885 <B>Bash</B> itself returns the exit status of the last command
5886 executed, unless a syntax error occurs, in which case it exits
5887 with a non-zero value. See also the <B>exit</B> builtin
5889 <A NAME="lbCC"> </A>
5892 When <B>bash</B> is interactive, in the absence of any traps, it ignores
5893 <FONT SIZE=-1><B>SIGTERM</B>
5896 (so that <B>kill 0</B> does not kill an interactive shell),
5898 <FONT SIZE=-1><B>SIGINT</B>
5901 is caught and handled (so that the <B>wait</B> builtin is interruptible).
5902 In all cases, <B>bash</B> ignores
5903 <FONT SIZE=-1><B>SIGQUIT</B>.
5906 If job control is in effect,
5910 <FONT SIZE=-1><B>SIGTTIN</B>,
5913 <FONT SIZE=-1><B>SIGTTOU</B>,
5917 <FONT SIZE=-1><B>SIGTSTP</B>.
5922 Non-builtin commands run by <B>bash</B> have signal handlers
5923 set to the values inherited by the shell from its parent.
5924 When job control is not in effect, asynchronous commands
5926 <FONT SIZE=-1><B>SIGINT</B>
5930 <FONT SIZE=-1><B>SIGQUIT</B>
5933 in addition to these inherited handlers.
5934 Commands run as a result of command substitution ignore the
5935 keyboard-generated job control signals
5936 <FONT SIZE=-1><B>SIGTTIN</B>,
5939 <FONT SIZE=-1><B>SIGTTOU</B>,
5943 <FONT SIZE=-1><B>SIGTSTP</B>.
5948 The shell exits by default upon receipt of a
5949 <FONT SIZE=-1><B>SIGHUP</B>.
5952 Before exiting, an interactive shell resends the
5953 <FONT SIZE=-1><B>SIGHUP</B>
5956 to all jobs, running or stopped.
5957 Stopped jobs are sent
5958 <FONT SIZE=-1><B>SIGCONT</B>
5961 to ensure that they receive the
5962 <FONT SIZE=-1><B>SIGHUP</B>.
5965 To prevent the shell from
5966 sending the signal to a particular job, it should be removed from the
5971 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
5976 <FONT SIZE=-1><B>SIGHUP</B>
5987 shell option has been set with
5993 <FONT SIZE=-1><B>SIGHUP</B>
5996 to all jobs when an interactive login shell exits.
5999 If <B>bash</B> is waiting for a command to complete and receives a signal
6000 for which a trap has been set, the trap will not be executed until
6001 the command completes.
6002 When <B>bash</B> is waiting for an asynchronous command via the <B>wait</B>
6003 builtin, the reception of a signal for which a trap has been set will
6004 cause the <B>wait</B> builtin to return immediately with an exit status
6005 greater than 128, immediately after which the trap is executed.
6006 <A NAME="lbCD"> </A>
6007 <H3>JOB CONTROL</H3>
6011 refers to the ability to selectively stop (<I>suspend</I>)
6012 the execution of processes and continue (<I>resume</I>)
6013 their execution at a later point. A user typically employs
6014 this facility via an interactive interface supplied jointly
6015 by the operating system kernel's terminal driver and
6020 The shell associates a
6023 with each pipeline. It keeps a table of currently executing
6024 jobs, which may be listed with the
6030 starts a job asynchronously (in the
6033 it prints a line that looks like:
6034 <DL COMPACT><DT><DD>
6042 indicating that this job is job number 1 and that the process ID
6043 of the last process in the pipeline associated with this job is 25647.
6044 All of the processes in a single pipeline are members of the same job.
6050 abstraction as the basis for job control.
6053 To facilitate the implementation of the user interface to job
6054 control, the operating system maintains the notion of a <I>current terminal
6055 process group ID</I>. Members of this process group (processes whose
6056 process group ID is equal to the current terminal process group ID)
6057 receive keyboard-generated signals such as
6058 <FONT SIZE=-1><B>SIGINT</B>.
6061 These processes are said to be in the
6066 processes are those whose process group ID differs from the terminal's;
6067 such processes are immune to keyboard-generated signals.
6068 Only foreground processes are allowed to read from or, if the
6069 user so specifies with <TT>stty tostop</TT>, write to the
6071 Background processes which attempt to read from (write to when
6072 <TT>stty tostop</TT> is in effect) the
6074 <FONT SIZE=-1><B>SIGTTIN (SIGTTOU)</B>
6077 signal by the kernel's terminal driver,
6078 which, unless caught, suspends the process.
6081 If the operating system on which
6088 contains facilities to use it.
6092 character (typically
6095 Control-Z) while a process is running
6096 causes that process to be stopped and returns control to
6100 <I>delayed suspend</I>
6102 character (typically
6105 Control-Y) causes the process to be stopped when it
6106 attempts to read input from the terminal, and control to
6110 The user may then manipulate the state of this job, using the
6113 command to continue it in the background, the
6116 command to continue it in the foreground, or
6120 command to kill it. A <B>^Z</B> takes effect immediately,
6121 and has the additional side effect of causing pending output
6122 and typeahead to be discarded.
6125 There are a number of ways to refer to a job in the shell.
6129 introduces a job specification (<I>jobspec</I>). Job number
6132 may be referred to as
6135 A job may also be referred to using a prefix of the name used to
6136 start it, or using a substring that appears in its command line.
6143 job. If a prefix matches more than one job,
6146 reports an error. Using
6149 on the other hand, refers to any job containing the string
6152 in its command line. If the substring matches more than one job,
6155 reports an error. The symbols
6161 refer to the shell's notion of the
6164 which is the last job stopped while it was in
6165 the foreground or started in the background.
6169 may be referenced using
6172 If there is only a single job, <B>%+</B> and <B>%-</B> can both be used
6173 to refer to that job.
6174 In output pertaining to jobs (e.g., the output of the
6177 command), the current job is always flagged with a
6180 and the previous job with a
6183 A single % (with no accompanying job specification) also refers to the
6187 Simply naming a job can be used to bring it into the
6193 bringing job 1 from the background into the foreground.
6197 resumes job 1 in the background, equivalent to
6201 The shell learns immediately whenever a job changes state.
6205 waits until it is about to print a prompt before reporting
6206 changes in a job's status so as to not interrupt
6207 any other output. If the
6217 reports such changes immediately.
6219 <FONT SIZE=-1><B>SIGCHLD</B>
6222 is executed for each child that exits.
6225 If an attempt to exit
6228 is made while jobs are stopped (or, if the <B>checkjobs</B> shell option has
6229 been enabled using the <B>shopt</B> builtin, running), the shell prints a
6230 warning message, and, if the <B>checkjobs</B> option is enabled, lists the
6231 jobs and their statuses.
6235 command may then be used to inspect their status.
6236 If a second attempt to exit is made without an intervening command,
6237 the shell does not print another warning, and any stopped
6238 jobs are terminated.
6239 <A NAME="lbCE"> </A>
6242 When executing interactively,
6245 displays the primary prompt
6246 <FONT SIZE=-1><B>PS1</B>
6249 when it is ready to read a command, and the secondary prompt
6250 <FONT SIZE=-1><B>PS2</B>
6253 when it needs more input to complete a command.
6256 allows these prompt strings to be customized by inserting a number of
6257 backslash-escaped special characters that are decoded as follows:
6258 <DL COMPACT><DT><DD>
6264 an ASCII bell character (07)
6268 the date in "Weekday Month Date" format (e.g., "Tue May 26")
6269 <DT><B>\D{</B><I>format</I>}
6272 the <I>format</I> is passed to <I>strftime</I>(3) and the result is inserted
6273 into the prompt string; an empty <I>format</I> results in a locale-specific
6274 time representation. The braces are required
6278 an ASCII escape character (033)
6282 the hostname up to the first `.'
6290 the number of jobs currently managed by the shell
6294 the basename of the shell's terminal device name
6306 the name of the shell, the basename of
6309 (the portion following the final slash)
6313 the current time in 24-hour HH:MM:SS format
6317 the current time in 12-hour HH:MM:SS format
6321 the current time in 12-hour am/pm format
6325 the current time in 24-hour HH:MM format
6329 the username of the current user
6333 the version of <B>bash</B> (e.g., 2.00)
6337 the release of <B>bash</B>, version + patch level (e.g., 2.00.0)
6341 the current working directory, with
6342 <FONT SIZE=-1><B>$HOME</B>
6345 abbreviated with a tilde
6346 (uses the value of the
6347 <FONT SIZE=-1><B>PROMPT_DIRTRIM</B>
6354 the basename of the current working directory, with
6355 <FONT SIZE=-1><B>$HOME</B>
6358 abbreviated with a tilde
6362 the history number of this command
6366 the command number of this command
6370 if the effective UID is 0, a
6376 <DT><B>\</B><I>nnn</I>
6379 the character corresponding to the octal number <I>nnn</I>
6387 begin a sequence of non-printing characters, which could be used to
6388 embed a terminal control sequence into the prompt
6392 end a sequence of non-printing characters
6398 The command number and the history number are usually different:
6399 the history number of a command is its position in the history
6400 list, which may include commands restored from the history file
6402 <FONT SIZE=-1><B>HISTORY</B>
6405 below), while the command number is the position in the sequence
6406 of commands executed during the current shell session.
6407 After the string is decoded, it is expanded via
6408 parameter expansion, command substitution, arithmetic
6409 expansion, and quote removal, subject to the value of the
6412 shell option (see the description of the
6416 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
6420 <A NAME="lbCF"> </A>
6423 This is the library that handles reading input when using an interactive
6427 option is given at shell invocation.
6428 Line editing is also used when using the <B>-e</B> option to the
6429 <B>read</B> builtin.
6430 By default, the line editing commands are similar to those of Emacs.
6431 A vi-style line editing interface is also available.
6432 Line editing can be enabled at any time using the
6442 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
6446 To turn off line editing after the shell is running, use the
6456 <A NAME="lbCG"> </A>
6457 <H4>Readline Notation</H4>
6461 In this section, the Emacs-style notation is used to denote
6462 keystrokes. Control keys are denoted by C-<I>key</I>, e.g., C-n
6463 means Control-N. Similarly,
6466 keys are denoted by M-<I>key</I>, so M-x means Meta-X. (On keyboards
6470 key, M-<I>x</I> means ESC <I>x</I>, i.e., press the Escape key
6474 key. This makes ESC the <I>meta prefix</I>.
6475 The combination M-C-<I>x</I> means ESC-Control-<I>x</I>,
6476 or press the Escape key
6477 then hold the Control key while pressing the
6483 Readline commands may be given numeric
6486 which normally act as a repeat count.
6487 Sometimes, however, it is the sign of the argument that is significant.
6488 Passing a negative argument to a command that acts in the forward
6489 direction (e.g., <B>kill-line</B>) causes that command to act in a
6491 Commands whose behavior with arguments deviates from this are noted
6495 When a command is described as <I>killing</I> text, the text
6496 deleted is saved for possible future retrieval
6497 (<I>yanking</I>). The killed text is saved in a
6498 <I>kill ring</I>. Consecutive kills cause the text to be
6499 accumulated into one unit, which can be yanked all at once.
6500 Commands which do not kill text separate the chunks of text
6502 <A NAME="lbCH"> </A>
6503 <H4>Readline Initialization</H4>
6507 Readline is customized by putting commands in an initialization
6508 file (the <I>inputrc</I> file).
6509 The name of this file is taken from the value of the
6510 <FONT SIZE=-1><B>INPUTRC</B>
6513 variable. If that variable is unset, the default is
6514 <A HREF="file:~/.inputrc"><I>~/.inputrc</I></A>.
6516 When a program which uses the readline library starts up, the
6517 initialization file is read, and the key bindings and variables
6519 There are only a few basic constructs allowed in the
6520 readline initialization file.
6521 Blank lines are ignored.
6522 Lines beginning with a <B>#</B> are comments.
6523 Lines beginning with a <B>$</B> indicate conditional constructs.
6524 Other lines denote key bindings and variable settings.
6527 The default key-bindings may be changed with an
6531 Other programs that use this library may add their own commands
6535 For example, placing
6536 <DL COMPACT><DT><DD>
6539 M-Control-u: universal-argument
6543 <DL COMPACT><DT><DD>
6544 C-Meta-u: universal-argument
6550 would make M-C-u execute the readline command
6551 <I>universal-argument</I>.
6555 The following symbolic character names are recognized:
6579 In addition to command names, readline allows keys to be bound
6580 to a string that is inserted when the key is pressed (a <I>macro</I>).
6581 <A NAME="lbCI"> </A>
6582 <H4>Readline Key Bindings</H4>
6586 The syntax for controlling key bindings in the
6589 file is simple. All that is required is the name of the
6590 command or the text of a macro and a key sequence to which
6591 it should be bound. The name may be specified in one of two ways:
6592 as a symbolic key name, possibly with <I>Meta-</I> or <I>Control-</I>
6593 prefixes, or as a key sequence.
6596 When using the form <B>keyname</B>:<I>function-name</I> or <I>macro</I>,
6599 is the name of a key spelled out in English. For example:
6601 <DL COMPACT><DT><DD>
6602 Control-u: universal-argument
6605 Meta-Rubout: backward-kill-word
6608 Control-o: "> output"
6613 In the above example,
6616 is bound to the function
6617 <B>universal-argument</B>,
6621 is bound to the function
6622 <B>backward-kill-word</B>,
6627 is bound to run the macro
6628 expressed on the right hand side (that is, to insert the text
6629 <TT>> output</TT>
6634 In the second form, <B>"keyseq"</B>:<I>function-name</I> or <I>macro</I>,
6640 above in that strings denoting
6641 an entire key sequence may be specified by placing the sequence
6642 within double quotes. Some GNU Emacs style key escapes can be
6643 used, as in the following example, but the symbolic character names
6646 <DL COMPACT><DT><DD>
6647 "\C-u": universal-argument
6650 "\C-x\C-r": re-read-init-file
6653 "\e[11~": "Function Key 1"
6661 is again bound to the function
6662 <B>universal-argument</B>.
6666 is bound to the function
6667 <B>re-read-init-file</B>,
6672 is bound to insert the text
6673 <TT>Function Key 1</TT>.
6677 The full set of GNU Emacs style escape sequences is
6678 <DL COMPACT><DT><DD>
6710 In addition to the GNU Emacs style escape sequences, a second
6711 set of backslash escapes is available:
6712 <DL COMPACT><DT><DD>
6747 <DT><B>\</B><I>nnn</I>
6750 the eight-bit character whose value is the octal value <I>nnn</I>
6751 (one to three digits)
6752 <DT><B>\x</B><I>HH</I>
6755 the eight-bit character whose value is the hexadecimal value <I>HH</I>
6756 (one or two hex digits)
6762 When entering the text of a macro, single or double quotes must
6763 be used to indicate a macro definition.
6764 Unquoted text is assumed to be a function name.
6765 In the macro body, the backslash escapes described above are expanded.
6766 Backslash will quote any other character in the macro text,
6767 including " and aq.
6772 allows the current readline key bindings to be displayed or modified
6776 builtin command. The editing mode may be switched during interactive
6783 builtin command (see
6784 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
6788 <A NAME="lbCJ"> </A>
6789 <H4>Readline Variables</H4>
6793 Readline has variables that can be used to further customize its
6794 behavior. A variable may be set in the
6797 file with a statement of the form
6798 <DL COMPACT><DT><DD>
6801 <B>set</B> <I>variable-name</I> <I>value</I>
6806 Except where noted, readline variables can take the values
6812 (without regard to case).
6813 Unrecognized variable names are ignored.
6814 When a variable value is read, empty or null values, "on" (case-insensitive),
6815 and "1" are equivalent to <B>On</B>. All other values are equivalent to
6817 The variables and their default values are:
6822 <DT><B>bell-style (audible)</B>
6825 Controls what happens when readline wants to ring the terminal bell.
6826 If set to <B>none</B>, readline never rings the bell. If set to
6827 <B>visible</B>, readline uses a visible bell if one is available.
6828 If set to <B>audible</B>, readline attempts to ring the terminal's bell.
6829 <DT><B>bind-tty-special-chars (On)</B>
6832 If set to <B>On</B>, readline attempts to bind the control characters
6833 treated specially by the kernel's terminal driver to their readline
6835 <DT><B>colored-stats (Off)</B>
6838 If set to <B>On</B>, readline displays possible completions using different
6839 colors to indicate their file type.
6840 The color definitions are taken from the value of the <B>LS_COLORS</B>
6841 environment variable.
6842 <DT><B>comment-begin (``#'')</B>
6845 The string that is inserted when the readline
6846 <B>insert-comment</B>
6848 command is executed.
6849 This command is bound to
6852 in emacs mode and to
6856 <DT><B>completion-ignore-case (Off)</B>
6859 If set to <B>On</B>, readline performs filename matching and completion
6860 in a case-insensitive fashion.
6861 <DT><B>completion-prefix-display-length (0)</B>
6864 The length in characters of the common prefix of a list of possible
6865 completions that is displayed without modification. When set to a
6866 value greater than zero, common prefixes longer than this value are
6867 replaced with an ellipsis when displaying possible completions.
6868 <DT><B>completion-query-items (100)</B>
6871 This determines when the user is queried about viewing
6872 the number of possible completions
6873 generated by the <B>possible-completions</B> command.
6874 It may be set to any integer value greater than or equal to
6875 zero. If the number of possible completions is greater than
6876 or equal to the value of this variable, the user is asked whether
6877 or not he wishes to view them; otherwise they are simply listed
6879 <DT><B>convert-meta (On)</B>
6882 If set to <B>On</B>, readline will convert characters with the
6883 eighth bit set to an ASCII key sequence
6884 by stripping the eighth bit and prefixing an
6885 escape character (in effect, using escape as the <I>meta prefix</I>).
6886 <DT><B>disable-completion (Off)</B>
6889 If set to <B>On</B>, readline will inhibit word completion. Completion
6890 characters will be inserted into the line as if they had been
6891 mapped to <B>self-insert</B>.
6892 <DT><B>editing-mode (emacs)</B>
6895 Controls whether readline begins with a set of key bindings similar
6896 to <I>Emacs</I> or <I>vi</I>.
6899 can be set to either
6905 <DT><B>echo-control-characters (On)</B>
6908 When set to <B>On</B>, on operating systems that indicate they support it,
6909 readline echoes a character corresponding to a signal generated from the
6911 <DT><B>enable-keypad (Off)</B>
6914 When set to <B>On</B>, readline will try to enable the application
6915 keypad when it is called. Some systems need this to enable the
6917 <DT><B>enable-meta-key (On)</B>
6920 When set to <B>On</B>, readline will try to enable any meta modifier
6921 key the terminal claims to support when it is called. On many terminals,
6922 the meta key is used to send eight-bit characters.
6923 <DT><B>expand-tilde (Off)</B>
6926 If set to <B>On</B>, tilde expansion is performed when readline
6927 attempts word completion.
6928 <DT><B>history-preserve-point (Off)</B>
6931 If set to <B>On</B>, the history code attempts to place point at the
6932 same location on each history line retrieved with <B>previous-history</B>
6933 or <B>next-history</B>.
6934 <DT><B>history-size (0)</B>
6937 Set the maximum number of history entries saved in the history list.
6938 If set to zero, any existing history entries are deleted and no new entries
6940 If set to a value less than zero, the number of history entries is not
6942 By default, the number of history entries is not limited.
6943 <DT><B>horizontal-scroll-mode (Off)</B>
6946 When set to <B>On</B>, makes readline use a single line for display,
6947 scrolling the input horizontally on a single screen line when it
6948 becomes longer than the screen width rather than wrapping to a new line.
6949 <DT><B>input-meta (Off)</B>
6952 If set to <B>On</B>, readline will enable eight-bit input (that is,
6953 it will not strip the high bit from the characters it reads),
6954 regardless of what the terminal claims it can support. The name
6957 is a synonym for this variable.
6958 <DT><B>isearch-terminators (``C-[C-J'')</B>
6961 The string of characters that should terminate an incremental
6962 search without subsequently executing the character as a command.
6963 If this variable has not been given a value, the characters
6964 <I>ESC</I> and <I>C-J</I> will terminate an incremental search.
6965 <DT><B>keymap (emacs)</B>
6968 Set the current readline keymap. The set of valid keymap names is
6969 <I>emacs, emacs-standard, emacs-meta, emacs-ctlx, vi,
6973 <I>vi</I> is equivalent to <I>vi-command</I>; <I>emacs</I> is
6974 equivalent to <I>emacs-standard</I>. The default value is
6980 also affects the default keymap.
6981 <DT><B>keyseq-timeout (500)</B>
6984 Specifies the duration <I>readline</I> will wait for a character when reading an
6985 ambiguous key sequence (one that can form a complete key sequence using
6986 the input read so far, or can take additional input to complete a longer
6988 If no input is received within the timeout, <I>readline</I> will use the shorter
6989 but complete key sequence.
6990 The value is specified in milliseconds, so a value of 1000 means that
6991 <I>readline</I> will wait one second for additional input.
6992 If this variable is set to a value less than or equal to zero, or to a
6993 non-numeric value, <I>readline</I> will wait until another key is pressed to
6994 decide which key sequence to complete.
6995 <DT><B>mark-directories (On)</B>
6998 If set to <B>On</B>, completed directory names have a slash
7000 <DT><B>mark-modified-lines (Off)</B>
7003 If set to <B>On</B>, history lines that have been modified are displayed
7004 with a preceding asterisk (<B>*</B>).
7005 <DT><B>mark-symlinked-directories (Off)</B>
7008 If set to <B>On</B>, completed names which are symbolic links to directories
7009 have a slash appended (subject to the value of
7010 <B>mark-directories</B>).
7011 <DT><B>match-hidden-files (On)</B>
7014 This variable, when set to <B>On</B>, causes readline to match files whose
7015 names begin with a `.' (hidden files) when performing filename
7017 If set to <B>Off</B>, the leading `.' must be
7018 supplied by the user in the filename to be completed.
7019 <DT><B>menu-complete-display-prefix (Off)</B>
7022 If set to <B>On</B>, menu completion displays the common prefix of the
7023 list of possible completions (which may be empty) before cycling through
7025 <DT><B>output-meta (Off)</B>
7028 If set to <B>On</B>, readline will display characters with the
7029 eighth bit set directly rather than as a meta-prefixed escape
7031 <DT><B>page-completions (On)</B>
7034 If set to <B>On</B>, readline uses an internal <I>more</I>-like pager
7035 to display a screenful of possible completions at a time.
7036 <DT><B>print-completions-horizontally (Off)</B>
7039 If set to <B>On</B>, readline will display completions with matches
7040 sorted horizontally in alphabetical order, rather than down the screen.
7041 <DT><B>revert-all-at-newline (Off)</B>
7044 If set to <B>On</B>, readline will undo all changes to history lines
7045 before returning when <B>accept-line</B> is executed. By default,
7046 history lines may be modified and retain individual undo lists across
7047 calls to <B>readline</B>.
7048 <DT><B>show-all-if-ambiguous (Off)</B>
7051 This alters the default behavior of the completion functions. If
7055 words which have more than one possible completion cause the
7056 matches to be listed immediately instead of ringing the bell.
7057 <DT><B>show-all-if-unmodified (Off)</B>
7060 This alters the default behavior of the completion functions in
7061 a fashion similar to <B>show-all-if-ambiguous</B>.
7065 words which have more than one possible completion without any
7066 possible partial completion (the possible completions don't share
7067 a common prefix) cause the matches to be listed immediately instead
7068 of ringing the bell.
7069 <DT><B>show-mode-in-prompt (Off)</B>
7072 If set to <B>On</B>, add a character to the beginning of the prompt
7073 indicating the editing mode: emacs (@), vi command (:) or vi
7075 <DT><B>skip-completed-text (Off)</B>
7078 If set to <B>On</B>, this alters the default completion behavior when
7079 inserting a single match into the line. It's only active when
7080 performing completion in the middle of a word. If enabled, readline
7081 does not insert characters from the completion that match characters
7082 after point in the word being completed, so portions of the word
7083 following the cursor are not duplicated.
7084 <DT><B>visible-stats (Off)</B>
7087 If set to <B>On</B>, a character denoting a file's type as reported
7088 by <I>stat</I>(2) is appended to the filename when listing possible
7092 <A NAME="lbCK"> </A>
7093 <H4>Readline Conditional Constructs</H4>
7097 Readline implements a facility similar in spirit to the conditional
7098 compilation features of the C preprocessor which allows key
7099 bindings and variable settings to be performed as the result
7100 of tests. There are four parser directives used.
7106 construct allows bindings to be made based on the
7107 editing mode, the terminal being used, or the application using
7108 readline. The text of the test extends to the end of the line;
7109 no characters are required to isolate it.
7110 <DL COMPACT><DT><DD>
7113 The <B>mode=</B> form of the <B>$if</B> directive is used to test
7114 whether readline is in emacs or vi mode.
7115 This may be used in conjunction
7116 with the <B>set keymap</B> command, for instance, to set bindings in
7117 the <I>emacs-standard</I> and <I>emacs-ctlx</I> keymaps only if
7118 readline is starting out in emacs mode.
7120 The <B>term=</B> form may be used to include terminal-specific
7121 key bindings, perhaps to bind the key sequences output by the
7122 terminal's function keys. The word on the right side of the
7125 is tested against the both full name of the terminal and the portion
7126 of the terminal name before the first <B>-</B>. This allows
7136 <DT><B>application</B><DD>
7137 The <B>application</B> construct is used to include
7138 application-specific settings. Each program using the readline
7139 library sets the <I>application name</I>, and an initialization
7140 file can test for a particular value.
7141 This could be used to bind key sequences to functions useful for
7142 a specific program. For instance, the following command adds a
7143 key sequence that quotes the current or previous word in <B>bash</B>:
7145 <DL COMPACT><DT><DD>
7148 # Quote the current or previous word
7149 "\C-xq": "\eb\"\ef\""
7157 <DT><B>$endif</B><DD>
7158 This command, as seen in the previous example, terminates an
7160 <DT><B>$else</B><DD>
7161 Commands in this branch of the <B>$if</B> directive are executed if
7163 <DT><B>$include</B><DD>
7164 This directive takes a single filename as an argument and reads commands
7165 and bindings from that file. For example, the following directive
7166 would read <A HREF="file:/etc/inputrc"><I>/etc/inputrc</I></A>:
7168 <DL COMPACT><DT><DD>
7170 <B>$include</B> <A HREF="file:/etc/inputrc"><I>/etc/inputrc</I></A>
7176 <A NAME="lbCL"> </A>
7181 Readline provides commands for searching through the command history
7183 <FONT SIZE=-1><B>HISTORY</B>
7186 below) for lines containing a specified string.
7187 There are two search modes:
7191 <I>non-incremental</I>.
7195 Incremental searches begin before the user has finished typing the
7197 As each character of the search string is typed, readline displays
7198 the next entry from the history matching the string typed so far.
7199 An incremental search requires only as many characters as needed to
7200 find the desired history entry.
7201 The characters present in the value of the <B>isearch-terminators</B>
7202 variable are used to terminate an incremental search.
7203 If that variable has not been assigned a value the Escape and
7204 Control-J characters will terminate an incremental search.
7205 Control-G will abort an incremental search and restore the original
7207 When the search is terminated, the history entry containing the
7208 search string becomes the current line.
7211 To find other matching entries in the history list, type Control-S or
7212 Control-R as appropriate.
7213 This will search backward or forward in the history for the next
7214 entry matching the search string typed so far.
7215 Any other key sequence bound to a readline command will terminate
7216 the search and execute that command.
7217 For instance, a <I>newline</I> will terminate the search and accept
7218 the line, thereby executing the command from the history list.
7221 Readline remembers the last incremental search string. If two
7222 Control-Rs are typed without any intervening characters defining a
7223 new search string, any remembered search string is used.
7226 Non-incremental searches read the entire search string before starting
7227 to search for matching history lines. The search string may be
7228 typed by the user or be part of the contents of the current line.
7229 <A NAME="lbCM"> </A>
7230 <H4>Readline Command Names</H4>
7234 The following is a list of the names of the commands and the default
7235 key sequences to which they are bound.
7236 Command names without an accompanying key sequence are unbound by default.
7237 In the following descriptions, <I>point</I> refers to the current cursor
7238 position, and <I>mark</I> refers to a cursor position saved by the
7239 <B>set-mark</B> command.
7240 The text between the point and mark is referred to as the <I>region</I>.
7241 <A NAME="lbCN"> </A>
7242 <H4>Commands for Moving</H4>
7248 <DT><B>beginning-of-line (C-a)</B>
7251 Move to the start of the current line.
7252 <DT><B>end-of-line (C-e)</B>
7255 Move to the end of the line.
7256 <DT><B>forward-char (C-f)</B>
7259 Move forward a character.
7260 <DT><B>backward-char (C-b)</B>
7263 Move back a character.
7264 <DT><B>forward-word (M-f)</B>
7267 Move forward to the end of the next word. Words are composed of
7268 alphanumeric characters (letters and digits).
7269 <DT><B>backward-word (M-b)</B>
7272 Move back to the start of the current or previous word.
7273 Words are composed of alphanumeric characters (letters and digits).
7274 <DT><B>shell-forward-word</B>
7277 Move forward to the end of the next word.
7278 Words are delimited by non-quoted shell metacharacters.
7279 <DT><B>shell-backward-word</B>
7282 Move back to the start of the current or previous word.
7283 Words are delimited by non-quoted shell metacharacters.
7284 <DT><B>clear-screen (C-l)</B>
7287 Clear the screen leaving the current line at the top of the screen.
7288 With an argument, refresh the current line without clearing the
7290 <DT><B>redraw-current-line</B>
7293 Refresh the current line.
7296 <A NAME="lbCO"> </A>
7297 <H4>Commands for Manipulating the History</H4>
7303 <DT><B>accept-line (Newline, Return)</B>
7306 Accept the line regardless of where the cursor is. If this line is
7307 non-empty, add it to the history list according to the state of the
7308 <FONT SIZE=-1><B>HISTCONTROL</B>
7311 variable. If the line is a modified history
7312 line, then restore the history line to its original state.
7313 <DT><B>previous-history (C-p)</B>
7316 Fetch the previous command from the history list, moving back in
7318 <DT><B>next-history (C-n)</B>
7321 Fetch the next command from the history list, moving forward in the
7323 <DT><B>beginning-of-history (M-<)</B>
7326 Move to the first line in the history.
7327 <DT><B>end-of-history (M->)</B>
7330 Move to the end of the input history, i.e., the line currently being
7332 <DT><B>reverse-search-history (C-r)</B>
7335 Search backward starting at the current line and moving `up' through
7336 the history as necessary. This is an incremental search.
7337 <DT><B>forward-search-history (C-s)</B>
7340 Search forward starting at the current line and moving `down' through
7341 the history as necessary. This is an incremental search.
7342 <DT><B>non-incremental-reverse-search-history (M-p)</B>
7345 Search backward through the history starting at the current line
7346 using a non-incremental search for a string supplied by the user.
7347 <DT><B>non-incremental-forward-search-history (M-n)</B>
7350 Search forward through the history using a non-incremental search for
7351 a string supplied by the user.
7352 <DT><B>history-search-forward</B>
7355 Search forward through the history for the string of characters
7356 between the start of the current line and the point.
7357 This is a non-incremental search.
7358 <DT><B>history-search-backward</B>
7361 Search backward through the history for the string of characters
7362 between the start of the current line and the point.
7363 This is a non-incremental search.
7364 <DT><B>yank-nth-arg (M-C-y)</B>
7367 Insert the first argument to the previous command (usually
7368 the second word on the previous line) at point.
7372 insert the <I>n</I>th word from the previous command (the words
7373 in the previous command begin with word 0). A negative argument
7374 inserts the <I>n</I>th word from the end of the previous command.
7375 Once the argument <I>n</I> is computed, the argument is extracted
7376 as if the "!<I>n</I>" history expansion had been specified.
7377 <DT><B>yank-last-arg (M-., M-_)</B>
7380 Insert the last argument to the previous command (the last word of
7381 the previous history entry).
7382 With a numeric argument, behave exactly like <B>yank-nth-arg</B>.
7383 Successive calls to <B>yank-last-arg</B> move back through the history
7384 list, inserting the last word (or the word specified by the argument to
7385 the first call) of each line in turn.
7386 Any numeric argument supplied to these successive calls determines
7387 the direction to move through the history. A negative argument switches
7388 the direction through the history (back or forward).
7389 The history expansion facilities are used to extract the last word,
7390 as if the "!$" history expansion had been specified.
7391 <DT><B>shell-expand-line (M-C-e)</B>
7394 Expand the line as the shell does. This
7395 performs alias and history expansion as well as all of the shell
7396 word expansions. See
7397 <FONT SIZE=-1><B>HISTORY EXPANSION</B>
7400 below for a description of history expansion.
7401 <DT><B>history-expand-line (M-^)</B>
7404 Perform history expansion on the current line.
7406 <FONT SIZE=-1><B>HISTORY EXPANSION</B>
7409 below for a description of history expansion.
7410 <DT><B>magic-space</B>
7413 Perform history expansion on the current line and insert a space.
7415 <FONT SIZE=-1><B>HISTORY EXPANSION</B>
7418 below for a description of history expansion.
7419 <DT><B>alias-expand-line</B>
7422 Perform alias expansion on the current line.
7424 <FONT SIZE=-1><B>ALIASES</B>
7427 above for a description of alias expansion.
7428 <DT><B>history-and-alias-expand-line</B>
7431 Perform history and alias expansion on the current line.
7432 <DT><B>insert-last-argument (M-., M-_)</B>
7435 A synonym for <B>yank-last-arg</B>.
7436 <DT><B>operate-and-get-next (C-o)</B>
7439 Accept the current line for execution and fetch the next line
7440 relative to the current line from the history for editing. Any
7441 argument is ignored.
7442 <DT><B>edit-and-execute-command (C-xC-e)</B>
7445 Invoke an editor on the current command line, and execute the result as shell
7447 <B>Bash</B> attempts to invoke
7448 <FONT SIZE=-1><B>$VISUAL</B>,
7451 <FONT SIZE=-1><B>$EDITOR</B>,
7454 and <I>emacs</I> as the editor, in that order.
7457 <A NAME="lbCP"> </A>
7458 <H4>Commands for Changing Text</H4>
7464 <DT><B></B><I>end-of-file</I> (usually C-d)
7467 The character indicating end-of-file as set, for example, by
7470 If this character is read when there are no characters
7471 on the line, and point is at the beginning of the line, Readline
7472 interprets it as the end of input and returns
7473 <FONT SIZE=-1><B>EOF</B>.
7476 <DT><B>delete-char (C-d)</B>
7479 Delete the character at point.
7480 If this function is bound to the
7481 same character as the tty <B>EOF</B> character, as <B>C-d</B>
7482 commonly is, see above for the effects.
7483 <DT><B>backward-delete-char (Rubout)</B>
7486 Delete the character behind the cursor. When given a numeric argument,
7487 save the deleted text on the kill ring.
7488 <DT><B>forward-backward-delete-char</B>
7491 Delete the character under the cursor, unless the cursor is at the
7492 end of the line, in which case the character behind the cursor is
7494 <DT><B>quoted-insert (C-q, C-v)</B>
7497 Add the next character typed to the line verbatim. This is
7498 how to insert characters like <B>C-q</B>, for example.
7499 <DT><B>tab-insert (C-v TAB)</B>
7502 Insert a tab character.
7503 <DT><B>self-insert (a, b, A, 1, !, ...)</B>
7506 Insert the character typed.
7507 <DT><B>transpose-chars (C-t)</B>
7510 Drag the character before point forward over the character at point,
7511 moving point forward as well.
7512 If point is at the end of the line, then this transposes
7513 the two characters before point.
7514 Negative arguments have no effect.
7515 <DT><B>transpose-words (M-t)</B>
7518 Drag the word before point past the word after point,
7519 moving point over that word as well.
7520 If point is at the end of the line, this transposes
7521 the last two words on the line.
7522 <DT><B>upcase-word (M-u)</B>
7525 Uppercase the current (or following) word. With a negative argument,
7526 uppercase the previous word, but do not move point.
7527 <DT><B>downcase-word (M-l)</B>
7530 Lowercase the current (or following) word. With a negative argument,
7531 lowercase the previous word, but do not move point.
7532 <DT><B>capitalize-word (M-c)</B>
7535 Capitalize the current (or following) word. With a negative argument,
7536 capitalize the previous word, but do not move point.
7537 <DT><B>overwrite-mode</B>
7540 Toggle overwrite mode. With an explicit positive numeric argument,
7541 switches to overwrite mode. With an explicit non-positive numeric
7542 argument, switches to insert mode. This command affects only
7543 <B>emacs</B> mode; <B>vi</B> mode does overwrite differently.
7544 Each call to <I>readline()</I> starts in insert mode.
7545 In overwrite mode, characters bound to <B>self-insert</B> replace
7546 the text at point rather than pushing the text to the right.
7547 Characters bound to <B>backward-delete-char</B> replace the character
7548 before point with a space. By default, this command is unbound.
7551 <A NAME="lbCQ"> </A>
7552 <H4>Killing and Yanking</H4>
7558 <DT><B>kill-line (C-k)</B>
7561 Kill the text from point to the end of the line.
7562 <DT><B>backward-kill-line (C-x Rubout)</B>
7565 Kill backward to the beginning of the line.
7566 <DT><B>unix-line-discard (C-u)</B>
7569 Kill backward from point to the beginning of the line.
7570 The killed text is saved on the kill-ring.
7572 <DT><B>kill-whole-line</B>
7575 Kill all characters on the current line, no matter where point is.
7576 <DT><B>kill-word (M-d)</B>
7579 Kill from point to the end of the current word, or if between
7580 words, to the end of the next word.
7581 Word boundaries are the same as those used by <B>forward-word</B>.
7582 <DT><B>backward-kill-word (M-Rubout)</B>
7585 Kill the word behind point.
7586 Word boundaries are the same as those used by <B>backward-word</B>.
7587 <DT><B>shell-kill-word (M-d)</B>
7590 Kill from point to the end of the current word, or if between
7591 words, to the end of the next word.
7592 Word boundaries are the same as those used by <B>shell-forward-word</B>.
7593 <DT><B>shell-backward-kill-word (M-Rubout)</B>
7596 Kill the word behind point.
7597 Word boundaries are the same as those used by <B>shell-backward-word</B>.
7598 <DT><B>unix-word-rubout (C-w)</B>
7601 Kill the word behind point, using white space as a word boundary.
7602 The killed text is saved on the kill-ring.
7603 <DT><B>unix-filename-rubout</B>
7606 Kill the word behind point, using white space and the slash character
7607 as the word boundaries.
7608 The killed text is saved on the kill-ring.
7609 <DT><B>delete-horizontal-space (M-\)</B>
7612 Delete all spaces and tabs around point.
7613 <DT><B>kill-region</B>
7616 Kill the text in the current region.
7617 <DT><B>copy-region-as-kill</B>
7620 Copy the text in the region to the kill buffer.
7621 <DT><B>copy-backward-word</B>
7624 Copy the word before point to the kill buffer.
7625 The word boundaries are the same as <B>backward-word</B>.
7626 <DT><B>copy-forward-word</B>
7629 Copy the word following point to the kill buffer.
7630 The word boundaries are the same as <B>forward-word</B>.
7631 <DT><B>yank (C-y)</B>
7634 Yank the top of the kill ring into the buffer at point.
7635 <DT><B>yank-pop (M-y)</B>
7638 Rotate the kill ring, and yank the new top. Only works following
7646 <A NAME="lbCR"> </A>
7647 <H4>Numeric Arguments</H4>
7653 <DT><B>digit-argument (M-0, M-1, ..., M--)</B>
7656 Add this digit to the argument already accumulating, or start a new
7657 argument. M-- starts a negative argument.
7658 <DT><B>universal-argument</B>
7661 This is another way to specify an argument.
7662 If this command is followed by one or more digits, optionally with a
7663 leading minus sign, those digits define the argument.
7664 If the command is followed by digits, executing
7665 <B>universal-argument</B>
7667 again ends the numeric argument, but is otherwise ignored.
7668 As a special case, if this command is immediately followed by a
7669 character that is neither a digit or minus sign, the argument count
7670 for the next command is multiplied by four.
7671 The argument count is initially one, so executing this function the
7672 first time makes the argument count four, a second time makes the
7673 argument count sixteen, and so on.
7676 <A NAME="lbCS"> </A>
7683 <DT><B>complete (TAB)</B>
7686 Attempt to perform completion on the text before point.
7689 attempts completion treating the text as a variable (if the
7690 text begins with <B>$</B>), username (if the text begins with
7691 <B>~</B>), hostname (if the text begins with <B>@</B>), or
7692 command (including aliases and functions) in turn. If none
7693 of these produces a match, filename completion is attempted.
7694 <DT><B>possible-completions (M-?)</B>
7697 List the possible completions of the text before point.
7698 <DT><B>insert-completions (M-*)</B>
7701 Insert all completions of the text before point
7702 that would have been generated by
7703 <B>possible-completions</B>.
7704 <DT><B>menu-complete</B>
7707 Similar to <B>complete</B>, but replaces the word to be completed
7708 with a single match from the list of possible completions.
7709 Repeated execution of <B>menu-complete</B> steps through the list
7710 of possible completions, inserting each match in turn.
7711 At the end of the list of completions, the bell is rung
7712 (subject to the setting of <B>bell-style</B>)
7713 and the original text is restored.
7714 An argument of <I>n</I> moves <I>n</I> positions forward in the list
7715 of matches; a negative argument may be used to move backward
7717 This command is intended to be bound to <B>TAB</B>, but is unbound
7719 <DT><B>menu-complete-backward</B>
7722 Identical to <B>menu-complete</B>, but moves backward through the list
7723 of possible completions, as if <B>menu-complete</B> had been given a
7724 negative argument. This command is unbound by default.
7725 <DT><B>delete-char-or-list</B>
7728 Deletes the character under the cursor if not at the beginning or
7729 end of the line (like <B>delete-char</B>).
7730 If at the end of the line, behaves identically to
7731 <B>possible-completions</B>.
7732 This command is unbound by default.
7733 <DT><B>complete-filename (M-/)</B>
7736 Attempt filename completion on the text before point.
7737 <DT><B>possible-filename-completions (C-x /)</B>
7740 List the possible completions of the text before point,
7741 treating it as a filename.
7742 <DT><B>complete-username (M-~)</B>
7745 Attempt completion on the text before point, treating
7747 <DT><B>possible-username-completions (C-x ~)</B>
7750 List the possible completions of the text before point,
7751 treating it as a username.
7752 <DT><B>complete-variable (M-$)</B>
7755 Attempt completion on the text before point, treating
7756 it as a shell variable.
7757 <DT><B>possible-variable-completions (C-x $)</B>
7760 List the possible completions of the text before point,
7761 treating it as a shell variable.
7762 <DT><B>complete-hostname (M-@)</B>
7765 Attempt completion on the text before point, treating
7767 <DT><B>possible-hostname-completions (C-x @)</B>
7770 List the possible completions of the text before point,
7771 treating it as a hostname.
7772 <DT><B>complete-command (M-!)</B>
7775 Attempt completion on the text before point, treating
7776 it as a command name. Command completion attempts to
7777 match the text against aliases, reserved words, shell
7778 functions, shell builtins, and finally executable filenames,
7780 <DT><B>possible-command-completions (C-x !)</B>
7783 List the possible completions of the text before point,
7784 treating it as a command name.
7785 <DT><B>dynamic-complete-history (M-TAB)</B>
7788 Attempt completion on the text before point, comparing
7789 the text against lines from the history list for possible
7791 <DT><B>dabbrev-expand</B>
7794 Attempt menu completion on the text before point, comparing
7795 the text against lines from the history list for possible
7797 <DT><B>complete-into-braces (M-{)</B>
7800 Perform filename completion and insert the list of possible completions
7801 enclosed within braces so the list is available to the shell (see
7802 <B>Brace Expansion</B>
7807 <A NAME="lbCT"> </A>
7808 <H4>Keyboard Macros</H4>
7814 <DT><B>start-kbd-macro (C-x ()</B>
7817 Begin saving the characters typed into the current keyboard macro.
7818 <DT><B>end-kbd-macro (C-x ))</B>
7821 Stop saving the characters typed into the current keyboard macro
7822 and store the definition.
7823 <DT><B>call-last-kbd-macro (C-x e)</B>
7826 Re-execute the last keyboard macro defined, by making the characters
7827 in the macro appear as if typed at the keyboard.
7828 <DT><B>print-last-kbd-macro ()</B>
7831 Print the last keyboard macro defined in a format suitable for the
7832 <I>inputrc</I> file.
7835 <A NAME="lbCU"> </A>
7836 <H4>Miscellaneous</H4>
7842 <DT><B>re-read-init-file (C-x C-r)</B>
7845 Read in the contents of the <I>inputrc</I> file, and incorporate
7846 any bindings or variable assignments found there.
7847 <DT><B>abort (C-g)</B>
7850 Abort the current editing command and
7851 ring the terminal's bell (subject to the setting of
7854 <DT><B>do-uppercase-version (M-a, M-b, M-</B><I>x</I>, ...)
7857 If the metafied character <I>x</I> is lowercase, run the command
7858 that is bound to the corresponding uppercase character.
7859 <DT><B>prefix-meta (ESC)</B>
7862 Metafy the next character typed.
7863 <FONT SIZE=-1><B>ESC</B>
7871 <DT><B>undo (C-_, C-x C-u)</B>
7874 Incremental undo, separately remembered for each line.
7875 <DT><B>revert-line (M-r)</B>
7878 Undo all changes made to this line. This is like executing the
7881 command enough times to return the line to its initial state.
7882 <DT><B>tilde-expand (M-&)</B>
7885 Perform tilde expansion on the current word.
7886 <DT><B>set-mark (C-@, M-<space>)</B>
7889 Set the mark to the point. If a
7890 numeric argument is supplied, the mark is set to that position.
7891 <DT><B>exchange-point-and-mark (C-x C-x)</B>
7894 Swap the point with the mark. The current cursor position is set to
7895 the saved position, and the old cursor position is saved as the mark.
7896 <DT><B>character-search (C-])</B>
7899 A character is read and point is moved to the next occurrence of that
7900 character. A negative count searches for previous occurrences.
7901 <DT><B>character-search-backward (M-C-])</B>
7904 A character is read and point is moved to the previous occurrence of that
7905 character. A negative count searches for subsequent occurrences.
7906 <DT><B>skip-csi-sequence</B>
7909 Read enough characters to consume a multi-key sequence such as those
7910 defined for keys like Home and End. Such sequences begin with a
7911 Control Sequence Indicator (CSI), usually ESC-[. If this sequence is
7912 bound to "\[", keys producing such sequences will have no effect
7913 unless explicitly bound to a readline command, instead of inserting
7914 stray characters into the editing buffer. This is unbound by default,
7915 but usually bound to ESC-[.
7916 <DT><B>insert-comment (M-#)</B>
7919 Without a numeric argument, the value of the readline
7920 <B>comment-begin</B>
7922 variable is inserted at the beginning of the current line.
7923 If a numeric argument is supplied, this command acts as a toggle: if
7924 the characters at the beginning of the line do not match the value
7925 of <B>comment-begin</B>, the value is inserted, otherwise
7926 the characters in <B>comment-begin</B> are deleted from the beginning of
7928 In either case, the line is accepted as if a newline had been typed.
7929 The default value of
7930 <B>comment-begin</B> causes this command to make the current line
7932 If a numeric argument causes the comment character to be removed, the line
7933 will be executed by the shell.
7934 <DT><B>glob-complete-word (M-g)</B>
7937 The word before point is treated as a pattern for pathname expansion,
7938 with an asterisk implicitly appended. This pattern is used to
7939 generate a list of matching filenames for possible completions.
7940 <DT><B>glob-expand-word (C-x *)</B>
7943 The word before point is treated as a pattern for pathname expansion,
7944 and the list of matching filenames is inserted, replacing the word.
7945 If a numeric argument is supplied, an asterisk is appended before
7947 <DT><B>glob-list-expansions (C-x g)</B>
7950 The list of expansions that would have been generated by
7951 <B>glob-expand-word</B>
7953 is displayed, and the line is redrawn.
7954 If a numeric argument is supplied, an asterisk is appended before
7956 <DT><B>dump-functions</B>
7959 Print all of the functions and their key bindings to the
7960 readline output stream. If a numeric argument is supplied,
7961 the output is formatted in such a way that it can be made part
7962 of an <I>inputrc</I> file.
7963 <DT><B>dump-variables</B>
7966 Print all of the settable readline variables and their values to the
7967 readline output stream. If a numeric argument is supplied,
7968 the output is formatted in such a way that it can be made part
7969 of an <I>inputrc</I> file.
7970 <DT><B>dump-macros</B>
7973 Print all of the readline key sequences bound to macros and the
7974 strings they output. If a numeric argument is supplied,
7975 the output is formatted in such a way that it can be made part
7976 of an <I>inputrc</I> file.
7977 <DT><B>display-shell-version (C-x C-v)</B>
7980 Display version information about the current instance of
7985 <A NAME="lbCV"> </A>
7986 <H4>Programmable Completion</H4>
7990 When word completion is attempted for an argument to a command for
7991 which a completion specification (a <I>compspec</I>) has been defined
7992 using the <B>complete</B> builtin (see
7993 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
7996 below), the programmable completion facilities are invoked.
7999 First, the command name is identified.
8000 If the command word is the empty string (completion attempted at the
8001 beginning of an empty line), any compspec defined with
8002 the <B>-E</B> option to <B>complete</B> is used.
8003 If a compspec has been defined for that command, the
8004 compspec is used to generate the list of possible completions for the word.
8005 If the command word is a full pathname, a compspec for the full
8006 pathname is searched for first.
8007 If no compspec is found for the full pathname, an attempt is made to
8008 find a compspec for the portion following the final slash.
8009 If those searches do not result in a compspec, any compspec defined with
8010 the <B>-D</B> option to <B>complete</B> is used as the default.
8013 Once a compspec has been found, it is used to generate the list of
8015 If a compspec is not found, the default <B>bash</B> completion as
8016 described above under <B>Completing</B> is performed.
8019 First, the actions specified by the compspec are used.
8020 Only matches which are prefixed by the word being completed are
8028 option is used for filename or directory name completion, the shell
8030 <FONT SIZE=-1><B>FIGNORE</B>
8033 is used to filter the matches.
8036 Any completions specified by a pathname expansion pattern to the
8037 <B>-G</B> option are generated next.
8038 The words generated by the pattern need not match the word
8041 <FONT SIZE=-1><B>GLOBIGNORE</B>
8044 shell variable is not used to filter the matches, but the
8045 <FONT SIZE=-1><B>FIGNORE</B>
8051 Next, the string specified as the argument to the <B>-W</B> option
8053 The string is first split using the characters in the
8054 <FONT SIZE=-1><B>IFS</B>
8057 special variable as delimiters.
8058 Shell quoting is honored.
8059 Each word is then expanded using
8060 brace expansion, tilde expansion, parameter and variable expansion,
8061 command substitution, and arithmetic expansion,
8062 as described above under
8063 <FONT SIZE=-1><B>EXPANSION</B>.
8066 The results are split using the rules described above under
8067 <B>Word Splitting</B>.
8068 The results of the expansion are prefix-matched against the word being
8069 completed, and the matching words become the possible completions.
8072 After these matches have been generated, any shell function or command
8073 specified with the <B>-F</B> and <B>-C</B> options is invoked.
8074 When the command or function is invoked, the
8075 <FONT SIZE=-1><B>COMP_LINE</B>,
8078 <FONT SIZE=-1><B>COMP_POINT</B>,
8081 <FONT SIZE=-1><B>COMP_KEY</B>,
8085 <FONT SIZE=-1><B>COMP_TYPE</B>
8088 variables are assigned values as described above under
8089 <B>Shell Variables</B>.
8090 If a shell function is being invoked, the
8091 <FONT SIZE=-1><B>COMP_WORDS</B>
8095 <FONT SIZE=-1><B>COMP_CWORD</B>
8098 variables are also set.
8099 When the function or command is invoked,
8100 the first argument (<B>$1</B>) is the name of the command whose arguments are
8102 the second argument (<B>$2</B>) is the word being completed,
8103 and the third argument (<B>$3</B>) is the word preceding the word being
8104 completed on the current command line.
8105 No filtering of the generated completions against the word being completed
8106 is performed; the function or command has complete freedom in generating
8110 Any function specified with <B>-F</B> is invoked first.
8111 The function may use any of the shell facilities, including the
8112 <B>compgen</B> builtin described below, to generate the matches.
8113 It must put the possible completions in the
8114 <FONT SIZE=-1><B>COMPREPLY</B>
8117 array variable, one per array element.
8120 Next, any command specified with the <B>-C</B> option is invoked
8121 in an environment equivalent to command substitution.
8122 It should print a list of completions, one per line, to the
8124 Backslash may be used to escape a newline, if necessary.
8127 After all of the possible completions are generated, any filter
8128 specified with the <B>-X</B> option is applied to the list.
8129 The filter is a pattern as used for pathname expansion; a <B>&</B>
8130 in the pattern is replaced with the text of the word being completed.
8131 A literal <B>&</B> may be escaped with a backslash; the backslash
8132 is removed before attempting a match.
8133 Any completion that matches the pattern will be removed from the list.
8134 A leading <B>!</B> negates the pattern; in this case any completion
8135 not matching the pattern will be removed.
8138 Finally, any prefix and suffix specified with the <B>-P</B> and <B>-S</B>
8139 options are added to each member of the completion list, and the result is
8140 returned to the readline completion code as the list of possible
8144 If the previously-applied actions do not generate any matches, and the
8145 <B>-o dirnames</B> option was supplied to <B>complete</B> when the
8146 compspec was defined, directory name completion is attempted.
8149 If the <B>-o plusdirs</B> option was supplied to <B>complete</B> when the
8150 compspec was defined, directory name completion is attempted and any
8151 matches are added to the results of the other actions.
8154 By default, if a compspec is found, whatever it generates is returned
8155 to the completion code as the full set of possible completions.
8156 The default <B>bash</B> completions are not attempted, and the readline
8157 default of filename completion is disabled.
8158 If the <B>-o bashdefault</B> option was supplied to <B>complete</B> when
8159 the compspec was defined, the <B>bash</B> default completions are attempted
8160 if the compspec generates no matches.
8161 If the <B>-o default</B> option was supplied to <B>complete</B> when the
8162 compspec was defined, readline's default completion will be performed
8163 if the compspec (and, if attempted, the default <B>bash</B> completions)
8164 generate no matches.
8167 When a compspec indicates that directory name completion is desired,
8168 the programmable completion functions force readline to append a slash
8169 to completed names which are symbolic links to directories, subject to
8170 the value of the <B>mark-directories</B> readline variable, regardless
8171 of the setting of the <B>mark-symlinked-directories</B> readline variable.
8174 There is some support for dynamically modifying completions. This is
8175 most useful when used in combination with a default completion specified
8176 with <B>complete -D</B>.
8177 It's possible for shell functions executed as completion
8178 handlers to indicate that completion should be retried by returning an
8179 exit status of 124. If a shell function returns 124, and changes
8180 the compspec associated with the command on which completion is being
8181 attempted (supplied as the first argument when the function is executed),
8182 programmable completion restarts from the beginning, with an
8183 attempt to find a new compspec for that command. This allows a set of
8184 completions to be built dynamically as completion is attempted, rather than
8185 being loaded all at once.
8188 For instance, assuming that there is a library of compspecs, each kept in a
8189 file corresponding to the name of the command, the following default
8190 completion function would load completions dynamically:
8193 <TT>_completion_loader()
8199 <TT> </TT>. "/etc/bash_completion.d/$1.sh" >/dev/null 2>&1 && return 124<BR>
8205 complete -D -F _completion_loader -o bashdefault -o default
8209 <A NAME="lbCW"> </A>
8218 builtin is enabled, the shell provides access to the
8219 <I>command history</I>,
8220 the list of commands previously typed.
8222 <FONT SIZE=-1><B>HISTSIZE</B>
8225 variable is used as the
8226 number of commands to save in a history list.
8227 The text of the last
8228 <FONT SIZE=-1><B>HISTSIZE</B>
8231 commands (default 500) is saved. The shell
8232 stores each command in the history list prior to parameter and
8233 variable expansion (see
8234 <FONT SIZE=-1><B>EXPANSION</B>
8237 above) but after history expansion is performed, subject to the
8238 values of the shell variables
8239 <FONT SIZE=-1><B>HISTIGNORE</B>
8243 <FONT SIZE=-1><B>HISTCONTROL</B>.
8248 On startup, the history is initialized from the file named by
8250 <FONT SIZE=-1><B>HISTFILE</B>
8253 (default <A HREF="file:~/.bash_history"><I>~/.bash_history</I></A>).
8254 The file named by the value of
8255 <FONT SIZE=-1><B>HISTFILE</B>
8258 is truncated, if necessary, to contain no more than
8259 the number of lines specified by the value of
8260 <FONT SIZE=-1><B>HISTFILESIZE</B>.
8263 If <B>HISTFILESIZE</B> is unset, or set to null, a non-numeric value,
8264 or a numeric value less than zero, the history file is not truncated.
8265 When the history file is read,
8266 lines beginning with the history comment character followed immediately
8267 by a digit are interpreted as timestamps for the preceding history line.
8268 These timestamps are optionally displayed depending on the value of the
8269 <FONT SIZE=-1><B>HISTTIMEFORMAT</B>
8273 When a shell with history enabled exits, the last
8274 <FONT SIZE=-1><B>$HISTSIZE</B>
8277 lines are copied from the history list to
8278 <FONT SIZE=-1><B>$HISTFILE</B>.
8284 shell option is enabled
8285 (see the description of
8289 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
8292 below), the lines are appended to the history file,
8293 otherwise the history file is overwritten.
8295 <FONT SIZE=-1><B>HISTFILE</B>
8298 is unset, or if the history file is unwritable, the history is
8301 <FONT SIZE=-1><B>HISTTIMEFORMAT</B>
8304 variable is set, time stamps are written to the history file, marked
8305 with the history comment character, so
8306 they may be preserved across shell sessions.
8307 This uses the history comment character to distinguish timestamps from
8308 other history lines.
8309 After saving the history, the history file is truncated
8310 to contain no more than
8311 <FONT SIZE=-1><B>HISTFILESIZE</B>
8315 <FONT SIZE=-1><B>HISTFILESIZE</B>
8318 is unset, or set to null, a non-numeric value,
8319 or a numeric value less than zero, the history file is not truncated.
8326 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
8329 below) may be used to list or edit and re-execute a portion of
8334 builtin may be used to display or modify the history list and
8335 manipulate the history file.
8336 When using command-line editing, search commands
8337 are available in each editing mode that provide access to the
8341 The shell allows control over which commands are saved on the history
8343 <FONT SIZE=-1><B>HISTCONTROL</B>
8347 <FONT SIZE=-1><B>HISTIGNORE</B>
8350 variables may be set to cause the shell to save only a subset of the
8355 shell option, if enabled, causes the shell to attempt to save each
8356 line of a multi-line command in the same history entry, adding
8357 semicolons where necessary to preserve syntactic correctness.
8361 shell option causes the shell to save the command with embedded newlines
8362 instead of semicolons. See the description of the
8366 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
8369 for information on setting and unsetting shell options.
8370 <A NAME="lbCX"> </A>
8371 <H3>HISTORY EXPANSION</H3>
8375 The shell supports a history expansion feature that
8376 is similar to the history expansion in
8379 This section describes what syntax features are available. This
8380 feature is enabled by default for interactive shells, and can be
8387 builtin command (see
8388 <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
8391 below). Non-interactive shells do not perform history expansion
8395 History expansions introduce words from the history list into
8396 the input stream, making it easy to repeat commands, insert the
8397 arguments to a previous command into the current input line, or
8398 fix errors in previous commands quickly.
8401 History expansion is performed immediately after a complete line
8402 is read, before the shell breaks it into words.
8403 It takes place in two parts.
8404 The first is to determine which line from the history list
8405 to use during substitution.
8406 The second is to select portions of that line for inclusion into
8408 The line selected from the history is the <I>event</I>,
8409 and the portions of that line that are acted upon are <I>words</I>.
8410 Various <I>modifiers</I> are available to manipulate the selected words.
8411 The line is broken into words in the same fashion as when reading input,
8412 so that several <I>metacharacter</I>-separated words surrounded by
8413 quotes are considered one word.
8414 History expansions are introduced by the appearance of the
8415 history expansion character, which is <B>!</B> by default.
8416 Only backslash (<B>\</B>) and single quotes can quote
8417 the history expansion character.
8420 Several characters inhibit history expansion if found immediately
8421 following the history expansion character, even if it is unquoted:
8422 space, tab, newline, carriage return, and <B>=</B>.
8423 If the <B>extglob</B> shell option is enabled, <B>(</B> will also
8427 Several shell options settable with the
8430 builtin may be used to tailor the behavior of history expansion.
8434 shell option is enabled (see the description of the
8440 is being used, history substitutions are not immediately passed to
8442 Instead, the expanded line is reloaded into the
8445 editing buffer for further modification.
8449 is being used, and the
8452 shell option is enabled, a failed history substitution will be reloaded
8456 editing buffer for correction.
8463 builtin command may be used to see what a history expansion will
8471 builtin may be used to add commands to the end of the history list
8472 without actually executing them, so that they are available for
8476 The shell allows control of the various characters used by the
8477 history expansion mechanism (see the description of
8481 <B>Shell Variables</B>).
8484 the history comment character to mark history timestamps when
8485 writing the history file.
8486 <A NAME="lbCY"> </A>
8487 <H4>Event Designators</H4>
8491 An event designator is a reference to a command line entry in the
8493 Unless the reference is absolute, events are relative to the current
8494 position in the history list.
8502 Start a history substitution, except when followed by a
8505 newline, carriage return, =
8506 or ( (when the <B>extglob</B> shell option is enabled using
8507 the <B>shopt</B> builtin).
8508 <DT><B>!</B><I>n</I>
8511 Refer to command line
8514 <DT><B>!-</B><I>n</I>
8517 Refer to the current command minus
8523 Refer to the previous command. This is a synonym for `!-1'.
8524 <DT><B>!</B><I>string</I>
8527 Refer to the most recent command preceding the current position in the
8528 history list starting with
8531 <DT><B>!?</B><I>string</I><B>[?]</B>
8534 Refer to the most recent command preceding the current position in the
8535 history list containing
8538 The trailing <B>?</B> may be omitted if
8541 is followed immediately by a newline.
8542 <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>
8545 Quick substitution. Repeat the previous command, replacing
8552 ``!!:s/<I>string1</I>/<I>string2</I>/''
8553 (see <B>Modifiers</B> below).
8557 The entire command line typed so far.
8560 <A NAME="lbCZ"> </A>
8561 <H4>Word Designators</H4>
8565 Word designators are used to select desired words from the event.
8569 separates the event specification from the word designator.
8570 It may be omitted if the word designator begins with a
8582 Words are numbered from the beginning of the line,
8583 with the first word being denoted by 0 (zero).
8584 Words are inserted into the current line separated by single spaces.
8592 The zeroth word. For the shell, this is the command
8597 The <I>n</I>th word.
8601 The first argument. That is, word 1.
8605 The last word. This is usually the last argument, but will expand to the
8606 zeroth word if there is only one word in the line.
8610 The word matched by the most recent `?<I>string</I>?' search.
8611 <DT><I>x</I><B>-</B>y
8614 A range of words; `-<I>y</I>' abbreviates `0-<I>y</I>'.
8618 All of the words but the zeroth. This is a synonym
8619 for `<I>1-$</I>'. It is not an error to use
8622 if there is just one
8623 word in the event; the empty string is returned in that case.
8627 Abbreviates <I>x-$</I>.
8631 Abbreviates <I>x-$</I> like <B>x*</B>, but omits the last word.
8636 If a word designator is supplied without an event specification, the
8637 previous command is used as the event.
8638 <A NAME="lbDA"> </A>
8643 After the optional word designator, there may appear a sequence of
8644 one or more of the following modifiers, each preceded by a `:'.
8654 Remove a trailing filename component, leaving only the head.
8658 Remove all leading filename components, leaving the tail.
8662 Remove a trailing suffix of the form <I>.xxx</I>, leaving the
8667 Remove all but the trailing suffix.
8671 Print the new command but do not execute it.
8675 Quote the substituted words, escaping further substitutions.
8679 Quote the substituted words as with
8682 but break into words at
8686 <DT><B>s/</B><I>old</I>/<I>new</I>/
8692 for the first occurrence of
8695 in the event line. Any delimiter can be used in place of /. The
8696 final delimiter is optional if it is the last character of the
8697 event line. The delimiter may be quoted in
8703 with a single backslash. If & appears in
8709 A single backslash will quote the &. If
8712 is null, it is set to the last
8715 substituted, or, if no previous history substitutions took place,
8720 <B>!?</B><I>string</I><B>[?]</B>
8726 Repeat the previous substitution.
8730 Cause changes to be applied over the entire event line. This is
8731 used in conjunction with `<B>:s</B>' (e.g., `<B>:gs/</B><I>old</I>/<I>new</I>/')
8732 or `<B>:&</B>'. If used with
8733 `<B>:s</B>', any delimiter can be used
8734 in place of /, and the final delimiter is optional
8735 if it is the last character of the event line.
8736 An <B>a</B> may be used as a synonym for <B>g</B>.
8740 Apply the following `<B>s</B>' modifier once to each word in the event line.
8743 <A NAME="lbDB"> </A>
8744 <H3>SHELL BUILTIN COMMANDS</H3>
8750 Unless otherwise noted, each builtin command documented in this
8751 section as accepting options preceded by
8757 to signify the end of the options.
8758 The <B>:</B>, <B>true</B>, <B>false</B>, and <B>test</B> builtins
8759 do not accept options and do not treat <B>--</B> specially.
8760 The <B>exit</B>, <B>logout</B>, <B>break</B>, <B>continue</B>, <B>let</B>,
8761 and <B>shift</B> builtins accept and process arguments beginning with
8762 <B>-</B> without requiring <B>--</B>.
8763 Other builtins that accept arguments but are not specified as accepting
8764 options interpret arguments beginning with <B>-</B> as invalid options and
8765 require <B>--</B> to prevent this interpretation.
8769 <DT><B>:</B> [<I>arguments</I>]<DD>
8771 No effect; the command does nothing beyond expanding
8774 and performing any specified
8775 redirections. A zero exit code is returned.
8776 <DT><B> . </B> <I>filename</I> [<I>arguments</I>]<DD>
8778 <DT><B>source</B> <I>filename</I> [<I>arguments</I>]<DD>
8780 Read and execute commands from
8784 shell environment and return the exit status of the last command
8791 does not contain a slash, filenames in
8792 <FONT SIZE=-1><B>PATH</B>
8795 are used to find the directory containing
8798 The file searched for in
8799 <FONT SIZE=-1><B>PATH</B>
8802 need not be executable.
8803 When <B>bash</B> is not in <I>posix mode</I>, the current directory is
8804 searched if no file is found in
8805 <FONT SIZE=-1><B>PATH</B>.
8814 builtin command is turned off, the
8815 <FONT SIZE=-1><B>PATH</B>
8819 If any <I>arguments</I> are supplied, they become the positional
8820 parameters when <I>filename</I> is executed. Otherwise the positional
8821 parameters are unchanged.
8822 The return status is the status of the last command exited within
8823 the script (0 if no commands are executed), and false if
8826 is not found or cannot be read.
8827 <DT><B>alias</B> [<B>-p</B>] [<I>name</I>[=<I>value</I>] ...]<DD>
8828 <B>Alias</B> with no arguments or with the
8831 option prints the list of aliases in the form
8832 <B>alias</B> <I>name</I>=<I>value</I> on standard output.
8833 When arguments are supplied, an alias is defined for
8834 each <I>name</I> whose <I>value</I> is given.
8835 A trailing space in <I>value</I> causes the next word to be
8836 checked for alias substitution when the alias is expanded.
8837 For each <I>name</I> in the argument list for which no <I>value</I>
8838 is supplied, the name and value of the alias is printed.
8839 <B>Alias</B> returns true unless a <I>name</I> is given for which
8840 no alias has been defined.
8841 <DT><B>bg</B> [<I>jobspec</I> ...]<DD>
8842 Resume each suspended job <I>jobspec</I> in the background, as if it
8843 had been started with
8849 is not present, the shell's notion of the <I>current job</I> is used.
8854 returns 0 unless run when job control is disabled or, when run with
8855 job control enabled, any specified <I>jobspec</I> was not found
8856 or was started without job control.
8857 <DT><B>bind</B> [<B>-m</B> <I>keymap</I>] [<B>-lpsvPSVX</B>]<DD>
8859 <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>
8860 <DT><B>bind</B> [<B>-m</B> <I>keymap</I>] <B>-f</B> <I>filename</I><DD>
8861 <DT><B>bind</B> [<B>-m</B> <I>keymap</I>] <B>-x</B> <I>keyseq</I>:<I>shell-command</I><DD>
8862 <DT><B>bind</B> [<B>-m</B> <I>keymap</I>] <I>keyseq</I>:<I>function-name</I><DD>
8863 <DT><B>bind</B> <I>readline-command</I><DD>
8868 key and function bindings, bind a key sequence to a
8871 function or macro, or set a
8875 Each non-option argument is a command as it would appear in
8878 but each binding or command must be passed as a separate argument;
8879 e.g., '"\C-x\C-r": re-read-init-file'.
8880 Options, if supplied, have the following meanings:
8881 <DL COMPACT><DT><DD>
8884 <DT><B>-m </B><I>keymap</I>
8890 as the keymap to be affected by the subsequent bindings.
8895 <I>emacs, emacs-standard, emacs-meta, emacs-ctlx, vi,
8896 vi-move, vi-command</I>, and
8899 <I>vi</I> is equivalent to <I>vi-command</I>; <I>emacs</I> is
8900 equivalent to <I>emacs-standard</I>.
8904 List the names of all <B>readline</B> functions.
8908 Display <B>readline</B> function names and bindings in such a way
8909 that they can be re-read.
8913 List current <B>readline</B> function names and bindings.
8917 Display <B>readline</B> key sequences bound to macros and the strings
8918 they output in such a way that they can be re-read.
8922 Display <B>readline</B> key sequences bound to macros and the strings
8927 Display <B>readline</B> variable names and values in such a way that they
8932 List current <B>readline</B> variable names and values.
8933 <DT><B>-f </B><I>filename</I>
8936 Read key bindings from <I>filename</I>.
8937 <DT><B>-q </B><I>function</I>
8940 Query about which keys invoke the named <I>function</I>.
8941 <DT><B>-u </B><I>function</I>
8944 Unbind all keys bound to the named <I>function</I>.
8945 <DT><B>-r </B><I>keyseq</I>
8948 Remove any current binding for <I>keyseq</I>.
8949 <DT><B>-x </B><I>keyseq</I>:<I>shell-command</I>
8952 Cause <I>shell-command</I> to be executed whenever <I>keyseq</I> is
8954 When <I>shell-command</I> is executed, the shell sets the
8955 <FONT SIZE=-1><B>READLINE_LINE</B>
8958 variable to the contents of the <B>readline</B> line buffer and the
8959 <FONT SIZE=-1><B>READLINE_POINT</B>
8962 variable to the current location of the insertion point.
8963 If the executed command changes the value of
8964 <FONT SIZE=-1><B>READLINE_LINE</B>
8968 <FONT SIZE=-1><B>READLINE_POINT</B>,
8971 those new values will be reflected in the editing state.
8975 List all key sequences bound to shell commands and the associated commands
8976 in a format that can be reused as input.
8981 The return value is 0 unless an unrecognized option is given or an
8985 <DT><B>break</B> [<I>n</I>]<DD>
8996 loop. If <I>n</I> is specified, break <I>n</I> levels.
9002 is greater than the number of enclosing loops, all enclosing loops
9004 The return value is 0 unless <I>n</I> is not greater than or equal to 1.
9005 <DT><B>builtin</B> <I>shell-builtin</I> [<I>arguments</I>]<DD>
9006 Execute the specified shell builtin, passing it
9009 and return its exit status.
9010 This is useful when defining a
9011 function whose name is the same as a shell builtin,
9012 retaining the functionality of the builtin within the function.
9013 The <B>cd</B> builtin is commonly redefined this way.
9014 The return status is false if
9015 <I>shell-builtin</I>
9017 is not a shell builtin command.
9018 <DT><B>caller</B> [<I>expr</I>]<DD>
9019 Returns the context of any active subroutine call (a shell function or
9020 a script executed with the <B>.</B> or <B>source</B> builtins).
9021 Without <I>expr</I>, <B>caller</B> displays the line number and source
9022 filename of the current subroutine call.
9023 If a non-negative integer is supplied as <I>expr</I>, <B>caller</B>
9024 displays the line number, subroutine name, and source file corresponding
9025 to that position in the current execution call stack. This extra
9026 information may be used, for example, to print a stack trace. The
9027 current frame is frame 0.
9028 The return value is 0 unless the shell is not executing a subroutine
9029 call or <I>expr</I> does not correspond to a valid position in the
9031 <DT><B>cd</B> [<B>-L</B>|[<B>-P</B> [<B>-e</B>]] [-@]] [<I>dir</I>]<DD>
9032 Change the current directory to <I>dir</I>.
9033 if <I>dir</I> is not supplied, the value of the
9034 <FONT SIZE=-1><B>HOME</B>
9037 shell variable is the default.
9038 Any additional arguments following <I>dir</I> are ignored.
9040 <FONT SIZE=-1><B>CDPATH</B>
9043 defines the search path for the directory containing
9046 each directory name in
9047 <FONT SIZE=-1><B>CDPATH</B>
9050 is searched for <I>dir</I>.
9051 Alternative directory names in
9052 <FONT SIZE=-1><B>CDPATH</B>
9055 are separated by a colon (:). A null directory name in
9056 <FONT SIZE=-1><B>CDPATH</B>
9059 is the same as the current directory, i.e., ``<B>.</B>''. If
9062 begins with a slash (/),
9064 <FONT SIZE=-1><B>CDPATH</B>
9070 option causes <B>cd</B> to use the physical directory structure
9071 by resolving symbolic links while traversing <I>dir</I> and
9072 before processing instances of <I>..</I> in <I>dir</I> (see also the
9078 builtin command); the
9081 option forces symbolic links to be followed by resolving the link
9082 after processing instances of <I>..</I> in <I>dir</I>.
9083 If <I>..</I> appears in <I>dir</I>, it is processed by removing the
9084 immediately previous pathname component from <I>dir</I>, back to a slash
9085 or the beginning of <I>dir</I>.
9089 option is supplied with
9092 and the current working directory cannot be successfully determined
9093 after a successful directory change, <B>cd</B> will return an unsuccessful
9095 On systems that support it, the <B>-@</B> option presents the extended
9096 attributes associated with a file as a directory.
9101 <FONT SIZE=-1><B>$OLDPWD</B>
9104 before the directory change is attempted.
9105 If a non-empty directory name from
9106 <FONT SIZE=-1><B>CDPATH</B>
9110 <B>-</B> is the first argument, and the directory change is
9111 successful, the absolute pathname of the new working directory is
9112 written to the standard output.
9113 The return value is true if the directory was successfully changed;
9115 <DT><B>command</B> [<B>-pVv</B>] <I>command</I> [<I>arg</I> ...]<DD>
9122 suppressing the normal shell function lookup. Only builtin
9123 commands or commands found in the
9124 <FONT SIZE=-1><B>PATH</B>
9127 are executed. If the
9130 option is given, the search for
9133 is performed using a default value for
9134 <FONT SIZE=-1><B>PATH</B>
9137 that is guaranteed to find all of the standard utilities.
9144 option is supplied, a description of
9150 option causes a single word indicating the command or filename
9154 to be displayed; the
9157 option produces a more verbose description.
9164 option is supplied, the exit status is 0 if
9167 was found, and 1 if not. If neither option is supplied and
9168 an error occurred or
9171 cannot be found, the exit status is 127. Otherwise, the exit status of the
9174 builtin is the exit status of
9177 <DT><B>compgen</B> [<I>option</I>] [<I>word</I>]<DD>
9178 Generate possible completion matches for <I>word</I> according to
9179 the <I>option</I>s, which may be any option accepted by the
9182 builtin with the exception of <B>-p</B> and <B>-r</B>, and write
9183 the matches to the standard output.
9184 When using the <B>-F</B> or <B>-C</B> options, the various shell variables
9185 set by the programmable completion facilities, while available, will not
9188 The matches will be generated in the same way as if the programmable
9189 completion code had generated them directly from a completion specification
9190 with the same flags.
9191 If <I>word</I> is specified, only those completions matching <I>word</I>
9194 The return value is true unless an invalid option is supplied, or no
9195 matches were generated.
9196 <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>
9199 [<B>-X</B> <I>filterpat</I>] [<B>-P</B> <I>prefix</I>] [<B>-S</B> <I>suffix</I>] <I>name</I> [<I>name ...</I>]
9201 <DT><B>complete</B> <B>-pr</B> [<B>-DE</B>] [<I>name</I> ...]<DD>
9203 Specify how arguments to each <I>name</I> should be completed.
9204 If the <B>-p</B> option is supplied, or if no options are supplied,
9205 existing completion specifications are printed in a way that allows
9206 them to be reused as input.
9207 The <B>-r</B> option removes a completion specification for
9208 each <I>name</I>, or, if no <I>name</I>s are supplied, all
9209 completion specifications.
9210 The <B>-D</B> option indicates that the remaining options and actions should
9211 apply to the ``default'' command completion; that is, completion attempted
9212 on a command for which no completion has previously been defined.
9213 The <B>-E</B> option indicates that the remaining options and actions should
9214 apply to ``empty'' command completion; that is, completion attempted on a
9217 The process of applying these completion specifications when word completion
9218 is attempted is described above under <B>Programmable Completion</B>.
9220 Other options, if specified, have the following meanings.
9221 The arguments to the <B>-G</B>, <B>-W</B>, and <B>-X</B> options
9222 (and, if necessary, the <B>-P</B> and <B>-S</B> options)
9223 should be quoted to protect them from expansion before the
9227 <DL COMPACT><DT><DD>
9230 <DT><B>-o</B> <I>comp-option</I><DD>
9231 The <I>comp-option</I> controls several aspects of the compspec's behavior
9232 beyond the simple generation of completions.
9233 <I>comp-option</I> may be one of:
9234 <DL COMPACT><DT><DD>
9236 <DT><B>bashdefault</B>
9239 Perform the rest of the default <B>bash</B> completions if the compspec
9240 generates no matches.
9244 Use readline's default filename completion if the compspec generates
9249 Perform directory name completion if the compspec generates no matches.
9250 <DT><B>filenames</B>
9253 Tell readline that the compspec generates filenames, so it can perform any
9254 filename-specific processing (like adding a slash to directory names,
9255 quoting special characters, or suppressing trailing spaces).
9256 Intended to be used with shell functions.
9260 Tell readline not to quote the completed words if they are filenames
9261 (quoting filenames is the default).
9265 Tell readline not to append a space (the default) to words completed at
9266 the end of the line.
9270 After any matches defined by the compspec are generated,
9271 directory name completion is attempted and any
9272 matches are added to the results of the other actions.
9275 <DT><B>-A</B> <I>action</I><DD>
9276 The <I>action</I> may be one of the following to generate a list of possible
9278 <DL COMPACT><DT><DD>
9283 Alias names. May also be specified as <B>-a</B>.
9287 Array variable names.
9291 <B>Readline</B> key binding names.
9295 Names of shell builtin commands. May also be specified as <B>-b</B>.
9299 Command names. May also be specified as <B>-c</B>.
9300 <DT><B>directory</B>
9303 Directory names. May also be specified as <B>-d</B>.
9307 Names of disabled shell builtins.
9311 Names of enabled shell builtins.
9315 Names of exported shell variables. May also be specified as <B>-e</B>.
9319 File names. May also be specified as <B>-f</B>.
9323 Names of shell functions.
9327 Group names. May also be specified as <B>-g</B>.
9328 <DT><B>helptopic</B>
9331 Help topics as accepted by the <B>help</B> builtin.
9335 Hostnames, as taken from the file specified by the
9336 <FONT SIZE=-1><B>HOSTFILE</B>
9343 Job names, if job control is active. May also be specified as <B>-j</B>.
9347 Shell reserved words. May also be specified as <B>-k</B>.
9351 Names of running jobs, if job control is active.
9355 Service names. May also be specified as <B>-s</B>.
9359 Valid arguments for the <B>-o</B> option to the <B>set</B> builtin.
9363 Shell option names as accepted by the <B>shopt</B> builtin.
9371 Names of stopped jobs, if job control is active.
9375 User names. May also be specified as <B>-u</B>.
9379 Names of all shell variables. May also be specified as <B>-v</B>.
9382 <DT><B>-C</B> <I>command</I><DD>
9383 <I>command</I> is executed in a subshell environment, and its output is
9384 used as the possible completions.
9385 <DT><B>-F</B> <I>function</I><DD>
9386 The shell function <I>function</I> is executed in the current shell
9388 When the function is executed,
9389 the first argument (<B>$1</B>) is the name of the command whose arguments are
9391 the second argument (<B>$2</B>) is the word being completed,
9392 and the third argument (<B>$3</B>) is the word preceding the word being
9393 completed on the current command line.
9394 When it finishes, the possible completions are retrieved from the value
9396 <FONT SIZE=-1><B>COMPREPLY</B>
9400 <DT><B>-G</B> <I>globpat</I><DD>
9401 The pathname expansion pattern <I>globpat</I> is expanded to generate
9402 the possible completions.
9403 <DT><B>-P</B> <I>prefix</I><DD>
9404 <I>prefix</I> is added at the beginning of each possible completion
9405 after all other options have been applied.
9406 <DT><B>-S</B> <I>suffix</I><DD>
9407 <I>suffix</I> is appended to each possible completion
9408 after all other options have been applied.
9409 <DT><B>-W</B> <I>wordlist</I><DD>
9410 The <I>wordlist</I> is split using the characters in the
9411 <FONT SIZE=-1><B>IFS</B>
9414 special variable as delimiters, and each resultant word is expanded.
9415 The possible completions are the members of the resultant list which
9416 match the word being completed.
9417 <DT><B>-X</B> <I>filterpat</I><DD>
9418 <I>filterpat</I> is a pattern as used for pathname expansion.
9419 It is applied to the list of possible completions generated by the
9420 preceding options and arguments, and each completion matching
9421 <I>filterpat</I> is removed from the list.
9422 A leading <B>!</B> in <I>filterpat</I> negates the pattern; in this
9423 case, any completion not matching <I>filterpat</I> is removed.
9428 The return value is true unless an invalid option is supplied, an option
9429 other than <B>-p</B> or <B>-r</B> is supplied without a <I>name</I>
9430 argument, an attempt is made to remove a completion specification for
9431 a <I>name</I> for which no specification exists, or
9432 an error occurs adding a completion specification.
9435 <DT><B>compopt</B> [<B>-o</B> <I>option</I>] [<B>-DE</B>] [<B>+o</B> <I>option</I>] [<I>name</I>]<DD>
9436 Modify completion options for each <I>name</I> according to the
9437 <I>option</I>s, or for the
9438 currently-executing completion if no <I>name</I>s are supplied.
9439 If no <I>option</I>s are given, display the completion options for each
9440 <I>name</I> or the current completion.
9441 The possible values of <I>option</I> are those valid for the <B>complete</B>
9442 builtin described above.
9443 The <B>-D</B> option indicates that the remaining options should
9444 apply to the ``default'' command completion; that is, completion attempted
9445 on a command for which no completion has previously been defined.
9446 The <B>-E</B> option indicates that the remaining options should
9447 apply to ``empty'' command completion; that is, completion attempted on a
9450 The return value is true unless an invalid option is supplied, an attempt
9451 is made to modify the options for a <I>name</I> for which no completion
9452 specification exists, or an output error occurs.
9453 <DT><B>continue</B> [<I>n</I>]<DD>
9454 Resume the next iteration of the enclosing
9468 is specified, resume at the <I>n</I>th enclosing loop.
9474 is greater than the number of enclosing loops, the last enclosing loop
9475 (the ``top-level'' loop) is resumed.
9476 The return value is 0 unless <I>n</I> is not greater than or equal to 1.
9477 <DT><B>declare</B> [<B>-aAfFgilnrtux</B>] [<B>-p</B>] [<I>name</I>[=<I>value</I>] ...]<DD>
9479 <DT><B>typeset</B> [<B>-aAfFgilnrtux</B>] [<B>-p</B>] [<I>name</I>[=<I>value</I>] ...]<DD>
9481 Declare variables and/or give them attributes.
9482 If no <I>name</I>s are given then display the values of variables.
9486 option will display the attributes and values of each
9492 is used with <I>name</I> arguments, additional options,
9493 other than <B>-f</B> and <B>-F</B>, are ignored.
9497 is supplied without <I>name</I> arguments, it will display the attributes
9498 and values of all variables having the attributes specified by the
9500 If no other options are supplied with <B>-p</B>, <B>declare</B> will display
9501 the attributes and values of all shell variables. The <B>-f</B> option
9502 will restrict the display to shell functions.
9506 option inhibits the display of function definitions; only the
9507 function name and attributes are printed.
9508 If the <B>extdebug</B> shell option is enabled using <B>shopt</B>,
9509 the source file name and line number where the function is defined
9510 are displayed as well. The
9519 option forces variables to be created or modified at the global scope,
9520 even when <B>declare</B> is executed in a shell function.
9521 It is ignored in all other cases.
9522 The following options can
9523 be used to restrict output to variables with the specified attribute or
9524 to give variables attributes:
9525 <DL COMPACT><DT><DD>
9531 Each <I>name</I> is an indexed array variable (see
9538 Each <I>name</I> is an associative array variable (see
9545 Use function names only.
9549 The variable is treated as an integer; arithmetic evaluation (see
9550 <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>
9553 above) is performed when the variable is assigned a value.
9557 When the variable is assigned a value, all upper-case characters are
9558 converted to lower-case.
9559 The upper-case attribute is disabled.
9563 Give each <I>name</I> the <I>nameref</I> attribute, making
9564 it a name reference to another variable.
9565 That other variable is defined by the value of <I>name</I>.
9566 All references and assignments to <I>name</I>, except for changing the
9567 <B>-n</B> attribute itself, are performed on the variable referenced by
9568 <I>name</I>'s value.
9569 The <B>-n</B> attribute cannot be applied to array variables.
9573 Make <I>name</I>s readonly. These names cannot then be assigned values
9574 by subsequent assignment statements or unset.
9578 Give each <I>name</I> the <I>trace</I> attribute.
9579 Traced functions inherit the <B>DEBUG</B> and <B>RETURN</B> traps from
9581 The trace attribute has no special meaning for variables.
9585 When the variable is assigned a value, all lower-case characters are
9586 converted to upper-case.
9587 The lower-case attribute is disabled.
9591 Mark <I>name</I>s for export to subsequent commands via the environment.
9596 Using `+' instead of `-'
9597 turns off the attribute instead,
9598 with the exceptions that <B>+a</B>
9599 may not be used to destroy an array variable and <B>+r</B> will not
9600 remove the readonly attribute.
9601 When used in a function,
9608 <I>name</I> local, as with the
9612 unless the <B>-g</B> option is supplied.
9613 If a variable name is followed by =<I>value</I>, the value of
9614 the variable is set to <I>value</I>.
9615 When using <B>-a</B> or <B>-A</B> and the compound assignment syntax to
9616 create array variables, additional attributes do not take effect until
9617 subsequent assignments.
9618 The return value is 0 unless an invalid option is encountered,
9619 an attempt is made to define a function using
9621 <TT>-f foo=bar</TT>,
9622 an attempt is made to assign a value to a readonly variable,
9623 an attempt is made to assign a value to an array variable without
9624 using the compound assignment syntax (see
9627 above), one of the <I>names</I> is not a valid shell variable name,
9628 an attempt is made to turn off readonly status for a readonly variable,
9629 an attempt is made to turn off array status for an array variable,
9630 or an attempt is made to display a non-existent function with <B>-f</B>.
9633 <DT><B>dirs [-clpv</B>] [+<I>n</I>] [-<I>n</I>]
9636 Without options, displays the list of currently remembered directories.
9637 The default display is on a single line with directory names separated
9639 Directories are added to the list with the
9645 command removes entries from the list.
9646 <DL COMPACT><DT><DD>
9652 Clears the directory stack by deleting all of the entries.
9656 Produces a listing using full pathnames;
9657 the default listing format uses a tilde to denote the home directory.
9661 Print the directory stack with one entry per line.
9665 Print the directory stack with one entry per line,
9666 prefixing each entry with its index in the stack.
9667 <DT><B>+</B><I>n</I><DD>
9668 Displays the <I>n</I>th entry counting from the left of the list
9672 when invoked without options, starting with zero.
9673 <DT><B>-</B><I>n</I><DD>
9674 Displays the <I>n</I>th entry counting from the right of the list
9678 when invoked without options, starting with zero.
9683 The return value is 0 unless an
9684 invalid option is supplied or <I>n</I> indexes beyond the end
9685 of the directory stack.
9688 <DT><B>disown</B> [<B>-ar</B>] [<B>-h</B>] [<I>jobspec</I> ...]<DD>
9689 Without options, remove each
9692 from the table of active jobs.
9696 is not present, and neither the <B>-a</B> nor the <B>-r</B> option
9697 is supplied, the <I>current job</I> is used.
9698 If the <B>-h</B> option is given, each
9701 is not removed from the table, but is marked so that
9702 <FONT SIZE=-1><B>SIGHUP</B>
9705 is not sent to the job if the shell receives a
9706 <FONT SIZE=-1><B>SIGHUP</B>.
9715 option means to remove or mark all jobs; the
9721 argument restricts operation to running jobs.
9722 The return value is 0 unless a
9725 does not specify a valid job.
9726 <DT><B>echo</B> [<B>-neE</B>] [<I>arg</I> ...]<DD>
9727 Output the <I>arg</I>s, separated by spaces, followed by a newline.
9728 The return status is 0 unless a write error occurs.
9729 If <B>-n</B> is specified, the trailing newline is
9730 suppressed. If the <B>-e</B> option is given, interpretation of
9731 the following backslash-escaped characters is enabled. The
9734 option disables the interpretation of these escape characters,
9735 even on systems where they are interpreted by default.
9736 The <B>xpg_echo</B> shell option may be used to
9737 dynamically determine whether or not <B>echo</B> expands these
9738 escape characters by default.
9741 does not interpret <B>--</B> to mean the end of options.
9744 interprets the following escape sequences:
9745 <DL COMPACT><DT><DD>
9759 suppress further output
9791 <DT><B>\0</B><I>nnn</I>
9794 the eight-bit character whose value is the octal value <I>nnn</I>
9795 (zero to three octal digits)
9796 <DT><B>\x</B><I>HH</I>
9799 the eight-bit character whose value is the hexadecimal value <I>HH</I>
9800 (one or two hex digits)
9801 <DT><B>\u</B><I>HHHH</I>
9804 the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value
9805 <I>HHHH</I> (one to four hex digits)
9806 <DT><B>\U</B><I>HHHHHHHH</I>
9809 the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value
9810 <I>HHHHHHHH</I> (one to eight hex digits)
9814 <DT><B>enable</B> [<B>-a</B>] [<B>-dnps</B>] [<B>-f</B> <I>filename</I>] [<I>name</I> ...]<DD>
9815 Enable and disable builtin shell commands.
9816 Disabling a builtin allows a disk command which has the same name
9817 as a shell builtin to be executed without specifying a full pathname,
9818 even though the shell normally searches for builtins before disk commands.
9819 If <B>-n</B> is used, each <I>name</I>
9820 is disabled; otherwise,
9821 <I>names</I> are enabled. For example, to use the
9824 binary found via the
9825 <FONT SIZE=-1><B>PATH</B>
9828 instead of the shell builtin version, run
9829 <TT>enable -n test</TT>.
9834 option means to load the new builtin command
9840 on systems that support dynamic loading. The
9843 option will delete a builtin previously loaded with
9846 If no <I>name</I> arguments are given, or if the
9849 option is supplied, a list of shell builtins is printed.
9850 With no other option arguments, the list consists of all enabled
9852 If <B>-n</B> is supplied, only disabled builtins are printed.
9853 If <B>-a</B> is supplied, the list printed includes all builtins, with an
9854 indication of whether or not each is enabled.
9855 If <B>-s</B> is supplied, the output is restricted to the POSIX
9856 <I>special</I> builtins.
9857 The return value is 0 unless a
9860 is not a shell builtin or there is an error loading a new builtin
9861 from a shared object.
9862 <DT><B>eval</B> [<I>arg</I> ...]<DD>
9863 The <I>arg</I>s are read and concatenated together into a single
9864 command. This command is then read and executed by the shell, and
9865 its exit status is returned as the value of
9871 or only null arguments,
9875 <DT><B>exec</B> [<B>-cl</B>] [<B>-a</B> <I>name</I>] [<I>command</I> [<I>arguments</I>]]<DD>
9879 is specified, it replaces the shell.
9880 No new process is created. The
9883 become the arguments to <I>command</I>.
9888 the shell places a dash at the beginning of the zeroth argument passed to
9900 to be executed with an empty environment. If
9903 is supplied, the shell passes
9906 as the zeroth argument to the executed command.
9910 cannot be executed for some reason, a non-interactive shell exits,
9915 is enabled. In that case, it returns failure.
9916 An interactive shell returns failure if the file cannot be executed.
9920 is not specified, any redirections take effect in the current shell,
9921 and the return status is 0. If there is a redirection error, the
9923 <DT><B>exit</B> [<I>n</I>]<DD>
9924 Cause the shell to exit
9925 with a status of <I>n</I>. If
9928 is omitted, the exit status
9929 is that of the last command executed.
9931 <FONT SIZE=-1><B>EXIT</B>
9934 is executed before the shell terminates.
9935 <DT><B>export</B> [<B>-fn</B>] [<I>name</I>[=<I>word</I>]] ...<DD>
9937 <DT><B>export -p</B>
9944 are marked for automatic export to the environment of
9945 subsequently executed commands. If the
9956 are given, or if the
9959 option is supplied, a list
9960 of names of all exported variables is printed.
9964 option causes the export property to be removed from each
9966 If a variable name is followed by =<I>word</I>, the value of
9967 the variable is set to <I>word</I>.
9970 returns an exit status of 0 unless an invalid option is
9972 one of the <I>names</I> is not a valid shell variable name, or
9978 that is not a function.
9979 <DT><B>fc</B> [<B>-e</B> <I>ename</I>] [<B>-lnr</B>] [<I>first</I>] [<I>last</I>]<DD>
9981 <DT><B>fc</B> <B>-s</B> [<I>pat</I>=<I>rep</I>] [<I>cmd</I>]<DD>
9983 The first form selects a range of commands from
9989 from the history list and displays or edits and re-executes them.
9995 may be specified as a string (to locate the last command beginning
9996 with that string) or as a number (an index into the history list,
9997 where a negative number is used as an offset from the current
10001 is not specified it is set to
10002 the current command for listing (so that
10005 prints the last 10 commands) and to
10012 is not specified it is set to the previous
10013 command for editing and -16 for listing.
10019 the command numbers when listing. The
10022 option reverses the order of
10023 the commands. If the
10027 the commands are listed on
10028 standard output. Otherwise, the editor given by
10032 on a file containing those commands. If
10037 <FONT SIZE=-1><B>FCEDIT</B>
10040 variable is used, and
10042 <FONT SIZE=-1><B>EDITOR</B>
10046 <FONT SIZE=-1><B>FCEDIT</B>
10049 is not set. If neither variable is set,
10053 is used. When editing is complete, the edited commands are
10054 echoed and executed.
10056 In the second form, <I>command</I> is re-executed after each instance
10057 of <I>pat</I> is replaced by <I>rep</I>.
10058 <I>Command</I> is intepreted the same as <I>first</I> above.
10059 A useful alias to use with this is
10061 <TT>r='fc -s'</TT>,
10065 runs the last command beginning with
10071 re-executes the last command.
10073 If the first form is used, the return value is 0 unless an invalid
10074 option is encountered or
10080 specify history lines out of range.
10084 option is supplied, the return value is the value of the last
10085 command executed or failure if an error occurs with the temporary
10086 file of commands. If the second form is used, the return status
10087 is that of the command re-executed, unless
10090 does not specify a valid history line, in which case
10094 <DT><B>fg</B> [<I>jobspec</I>]<DD>
10098 in the foreground, and make it the current job.
10102 is not present, the shell's notion of the <I>current job</I> is used.
10103 The return value is that of the command placed into the foreground,
10104 or failure if run when job control is disabled or, when run with
10105 job control enabled, if
10108 does not specify a valid job or
10111 specifies a job that was started without job control.
10112 <DT><B>getopts</B> <I>optstring</I> <I>name</I> [<I>args</I>]<DD>
10115 is used by shell procedures to parse positional parameters.
10118 contains the option characters to be recognized; if a character
10119 is followed by a colon, the option is expected to have an
10120 argument, which should be separated from it by white space.
10121 The colon and question mark characters may not be used as
10123 Each time it is invoked,
10126 places the next option in the shell variable
10132 if it does not exist,
10133 and the index of the next argument to be processed into the
10135 <FONT SIZE=-1><B>OPTIND</B>.
10138 <FONT SIZE=-1><B>OPTIND</B>
10141 is initialized to 1 each time the shell or a shell script
10142 is invoked. When an option requires an argument,
10145 places that argument into the variable
10146 <FONT SIZE=-1><B>OPTARG</B>.
10149 The shell does not reset
10150 <FONT SIZE=-1><B>OPTIND</B>
10153 automatically; it must be manually reset between multiple
10157 within the same shell invocation if a new set of parameters
10160 When the end of options is encountered, <B>getopts</B> exits with a
10161 return value greater than zero.
10162 <FONT SIZE=-1><B>OPTIND</B>
10165 is set to the index of the first non-option argument,
10166 and <I>name</I> is set to ?.
10170 normally parses the positional parameters, but if more arguments are
10176 parses those instead.
10180 can report errors in two ways. If the first character of
10186 error reporting is used. In normal operation, diagnostic messages
10187 are printed when invalid options or missing option arguments are
10190 <FONT SIZE=-1><B>OPTERR</B>
10193 is set to 0, no error messages will be displayed, even if the first
10199 If an invalid option is seen,
10205 and, if not silent,
10206 prints an error message and unsets
10207 <FONT SIZE=-1><B>OPTARG</B>.
10214 the option character found is placed in
10215 <FONT SIZE=-1><B>OPTARG</B>
10218 and no diagnostic message is printed.
10220 If a required argument is not found, and
10224 a question mark (<B>?</B>) is placed in
10227 <FONT SIZE=-1><B>OPTARG</B>
10230 is unset, and a diagnostic message is printed.
10234 is silent, then a colon (<B>:</B>) is placed in
10238 <FONT SIZE=-1><B>OPTARG</B>
10241 is set to the option character found.
10245 returns true if an option, specified or unspecified, is found.
10246 It returns false if the end of options is encountered or an
10248 <DT><B>hash</B> [<B>-lr</B>] [<B>-p</B> <I>filename</I>] [<B>-dt</B>] [<I>name</I>]<DD>
10249 Each time <B>hash</B> is invoked,
10250 the full pathname of the command
10253 is determined by searching
10257 and remembered. Any previously-remembered pathname is discarded.
10261 option is supplied, no path search is performed, and
10264 is used as the full filename of the command.
10268 option causes the shell to forget all
10269 remembered locations.
10273 option causes the shell to forget the remembered location of each <I>name</I>.
10277 option is supplied, the full pathname to which each <I>name</I> corresponds
10278 is printed. If multiple <I>name</I> arguments are supplied with <B>-t</B>,
10279 the <I>name</I> is printed before the hashed full pathname.
10283 option causes output to be displayed in a format that may be reused as input.
10284 If no arguments are given, or if only <B>-l</B> is supplied,
10285 information about remembered commands is printed.
10286 The return status is true unless a
10289 is not found or an invalid option is supplied.
10290 <DT><B>help</B> [<B>-dms</B>] [<I>pattern</I>]<DD>
10291 Display helpful information about builtin commands. If
10297 gives detailed help on all commands matching
10300 otherwise help for all the builtins and shell control structures
10302 <DL COMPACT><DT><DD>
10308 Display a short description of each <I>pattern</I>
10312 Display the description of each <I>pattern</I> in a manpage-like format
10316 Display only a short usage synopsis for each <I>pattern</I>
10321 The return status is 0 unless no command matches
10326 <DT><B>history [</B><I>n</I>]<DD>
10328 <DT><B>history</B> <B>-c</B><DD>
10329 <DT><B>history -d</B> <I>offset</I><DD>
10330 <DT><B>history</B> <B>-anrw</B> [<I>filename</I>]<DD>
10331 <DT><B>history</B> <B>-p</B> <I>arg</I> [<I>arg ...</I>]<DD>
10332 <DT><B>history</B> <B>-s</B> <I>arg</I> [<I>arg ...</I>]<DD>
10334 With no options, display the command
10335 history list with line numbers. Lines listed
10339 have been modified. An argument of
10342 lists only the last
10346 If the shell variable
10347 <FONT SIZE=-1><B>HISTTIMEFORMAT</B>
10350 is set and not null,
10351 it is used as a format string for <I>strftime</I>(3) to display
10352 the time stamp associated with each displayed history entry.
10353 No intervening blank is printed between the formatted time stamp
10354 and the history line.
10355 If <I>filename</I> is supplied, it is used as the
10356 name of the history file; if not, the value of
10357 <FONT SIZE=-1><B>HISTFILE</B>
10360 is used. Options, if supplied, have the following meanings:
10361 <DL COMPACT><DT><DD>
10367 Clear the history list by deleting all the entries.
10368 <DT><B>-d</B> <I>offset</I><DD>
10369 Delete the history entry at position <I>offset</I>.
10373 Append the ``new'' history lines (history lines entered since the
10374 beginning of the current <B>bash</B> session) to the history file.
10378 Read the history lines not already read from the history
10379 file into the current history list. These are lines
10380 appended to the history file since the beginning of the
10381 current <B>bash</B> session.
10385 Read the contents of the history file
10386 and append them to the current history list.
10390 Write the current history list to the history file, overwriting the
10391 history file's contents.
10395 Perform history substitution on the following <I>args</I> and display
10396 the result on the standard output.
10397 Does not store the results in the history list.
10398 Each <I>arg</I> must be quoted to disable normal history expansion.
10405 in the history list as a single entry. The last command in the
10406 history list is removed before the
10415 <FONT SIZE=-1><B>HISTTIMEFORMAT</B>
10418 variable is set, the time stamp information
10419 associated with each history entry is written to the history file,
10420 marked with the history comment character.
10421 When the history file is read, lines beginning with the history
10422 comment character followed immediately by a digit are interpreted
10423 as timestamps for the previous history line.
10424 The return value is 0 unless an invalid option is encountered, an
10425 error occurs while reading or writing the history file, an invalid
10426 <I>offset</I> is supplied as an argument to <B>-d</B>, or the
10427 history expansion supplied as an argument to <B>-p</B> fails.
10430 <DT><B>jobs</B> [<B>-lnprs</B>] [ <I>jobspec</I> ... ]<DD>
10432 <DT><B>jobs</B> <B>-x</B> <I>command</I> [ <I>args</I> ... ]<DD>
10434 The first form lists the active jobs. The options have the following
10436 <DL COMPACT><DT><DD>
10443 in addition to the normal information.
10447 Display information only about jobs that have changed status since
10448 the user was last notified of their status.
10452 List only the process ID of the job's process group
10457 Display only running jobs.
10461 Display only stopped jobs.
10469 is given, output is restricted to information about that job.
10470 The return status is 0 unless an invalid option is encountered
10480 option is supplied,
10492 with the corresponding process group ID, and executes
10498 returning its exit status.
10501 <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>
10503 <DT><B>kill</B> <B>-l</B> [<I>sigspec</I> | <I>exit_status</I>]<DD>
10505 Send the signal named by
10511 to the processes named by
10519 is either a case-insensitive signal name such as
10520 <FONT SIZE=-1><B>SIGKILL</B>
10523 (with or without the
10524 <FONT SIZE=-1><B>SIG</B>
10527 prefix) or a signal number;
10530 is a signal number.
10534 is not present, then
10535 <FONT SIZE=-1><B>SIGTERM</B>
10542 lists the signal names.
10543 If any arguments are supplied when
10546 is given, the names of the signals corresponding to the arguments are
10547 listed, and the return status is 0.
10548 The <I>exit_status</I> argument to
10551 is a number specifying either a signal number or the exit status of
10552 a process terminated by a signal.
10555 returns true if at least one signal was successfully sent, or false
10556 if an error occurs or an invalid option is encountered.
10557 <DT><B>let</B> <I>arg</I> [<I>arg</I> ...]<DD>
10561 is an arithmetic expression to be evaluated (see
10562 <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>
10572 returns 1; 0 is returned otherwise.
10573 <DT><B>local</B> [<I>option</I>] [<I>name</I>[=<I>value</I>] ...]<DD>
10574 For each argument, a local variable named
10577 is created, and assigned
10580 The <I>option</I> can be any of the options accepted by <B>declare</B>.
10584 is used within a function, it causes the variable
10587 to have a visible scope restricted to that function and its children.
10591 writes a list of local variables to the standard output. It is
10595 when not within a function. The return status is 0 unless
10598 is used outside a function, an invalid
10602 <I>name</I> is a readonly variable.
10606 Exit a login shell.
10607 <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>
10609 <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>
10611 Read lines from the standard input into the indexed array variable
10614 or from file descriptor
10620 option is supplied.
10622 <FONT SIZE=-1><B>MAPFILE</B>
10625 is the default <I>array</I>.
10626 Options, if supplied, have the following meanings:
10627 <DL COMPACT><DT><DD>
10636 lines. If <I>count</I> is 0, all lines are copied.
10646 The default index is 0.
10650 Discard the first <I>count</I> lines read.
10654 Remove a trailing newline from each line read.
10658 Read lines from file descriptor <I>fd</I> instead of the standard input.
10665 each time <I>quantum</I> lines are read. The <B>-c</B> option specifies
10671 Specify the number of lines read between each call to
10681 is specified without
10684 the default quantum is 5000.
10685 When <I>callback</I> is evaluated, it is supplied the index of the next
10686 array element to be assigned and the line to be assigned to that element
10687 as additional arguments.
10688 <I>callback</I> is evaluated after the line is read but before the
10689 array element is assigned.
10692 If not supplied with an explicit origin, <B>mapfile</B> will clear <I>array</I>
10693 before assigning to it.
10696 <B>mapfile</B> returns successfully unless an invalid option or option
10697 argument is supplied, <I>array</I> is invalid or unassignable, or if
10698 <I>array</I> is not an indexed array.
10701 <DT><B>popd</B> [-<B>n</B>] [+<I>n</I>] [-<I>n</I>]<DD>
10702 Removes entries from the directory stack. With no arguments,
10703 removes the top directory from the stack, and performs a
10706 to the new top directory.
10707 Arguments, if supplied, have the following meanings:
10708 <DL COMPACT><DT><DD>
10714 Suppresses the normal change of directory when removing directories
10715 from the stack, so that only the stack is manipulated.
10716 <DT><B>+</B><I>n</I><DD>
10717 Removes the <I>n</I>th entry counting from the left of the list
10721 starting with zero. For example:
10724 removes the first directory,
10728 <DT><B>-</B><I>n</I><DD>
10729 Removes the <I>n</I>th entry counting from the right of the list
10733 starting with zero. For example:
10736 removes the last directory,
10747 command is successful, a
10750 is performed as well, and the return status is 0.
10753 returns false if an invalid option is encountered, the directory stack
10754 is empty, a non-existent directory stack entry is specified, or the
10755 directory change fails.
10758 <DT><B>printf</B> [<B>-v</B> <I>var</I>] <I>format</I> [<I>arguments</I>]<DD>
10759 Write the formatted <I>arguments</I> to the standard output under the
10760 control of the <I>format</I>.
10761 The <B>-v</B> option causes the output to be assigned to the variable
10762 <I>var</I> rather than being printed to the standard output.
10764 The <I>format</I> is a character string which contains three types of objects:
10765 plain characters, which are simply copied to standard output, character
10766 escape sequences, which are converted and copied to the standard output, and
10767 format specifications, each of which causes printing of the next successive
10769 In addition to the standard <I>printf</I>(1) format specifications,
10770 <B>printf</B> interprets the following extensions:
10771 <DL COMPACT><DT><DD>
10778 <B>printf</B> to expand backslash escape sequences in the corresponding
10779 <I>argument</I> (except that <B>\c</B> terminates output, backslashes in
10780 <B>\aq</B>, <B>\"</B>, and <B>\?</B> are not removed, and octal escapes
10781 beginning with <B>\0</B> may contain up to four digits).
10785 causes <B>printf</B> to output the corresponding
10786 <I>argument</I> in a format that can be reused as shell input.
10787 <DT><B>%(</B><I>datefmt</I>)T
10790 causes <B>printf</B> to output the date-time string resulting from using
10791 <I>datefmt</I> as a format string for <I>strftime</I>(3).
10792 The corresponding <I>argument</I> is an integer representing the number of
10793 seconds since the epoch.
10794 Two special argument values may be used: -1 represents the current
10795 time, and -2 represents the time the shell was invoked.
10796 If no argument is specified, conversion behaves as if -1 had been given.
10797 This is an exception to the usual <B>printf</B> behavior.
10802 Arguments to non-string format specifiers are treated as C constants,
10803 except that a leading plus or minus sign is allowed, and if the leading
10804 character is a single or double quote, the value is the ASCII value of
10805 the following character.
10808 The <I>format</I> is reused as necessary to consume all of the <I>arguments</I>.
10809 If the <I>format</I> requires more <I>arguments</I> than are supplied, the
10810 extra format specifications behave as if a zero value or null string, as
10811 appropriate, had been supplied.
10812 The return value is zero on success, non-zero on failure.
10815 <DT><B>pushd</B> [<B>-n</B>] [+<I>n</I>] [-<I>n</I>]<DD>
10817 <DT><B>pushd</B> [<B>-n</B>] [<I>dir</I>]<DD>
10819 Adds a directory to the top of the directory stack, or rotates
10820 the stack, making the new top of the stack the current working
10821 directory. With no arguments, exchanges the top two directories
10822 and returns 0, unless the directory stack is empty.
10823 Arguments, if supplied, have the following meanings:
10824 <DL COMPACT><DT><DD>
10830 Suppresses the normal change of directory when adding directories
10831 to the stack, so that only the stack is manipulated.
10832 <DT><B>+</B><I>n</I><DD>
10833 Rotates the stack so that the <I>n</I>th directory
10834 (counting from the left of the list shown by
10837 starting with zero)
10839 <DT><B>-</B><I>n</I><DD>
10840 Rotates the stack so that the <I>n</I>th directory
10841 (counting from the right of the list shown by
10844 starting with zero) is at the top.
10851 to the directory stack at the top, making it the
10852 new current working directory as if it had been supplied as the argument
10853 to the <B>cd</B> builtin.
10861 command is successful, a
10864 is performed as well.
10865 If the first form is used,
10868 returns 0 unless the cd to
10871 fails. With the second form,
10874 returns 0 unless the directory stack is empty,
10875 a non-existent directory stack element is specified,
10876 or the directory change to the specified new current directory
10880 <DT><B>pwd</B> [<B>-LP</B>]<DD>
10881 Print the absolute pathname of the current working directory.
10882 The pathname printed contains no symbolic links if the
10885 option is supplied or the
10891 builtin command is enabled.
10895 option is used, the pathname printed may contain symbolic links.
10896 The return status is 0 unless an error occurs while
10897 reading the name of the current directory or an
10898 invalid option is supplied.
10899 <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>
10900 One line is read from the standard input, or from the file descriptor
10901 <I>fd</I> supplied as an argument to the <B>-u</B> option, and the first word
10902 is assigned to the first
10905 the second word to the second
10908 and so on, with leftover words and their intervening separators assigned
10912 If there are fewer words read from the input stream than names,
10913 the remaining names are assigned empty values.
10915 <FONT SIZE=-1><B>IFS</B>
10918 are used to split the line into words using the same rules the shell
10919 uses for expansion (described above under <B>Word Splitting</B>).
10920 The backslash character (<B>\</B>) may be used to remove any special
10921 meaning for the next character read and for line continuation.
10922 Options, if supplied, have the following meanings:
10923 <DL COMPACT><DT><DD>
10926 <DT><B>-a </B><I>aname</I>
10929 The words are assigned to sequential indices
10930 of the array variable
10936 is unset before any new values are assigned.
10937 Other <I>name</I> arguments are ignored.
10938 <DT><B>-d </B><I>delim</I>
10941 The first character of <I>delim</I> is used to terminate the input line,
10942 rather than newline.
10946 If the standard input
10947 is coming from a terminal,
10951 <FONT SIZE=-1><B>READLINE</B>
10954 above) is used to obtain the line.
10955 Readline uses the current (or default, if line editing was not previously
10956 active) editing settings.
10957 <DT><B>-i </B><I>text</I>
10963 is being used to read the line, <I>text</I> is placed into the editing
10964 buffer before editing begins.
10965 <DT><B>-n </B><I>nchars</I>
10968 <B>read</B> returns after reading <I>nchars</I> characters rather than
10969 waiting for a complete line of input, but honor a delimiter if fewer
10970 than <I>nchars</I> characters are read before the delimiter.
10971 <DT><B>-N </B><I>nchars</I>
10974 <B>read</B> returns after reading exactly <I>nchars</I> characters rather
10975 than waiting for a complete line of input, unless EOF is encountered or
10976 <B>read</B> times out.
10977 Delimiter characters encountered in the input are
10978 not treated specially and do not cause <B>read</B> to return until
10979 <I>nchars</I> characters are read.
10980 <DT><B>-p </B><I>prompt</I>
10983 Display <I>prompt</I> on standard error, without a
10984 trailing newline, before attempting to read any input. The prompt
10985 is displayed only if input is coming from a terminal.
10989 Backslash does not act as an escape character.
10990 The backslash is considered to be part of the line.
10991 In particular, a backslash-newline pair may not be used as a line
10996 Silent mode. If input is coming from a terminal, characters are
10998 <DT><B>-t </B><I>timeout</I>
11001 Cause <B>read</B> to time out and return failure if a complete line of
11002 input (or a specified number of characters)
11003 is not read within <I>timeout</I> seconds.
11004 <I>timeout</I> may be a decimal number with a fractional portion following
11006 This option is only effective if <B>read</B> is reading input from a
11007 terminal, pipe, or other special file; it has no effect when reading
11008 from regular files.
11009 If <B>read</B> times out, <B>read</B> saves any partial input read into
11010 the specified variable <I>name</I>.
11011 If <I>timeout</I> is 0, <B>read</B> returns immediately, without trying to
11012 read any data. The exit status is 0 if input is available on
11013 the specified file descriptor, non-zero otherwise.
11014 The exit status is greater than 128 if the timeout is exceeded.
11015 <DT><B>-u </B><I>fd</I>
11018 Read input from file descriptor <I>fd</I>.
11026 are supplied, the line read is assigned to the variable
11027 <FONT SIZE=-1><B>REPLY</B>.
11030 The return code is zero, unless end-of-file is encountered, <B>read</B>
11031 times out (in which case the return code is greater than 128),
11032 a variable assignment error (such as assigning to a readonly variable) occurs,
11033 or an invalid file descriptor is supplied as the argument to <B>-u</B>.
11036 <DT><B>readonly</B> [<B>-aAf</B>] [<B>-p</B>] [<I>name</I>[=<I>word</I>] ...]<DD>
11039 <I>names</I> are marked readonly; the values of these
11042 may not be changed by subsequent assignment.
11046 option is supplied, the functions corresponding to the
11047 <I>names</I> are so
11052 option restricts the variables to indexed arrays; the
11055 option restricts the variables to associative arrays.
11056 If both options are supplied,
11063 arguments are given, or if the
11066 option is supplied, a list of all readonly names is printed.
11067 The other options may be used to restrict the output to a subset of
11068 the set of readonly names.
11072 option causes output to be displayed in a format that
11073 may be reused as input.
11074 If a variable name is followed by =<I>word</I>, the value of
11075 the variable is set to <I>word</I>.
11076 The return status is 0 unless an invalid option is encountered,
11080 is not a valid shell variable name, or
11086 that is not a function.
11087 <DT><B>return</B> [<I>n</I>]<DD>
11088 Causes a function to stop executing and return the value specified by
11095 is omitted, the return status is that of the last command
11096 executed in the function body. If
11099 is used outside a function,
11100 but during execution of a script by the
11103 (<B>source</B>) command, it causes the shell to stop executing
11104 that script and return either
11107 or the exit status of the last command executed within the
11108 script as the exit status of the script.
11109 If <I>n</I> is supplied, the return value is its least significant
11111 The return status is non-zero if
11114 is supplied a non-numeric argument, or
11116 function and not during execution of a script by <B>.</B> or <B>source</B>.
11117 Any command associated with the <B>RETURN</B> trap is executed
11118 before execution resumes after the function or script.
11119 <DT><B>set</B> [<B>--abefhkmnptuvxBCEHPT</B>] [<B>-o</B> <I>option-name</I>] [<I>arg</I> ...]<DD>
11121 <DT><B>set</B> [<B>+abefhkmnptuvxBCEHPT</B>] [<B>+o</B> <I>option-name</I>] [<I>arg</I> ...]<DD>
11123 Without options, the name and value of each shell variable are displayed
11124 in a format that can be reused as input
11125 for setting or resetting the currently-set variables.
11126 Read-only variables cannot be reset.
11127 In <I>posix</I> mode, only shell variables are listed.
11128 The output is sorted according to the current locale.
11129 When options are specified, they set or unset shell attributes.
11130 Any arguments remaining after option processing are treated
11131 as values for the positional parameters and are assigned, in order, to
11140 Options, if specified, have the following meanings:
11141 <DL COMPACT><DT><DD>
11147 Automatically mark variables and functions which are modified or
11148 created for export to the environment of subsequent commands.
11152 Report the status of terminated background jobs
11153 immediately, rather than before the next primary prompt. This is
11154 effective only when job control is enabled.
11158 Exit immediately if a
11159 <I>pipeline</I> (which may consist of a single <I>simple command</I>),
11161 or a <I>compound command</I>
11163 <FONT SIZE=-1><B>SHELL GRAMMAR</B>
11166 above), exits with a non-zero status.
11167 The shell does not exit if the
11168 command that fails is part of the command list immediately following a
11175 part of the test following the
11181 reserved words, part of any command executed in a
11187 list except the command following the final <B>&&</B> or <B>||</B>,
11188 any command in a pipeline but the last,
11189 or if the command's return value is
11190 being inverted with
11193 If a compound command other than a subshell
11194 returns a non-zero status because a command failed
11195 while <B>-e</B> was being ignored, the shell does not exit.
11196 A trap on <B>ERR</B>, if set, is executed before the shell exits.
11197 This option applies to the shell environment and each subshell environment
11199 <FONT SIZE=-1><B>COMMAND EXECUTION ENVIRONMENT</B>
11202 above), and may cause
11203 subshells to exit before executing all the commands in the subshell.
11207 If a compound command or shell function executes in a context
11208 where <B>-e</B> is being ignored,
11209 none of the commands executed within the compound command or function body
11210 will be affected by the <B>-e</B> setting, even if <B>-e</B> is set
11211 and a command returns a failure status.
11212 If a compound command or shell function sets <B>-e</B> while executing in
11213 a context where <B>-e</B> is ignored, that setting will not have any
11214 effect until the compound command or the command containing the function
11219 Disable pathname expansion.
11223 Remember the location of commands as they are looked up for execution.
11224 This is enabled by default.
11228 All arguments in the form of assignment statements
11229 are placed in the environment for a command, not just
11230 those that precede the command name.
11234 Monitor mode. Job control is enabled. This option is on
11235 by default for interactive shells on systems that support
11237 <FONT SIZE=-1><B>JOB CONTROL</B>
11241 All processes run in a separate process group.
11242 When a background job completes, the shell prints a line
11243 containing its exit status.
11247 Read commands but do not execute them. This may be used to
11248 check a shell script for syntax errors. This is ignored by
11249 interactive shells.
11250 <DT><B>-o </B><I>option-name</I>
11253 The <I>option-name</I> can be one of the following:
11254 <DL COMPACT><DT><DD>
11256 <DT><B>allexport</B>
11262 <DT><B>braceexpand</B>
11271 Use an emacs-style command line editing interface. This is enabled
11272 by default when the shell is interactive, unless the shell is started
11277 This also affects the editing interface used for <B>read -e</B>.
11284 <DT><B>errtrace</B>
11290 <DT><B>functrace</B>
11302 <DT><B>histexpand</B>
11311 Enable command history, as described above under
11312 <FONT SIZE=-1><B>HISTORY</B>.
11315 This option is on by default in interactive shells.
11316 <DT><B>ignoreeof</B>
11319 The effect is as if the shell command
11320 <TT>IGNOREEOF=10</TT>
11324 <B>Shell Variables</B>
11339 <DT><B>noclobber</B>
11379 <DT><B>physical</B>
11385 <DT><B>pipefail</B>
11388 If set, the return value of a pipeline is the value of the last
11389 (rightmost) command to exit with a non-zero status, or zero if all
11390 commands in the pipeline exit successfully.
11391 This option is disabled by default.
11395 Change the behavior of
11398 where the default operation differs
11399 from the POSIX standard to match the standard (<I>posix mode</I>).
11401 <FONT SIZE=-1><B>SEE ALSO</B>
11404 below for a reference to a document that details how posix mode affects
11406 <DT><B>privileged</B>
11421 Use a vi-style command line editing interface.
11422 This also affects the editing interface used for <B>read -e</B>.
11436 is supplied with no <I>option-name</I>, the values of the current options are
11441 is supplied with no <I>option-name</I>, a series of
11444 commands to recreate the current option settings is displayed on
11445 the standard output.
11454 mode. In this mode, the
11455 <FONT SIZE=-1><B>$ENV</B>
11459 <FONT SIZE=-1><B>$BASH_ENV</B>
11462 files are not processed, shell functions are not inherited from the
11463 environment, and the
11464 <FONT SIZE=-1><B>SHELLOPTS</B>,
11467 <FONT SIZE=-1><B>BASHOPTS</B>,
11470 <FONT SIZE=-1><B>CDPATH</B>,
11474 <FONT SIZE=-1><B>GLOBIGNORE</B>
11477 variables, if they appear in the environment, are ignored.
11478 If the shell is started with the effective user (group) id not equal to the
11479 real user (group) id, and the <B>-p</B> option is not supplied, these actions
11480 are taken and the effective user id is set to the real user id.
11481 If the <B>-p</B> option is supplied at startup, the effective user id is
11483 Turning this option off causes the effective user
11484 and group ids to be set to the real user and group ids.
11488 Exit after reading and executing one command.
11492 Treat unset variables and parameters other than the special
11493 parameters "@" and "*" as an error when performing
11494 parameter expansion. If expansion is attempted on an
11495 unset variable or parameter, the shell prints an error message, and,
11496 if not interactive, exits with a non-zero status.
11500 Print shell input lines as they are read.
11504 After expanding each <I>simple command</I>,
11505 <B>for</B> command, <B>case</B> command, <B>select</B> command, or
11506 arithmetic <B>for</B> command, display the expanded value of
11507 <FONT SIZE=-1><B>PS4</B>,
11510 followed by the command and its expanded arguments
11511 or associated word list.
11515 The shell performs brace expansion (see
11516 <B>Brace Expansion</B>
11518 above). This is on by default.
11525 does not overwrite an existing file with the
11533 redirection operators. This may be overridden when
11534 creating output files by using the redirection operator
11543 If set, any trap on <B>ERR</B> is inherited by shell functions, command
11544 substitutions, and commands executed in a subshell environment.
11545 The <B>ERR</B> trap is normally not inherited in such cases.
11552 style history substitution. This option is on by
11553 default when the shell is interactive.
11557 If set, the shell does not resolve symbolic links when executing
11561 that change the current working directory. It uses the
11562 physical directory structure instead. By default,
11565 follows the logical chain of directories when performing commands
11566 which change the current directory.
11570 If set, any traps on <B>DEBUG</B> and <B>RETURN</B> are inherited by shell
11571 functions, command substitutions, and commands executed in a
11572 subshell environment.
11573 The <B>DEBUG</B> and <B>RETURN</B> traps are normally not inherited
11578 If no arguments follow this option, then the positional parameters are
11579 unset. Otherwise, the positional parameters are set to the
11580 <I>arg</I>s, even if some of them begin with a
11586 Signal the end of options, cause all remaining <I>arg</I>s to be
11587 assigned to the positional parameters. The
11593 options are turned off.
11594 If there are no <I>arg</I>s,
11595 the positional parameters remain unchanged.
11600 The options are off by default unless otherwise noted.
11601 Using + rather than - causes these options to be turned off.
11602 The options can also be specified as arguments to an invocation of
11604 The current set of options may be found in
11607 The return status is always true unless an invalid option is encountered.
11610 <DT><B>shift</B> [<I>n</I>]<DD>
11611 The positional parameters from <I>n</I>+1 ... are renamed to
11616 Parameters represented by the numbers <B>$#</B>
11617 down to <B>$#</B>-<I>n</I>+1 are unset.
11620 must be a non-negative number less than or equal to <B>$#</B>.
11624 is 0, no parameters are changed.
11628 is not given, it is assumed to be 1.
11632 is greater than <B>$#</B>, the positional parameters are not changed.
11633 The return status is greater than zero if
11639 or less than zero; otherwise 0.
11640 <DT><B>shopt</B> [<B>-pqsu</B>] [<B>-o</B>] [<I>optname</I> ...]<DD>
11641 Toggle the values of settings controlling optional shell behavior.
11642 The settings can be either those listed below, or, if the
11645 option is used, those available with the
11648 option to the <B>set</B> builtin command.
11649 With no options, or with the
11652 option, a list of all settable options is displayed, with
11653 an indication of whether or not each is set.
11654 The <B>-p</B> option causes output to be displayed in a form that
11655 may be reused as input.
11656 Other options have the following meanings:
11657 <DL COMPACT><DT><DD>
11663 Enable (set) each <I>optname</I>.
11667 Disable (unset) each <I>optname</I>.
11671 Suppresses normal output (quiet mode); the return status indicates
11672 whether the <I>optname</I> is set or unset.
11673 If multiple <I>optname</I> arguments are given with
11676 the return status is zero if all <I>optnames</I> are enabled; non-zero
11681 Restricts the values of <I>optname</I> to be those defined for the
11698 is used with no <I>optname</I> arguments,
11701 shows only those options which are set or unset, respectively.
11702 Unless otherwise noted, the <B>shopt</B> options are disabled (unset)
11706 The return status when listing options is zero if all <I>optnames</I>
11707 are enabled, non-zero otherwise. When setting or unsetting options,
11708 the return status is zero unless an <I>optname</I> is not a valid shell
11712 The list of <B>shopt</B> options is:
11721 If set, a command name that is the name of a directory is executed as if
11722 it were the argument to the <B>cd</B> command.
11723 This option is only used by interactive shells.
11724 <DT><B>cdable_vars</B>
11727 If set, an argument to the
11730 builtin command that
11731 is not a directory is assumed to be the name of a variable whose
11732 value is the directory to change to.
11736 If set, minor errors in the spelling of a directory component in a
11739 command will be corrected.
11740 The errors checked for are transposed characters,
11741 a missing character, and one character too many.
11742 If a correction is found, the corrected filename is printed,
11743 and the command proceeds.
11744 This option is only used by interactive shells.
11745 <DT><B>checkhash</B>
11748 If set, <B>bash</B> checks that a command found in the hash
11749 table exists before trying to execute it. If a hashed command no
11750 longer exists, a normal path search is performed.
11751 <DT><B>checkjobs</B>
11754 If set, <B>bash</B> lists the status of any stopped and running jobs before
11755 exiting an interactive shell. If any jobs are running, this causes
11756 the exit to be deferred until a second exit is attempted without an
11757 intervening command (see
11758 <FONT SIZE=-1><B>JOB CONTROL</B>
11761 above). The shell always
11762 postpones exiting if any jobs are stopped.
11763 <DT><B>checkwinsize</B>
11766 If set, <B>bash</B> checks the window size after each command
11767 and, if necessary, updates the values of
11768 <FONT SIZE=-1><B>LINES</B>
11772 <FONT SIZE=-1><B>COLUMNS</B>.
11781 attempts to save all lines of a multiple-line
11782 command in the same history entry. This allows
11783 easy re-editing of multi-line commands.
11784 <DT><B>compat31</B>
11790 changes its behavior to that of version 3.1 with respect to quoted
11791 arguments to the <B>[[</B> conditional command's <B>=~</B> operator
11792 and locale-specific string comparison when using the <B>[[</B>
11793 conditional command's <B><</B> and <B>></B> operators.
11794 Bash versions prior to bash-4.1 use ASCII collation and
11797 bash-4.1 and later use the current locale's collation sequence and
11800 <DT><B>compat32</B>
11806 changes its behavior to that of version 3.2 with respect to
11807 locale-specific string comparison when using the <B>[[</B>
11808 conditional command's <B><</B> and <B>></B> operators (see previous item).
11809 <DT><B>compat40</B>
11815 changes its behavior to that of version 4.0 with respect to locale-specific
11816 string comparison when using the <B>[[</B>
11817 conditional command's <B><</B> and <B>></B> operators (see description of
11819 and the effect of interrupting a command list.
11820 Bash versions 4.0 and later interrupt the list as if the shell received the
11821 interrupt; previous versions continue with the next command in the list.
11822 <DT><B>compat41</B>
11828 when in <I>posix</I> mode, treats a single quote in a double-quoted
11829 parameter expansion as a special character. The single quotes must match
11830 (an even number) and the characters between the single quotes are considered
11831 quoted. This is the behavior of posix mode through version 4.1.
11832 The default bash behavior remains as in previous versions.
11833 <DT><B>compat42</B>
11839 does not process the replacement string in the pattern substitution word
11840 expansion using quote removal.
11841 <DT><B>complete_fullquote</B>
11847 quotes all shell metacharacters in filenames and directory names when
11848 performing completion.
11852 removes metacharacters such as the dollar sign from the set of
11853 characters that will be quoted in completed filenames
11854 when these metacharacters appear in shell variable references in words to be
11856 This means that dollar signs in variable names that expand to directories
11857 will not be quoted;
11858 however, any dollar signs appearing in filenames will not be quoted, either.
11859 This is active only when bash is using backslashes to quote completed
11861 This variable is set by default, which is the default bash behavior in
11862 versions through 4.2.
11863 <DT><B>direxpand</B>
11869 replaces directory names with the results of word expansion when performing
11870 filename completion. This changes the contents of the readline editing
11875 attempts to preserve what the user typed.
11876 <DT><B>dirspell</B>
11882 attempts spelling correction on directory names during word completion
11883 if the directory name initially supplied does not exist.
11890 includes filenames beginning with a `.' in the results of pathname
11892 <DT><B>execfail</B>
11895 If set, a non-interactive shell will not exit if
11896 it cannot execute the file specified as an argument to the
11899 builtin command. An interactive shell does not exit if
11903 <DT><B>expand_aliases</B>
11906 If set, aliases are expanded as described above under
11907 <FONT SIZE=-1><B>ALIASES</B>.
11910 This option is enabled by default for interactive shells.
11911 <DT><B>extdebug</B>
11914 If set, behavior intended for use by debuggers is enabled:
11915 <DL COMPACT><DT><DD>
11920 The <B>-F</B> option to the <B>declare</B> builtin displays the source
11921 file name and line number corresponding to each function name supplied
11926 If the command run by the <B>DEBUG</B> trap returns a non-zero value, the
11927 next command is skipped and not executed.
11931 If the command run by the <B>DEBUG</B> trap returns a value of 2, and the
11932 shell is executing in a subroutine (a shell function or a shell script
11933 executed by the <B>.</B> or <B>source</B> builtins), a call to
11934 <B>return</B> is simulated.
11938 <FONT SIZE=-1><B>BASH_ARGC</B>
11942 <FONT SIZE=-1><B>BASH_ARGV</B>
11945 are updated as described in their descriptions above.
11949 Function tracing is enabled: command substitution, shell functions, and
11950 subshells invoked with <B>(</B> <I>command</I> <B>)</B> inherit the
11951 <B>DEBUG</B> and <B>RETURN</B> traps.
11955 Error tracing is enabled: command substitution, shell functions, and
11956 subshells invoked with <B>(</B> <I>command</I> <B>)</B> inherit the
11963 If set, the extended pattern matching features described above under
11964 <B>Pathname Expansion</B> are enabled.
11965 <DT><B>extquote</B>
11968 If set, <B>$</B>aq<I>string</I>aq and <B>$</B>"<I>string</I>" quoting is
11969 performed within <B>${</B><I>parameter</I><B>}</B> expansions
11970 enclosed in double quotes. This option is enabled by default.
11971 <DT><B>failglob</B>
11974 If set, patterns which fail to match filenames during pathname expansion
11975 result in an expansion error.
11976 <DT><B>force_fignore</B>
11979 If set, the suffixes specified by the
11980 <FONT SIZE=-1><B>FIGNORE</B>
11984 cause words to be ignored when performing word completion even if
11985 the ignored words are the only possible completions.
11987 <FONT SIZE=-1><B>SHELL VARIABLES</B></FONT>
11988 above for a description of
11989 <FONT SIZE=-1><B>FIGNORE</B>.
11992 This option is enabled by default.
11993 <DT><B>globasciiranges</B>
11996 If set, range expressions used in pattern matching bracket expressions (see
11997 <FONT SIZE=-1><B>Pattern Matching</B>
12000 above) behave as if in the traditional C locale when performing
12001 comparisons. That is, the current locale's collating sequence
12002 is not taken into account, so
12005 will not collate between
12011 and upper-case and lower-case ASCII characters will collate together.
12012 <DT><B>globstar</B>
12015 If set, the pattern <B>**</B> used in a pathname expansion context will
12016 match all files and zero or more directories and subdirectories.
12017 If the pattern is followed by a <B>/</B>, only directories and
12018 subdirectories match.
12019 <DT><B>gnu_errfmt</B>
12022 If set, shell error messages are written in the standard GNU error
12024 <DT><B>histappend</B>
12027 If set, the history list is appended to the file named by the value
12029 <FONT SIZE=-1><B>HISTFILE</B>
12032 variable when the shell exits, rather than overwriting the file.
12033 <DT><B>histreedit</B>
12039 is being used, a user is given the opportunity to re-edit a
12040 failed history substitution.
12041 <DT><B>histverify</B>
12047 is being used, the results of history substitution are not immediately
12048 passed to the shell parser. Instead, the resulting line is loaded into
12049 the <B>readline</B> editing buffer, allowing further modification.
12050 <DT><B>hostcomplete</B>
12056 is being used, <B>bash</B> will attempt to perform hostname completion when a
12057 word containing a <B>@</B> is being completed (see
12061 <FONT SIZE=-1><B>READLINE</B>
12065 This is enabled by default.
12066 <DT><B>huponexit</B>
12069 If set, <B>bash</B> will send
12070 <FONT SIZE=-1><B>SIGHUP</B>
12073 to all jobs when an interactive login shell exits.
12074 <DT><B>interactive_comments</B>
12077 If set, allow a word beginning with
12080 to cause that word and all remaining characters on that
12081 line to be ignored in an interactive shell (see
12082 <FONT SIZE=-1><B>COMMENTS</B>
12085 above). This option is enabled by default.
12086 <DT><B>lastpipe</B>
12089 If set, and job control is not active, the shell runs the last command of
12090 a pipeline not executed in the background in the current shell environment.
12097 option is enabled, multi-line commands are saved to the history with
12098 embedded newlines rather than using semicolon separators where possible.
12099 <DT><B>login_shell</B>
12102 The shell sets this option if it is started as a login shell (see
12103 <FONT SIZE=-1><B>INVOCATION</B>
12107 The value may not be changed.
12108 <DT><B>mailwarn</B>
12111 If set, and a file that <B>bash</B> is checking for mail has been
12112 accessed since the last time it was checked, the message ``The mail in
12113 <I>mailfile</I> has been read'' is displayed.
12114 <DT><B>no_empty_cmd_completion</B>
12123 will not attempt to search the
12124 <FONT SIZE=-1><B>PATH</B>
12127 for possible completions when
12128 completion is attempted on an empty line.
12129 <DT><B>nocaseglob</B>
12135 matches filenames in a case-insensitive fashion when performing pathname
12137 <B>Pathname Expansion</B>
12140 <DT><B>nocasematch</B>
12146 matches patterns in a case-insensitive fashion when performing matching
12147 while executing <B>case</B> or <B>[[</B> conditional commands.
12148 <DT><B>nullglob</B>
12154 allows patterns which match no
12156 <B>Pathname Expansion</B>
12159 to expand to a null string, rather than themselves.
12160 <DT><B>progcomp</B>
12163 If set, the programmable completion facilities (see
12164 <B>Programmable Completion</B> above) are enabled.
12165 This option is enabled by default.
12166 <DT><B>promptvars</B>
12169 If set, prompt strings undergo
12170 parameter expansion, command substitution, arithmetic
12171 expansion, and quote removal after being expanded as described in
12172 <FONT SIZE=-1><B>PROMPTING</B>
12175 above. This option is enabled by default.
12176 <DT><B>restricted_shell</B>
12179 The shell sets this option if it is started in restricted mode (see
12180 <FONT SIZE=-1><B>RESTRICTED SHELL</B>
12184 The value may not be changed.
12185 This is not reset when the startup files are executed, allowing
12186 the startup files to discover whether or not a shell is restricted.
12187 <DT><B>shift_verbose</B>
12193 builtin prints an error message when the shift count exceeds the
12194 number of positional parameters.
12195 <DT><B>sourcepath</B>
12199 <B>source</B> (<B>.</B>) builtin uses the value of
12200 <FONT SIZE=-1><B>PATH</B>
12203 to find the directory containing the file supplied as an argument.
12204 This option is enabled by default.
12205 <DT><B>xpg_echo</B>
12208 If set, the <B>echo</B> builtin expands backslash-escape sequences
12213 <DT><B>suspend</B> [<B>-f</B>]<DD>
12214 Suspend the execution of this shell until it receives a
12215 <FONT SIZE=-1><B>SIGCONT</B>
12218 signal. A login shell cannot be suspended; the
12221 option can be used to override this and force the suspension.
12222 The return status is 0 unless the shell is a login shell and
12225 is not supplied, or if job control is not enabled.
12226 <DT><B>test</B> <I>expr</I><DD>
12228 <DT><B>[</B> <I>expr</I> <B>]</B><DD>
12229 Return a status of 0 (true) or 1 (false) depending on
12230 the evaluation of the conditional expression
12233 Each operator and operand must be a separate argument.
12234 Expressions are composed of the primaries described above under
12235 <FONT SIZE=-1><B>CONDITIONAL EXPRESSIONS</B>.
12238 <B>test</B> does not accept any options, nor does it accept and ignore
12239 an argument of <B>--</B> as signifying the end of options.
12243 Expressions may be combined using the following operators, listed
12244 in decreasing order of precedence.
12245 The evaluation depends on the number of arguments; see below.
12246 Operator precedence is used when there are five or more arguments.
12247 <DL COMPACT><DT><DD>
12250 <DT><B>! </B><I>expr</I>
12257 <DT><B>( </B><I>expr</I> )
12260 Returns the value of <I>expr</I>.
12261 This may be used to override the normal precedence of operators.
12262 <DT><I>expr1</I> -<B>a</B> <I>expr2</I><DD>
12270 <DT><I>expr1</I> -<B>o</B> <I>expr2</I><DD>
12282 <B>test</B> and <B>[</B> evaluate conditional
12283 expressions using a set of rules based on the number of arguments.
12289 <DT>0 arguments<DD>
12290 The expression is false.
12292 The expression is true if and only if the argument is not null.
12293 <DT>2 arguments<DD>
12294 If the first argument is <B>!</B>, the expression is true if and
12295 only if the second argument is null.
12296 If the first argument is one of the unary conditional operators listed above
12298 <FONT SIZE=-1><B>CONDITIONAL EXPRESSIONS</B>,
12301 the expression is true if the unary test is true.
12302 If the first argument is not a valid unary conditional operator, the expression
12304 <DT>3 arguments<DD>
12305 The following conditions are applied in the order listed.
12306 If the second argument is one of the binary conditional operators listed above
12308 <FONT SIZE=-1><B>CONDITIONAL EXPRESSIONS</B>,
12311 the result of the expression is the result of the binary test using
12312 the first and third arguments as operands.
12313 The <B>-a</B> and <B>-o</B> operators are considered binary operators
12314 when there are three arguments.
12315 If the first argument is <B>!</B>, the value is the negation of
12316 the two-argument test using the second and third arguments.
12317 If the first argument is exactly <B>(</B> and the third argument is
12318 exactly <B>)</B>, the result is the one-argument test of the second
12320 Otherwise, the expression is false.
12321 <DT>4 arguments<DD>
12322 If the first argument is <B>!</B>, the result is the negation of
12323 the three-argument expression composed of the remaining arguments.
12324 Otherwise, the expression is parsed and evaluated according to
12325 precedence using the rules listed above.
12326 <DT>5 or more arguments<DD>
12327 The expression is parsed and evaluated according to precedence
12328 using the rules listed above.
12335 When used with <B>test</B> or <B>[</B>, the <B><</B> and <B>></B> operators
12336 sort lexicographically using ASCII ordering.
12343 Print the accumulated user and system times for the shell and
12344 for processes run from the shell. The return status is 0.
12345 <DT><B>trap</B> [<B>-lp</B>] [[<I>arg</I>] <I>sigspec</I> ...]<DD>
12349 is to be read and executed when the shell receives
12356 is absent (and there is a single <I>sigspec</I>) or
12359 each specified signal is
12360 reset to its original disposition (the value it had
12361 upon entrance to the shell).
12365 is the null string the signal specified by each
12368 is ignored by the shell and by the commands it invokes.
12375 has been supplied, then the trap commands associated with each
12379 If no arguments are supplied or if only
12385 prints the list of commands associated with each signal.
12389 option causes the shell to print a list of signal names and
12390 their corresponding numbers.
12395 a signal name defined in <<I>signal.h</I>>, or a signal number.
12396 Signal names are case insensitive and the
12397 <FONT SIZE=-1><B>SIG</B>
12400 prefix is optional.
12408 <FONT SIZE=-1><B>EXIT</B>
12414 is executed on exit from the shell.
12419 <FONT SIZE=-1><B>DEBUG</B>,
12425 is executed before every <I>simple command</I>, <I>for</I> command,
12426 <I>case</I> command, <I>select</I> command, every arithmetic <I>for</I>
12427 command, and before the first command executes in a shell function (see
12428 <FONT SIZE=-1><B>SHELL GRAMMAR</B>
12432 Refer to the description of the <B>extdebug</B> option to the
12433 <B>shopt</B> builtin for details of its effect on the <B>DEBUG</B> trap.
12438 <FONT SIZE=-1><B>RETURN</B>,
12444 is executed each time a shell function or a script executed with
12445 the <B>.</B> or <B>source</B> builtins finishes executing.
12453 <FONT SIZE=-1><B>ERR</B>,
12459 is executed whenever a
12460 a pipeline (which may consist of a single simple
12461 command), a list, or a compound command returns a
12462 non-zero exit status,
12463 subject to the following conditions.
12465 <FONT SIZE=-1><B>ERR</B>
12468 trap is not executed if the failed
12469 command is part of the command list immediately following a
12476 part of the test in an
12479 statement, part of a command executed in a
12485 list except the command following the final <B>&&</B> or <B>||</B>,
12486 any command in a pipeline but the last,
12487 or if the command's return value is
12488 being inverted using
12491 These are the same conditions obeyed by the <B>errexit</B> (<B>-e</B>) option.
12495 Signals ignored upon entry to the shell cannot be trapped or reset.
12496 Trapped signals that are not being ignored are reset to their original
12497 values in a subshell or subshell environment when one is created.
12498 The return status is false if any
12501 is invalid; otherwise
12505 <DT><B>type</B> [<B>-aftpP</B>] <I>name</I> [<I>name</I> ...]<DD>
12510 would be interpreted if used as a command name.
12517 prints a string which is one of
12532 is an alias, shell reserved word, function, builtin, or disk file,
12537 is not found, then nothing is printed, and an exit status of false
12545 either returns the name of the disk file
12546 that would be executed if
12549 were specified as a command name,
12551 <TT>type -t name</TT>
12560 <FONT SIZE=-1><B>PATH</B>
12563 search for each <I>name</I>, even if
12564 <TT>type -t name</TT>
12569 If a command is hashed,
12575 print the hashed value, which is not necessarily the file that appears
12577 <FONT SIZE=-1><B>PATH</B>.
12586 prints all of the places that contain
12587 an executable named
12590 This includes aliases and functions,
12594 option is not also used.
12595 The table of hashed commands is not consulted
12602 option suppresses shell function lookup, as with the <B>command</B> builtin.
12605 returns true if all of the arguments are found, false if
12607 <DT><B>ulimit</B> [<B>-HSTabcdefilmnpqrstuvx</B> [<I>limit</I>]]<DD>
12608 Provides control over the resources available to the shell and to
12609 processes started by it, on systems that allow such control.
12610 The <B>-H</B> and <B>-S</B> options specify that the hard or soft limit is
12611 set for the given resource.
12612 A hard limit cannot be increased by a non-root user once it is set;
12613 a soft limit may be increased up to the value of the hard limit.
12614 If neither <B>-H</B> nor <B>-S</B> is specified, both the soft and hard
12619 can be a number in the unit specified for the resource
12620 or one of the special values
12628 which stand for the current hard limit, the current soft limit, and
12629 no limit, respectively.
12633 is omitted, the current value of the soft limit of the resource is
12634 printed, unless the <B>-H</B> option is given. When more than one
12635 resource is specified, the limit name and unit are printed before the value.
12636 Other options are interpreted as follows:
12637 <DL COMPACT><DT><DD>
12643 All current limits are reported
12647 The maximum socket buffer size
12651 The maximum size of core files created
12655 The maximum size of a process's data segment
12659 The maximum scheduling priority ("nice")
12663 The maximum size of files written by the shell and its children
12667 The maximum number of pending signals
12671 The maximum size that may be locked into memory
12675 The maximum resident set size (many systems do not honor this limit)
12679 The maximum number of open file descriptors (most systems do not
12680 allow this value to be set)
12684 The pipe size in 512-byte blocks (this may not be set)
12688 The maximum number of bytes in POSIX message queues
12692 The maximum real-time scheduling priority
12696 The maximum stack size
12700 The maximum amount of cpu time in seconds
12704 The maximum number of processes available to a single user
12708 The maximum amount of virtual memory available to the shell and, on
12709 some systems, to its children
12713 The maximum number of file locks
12717 The maximum number of threads
12728 option is not used,
12729 <I>limit</I> is the new value of the specified resource.
12730 If no option is given, then
12733 is assumed. Values are in 1024-byte increments, except for
12736 which is in seconds;
12739 which is in units of 512-byte blocks;
12750 which are unscaled values.
12751 The return status is 0 unless an invalid option or argument is supplied,
12752 or an error occurs while setting a new limit.
12755 <DT><B>umask</B> [<B>-p</B>] [<B>-S</B>] [<I>mode</I>]<DD>
12756 The user file-creation mask is set to
12762 begins with a digit, it
12763 is interpreted as an octal number; otherwise
12764 it is interpreted as a symbolic mode mask similar
12765 to that accepted by
12771 is omitted, the current value of the mask is printed.
12775 option causes the mask to be printed in symbolic form; the
12776 default output is an octal number.
12780 option is supplied, and
12783 is omitted, the output is in a form that may be reused as input.
12784 The return status is 0 if the mode was successfully changed or if
12785 no <I>mode</I> argument was supplied, and false otherwise.
12786 <DT><B>unalias</B> [-<B>a</B>] [<I>name</I> ...]<DD>
12787 Remove each <I>name</I> from the list of defined aliases. If
12790 is supplied, all alias definitions are removed. The return
12791 value is true unless a supplied
12794 is not a defined alias.
12795 <DT><B>unset</B> [-<B>fv</B>] [-<B>n</B>] [<I>name</I> ...]<DD>
12799 remove the corresponding variable or function.
12803 option is given, each
12806 refers to a shell variable, and that variable is removed.
12807 Read-only variables may not be unset.
12814 refers to a shell function, and the function definition
12819 option is supplied, and <I>name</I> is a variable with the <I>nameref</I>
12820 attribute, <I>name</I> will be unset rather than the variable it
12822 <B>-n</B> has no effect if the <B>-f</B> option is supplied.
12823 If no options are supplied, each <I>name</I> refers to a variable; if
12824 there is no variable by that name, any function with that name is
12826 Each unset variable or function is removed from the environment
12827 passed to subsequent commands.
12829 <FONT SIZE=-1><B>COMP_WORDBREAKS</B>,
12832 <FONT SIZE=-1><B>RANDOM</B>,
12835 <FONT SIZE=-1><B>SECONDS</B>,
12838 <FONT SIZE=-1><B>LINENO</B>,
12841 <FONT SIZE=-1><B>HISTCMD</B>,
12844 <FONT SIZE=-1><B>FUNCNAME</B>,
12847 <FONT SIZE=-1><B>GROUPS</B>,
12851 <FONT SIZE=-1><B>DIRSTACK</B>
12854 are unset, they lose their special properties, even if they are
12855 subsequently reset. The exit status is true unless a
12859 <DT><B>wait</B> [<B>-n</B>] [<I>n ...</I>]<DD>
12860 Wait for each specified child process and return its termination status.
12865 ID or a job specification; if a job spec is given, all processes
12866 in that job's pipeline are waited for. If
12869 is not given, all currently active child processes
12870 are waited for, and the return status is zero.
12871 If the <B>-n</B> option is supplied, <B>wait</B> waits for any job to
12872 terminate and returns its exit status.
12876 specifies a non-existent process or job, the return status is
12877 127. Otherwise, the return status is the exit status of the last
12878 process or job waited for.
12882 <A NAME="lbDC"> </A>
12883 <H3>RESTRICTED SHELL</H3>
12892 is started with the name
12898 option is supplied at invocation,
12899 the shell becomes restricted.
12900 A restricted shell is used to
12901 set up an environment more controlled than the standard shell.
12902 It behaves identically to
12905 with the exception that the following are disallowed or not performed:
12908 changing directories with <B>cd</B>
12910 setting or unsetting the values of
12911 <FONT SIZE=-1><B>SHELL</B>,
12914 <FONT SIZE=-1><B>PATH</B>,
12917 <FONT SIZE=-1><B>ENV</B>,
12921 <FONT SIZE=-1><B>BASH_ENV</B>
12925 specifying command names containing
12929 specifying a filename containing a
12932 as an argument to the
12937 specifying a filename containing a slash as an argument to the
12945 importing function definitions from the shell environment at startup
12947 parsing the value of
12948 <FONT SIZE=-1><B>SHELLOPTS</B>
12951 from the shell environment at startup
12953 redirecting output using the >, >|, <>, >&, &>, and >> redirection operators
12958 builtin command to replace the shell with another command
12960 adding or deleting builtin commands with the
12971 using the <B>enable</B> builtin command to enable disabled shell builtins
12981 turning off restricted mode with
12982 <B>set +r</B> or <B>set +o restricted</B>.
12986 These restrictions are enforced after any startup files are read.
12990 When a command that is found to be a shell script is executed
12992 <FONT SIZE=-1><B>COMMAND EXECUTION</B>
13000 turns off any restrictions in the shell spawned to execute the
13004 <A NAME="lbDD"> </A>
13009 <DT><I>Bash Reference Manual</I>, Brian Fox and Chet Ramey<DD>
13010 <DT><I>The Gnu Readline Library</I>, Brian Fox and Chet Ramey<DD>
13011 <DT><I>The Gnu History Library</I>, Brian Fox and Chet Ramey<DD>
13012 <DT><I>Portable Operating System Interface (POSIX) Part 2: Shell and Utilities</I>, IEEE --<DD>
13013 <A HREF="http://pubs.opengroup.org/onlinepubs/9699919799/">http://pubs.opengroup.org/onlinepubs/9699919799/</A>
13014 <DT><A HREF="http://tiswww.case.edu/~chet/bash/POSIX">http://tiswww.case.edu/~chet/bash/POSIX</A> -- a description of posix mode<DD>
13015 <DT><I>sh</I>(1), <I>ksh</I>(1), <I>csh</I>(1)<DD>
13016 <DT><I>emacs</I>(1), <I>vi</I>(1)<DD>
13017 <DT><I>readline</I>(3)<DD>
13020 <A NAME="lbDE"> </A>
13026 <A HREF="file:/bin/bash"><I>/bin/bash</I></A>
13029 The <B>bash</B> executable
13031 <A HREF="file:/etc/profile"><I>/etc/profile</I></A>
13034 The systemwide initialization file, executed for login shells
13036 <A HREF="file:~/.bash_profile"><I>~/.bash_profile</I></A>
13039 The personal initialization file, executed for login shells
13041 <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>
13044 The individual per-interactive-shell startup file
13046 <A HREF="file:~/.bash_logout"><I>~/.bash_logout</I></A>
13049 The individual login shell cleanup file, executed when a login shell exits
13051 <A HREF="file:~/.inputrc"><I>~/.inputrc</I></A>
13054 Individual <I>readline</I> initialization file
13057 <A NAME="lbDF"> </A>
13060 Brian Fox, Free Software Foundation
13063 <A HREF="mailto:bfox@gnu.org">bfox@gnu.org</A>
13066 Chet Ramey, Case Western Reserve University
13069 <A HREF="mailto:chet.ramey@case.edu">chet.ramey@case.edu</A>
13070 <A NAME="lbDG"> </A>
13071 <H3>BUG REPORTS</H3>
13073 If you find a bug in
13076 you should report it. But first, you should
13077 make sure that it really is a bug, and that it appears in the latest
13081 The latest version is always available from
13082 <I><A HREF="ftp://ftp.gnu.org/pub/gnu/bash/">ftp://ftp.gnu.org/pub/gnu/bash/</A></I>.
13085 Once you have determined that a bug actually exists, use the
13088 command to submit a bug report.
13089 If you have a fix, you are encouraged to mail that as well!
13090 Suggestions and `philosophical' bug reports may be mailed
13091 to <I><A HREF="mailto:bug-bash@gnu.org">bug-bash@gnu.org</A></I> or posted to the Usenet
13093 <A HREF="news:gnu.bash.bug">gnu.bash.bug</A>.
13097 ALL bug reports should include:
13102 <DT>The version number of <B>bash</B><DD>
13103 <DT>The hardware and operating system<DD>
13104 <DT>The compiler used to compile<DD>
13105 <DT>A description of the bug behaviour<DD>
13106 <DT>A short script or `recipe' which exercises the bug<DD>
13113 inserts the first three items automatically into the template
13114 it provides for filing a bug report.
13117 Comments and bug reports concerning
13118 this manual page should be directed to
13119 <I><A HREF="mailto:chet.ramey@case.edu">chet.ramey@case.edu</A></I>.
13121 <A NAME="lbDH"> </A>
13126 It's too big and too slow.
13129 There are some subtle differences between
13132 and traditional versions of
13135 mostly because of the
13136 <FONT SIZE=-1><B>POSIX</B>
13142 Aliases are confusing in some uses.
13145 Shell builtin commands and functions are not stoppable/restartable.
13148 Compound commands and command sequences of the form `a ; b ; c'
13149 are not handled gracefully when process suspension is attempted.
13150 When a process is stopped, the shell immediately executes the next
13151 command in the sequence.
13152 It suffices to place the sequence of commands between
13153 parentheses to force it into a subshell, which may be stopped as
13157 Array variables may not (yet) be exported.
13160 There may be only one active coprocess at a time.
13167 <TH ALIGN=LEFT width=33%>GNU Bash 4.3<TH ALIGN=CENTER width=33%>2014 February 2<TH ALIGN=RIGHT width=33%>BASH(1)
13171 <A NAME="index"> </A><H2>Index</H2>
13173 <DT><A HREF="#lbAB">NAME</A><DD>
13174 <DT><A HREF="#lbAC">SYNOPSIS</A><DD>
13175 <DT><A HREF="#lbAD">COPYRIGHT</A><DD>
13176 <DT><A HREF="#lbAE">DESCRIPTION</A><DD>
13177 <DT><A HREF="#lbAF">OPTIONS</A><DD>
13178 <DT><A HREF="#lbAG">ARGUMENTS</A><DD>
13179 <DT><A HREF="#lbAH">INVOCATION</A><DD>
13180 <DT><A HREF="#lbAI">DEFINITIONS</A><DD>
13181 <DT><A HREF="#lbAJ">RESERVED WORDS</A><DD>
13182 <DT><A HREF="#lbAK">SHELL GRAMMAR</A><DD>
13184 <DT><A HREF="#lbAL">Simple Commands</A><DD>
13185 <DT><A HREF="#lbAM">Pipelines</A><DD>
13186 <DT><A HREF="#lbAN">Lists</A><DD>
13187 <DT><A HREF="#lbAO">Compound Commands</A><DD>
13188 <DT><A HREF="#lbAP">Coprocesses</A><DD>
13189 <DT><A HREF="#lbAQ">Shell Function Definitions</A><DD>
13191 <DT><A HREF="#lbAR">COMMENTS</A><DD>
13192 <DT><A HREF="#lbAS">QUOTING</A><DD>
13193 <DT><A HREF="#lbAT">PARAMETERS</A><DD>
13195 <DT><A HREF="#lbAU">Positional Parameters</A><DD>
13196 <DT><A HREF="#lbAV">Special Parameters</A><DD>
13197 <DT><A HREF="#lbAW">Shell Variables</A><DD>
13198 <DT><A HREF="#lbAX">Arrays</A><DD>
13200 <DT><A HREF="#lbAY">EXPANSION</A><DD>
13202 <DT><A HREF="#lbAZ">Brace Expansion</A><DD>
13203 <DT><A HREF="#lbBA">Tilde Expansion</A><DD>
13204 <DT><A HREF="#lbBB">Parameter Expansion</A><DD>
13205 <DT><A HREF="#lbBC">Command Substitution</A><DD>
13206 <DT><A HREF="#lbBD">Arithmetic Expansion</A><DD>
13207 <DT><A HREF="#lbBE">Process Substitution</A><DD>
13208 <DT><A HREF="#lbBF">Word Splitting</A><DD>
13209 <DT><A HREF="#lbBG">Pathname Expansion</A><DD>
13210 <DT><A HREF="#lbBH">Quote Removal</A><DD>
13212 <DT><A HREF="#lbBI">REDIRECTION</A><DD>
13214 <DT><A HREF="#lbBJ">Redirecting Input</A><DD>
13215 <DT><A HREF="#lbBK">Redirecting Output</A><DD>
13216 <DT><A HREF="#lbBL">Appending Redirected Output</A><DD>
13217 <DT><A HREF="#lbBM">Redirecting Standard Output and Standard Error</A><DD>
13218 <DT><A HREF="#lbBN">Appending Standard Output and Standard Error</A><DD>
13219 <DT><A HREF="#lbBO">Here Documents</A><DD>
13220 <DT><A HREF="#lbBP">Here Strings</A><DD>
13221 <DT><A HREF="#lbBQ">Duplicating File Descriptors</A><DD>
13222 <DT><A HREF="#lbBR">Moving File Descriptors</A><DD>
13223 <DT><A HREF="#lbBS">Opening File Descriptors for Reading and Writing</A><DD>
13225 <DT><A HREF="#lbBT">ALIASES</A><DD>
13226 <DT><A HREF="#lbBU">FUNCTIONS</A><DD>
13227 <DT><A HREF="#lbBV">ARITHMETIC EVALUATION</A><DD>
13228 <DT><A HREF="#lbBW">CONDITIONAL EXPRESSIONS</A><DD>
13229 <DT><A HREF="#lbBX">SIMPLE COMMAND EXPANSION</A><DD>
13230 <DT><A HREF="#lbBY">COMMAND EXECUTION</A><DD>
13231 <DT><A HREF="#lbBZ">COMMAND EXECUTION ENVIRONMENT</A><DD>
13232 <DT><A HREF="#lbCA">ENVIRONMENT</A><DD>
13233 <DT><A HREF="#lbCB">EXIT STATUS</A><DD>
13234 <DT><A HREF="#lbCC">SIGNALS</A><DD>
13235 <DT><A HREF="#lbCD">JOB CONTROL</A><DD>
13236 <DT><A HREF="#lbCE">PROMPTING</A><DD>
13237 <DT><A HREF="#lbCF">READLINE</A><DD>
13239 <DT><A HREF="#lbCG">Readline Notation</A><DD>
13240 <DT><A HREF="#lbCH">Readline Initialization</A><DD>
13241 <DT><A HREF="#lbCI">Readline Key Bindings</A><DD>
13242 <DT><A HREF="#lbCJ">Readline Variables</A><DD>
13243 <DT><A HREF="#lbCK">Readline Conditional Constructs</A><DD>
13244 <DT><A HREF="#lbCL">Searching</A><DD>
13245 <DT><A HREF="#lbCM">Readline Command Names</A><DD>
13246 <DT><A HREF="#lbCN">Commands for Moving</A><DD>
13247 <DT><A HREF="#lbCO">Commands for Manipulating the History</A><DD>
13248 <DT><A HREF="#lbCP">Commands for Changing Text</A><DD>
13249 <DT><A HREF="#lbCQ">Killing and Yanking</A><DD>
13250 <DT><A HREF="#lbCR">Numeric Arguments</A><DD>
13251 <DT><A HREF="#lbCS">Completing</A><DD>
13252 <DT><A HREF="#lbCT">Keyboard Macros</A><DD>
13253 <DT><A HREF="#lbCU">Miscellaneous</A><DD>
13254 <DT><A HREF="#lbCV">Programmable Completion</A><DD>
13256 <DT><A HREF="#lbCW">HISTORY</A><DD>
13257 <DT><A HREF="#lbCX">HISTORY EXPANSION</A><DD>
13259 <DT><A HREF="#lbCY">Event Designators</A><DD>
13260 <DT><A HREF="#lbCZ">Word Designators</A><DD>
13261 <DT><A HREF="#lbDA">Modifiers</A><DD>
13263 <DT><A HREF="#lbDB">SHELL BUILTIN COMMANDS</A><DD>
13264 <DT><A HREF="#lbDC">RESTRICTED SHELL</A><DD>
13265 <DT><A HREF="#lbDD">SEE ALSO</A><DD>
13266 <DT><A HREF="#lbDE">FILES</A><DD>
13267 <DT><A HREF="#lbDF">AUTHORS</A><DD>
13268 <DT><A HREF="#lbDG">BUG REPORTS</A><DD>
13269 <DT><A HREF="#lbDH">BUGS</A><DD>
13272 This document was created by man2html from bash.1.<BR>
13273 Time: 24 February 2014 08:28:34 EST