i-bash/builtins/reserved.def

289 lines
9.9 KiB
Modula-2
Raw Normal View History

1996-08-26 18:22:31 +00:00
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.
2009-01-12 13:36:28 +00:00
Copyright (C) 1987-2009 Free Software Foundation, Inc.
1996-08-26 18:22:31 +00:00
This file is part of GNU Bash, the Bourne Again SHell.
2009-01-12 13:36:28 +00:00
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 3 of the License, or
(at your option) any later version.
1996-08-26 18:22:31 +00:00
2009-01-12 13:36:28 +00:00
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.
1996-08-26 18:22:31 +00:00
2009-01-12 13:36:28 +00:00
You should have received a copy of the GNU General Public License
along with Bash. If not, see <http://www.gnu.org/licenses/>.
1996-08-26 18:22:31 +00:00
$BUILTIN for
2009-01-12 13:36:28 +00:00
$SHORT_DOC for NAME [in WORDS ... ] ; do COMMANDS; done
Execute commands for each member in a list.
1996-08-26 18:22:31 +00:00
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.
2009-01-12 13:36:28 +00:00
Exit Status:
Returns the status of the last command executed.
1996-08-26 18:22:31 +00:00
$END
2002-07-17 14:10:11 +00:00
$BUILTIN for ((
$DOCNAME arith_for
$SHORT_DOC for (( exp1; exp2; exp3 )); do COMMANDS; done
2009-01-12 13:36:28 +00:00
Arithmetic for loop.
2002-07-17 14:10:11 +00:00
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.
2009-01-12 13:36:28 +00:00
Exit Status:
Returns the status of the last command executed.
2002-07-17 14:10:11 +00:00
$END
1996-08-26 18:22:31 +00:00
$BUILTIN select
$SHORT_DOC select NAME [in WORDS ... ;] do COMMANDS; done
2009-01-12 13:36:28 +00:00
Select words from a list and execute commands.
1996-08-26 18:22:31 +00:00
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
2002-07-17 14:10:11 +00:00
until a break command is executed.
2009-01-12 13:36:28 +00:00
Exit Status:
Returns the status of the last command executed.
1996-08-26 18:22:31 +00:00
$END
1996-12-23 17:02:34 +00:00
$BUILTIN time
2009-01-12 13:36:28 +00:00
$SHORT_DOC time [-p] pipeline
Report time consumed by pipeline's execution.
1996-12-23 17:02:34 +00:00
Execute PIPELINE and print a summary of the real time, user CPU time,
and system CPU time spent executing PIPELINE when it terminates.
2009-01-12 13:36:28 +00:00
Options:
-p print the timing summary in the portable Posix format
The value of the TIMEFORMAT variable is used as the output format.
Exit Status:
The return status is the return status of PIPELINE.
1996-12-23 17:02:34 +00:00
$END
1996-08-26 18:22:31 +00:00
$BUILTIN case
$SHORT_DOC case WORD in [PATTERN [| PATTERN]...) COMMANDS ;;]... esac
2009-01-12 13:36:28 +00:00
Execute commands based on pattern matching.
1996-08-26 18:22:31 +00:00
Selectively execute COMMANDS based upon WORD matching PATTERN. The
`|' is used to separate multiple patterns.
2009-01-12 13:36:28 +00:00
Exit Status:
Returns the status of the last command executed.
1996-08-26 18:22:31 +00:00
$END
$BUILTIN if
$SHORT_DOC if COMMANDS; then COMMANDS; [ elif COMMANDS; then COMMANDS; ]... [ else COMMANDS; ] fi
2009-01-12 13:36:28 +00:00
Execute commands based on conditional.
2005-12-07 14:08:12 +00:00
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.
2009-01-12 13:36:28 +00:00
Exit Status:
Returns the status of the last command executed.
1996-08-26 18:22:31 +00:00
$END
$BUILTIN while
$SHORT_DOC while COMMANDS; do COMMANDS; done
2009-01-12 13:36:28 +00:00
Execute commands as long as a test succeeds.
1996-08-26 18:22:31 +00:00
Expand and execute COMMANDS as long as the final command in the
`while' COMMANDS has an exit status of zero.
2009-01-12 13:36:28 +00:00
Exit Status:
Returns the status of the last command executed.
1996-08-26 18:22:31 +00:00
$END
$BUILTIN until
$SHORT_DOC until COMMANDS; do COMMANDS; done
2009-01-12 13:36:28 +00:00
Execute commands as long as a test does not succeed.
1996-08-26 18:22:31 +00:00
Expand and execute COMMANDS as long as the final command in the
`until' COMMANDS has an exit status which is not zero.
2009-01-12 13:36:28 +00:00
Exit Status:
Returns the status of the last command executed.
1996-08-26 18:22:31 +00:00
$END
2009-02-19 22:21:29 +00:00
$BUILTIN coproc
$SHORT_DOC coproc [NAME] command [redirections]
Create a coprocess named NAME.
Execute COMMAND asynchronously, with the standard output and standard
input of the command connected via a pipe to file descriptors assigned
to indices 0 and 1 of an array variable NAME in the executing shell.
The default NAME is "COPROC".
Exit Status:
The coproc command returns an exit status of 0.
2009-02-19 22:21:29 +00:00
$END
1996-08-26 18:22:31 +00:00
$BUILTIN function
2009-01-12 13:36:28 +00:00
$SHORT_DOC function name { COMMANDS ; } or name () { COMMANDS ; }
Define shell function.
Create a shell function named NAME. When invoked as a simple command,
NAME runs COMMANDs in the calling shell's context. When NAME is invoked,
the arguments are passed to the function as $1...$n, and the function's
name is in $FUNCNAME.
Exit Status:
Returns success unless NAME is readonly.
1996-08-26 18:22:31 +00:00
$END
$BUILTIN { ... }
$DOCNAME grouping_braces
1999-02-19 17:11:39 +00:00
$SHORT_DOC { COMMANDS ; }
2009-01-12 13:36:28 +00:00
Group commands as a unit.
1996-08-26 18:22:31 +00:00
Run a set of commands in a group. This is one way to redirect an
entire set of commands.
2009-01-12 13:36:28 +00:00
Exit Status:
Returns the status of the last command executed.
1996-08-26 18:22:31 +00:00
$END
$BUILTIN %
$DOCNAME fg_percent
2009-01-12 13:36:28 +00:00
$SHORT_DOC job_spec [&]
Resume job in foreground.
2005-12-07 14:08:12 +00:00
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'.
2009-01-12 13:36:28 +00:00
Exit Status:
Returns the status of the resumed job.
1996-08-26 18:22:31 +00:00
$END
2002-07-17 14:10:11 +00:00
$BUILTIN (( ... ))
$DOCNAME arith
$SHORT_DOC (( expression ))
2009-01-12 13:36:28 +00:00
Evaluate arithmetic expression.
2002-07-17 14:10:11 +00:00
The EXPRESSION is evaluated according to the rules for arithmetic
evaluation. Equivalent to "let EXPRESSION".
2009-01-12 13:36:28 +00:00
Exit Status:
Returns 1 if EXPRESSION evaluates to 0; returns 0 otherwise.
2002-07-17 14:10:11 +00:00
$END
$BUILTIN [[ ... ]]
$DOCNAME conditional
$SHORT_DOC [[ expression ]]
2009-01-12 13:36:28 +00:00
Execute conditional command.
2002-07-17 14:10:11 +00:00
Returns a status of 0 or 1 depending on the evaluation of the conditional
expression EXPRESSION. Expressions are composed of the same primaries used
2009-01-12 13:36:28 +00:00
by the `test' builtin, and may be combined using the following operators:
2002-07-17 14:10:11 +00:00
2009-01-12 13:36:28 +00:00
( 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
2002-07-17 14:10:11 +00:00
2009-01-12 13:36:28 +00:00
When the `==' and `!=' operators are used, the string to the right of
the operator is used as a pattern and pattern matching is performed.
When the `=~' operator is used, the string to the right of the operator
is matched as a regular expression.
The && and || operators do not evaluate EXPR2 if EXPR1 is sufficient to
2002-07-17 14:10:11 +00:00
determine the expression's value.
2009-01-12 13:36:28 +00:00
Exit Status:
0 or 1 depending on value of EXPRESSION.
2002-07-17 14:10:11 +00:00
$END
1996-08-26 18:22:31 +00:00
$BUILTIN variables
$DOCNAME variable_help
2009-01-12 13:36:28 +00:00
$SHORT_DOC variables - Names and meanings of some shell variables
Common shell variable names and usage.
2006-10-10 14:15:34 +00:00
BASH_VERSION Version information for this Bash.
CDPATH A colon-separated list of directories to search
2009-01-12 13:36:28 +00:00
for directories given as arguments to `cd'.
1996-12-23 17:02:34 +00:00
GLOBIGNORE A colon-separated list of patterns describing filenames to
be ignored by pathname expansion.
1996-08-26 18:22:31 +00:00
#if defined (HISTORY)
2006-10-10 14:15:34 +00:00
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
1996-08-26 18:22:31 +00:00
shell can access.
#endif /* HISTORY */
2006-10-10 14:15:34 +00:00
HOME The complete pathname to your login directory.
1996-12-23 17:02:34 +00:00
HOSTNAME The name of the current host.
2006-10-10 14:15:34 +00:00
HOSTTYPE The type of CPU this version of Bash is running under.
IGNOREEOF Controls the action of the shell on receipt of an EOF
1996-08-26 18:22:31 +00:00
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.
1996-12-23 17:02:34 +00:00
MACHTYPE A string describing the current system Bash is running on.
1996-08-26 18:22:31 +00:00
MAILCHECK How often, in seconds, Bash checks for new mail.
MAILPATH A colon-separated list of filenames which Bash checks
for new mail.
2006-10-10 14:15:34 +00:00
OSTYPE The version of Unix this version of Bash is running on.
PATH A colon-separated list of directories to search when
1996-08-26 18:22:31 +00:00
looking for commands.
2006-10-10 14:15:34 +00:00
PROMPT_COMMAND A command to be executed before the printing of each
1996-08-26 18:22:31 +00:00
primary prompt.
2006-10-10 14:15:34 +00:00
PS1 The primary prompt string.
PS2 The secondary prompt string.
1996-12-23 17:02:34 +00:00
PWD The full pathname of the current directory.
SHELLOPTS A colon-separated list of enabled shell options.
2006-10-10 14:15:34 +00:00
TERM The name of the current terminal type.
1996-12-23 17:02:34 +00:00
TIMEFORMAT The output format for timing statistics displayed by the
`time' reserved word.
2006-10-10 14:15:34 +00:00
auto_resume Non-null means a command word appearing on a line by
1996-08-26 18:22:31 +00:00
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)
2006-10-10 14:15:34 +00:00
histchars Characters controlling history expansion and quick
1996-08-26 18:22:31 +00:00
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 */
1996-12-23 17:02:34 +00:00
HISTIGNORE A colon-separated list of patterns used to decide which
2001-11-13 17:56:06 +00:00
commands should be saved on the history list.
1996-08-26 18:22:31 +00:00
#endif /* HISTORY */
$END