summaryrefslogtreecommitdiff
path: root/builtins/reserved.def
blob: 5482f5f362d049af80778bca5dab8a96c892d674 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
This file is reserved.def, in which the shell reserved words are defined.
It has no direct C file production, but defines builtins for the Bash
builtin help command.

Copyright (C) 1987-2005 Free Software Foundation, Inc.

This file is part of GNU Bash, the Bourne Again SHell.

Bash is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.

Bash is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License along
with Bash; see the file COPYING.  If not, write to the Free Software
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.

$BUILTIN for
$SHORT_DOC for NAME [in WORDS ... ;] do COMMANDS; done
The `for' loop executes a sequence of commands for each member in a
list of items.  If `in WORDS ...;' is not present, then `in "$@"' is
assumed.  For each element in WORDS, NAME is set to that element, and
the COMMANDS are executed.
$END

$BUILTIN for ((
$DOCNAME arith_for
$SHORT_DOC for (( exp1; exp2; exp3 )); do COMMANDS; done
Equivalent to
	(( EXP1 ))
	while (( EXP2 )); do
		COMMANDS
		(( EXP3 ))
	done
EXP1, EXP2, and EXP3 are arithmetic expressions.  If any expression is
omitted, it behaves as if it evaluates to 1.
$END

$BUILTIN select
$SHORT_DOC select NAME [in WORDS ... ;] do COMMANDS; done
The WORDS are expanded, generating a list of words.  The
set of expanded words is printed on the standard error, each
preceded by a number.  If `in WORDS' is not present, `in "$@"'
is assumed.  The PS3 prompt is then displayed and a line read
from the standard input.  If the line consists of the number
corresponding to one of the displayed words, then NAME is set
to that word.  If the line is empty, WORDS and the prompt are
redisplayed.  If EOF is read, the command completes.  Any other
value read causes NAME to be set to null.  The line read is saved
in the variable REPLY.  COMMANDS are executed after each selection
until a break command is executed.
$END

$BUILTIN time
$SHORT_DOC time [-p] PIPELINE
Execute PIPELINE and print a summary of the real time, user CPU time,
and system CPU time spent executing PIPELINE when it terminates.
The return status is the return status of PIPELINE.  The `-p' option
prints the timing summary in a slightly different format.  This uses
the value of the TIMEFORMAT variable as the output format.
$END

$BUILTIN case
$SHORT_DOC case WORD in [PATTERN [| PATTERN]...) COMMANDS ;;]... esac
Selectively execute COMMANDS based upon WORD matching PATTERN.  The
`|' is used to separate multiple patterns.
$END

$BUILTIN if
$SHORT_DOC if COMMANDS; then COMMANDS; [ elif COMMANDS; then COMMANDS; ]... [ else COMMANDS; ] fi
The `if COMMANDS' list is executed.  If its exit status is zero, then the
`then COMMANDS' list is executed.  Otherwise, each `elif COMMANDS' list is
executed in turn, and if its exit status is zero, the corresponding
`then COMMANDS' list is executed and the if command completes.  Otherwise,
the `else COMMANDS' list is executed, if present.  The exit status of the
entire construct is the exit status of the last command executed, or zero
if no condition tested true.
$END

$BUILTIN while
$SHORT_DOC while COMMANDS; do COMMANDS; done
Expand and execute COMMANDS as long as the final command in the
`while' COMMANDS has an exit status of zero.
$END

$BUILTIN until
$SHORT_DOC until COMMANDS; do COMMANDS; done
Expand and execute COMMANDS as long as the final command in the
`until' COMMANDS has an exit status which is not zero.
$END

$BUILTIN function
$SHORT_DOC function NAME { COMMANDS ; } or NAME () { COMMANDS ; }
Create a simple command invoked by NAME which runs COMMANDS.
Arguments on the command line along with NAME are passed to the
function as $0 .. $n.
$END

$BUILTIN { ... }
$DOCNAME grouping_braces
$SHORT_DOC { COMMANDS ; }
Run a set of commands in a group.  This is one way to redirect an
entire set of commands.
$END

$BUILTIN %
$DOCNAME fg_percent
$SHORT_DOC JOB_SPEC [&]
Equivalent to the JOB_SPEC argument to the `fg' command.  Resume a
stopped or background job.  JOB_SPEC can specify either a job name
or a job number.  Following JOB_SPEC with a `&' places the job in
the background, as if the job specification had been supplied as an
argument to `bg'.
$END

$BUILTIN (( ... ))
$DOCNAME arith
$SHORT_DOC (( expression ))
The EXPRESSION is evaluated according to the rules for arithmetic
evaluation.  Equivalent to "let EXPRESSION".
$END

$BUILTIN [[ ... ]]
$DOCNAME conditional
$SHORT_DOC [[ expression ]]
Returns a status of 0 or 1 depending on the evaluation of the conditional
expression EXPRESSION.  Expressions are composed of the same primaries used
by the `test' builtin, and may be combined using the following operators

	( EXPRESSION )	Returns the value of EXPRESSION
	! EXPRESSION	True if EXPRESSION is false; else false
	EXPR1 && EXPR2	True if both EXPR1 and EXPR2 are true; else false
	EXPR1 || EXPR2	True if either EXPR1 or EXPR2 is true; else false

When the `==' and `!=' operators are used, the string to the right of the
operator is used as a pattern and pattern matching is performed.  The
&& and || operators do not evaluate EXPR2 if EXPR1 is sufficient to
determine the expression's value.
$END

$BUILTIN variables
$DOCNAME variable_help
$SHORT_DOC variables - Some variable names and meanings
BASH_VERSION    Version information for this Bash.
CDPATH          A colon-separated list of directories to search
		for directries given as arguments to `cd'.
GLOBIGNORE	A colon-separated list of patterns describing filenames to
		be ignored by pathname expansion.
#if defined (HISTORY)
HISTFILE        The name of the file where your command history is stored.
HISTFILESIZE    The maximum number of lines this file can contain.
HISTSIZE        The maximum number of history lines that a running
		shell can access.
#endif /* HISTORY */
HOME            The complete pathname to your login directory.
HOSTNAME	The name of the current host.
HOSTTYPE        The type of CPU this version of Bash is running under.
IGNOREEOF       Controls the action of the shell on receipt of an EOF
		character as the sole input.  If set, then the value
		of it is the number of EOF characters that can be seen
		in a row on an empty line before the shell will exit
		(default 10).  When unset, EOF signifies the end of input.
MACHTYPE	A string describing the current system Bash is running on.
MAILCHECK	How often, in seconds, Bash checks for new mail.
MAILPATH	A colon-separated list of filenames which Bash checks
		for new mail.
OSTYPE		The version of Unix this version of Bash is running on.
PATH            A colon-separated list of directories to search when
		looking for commands.
PROMPT_COMMAND  A command to be executed before the printing of each
		primary prompt.
PS1             The primary prompt string.
PS2             The secondary prompt string.
PWD		The full pathname of the current directory.
SHELLOPTS	A colon-separated list of enabled shell options.
TERM            The name of the current terminal type.
TIMEFORMAT	The output format for timing statistics displayed by the
		`time' reserved word.
auto_resume     Non-null means a command word appearing on a line by
		itself is first looked for in the list of currently
		stopped jobs.  If found there, that job is foregrounded.
		A value of `exact' means that the command word must
		exactly match a command in the list of stopped jobs.  A
		value of `substring' means that the command word must
		match a substring of the job.  Any other value means that
		the command must be a prefix of a stopped job.
#if defined (HISTORY)
#  if defined (BANG_HISTORY)
histchars       Characters controlling history expansion and quick
		substitution.  The first character is the history
		substitution character, usually `!'.  The second is
		the `quick substitution' character, usually `^'.  The
		third is the `history comment' character, usually `#'.
#  endif /* BANG_HISTORY */
HISTIGNORE	A colon-separated list of patterns used to decide which
		commands should be saved on the history list.
#endif /* HISTORY */
$END