source: trunk/essentials/app-shells/bash/builtins/reserved.def

Last change on this file was 3228, checked in by bird, 18 years ago

bash 3.1

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