]>
Commit | Line | Data |
---|---|---|
726f6388 JA |
1 | This file is reserved.def, in which the shell reserved words are defined. |
2 | It has no direct C file production, but defines builtins for the Bash | |
3 | builtin help command. | |
4 | ||
0628567a | 5 | Copyright (C) 1987-2006 Free Software Foundation, Inc. |
726f6388 JA |
6 | |
7 | This file is part of GNU Bash, the Bourne Again SHell. | |
8 | ||
9 | Bash is free software; you can redistribute it and/or modify it under | |
10 | the terms of the GNU General Public License as published by the Free | |
bb70624e | 11 | Software Foundation; either version 2, or (at your option) any later |
726f6388 JA |
12 | version. |
13 | ||
14 | Bash is distributed in the hope that it will be useful, but WITHOUT ANY | |
15 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
16 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
17 | for more details. | |
18 | ||
19 | You should have received a copy of the GNU General Public License along | |
20 | with Bash; see the file COPYING. If not, write to the Free Software | |
bb70624e | 21 | Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. |
726f6388 JA |
22 | |
23 | $BUILTIN for | |
24 | $SHORT_DOC for NAME [in WORDS ... ;] do COMMANDS; done | |
25 | The `for' loop executes a sequence of commands for each member in a | |
26 | list of items. If `in WORDS ...;' is not present, then `in "$@"' is | |
27 | assumed. For each element in WORDS, NAME is set to that element, and | |
28 | the COMMANDS are executed. | |
29 | $END | |
30 | ||
7117c2d2 JA |
31 | $BUILTIN for (( |
32 | $DOCNAME arith_for | |
33 | $SHORT_DOC for (( exp1; exp2; exp3 )); do COMMANDS; done | |
34 | Equivalent to | |
35 | (( EXP1 )) | |
36 | while (( EXP2 )); do | |
37 | COMMANDS | |
38 | (( EXP3 )) | |
39 | done | |
40 | EXP1, EXP2, and EXP3 are arithmetic expressions. If any expression is | |
41 | omitted, it behaves as if it evaluates to 1. | |
42 | $END | |
43 | ||
726f6388 JA |
44 | $BUILTIN select |
45 | $SHORT_DOC select NAME [in WORDS ... ;] do COMMANDS; done | |
46 | The WORDS are expanded, generating a list of words. The | |
47 | set of expanded words is printed on the standard error, each | |
48 | preceded by a number. If `in WORDS' is not present, `in "$@"' | |
49 | is assumed. The PS3 prompt is then displayed and a line read | |
50 | from the standard input. If the line consists of the number | |
51 | corresponding to one of the displayed words, then NAME is set | |
52 | to that word. If the line is empty, WORDS and the prompt are | |
53 | redisplayed. If EOF is read, the command completes. Any other | |
54 | value read causes NAME to be set to null. The line read is saved | |
55 | in the variable REPLY. COMMANDS are executed after each selection | |
7117c2d2 | 56 | until a break command is executed. |
726f6388 JA |
57 | $END |
58 | ||
ccc6cda3 JA |
59 | $BUILTIN time |
60 | $SHORT_DOC time [-p] PIPELINE | |
61 | Execute PIPELINE and print a summary of the real time, user CPU time, | |
62 | and system CPU time spent executing PIPELINE when it terminates. | |
63 | The return status is the return status of PIPELINE. The `-p' option | |
64 | prints the timing summary in a slightly different format. This uses | |
65 | the value of the TIMEFORMAT variable as the output format. | |
66 | $END | |
67 | ||
726f6388 JA |
68 | $BUILTIN case |
69 | $SHORT_DOC case WORD in [PATTERN [| PATTERN]...) COMMANDS ;;]... esac | |
70 | Selectively execute COMMANDS based upon WORD matching PATTERN. The | |
71 | `|' is used to separate multiple patterns. | |
72 | $END | |
73 | ||
74 | $BUILTIN if | |
75 | $SHORT_DOC if COMMANDS; then COMMANDS; [ elif COMMANDS; then COMMANDS; ]... [ else COMMANDS; ] fi | |
95732b49 JA |
76 | The `if COMMANDS' list is executed. If its exit status is zero, then the |
77 | `then COMMANDS' list is executed. Otherwise, each `elif COMMANDS' list is | |
78 | executed in turn, and if its exit status is zero, the corresponding | |
79 | `then COMMANDS' list is executed and the if command completes. Otherwise, | |
80 | the `else COMMANDS' list is executed, if present. The exit status of the | |
81 | entire construct is the exit status of the last command executed, or zero | |
82 | if no condition tested true. | |
726f6388 JA |
83 | $END |
84 | ||
85 | $BUILTIN while | |
86 | $SHORT_DOC while COMMANDS; do COMMANDS; done | |
87 | Expand and execute COMMANDS as long as the final command in the | |
88 | `while' COMMANDS has an exit status of zero. | |
89 | $END | |
90 | ||
91 | $BUILTIN until | |
92 | $SHORT_DOC until COMMANDS; do COMMANDS; done | |
93 | Expand and execute COMMANDS as long as the final command in the | |
94 | `until' COMMANDS has an exit status which is not zero. | |
95 | $END | |
96 | ||
97 | $BUILTIN function | |
98 | $SHORT_DOC function NAME { COMMANDS ; } or NAME () { COMMANDS ; } | |
99 | Create a simple command invoked by NAME which runs COMMANDS. | |
100 | Arguments on the command line along with NAME are passed to the | |
101 | function as $0 .. $n. | |
102 | $END | |
103 | ||
104 | $BUILTIN { ... } | |
105 | $DOCNAME grouping_braces | |
b72432fd | 106 | $SHORT_DOC { COMMANDS ; } |
726f6388 JA |
107 | Run a set of commands in a group. This is one way to redirect an |
108 | entire set of commands. | |
109 | $END | |
110 | ||
111 | $BUILTIN % | |
112 | $DOCNAME fg_percent | |
95732b49 JA |
113 | $SHORT_DOC JOB_SPEC [&] |
114 | Equivalent to the JOB_SPEC argument to the `fg' command. Resume a | |
115 | stopped or background job. JOB_SPEC can specify either a job name | |
116 | or a job number. Following JOB_SPEC with a `&' places the job in | |
117 | the background, as if the job specification had been supplied as an | |
118 | argument to `bg'. | |
726f6388 JA |
119 | $END |
120 | ||
7117c2d2 JA |
121 | $BUILTIN (( ... )) |
122 | $DOCNAME arith | |
123 | $SHORT_DOC (( expression )) | |
124 | The EXPRESSION is evaluated according to the rules for arithmetic | |
125 | evaluation. Equivalent to "let EXPRESSION". | |
126 | $END | |
127 | ||
128 | $BUILTIN [[ ... ]] | |
129 | $DOCNAME conditional | |
130 | $SHORT_DOC [[ expression ]] | |
131 | Returns a status of 0 or 1 depending on the evaluation of the conditional | |
132 | expression EXPRESSION. Expressions are composed of the same primaries used | |
133 | by the `test' builtin, and may be combined using the following operators | |
134 | ||
135 | ( EXPRESSION ) Returns the value of EXPRESSION | |
136 | ! EXPRESSION True if EXPRESSION is false; else false | |
137 | EXPR1 && EXPR2 True if both EXPR1 and EXPR2 are true; else false | |
138 | EXPR1 || EXPR2 True if either EXPR1 or EXPR2 is true; else false | |
139 | ||
140 | When the `==' and `!=' operators are used, the string to the right of the | |
141 | operator is used as a pattern and pattern matching is performed. The | |
142 | && and || operators do not evaluate EXPR2 if EXPR1 is sufficient to | |
143 | determine the expression's value. | |
144 | $END | |
145 | ||
726f6388 JA |
146 | $BUILTIN variables |
147 | $DOCNAME variable_help | |
148 | $SHORT_DOC variables - Some variable names and meanings | |
0628567a JA |
149 | BASH_VERSION Version information for this Bash. |
150 | CDPATH A colon-separated list of directories to search | |
95732b49 | 151 | for directries given as arguments to `cd'. |
ccc6cda3 JA |
152 | GLOBIGNORE A colon-separated list of patterns describing filenames to |
153 | be ignored by pathname expansion. | |
726f6388 | 154 | #if defined (HISTORY) |
0628567a JA |
155 | HISTFILE The name of the file where your command history is stored. |
156 | HISTFILESIZE The maximum number of lines this file can contain. | |
157 | HISTSIZE The maximum number of history lines that a running | |
726f6388 JA |
158 | shell can access. |
159 | #endif /* HISTORY */ | |
0628567a | 160 | HOME The complete pathname to your login directory. |
ccc6cda3 | 161 | HOSTNAME The name of the current host. |
0628567a JA |
162 | HOSTTYPE The type of CPU this version of Bash is running under. |
163 | IGNOREEOF Controls the action of the shell on receipt of an EOF | |
726f6388 JA |
164 | character as the sole input. If set, then the value |
165 | of it is the number of EOF characters that can be seen | |
166 | in a row on an empty line before the shell will exit | |
167 | (default 10). When unset, EOF signifies the end of input. | |
ccc6cda3 | 168 | MACHTYPE A string describing the current system Bash is running on. |
726f6388 JA |
169 | MAILCHECK How often, in seconds, Bash checks for new mail. |
170 | MAILPATH A colon-separated list of filenames which Bash checks | |
171 | for new mail. | |
0628567a JA |
172 | OSTYPE The version of Unix this version of Bash is running on. |
173 | PATH A colon-separated list of directories to search when | |
726f6388 | 174 | looking for commands. |
0628567a | 175 | PROMPT_COMMAND A command to be executed before the printing of each |
726f6388 | 176 | primary prompt. |
0628567a JA |
177 | PS1 The primary prompt string. |
178 | PS2 The secondary prompt string. | |
ccc6cda3 JA |
179 | PWD The full pathname of the current directory. |
180 | SHELLOPTS A colon-separated list of enabled shell options. | |
0628567a | 181 | TERM The name of the current terminal type. |
ccc6cda3 JA |
182 | TIMEFORMAT The output format for timing statistics displayed by the |
183 | `time' reserved word. | |
0628567a | 184 | auto_resume Non-null means a command word appearing on a line by |
726f6388 JA |
185 | itself is first looked for in the list of currently |
186 | stopped jobs. If found there, that job is foregrounded. | |
187 | A value of `exact' means that the command word must | |
188 | exactly match a command in the list of stopped jobs. A | |
189 | value of `substring' means that the command word must | |
190 | match a substring of the job. Any other value means that | |
191 | the command must be a prefix of a stopped job. | |
192 | #if defined (HISTORY) | |
726f6388 | 193 | # if defined (BANG_HISTORY) |
0628567a | 194 | histchars Characters controlling history expansion and quick |
726f6388 JA |
195 | substitution. The first character is the history |
196 | substitution character, usually `!'. The second is | |
197 | the `quick substitution' character, usually `^'. The | |
198 | third is the `history comment' character, usually `#'. | |
199 | # endif /* BANG_HISTORY */ | |
ccc6cda3 | 200 | HISTIGNORE A colon-separated list of patterns used to decide which |
f73dda09 | 201 | commands should be saved on the history list. |
726f6388 JA |
202 | #endif /* HISTORY */ |
203 | $END |