diff options
Diffstat (limited to 'builtins/reserved.def')
-rw-r--r-- | builtins/reserved.def | 149 |
1 files changed, 117 insertions, 32 deletions
diff --git a/builtins/reserved.def b/builtins/reserved.def index e968ec7..2478f16 100644 --- a/builtins/reserved.def +++ b/builtins/reserved.def @@ -2,35 +2,41 @@ 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-2006 Free Software Foundation, Inc. +Copyright (C) 1987-2009 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 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. -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. +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. +You should have received a copy of the GNU General Public License +along with Bash. If not, see <http://www.gnu.org/licenses/>. $BUILTIN for -$SHORT_DOC for NAME [in WORDS ... ;] do COMMANDS; done +$SHORT_DOC for NAME [in WORDS ... ] ; do COMMANDS; done +Execute commands for each member in a list. + 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. + +Exit Status: +Returns the status of the last command executed. $END $BUILTIN for (( $DOCNAME arith_for $SHORT_DOC for (( exp1; exp2; exp3 )); do COMMANDS; done +Arithmetic for loop. + Equivalent to (( EXP1 )) while (( EXP2 )); do @@ -39,10 +45,15 @@ Equivalent to done EXP1, EXP2, and EXP3 are arithmetic expressions. If any expression is omitted, it behaves as if it evaluates to 1. + +Exit Status: +Returns the status of the last command executed. $END $BUILTIN select $SHORT_DOC select NAME [in WORDS ... ;] do COMMANDS; done +Select words from a list and execute commands. + 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 "$@"' @@ -54,25 +65,42 @@ 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. + +Exit Status: +Returns the status of the last command executed. $END $BUILTIN time -$SHORT_DOC time [-p] PIPELINE +$SHORT_DOC time [-p] pipeline +Report time consumed by pipeline's execution. + 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. + +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. $END $BUILTIN case $SHORT_DOC case WORD in [PATTERN [| PATTERN]...) COMMANDS ;;]... esac +Execute commands based on pattern matching. + Selectively execute COMMANDS based upon WORD matching PATTERN. The `|' is used to separate multiple patterns. + +Exit Status: +Returns the status of the last command executed. $END $BUILTIN if $SHORT_DOC if COMMANDS; then COMMANDS; [ elif COMMANDS; then COMMANDS; ]... [ else COMMANDS; ] fi +Execute commands based on conditional. + 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 @@ -80,75 +108,132 @@ executed in turn, and if its exit status is zero, the corresponding 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. + +Exit Status: +Returns the status of the last command executed. $END $BUILTIN while $SHORT_DOC while COMMANDS; do COMMANDS; done +Execute commands as long as a test succeeds. + Expand and execute COMMANDS as long as the final command in the `while' COMMANDS has an exit status of zero. + +Exit Status: +Returns the status of the last command executed. $END $BUILTIN until $SHORT_DOC until COMMANDS; do COMMANDS; done +Execute commands as long as a test does not succeed. + Expand and execute COMMANDS as long as the final command in the `until' COMMANDS has an exit status which is not zero. + +Exit Status: +Returns the status of the last command executed. +$END + +$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: +Returns the exit status of COMMAND. $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. +$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. $END $BUILTIN { ... } $DOCNAME grouping_braces $SHORT_DOC { COMMANDS ; } +Group commands as a unit. + Run a set of commands in a group. This is one way to redirect an entire set of commands. + +Exit Status: +Returns the status of the last command executed. $END $BUILTIN % $DOCNAME fg_percent -$SHORT_DOC JOB_SPEC [&] +$SHORT_DOC job_spec [&] +Resume job in foreground. + 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'. + +Exit Status: +Returns the status of the resumed job. $END $BUILTIN (( ... )) $DOCNAME arith $SHORT_DOC (( expression )) +Evaluate arithmetic expression. + The EXPRESSION is evaluated according to the rules for arithmetic evaluation. Equivalent to "let EXPRESSION". + +Exit Status: +Returns 1 if EXPRESSION evaluates to 0; returns 0 otherwise. $END $BUILTIN [[ ... ]] $DOCNAME conditional $SHORT_DOC [[ expression ]] +Execute conditional command. + 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 +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 - ( 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. +When the `=~' operator is used, the string to the right of the operator +is matched as a regular expression. -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 +The && and || operators do not evaluate EXPR2 if EXPR1 is sufficient to determine the expression's value. + +Exit Status: +0 or 1 depending on value of EXPRESSION. $END $BUILTIN variables $DOCNAME variable_help -$SHORT_DOC variables - Some variable names and meanings +$SHORT_DOC variables - Names and meanings of some shell variables +Common shell variable names and usage. + BASH_VERSION Version information for this Bash. CDPATH A colon-separated list of directories to search - for directries given as arguments to `cd'. + for directories given as arguments to `cd'. GLOBIGNORE A colon-separated list of patterns describing filenames to be ignored by pathname expansion. #if defined (HISTORY) |