lpic:bash
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen RevisionVorhergehende Überarbeitung | |||
lpic:bash [2009/02/12 16:15] – gelöscht d.weller | lpic:bash [2009/02/12 16:29] (aktuell) – angelegt d.weller | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
+ | bash(1) | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | NAME | ||
+ | |||
+ | bash - GNU Bourne-Again SHell | ||
+ | |||
+ | |||
+ | |||
+ | SYNOPSIS | ||
+ | |||
+ | bash [options] [file] | ||
+ | |||
+ | |||
+ | |||
+ | COPYRIGHT | ||
+ | |||
+ | Bash is Copyright (C) 1989-2005 by the Free Software Foundation, Inc. | ||
+ | |||
+ | |||
+ | |||
+ | DESCRIPTION | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | |||
+ | |||
+ | OPTIONS | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | -c string If the -c option | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | (see RESTRICTED SHELL below). | ||
+ | | ||
+ | | ||
+ | | ||
+ | set when invoking an interactive shell. | ||
+ | | ||
+ | | ||
+ | ject to language translation when the current locale is not C | ||
+ | | ||
+ | | ||
+ | [-+]O [shopt_option] | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | names and arguments. | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | Arrange for the debugger profile to be executed before the shell | ||
+ | starts. | ||
+ | of the extdebug | ||
+ | function tracing (see the description of the -o functrace option | ||
+ | to the set builtin below). | ||
+ | | ||
+ | Equivalent | ||
+ | table object) file format. | ||
+ | | ||
+ | Equivalent to -D. | ||
+ | | ||
+ | fully. | ||
+ | | ||
+ | | ||
+ | Execute commands from file instead of the standard personal ini- | ||
+ | tialization file ~/.bashrc if the shell is interactive | ||
+ | INVOCATION below). | ||
+ | |||
+ | | ||
+ | Equivalent to -l. | ||
+ | |||
+ | | ||
+ | Do not use the GNU readline library to read command lines when | ||
+ | the shell is interactive. | ||
+ | |||
+ | | ||
+ | Do not read either the system-wide startup file / | ||
+ | any | ||
+ | ~/ | ||
+ | files when it is invoked | ||
+ | below). | ||
+ | |||
+ | | ||
+ | ~/ | ||
+ | default if the shell is invoked as sh. | ||
+ | |||
+ | | ||
+ | Change the behavior of bash where the default operation | ||
+ | from the POSIX standard to match the standard (posix mode). | ||
+ | |||
+ | | ||
+ | The shell becomes restricted (see RESTRICTED SHELL below). | ||
+ | |||
+ | | ||
+ | Equivalent to -v. | ||
+ | |||
+ | | ||
+ | Show version information for this instance of bash on the stan- | ||
+ | dard output and exit successfully. | ||
+ | |||
+ | |||
+ | |||
+ | ARGUMENTS | ||
+ | |||
+ | If arguments remain after option processing, and neither the -c nor the | ||
+ | | ||
+ | name of a file containing shell commands. | ||
+ | | ||
+ | ters are set to the remaining arguments. | ||
+ | | ||
+ | tus of the last command executed in the script. | ||
+ | | ||
+ | file in the current directory, and, if no file is found, then the shell | ||
+ | | ||
+ | |||
+ | |||
+ | |||
+ | INVOCATION | ||
+ | |||
+ | | ||
+ | one started with the --login option. | ||
+ | |||
+ | An interactive shell is one started without | ||
+ | | ||
+ | to terminals (as determined by isatty(3)), or one started with the -i | ||
+ | | ||
+ | a shell script or a startup file to test this state. | ||
+ | |||
+ | The following paragraphs describe how bash executes its startup | ||
+ | | ||
+ | | ||
+ | sion in the EXPANSION section. | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | that file, it looks for ~/ | ||
+ | | ||
+ | | ||
+ | shell is started to inhibit this behavior. | ||
+ | |||
+ | | ||
+ | file ~/ | ||
+ | |||
+ | When an interactive shell that is not a login shell is started, | ||
+ | | ||
+ | may be inhibited by using the --norc option. | ||
+ | | ||
+ | | ||
+ | |||
+ | When bash is started non-interactively, | ||
+ | | ||
+ | its value if it appears there, and uses the expanded value as the name | ||
+ | | ||
+ | mand were executed: | ||
+ | if [ -n " | ||
+ | but the value of the PATH variable is not used to search for the file | ||
+ | name. | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | tive login shell, or a non-interactive shell with the --login | ||
+ | | ||
+ | | ||
+ | | ||
+ | name sh, bash looks for the variable ENV, expands its value if it is | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | When bash is started in posix mode, as with the --posix | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | Bash attempts to determine when it is being run by the remote | ||
+ | | ||
+ | reads and executes commands from ~/.bashrc, if that file exists and is | ||
+ | | ||
+ | be used to inhibit this behavior, and the --rcfile option may be used | ||
+ | | ||
+ | the shell with those options or allow them to be specified. | ||
+ | |||
+ | If the shell is started with the effective user (group) id not equal to | ||
+ | the real user (group) id, and the -p option is not supplied, no startup | ||
+ | files are read, shell functions are not inherited from the environment, | ||
+ | | ||
+ | and the effective user id is set to the real user id. If the -p option | ||
+ | | ||
+ | | ||
+ | |||
+ | |||
+ | |||
+ | DEFINITIONS | ||
+ | |||
+ | The following definitions are used throughout the rest of this docu- | ||
+ | ment. | ||
+ | | ||
+ | | ||
+ | shell. | ||
+ | | ||
+ | scores, | ||
+ | score. | ||
+ | | ||
+ | A character that, when unquoted, separates words. | ||
+ | following: | ||
+ | | & ; ( ) < > space tab | ||
+ | | ||
+ | A token that performs a control function. | ||
+ | lowing symbols: | ||
+ | || & && ; ;; ( ) | < | ||
+ | |||
+ | |||
+ | RESERVED WORDS | ||
+ | |||
+ | | ||
+ | | ||
+ | first word of a simple command (see SHELL GRAMMAR below) or the third | ||
+ | word of a case or for command: | ||
+ | |||
+ | | ||
+ | while { } time [[ ]] | ||
+ | |||
+ | |||
+ | SHELL GRAMMAR | ||
+ | |||
+ | | ||
+ | A simple command is a sequence of optional | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | The return value of a simple command is its exit status, | ||
+ | the command is terminated by signal n. | ||
+ | |||
+ | | ||
+ | A pipeline is a sequence of one or more commands separated by the char- | ||
+ | acter |. The format for a pipeline is: | ||
+ | |||
+ | [time [-p]] [ ! ] command [ | command2 ... ] | ||
+ | |||
+ | The standard output of command is connected via a pipe to the standard | ||
+ | | ||
+ | tions specified by the command (see REDIRECTION below). | ||
+ | |||
+ | The return status of a pipeline is the exit status of the last command, | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | user and system time consumed by its execution are reported | ||
+ | | ||
+ | | ||
+ | | ||
+ | see the description of TIMEFORMAT under Shell Variables below. | ||
+ | |||
+ | Each command in a pipeline is executed as a separate process (i.e., | ||
+ | a subshell). | ||
+ | |||
+ | Lists | ||
+ | | ||
+ | | ||
+ | < | ||
+ | |||
+ | Of these list operators, && and || have equal precedence, followed by ; | ||
+ | and &, which have equal precedence. | ||
+ | |||
+ | A sequence of one or more newlines may appear in a list instead | ||
+ | | ||
+ | |||
+ | | ||
+ | cutes the command in the background in a subshell. | ||
+ | | ||
+ | | ||
+ | | ||
+ | the last command executed. | ||
+ | |||
+ | The control operators && and || denote AND lists and OR lists, | ||
+ | | ||
+ | |||
+ | command1 && command2 | ||
+ | |||
+ | | ||
+ | of zero. | ||
+ | |||
+ | An OR list has the form | ||
+ | |||
+ | command1 || command2 | ||
+ | |||
+ | |||
+ | | ||
+ | | ||
+ | the last command executed in the list. | ||
+ | |||
+ | | ||
+ | A compound command is one of the following: | ||
+ | |||
+ | | ||
+ | TION ENVIRONMENT below). | ||
+ | mands that affect the shell' | ||
+ | effect | ||
+ | exit status of list. | ||
+ | |||
+ | { list; } | ||
+ | list is simply executed in the current shell environment. | ||
+ | must be terminated with a newline or semicolon. | ||
+ | as a group command. | ||
+ | list. Note that unlike the metacharacters ( and ), { and } are | ||
+ | reserved words and must occur where a reserved word is permitted | ||
+ | to be recognized. | ||
+ | must be separated from list by whitespace. | ||
+ | |||
+ | | ||
+ | The expression is evaluated according | ||
+ | below under ARITHMETIC EVALUATION. | ||
+ | sion is non-zero, the return status is 0; otherwise | ||
+ | status is 1. This is exactly equivalent to let " | ||
+ | |||
+ | [[ expression ]] | ||
+ | Return | ||
+ | conditional expression expression. | ||
+ | the primaries | ||
+ | Word splitting and pathname expansion are not performed | ||
+ | words between | ||
+ | variable expansion, arithmetic expansion, command | ||
+ | process | ||
+ | tional operators such as -f must be unquoted to be recognized as | ||
+ | primaries. | ||
+ | |||
+ | When the == and != operators are used, the string to the right | ||
+ | of the operator is considered a pattern and matched according to | ||
+ | the rules described below under Pattern Matching. | ||
+ | option nocasematch is enabled, the match is performed | ||
+ | regard | ||
+ | is 0 if the string matches (==) or does not match (!=) the pat- | ||
+ | tern, and 1 otherwise. | ||
+ | force it to be matched as a string. | ||
+ | |||
+ | An additional binary operator, =~, is available, with the same | ||
+ | precedence | ||
+ | right of the operator is considered an extended regular | ||
+ | sion and matched accordingly (as in regex(3)). | ||
+ | is 0 if the string matches the pattern, and 1 otherwise. | ||
+ | regular | ||
+ | expression' | ||
+ | is enabled, the match is performed without regard to the case of | ||
+ | alphabetic | ||
+ | subexpressions | ||
+ | array variable BASH_REMATCH. | ||
+ | index 0 is the portion of the string matching the entire regular | ||
+ | expression. | ||
+ | portion | ||
+ | sion. | ||
+ | |||
+ | Expressions may be combined | ||
+ | listed in decreasing order of precedence: | ||
+ | |||
+ | ( expression ) | ||
+ | | ||
+ | | ||
+ | ! expression | ||
+ | True if expression is false. | ||
+ | expression1 && expression2 | ||
+ | True if both expression1 and expression2 are true. | ||
+ | expression1 || expression2 | ||
+ | True if either expression1 or expression2 is true. | ||
+ | |||
+ | The && and || operators do not evaluate expression2 if the value | ||
+ | of expression1 | ||
+ | the entire conditional expression. | ||
+ | |||
+ | for name [ in word ] ; do list ; done | ||
+ | The list of words following in is expanded, generating a list of | ||
+ | items. | ||
+ | turn, and list is executed each time. If the in word is omit- | ||
+ | ted, the for command | ||
+ | parameter that is set (see PARAMETERS below). | ||
+ | is the exit status of the last command that executes. | ||
+ | expansion of the items following in results in an empty list, no | ||
+ | commands are executed, and the return status is 0. | ||
+ | |||
+ | for (( expr1 ; expr2 ; expr3 )) ; do list ; done | ||
+ | First, the arithmetic expression expr1 is evaluated according to | ||
+ | the rules described | ||
+ | arithmetic | ||
+ | it evaluates to zero. Each time expr2 evaluates to a non-zero | ||
+ | value, | ||
+ | evaluated. | ||
+ | evaluates to 1. The return value is the exit status of the last | ||
+ | command in list that is executed, or false if any of the expres- | ||
+ | sions is invalid. | ||
+ | |||
+ | | ||
+ | The list of words following in is expanded, generating a list of | ||
+ | items. | ||
+ | error, | ||
+ | the positional parameters are printed | ||
+ | The PS3 prompt is then displayed and a line read from the stan- | ||
+ | dard input. | ||
+ | one of the displayed | ||
+ | that word. If the line is empty, the words and prompt are dis- | ||
+ | played again. | ||
+ | value read causes name to be set to null. | ||
+ | saved in the variable REPLY. | ||
+ | selection until a break command is executed. | ||
+ | select | ||
+ | or zero if no commands were executed. | ||
+ | |||
+ | case word in [ [(] pattern [ | pattern ] ... ) list ;; ] ... esac | ||
+ | A case command first expands word, and tries to match it against | ||
+ | each pattern in turn, using the same matching rules as for path- | ||
+ | name expansion (see Pathname | ||
+ | expanded | ||
+ | sion, arithmetic | ||
+ | substitution | ||
+ | expanded using tilde expansion, parameter | ||
+ | sion, arithmetic substitution, | ||
+ | substitution. | ||
+ | match is performed | ||
+ | characters. | ||
+ | executed. | ||
+ | attempted. | ||
+ | erwise, | ||
+ | list. | ||
+ | |||
+ | if list; then list; [ elif list; then list; ] ... [ else list; ] fi | ||
+ | The if list is executed. | ||
+ | list is executed. | ||
+ | turn, and if its exit status is zero, the corresponding | ||
+ | list is executed and the command completes. | ||
+ | list is executed, if present. | ||
+ | tus of the last command executed, or zero if no condition tested | ||
+ | true. | ||
+ | |||
+ | while list; do list; done | ||
+ | until list; do list; done | ||
+ | The while command continuously executes the do list as long as | ||
+ | the last command | ||
+ | until command is identical to the while command, except that the | ||
+ | test is negated; | ||
+ | command in list returns a non-zero exit status. | ||
+ | of the while and until commands is the exit status of the last | ||
+ | do list command executed, or zero if none was executed. | ||
+ | |||
+ | Shell Function Definitions | ||
+ | A shell function is an object that is called like a simple command | ||
+ | | ||
+ | Shell functions are declared as follows: | ||
+ | |||
+ | [ function ] name () compound-command [redirection] | ||
+ | This defines a function named name. The reserved word function | ||
+ | is optional. | ||
+ | parentheses are optional. | ||
+ | pound command | ||
+ | That command is usually a list of commands between { and }, but | ||
+ | may be any command listed under Compound Commands above. | ||
+ | pound-command is executed whenever name is specified as the name | ||
+ | of a simple command. | ||
+ | specified when a function is defined | ||
+ | function | ||
+ | is zero unless a syntax error occurs or a readonly function with | ||
+ | the same name already exists. | ||
+ | a function is the exit status of the last command | ||
+ | the body. (See FUNCTIONS below.) | ||
+ | |||
+ | |||
+ | |||
+ | COMMENTS | ||
+ | |||
+ | In a non-interactive shell, or an interactive shell in which the inter- | ||
+ | | ||
+ | | ||
+ | all remaining characters on that line to be ignored. | ||
+ | | ||
+ | | ||
+ | tive shells. | ||
+ | |||
+ | |||
+ | |||
+ | QUOTING | ||
+ | |||
+ | | ||
+ | words to the shell. | ||
+ | for special characters, to prevent reserved words from being recognized | ||
+ | as such, and to prevent parameter expansion. | ||
+ | |||
+ | Each of the metacharacters listed above under DEFINITIONS | ||
+ | | ||
+ | |||
+ | | ||
+ | TORY EXPANSION below), the history expansion character, usually !, must | ||
+ | be quoted to prevent history expansion. | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | A non-quoted backslash (\) is the escape character. | ||
+ | | ||
+ | < | ||
+ | | ||
+ | is, it is removed from the input stream and effectively ignored). | ||
+ | |||
+ | | ||
+ | each character within the quotes. | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | when history expansion is enabled, !. The characters $ and ` retain | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | using a backslash. | ||
+ | |||
+ | The special parameters * and @ have special | ||
+ | | ||
+ | |||
+ | Words of the form $' | ||
+ | | ||
+ | | ||
+ | as follows: | ||
+ | \a alert (bell) | ||
+ | \b | ||
+ | \e an escape character | ||
+ | \f form feed | ||
+ | \n new line | ||
+ | \r | ||
+ | \t | ||
+ | \v | ||
+ | \\ | ||
+ | \' | ||
+ | \nnn the eight-bit character whose value is the octal value | ||
+ | nnn (one to three digits) | ||
+ | \xHH | ||
+ | value HH (one or two hex digits) | ||
+ | \cx a control-x character | ||
+ | |||
+ | The expanded result is single-quoted, | ||
+ | been present. | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | is translated and replaced, the replacement is double-quoted. | ||
+ | |||
+ | |||
+ | |||
+ | PARAMETERS | ||
+ | |||
+ | A parameter is an entity that stores values. | ||
+ | ber, or one of the special characters listed below under Special Param- | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | A parameter is set if it has been assigned a value. | ||
+ | a valid value. | ||
+ | the unset builtin command (see SHELL BUILTIN COMMANDS below). | ||
+ | |||
+ | A variable may be assigned to by a statement of the form | ||
+ | |||
+ | name=[value] | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | SION below). | ||
+ | is evaluated as an arithmetic expression even if the $((...)) expansion | ||
+ | is not used (see Arithmetic Expansion below). | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | In the context where an assignment statement is assigning a value to a | ||
+ | shell variable or array index, the += operator can be used to append to | ||
+ | or add to the variable' | ||
+ | | ||
+ | as an arithmetic expression and added to the variable' | ||
+ | which is also evaluated. | ||
+ | | ||
+ | unset (as it is when using =), and new values are appended to the array | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | A positional parameter is a parameter denoted by one or more digits, | ||
+ | other than the single digit 0. Positional parameters are assigned from | ||
+ | the shell' | ||
+ | | ||
+ | with assignment statements. | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | The shell treats several parameters specially. | ||
+ | only be referenced; assignment to them is not allowed. | ||
+ | | ||
+ | the expansion occurs within double quotes, it expands to a sin- | ||
+ | gle word with the value of each parameter separated by the first | ||
+ | character of the IFS special variable. | ||
+ | lent to " | ||
+ | of the IFS variable. | ||
+ | rated by spaces. | ||
+ | without intervening separators. | ||
+ | | ||
+ | the expansion | ||
+ | expands to a separate word. That is, " | ||
+ | " | ||
+ | the expansion of the first parameter is joined with the begin- | ||
+ | ning part of the original word, and the expansion of the last | ||
+ | parameter is joined with the last part of the original | ||
+ | When there are no positional parameters, " | ||
+ | nothing (i.e., they are removed). | ||
+ | # | ||
+ | ? | ||
+ | pipeline. | ||
+ | | ||
+ | tion, by the set builtin command, or those set by the shell | ||
+ | itself (such as the -i option). | ||
+ | | ||
+ | expands to the process ID of the current | ||
+ | shell. | ||
+ | | ||
+ | ground (asynchronous) command. | ||
+ | | ||
+ | at shell initialization. | ||
+ | mands, $0 is set to the name of that file. If bash is started | ||
+ | with the -c option, then $0 is set to the first argument after | ||
+ | the string to be executed, if one is present. | ||
+ | set to the file name used to invoke bash, as given by argument | ||
+ | zero. | ||
+ | | ||
+ | the shell or shell script being executed as passed in the envi- | ||
+ | ronment or argument list. Subsequently, | ||
+ | argument | ||
+ | the full pathname used to invoke | ||
+ | placed in the environment exported to that command. | ||
+ | ing mail, this parameter holds the name of the mail file cur- | ||
+ | rently being checked. | ||
+ | |||
+ | Shell Variables | ||
+ | The following variables are set by the shell: | ||
+ | |||
+ | | ||
+ | bash. | ||
+ | | ||
+ | An array variable whose values are the number of parameters | ||
+ | each frame of the current bash execution call stack. | ||
+ | of parameters to the current | ||
+ | script | ||
+ | When a subroutine is executed, the number of parameters | ||
+ | is pushed onto BASH_ARGC. | ||
+ | extended debugging mode (see the description | ||
+ | option to the shopt builtin below) | ||
+ | | ||
+ | An array variable containing all of the parameters in the cur- | ||
+ | rent bash execution call stack. | ||
+ | subroutine | ||
+ | of the initial call is at the bottom. | ||
+ | cuted, | ||
+ | shell sets BASH_ARGV only when in extended debugging | ||
+ | the description | ||
+ | below) | ||
+ | | ||
+ | The command currently being executed or about to be executed, | ||
+ | unless the shell is executing a command as the result of a trap, | ||
+ | in which case it is the command executing at the time of the | ||
+ | trap. | ||
+ | | ||
+ | The command argument to the -c invocation option. | ||
+ | | ||
+ | An array variable whose members are the line numbers in source | ||
+ | files | ||
+ | ${BASH_LINENO[$i]} | ||
+ | ${FUNCNAME[$ifP]} was called. | ||
+ | name is ${BASH_SOURCE[$i]}. | ||
+ | line number. | ||
+ | | ||
+ | An array variable whose members are assigned by the =~ binary | ||
+ | operator | ||
+ | 0 is the portion of the string | ||
+ | expression. | ||
+ | string matching the nth parenthesized subexpression. | ||
+ | able is read-only. | ||
+ | | ||
+ | An array variable whose members are the source filenames corre- | ||
+ | sponding to the elements in the FUNCNAME array variable. | ||
+ | | ||
+ | Incremented by one each time a subshell or subshell | ||
+ | is spawned. | ||
+ | | ||
+ | A readonly array variable whose members hold version information | ||
+ | for this instance of bash. The values | ||
+ | members are as follows: | ||
+ | BASH_VERSINFO[0] | ||
+ | BASH_VERSINFO[1] | ||
+ | BASH_VERSINFO[2] | ||
+ | BASH_VERSINFO[3] | ||
+ | BASH_VERSINFO[4] | ||
+ | BASH_VERSINFO[5] | ||
+ | |||
+ | | ||
+ | Expands | ||
+ | bash. | ||
+ | |||
+ | | ||
+ | An index into ${COMP_WORDS} of the word containing | ||
+ | cursor position. | ||
+ | tions invoked by the programmable | ||
+ | Programmable Completion below). | ||
+ | |||
+ | | ||
+ | The current | ||
+ | shell functions | ||
+ | grammable | ||
+ | below). | ||
+ | |||
+ | | ||
+ | The index of the current cursor position relative to the begin- | ||
+ | ning of the current command. | ||
+ | at the end of the current command, the value of this variable is | ||
+ | equal to ${# | ||
+ | shell functions | ||
+ | grammable | ||
+ | below). | ||
+ | |||
+ | | ||
+ | The set of characters that the Readline library treats | ||
+ | separators | ||
+ | is unset, it loses its special properties, even if it is subse- | ||
+ | quently reset. | ||
+ | |||
+ | | ||
+ | An array variable (see Arrays below) consisting of the individ- | ||
+ | ual words in the current command line. The words are split on | ||
+ | shell metacharacters | ||
+ | This variable is available only in shell functions | ||
+ | the programmable completion facilities (see Programmable Comple- | ||
+ | tion below). | ||
+ | |||
+ | | ||
+ | An array variable (see Arrays below) containing the current con- | ||
+ | tents of the directory stack. | ||
+ | in the order they are displayed by the dirs builtin. | ||
+ | to members of this array variable may be used to modify directo- | ||
+ | ries already in the stack, but the pushd and popd builtins | ||
+ | be used to add and remove directories. | ||
+ | able will not change the current | ||
+ | unset, | ||
+ | quently reset. | ||
+ | |||
+ | | ||
+ | ized at shell startup. | ||
+ | |||
+ | | ||
+ | An array variable | ||
+ | currently in the execution call stack. | ||
+ | is the name of any currently-executing shell function. | ||
+ | tom-most element is " | ||
+ | shell function | ||
+ | effect and return an error status. | ||
+ | loses its special properties, even if it is subsequently reset. | ||
+ | |||
+ | | ||
+ | current | ||
+ | and return an error status. | ||
+ | special properties, even if it is subsequently reset. | ||
+ | |||
+ | | ||
+ | The history number, or index in the history list, of the current | ||
+ | command. | ||
+ | even if it is subsequently reset. | ||
+ | |||
+ | | ||
+ | Automatically set to the name of the current host. | ||
+ | |||
+ | | ||
+ | Automatically | ||
+ | of machine on which bash is executing. | ||
+ | dependent. | ||
+ | |||
+ | | ||
+ | decimal number representing the current sequential | ||
+ | (starting | ||
+ | script or function, the value substituted is not guaranteed | ||
+ | be meaningful. | ||
+ | ties, even if it is subsequently reset. | ||
+ | |||
+ | | ||
+ | Automatically set to a string that fully describes | ||
+ | type on which bash is executing, in the standard GNU cpu-com- | ||
+ | pany-system format. | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | builtin command (see SHELL BUILTIN COMMANDS below). | ||
+ | |||
+ | | ||
+ | builtin command (see SHELL BUILTIN COMMANDS below). | ||
+ | |||
+ | | ||
+ | tem on which bash is executing. | ||
+ | dent. | ||
+ | |||
+ | | ||
+ | An array variable (see Arrays below) containing a list of exit | ||
+ | status | ||
+ | foreground pipeline (which may contain only a single command). | ||
+ | |||
+ | | ||
+ | only. | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | 0 and 32767 is generated. | ||
+ | initialized by assigning a value to RANDOM. | ||
+ | it loses its special properties, | ||
+ | reset. | ||
+ | |||
+ | | ||
+ | no arguments are supplied. | ||
+ | |||
+ | | ||
+ | Each time this parameter is referenced, the number | ||
+ | since shell invocation is returned. | ||
+ | SECONDS, the value returned upon subsequent | ||
+ | number | ||
+ | If SECONDS is unset, it loses its special properties, even if it | ||
+ | is subsequently reset. | ||
+ | |||
+ | | ||
+ | A colon-separated | ||
+ | the list is a valid argument | ||
+ | builtin command (see SHELL BUILTIN COMMANDS below). | ||
+ | appearing in SHELLOPTS are those reported as on by set -o. If | ||
+ | this variable | ||
+ | shell option in the list will be enabled | ||
+ | startup files. | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | startup. | ||
+ | |||
+ | The following variables are used by the shell. | ||
+ | | ||
+ | |||
+ | | ||
+ | If this parameter is set when bash is executing a shell script, | ||
+ | its value is interpreted as a filename | ||
+ | initialize the shell, as in ~/ | ||
+ | subjected to parameter | ||
+ | arithmetic | ||
+ | PATH is not used to search for the resultant file name. | ||
+ | | ||
+ | list of directories | ||
+ | directories specified by the cd command. | ||
+ | " | ||
+ | | ||
+ | Used by the select | ||
+ | width when printing selection | ||
+ | receipt of a SIGWINCH. | ||
+ | | ||
+ | An array variable from which bash reads the possible completions | ||
+ | generated by a shell function invoked by the programmable | ||
+ | pletion facility (see Programmable Completion below). | ||
+ | | ||
+ | starts with value " | ||
+ | an emacs shell buffer and disables line editing. | ||
+ | | ||
+ | | ||
+ | A colon-separated | ||
+ | filename completion (see READLINE below). | ||
+ | fix matches | ||
+ | list of matched filenames. | ||
+ | | ||
+ | A colon-separated list of patterns defining the set of filenames | ||
+ | to be ignored by pathname expansion. | ||
+ | pathname expansion pattern also matches one of the patterns | ||
+ | GLOBIGNORE, it is removed from the list of matches. | ||
+ | | ||
+ | A colon-separated | ||
+ | saved on the history list. | ||
+ | ignorespace, | ||
+ | saved in the history list. A value of ignoredups | ||
+ | matching the previous history entry to not be saved. | ||
+ | ignoreboth is shorthand for ignorespace and ignoredups. | ||
+ | of erasedups causes all previous lines matching the current line | ||
+ | to be removed from the history list before that line is saved. | ||
+ | Any value not in the above list is ignored. | ||
+ | unset, or does not include a valid value, all lines read by the | ||
+ | shell parser are saved on the history list, subject to the value | ||
+ | of HISTIGNORE. | ||
+ | compound | ||
+ | regardless of the value of HISTCONTROL. | ||
+ | | ||
+ | The name of the file in which command history is saved (see HIS- | ||
+ | TORY below). | ||
+ | the command history is not saved when an interactive | ||
+ | exits. | ||
+ | | ||
+ | The maximum number of lines contained in the history file. When | ||
+ | this variable is assigned a value, the history | ||
+ | cated, | ||
+ | no more than that number of lines. | ||
+ | The history file is also truncated to this size after writing it | ||
+ | when an interactive shell exits. | ||
+ | | ||
+ | A colon-separated list of patterns used to decide which command | ||
+ | lines should | ||
+ | anchored at the beginning of the line and must match the com- | ||
+ | plete line (no implicit | ||
+ | tested against the line after the checks specified | ||
+ | TROL are applied. | ||
+ | matching characters, `&' | ||
+ | may be escaped | ||
+ | before attempting a match. | ||
+ | multi-line compound command are not tested, and are added to the | ||
+ | history regardless of the value of HISTIGNORE. | ||
+ | | ||
+ | The number of commands to remember in the command | ||
+ | HISTORY below). | ||
+ | | ||
+ | If this variable | ||
+ | format string for strftime(3) to print the time stamp associated | ||
+ | with each history | ||
+ | this variable is set, time stamps are written | ||
+ | file so they may be preserved across shell sessions. | ||
+ | | ||
+ | the cd builtin command. | ||
+ | when performing tilde expansion. | ||
+ | | ||
+ | Contains | ||
+ | that should be read when the shell needs to complete a hostname. | ||
+ | The list of possible hostname completions may be changed while | ||
+ | the shell is running; | ||
+ | attempted | ||
+ | the new file to the existing list. If HOSTFILE is set, but has | ||
+ | no value, bash attempts to read /etc/hosts to obtain the list of | ||
+ | possible hostname completions. | ||
+ | hostname list is cleared. | ||
+ | | ||
+ | after expansion and to split lines into words with the read | ||
+ | builtin | ||
+ | line>'' | ||
+ | | ||
+ | Controls the action of an interactive shell on receipt of an EOF | ||
+ | character as the sole input. | ||
+ | consecutive EOF characters which must be typed as the first | ||
+ | characters | ||
+ | exists but does not have a numeric value, or has no value, | ||
+ | default | ||
+ | end of input to the shell. | ||
+ | | ||
+ | The filename for the readline | ||
+ | default of ~/.inputrc (see READLINE below). | ||
+ | | ||
+ | specifically selected with a variable starting with LC_. | ||
+ | | ||
+ | variable specifying a locale category. | ||
+ | | ||
+ | This variable | ||
+ | the results of pathname expansion, and determines | ||
+ | of | ||
+ | sequences within pathname expansion and pattern matching. | ||
+ | | ||
+ | This variable determines the interpretation | ||
+ | the behavior of character classes within pathname expansion and | ||
+ | pattern matching. | ||
+ | | ||
+ | This variable determines the locale used to translate | ||
+ | quoted strings preceded by a $. | ||
+ | | ||
+ | This variable | ||
+ | formatting. | ||
+ | | ||
+ | length | ||
+ | receipt of a SIGWINCH. | ||
+ | | ||
+ | able is not set, bash informs the user of the arrival of mail in | ||
+ | the specified file. | ||
+ | | ||
+ | Specifies how often (in seconds) | ||
+ | default | ||
+ | shell does so before displaying the primary | ||
+ | variable | ||
+ | greater than or equal to zero, the shell disables mail checking. | ||
+ | | ||
+ | A colon-separated | ||
+ | The message to be printed when mail arrives in a particular file | ||
+ | may be specified | ||
+ | with a `?' | ||
+ | the name of the current mailfile. | ||
+ | MAILPATH='/ | ||
+ | mail!"' | ||
+ | Bash supplies a default value for this variable, but the loca- | ||
+ | tion of the user mail files that it uses is system dependent | ||
+ | (e.g., / | ||
+ | | ||
+ | the getopts builtin command (see SHELL BUILTIN COMMANDS below). | ||
+ | OPTERR is initialized to 1 each time the shell is invoked | ||
+ | shell script is executed. | ||
+ | | ||
+ | directories in which the shell looks for commands | ||
+ | EXECUTION | ||
+ | value of PATH indicates the current directory. | ||
+ | name may appear | ||
+ | trailing colon. | ||
+ | set by the administrator who installs bash. A common value is | ||
+ | ``/ | ||
+ | | ||
+ | If this variable is in the environment | ||
+ | shell enters posix mode before reading the startup files, as if | ||
+ | the --posix invocation option had been supplied. | ||
+ | while the shell is running, bash enables posix mode, as if the | ||
+ | command set -o posix had been executed. | ||
+ | | ||
+ | If set, the value is executed as a command prior to issuing each | ||
+ | primary prompt. | ||
+ | | ||
+ | and used as the primary prompt string. | ||
+ | ``\s-\v\$ '' | ||
+ | | ||
+ | the secondary prompt string. | ||
+ | | ||
+ | command (see SHELL GRAMMAR above). | ||
+ | | ||
+ | value is printed before each command | ||
+ | execution | ||
+ | tiple times, as necessary, to indicate multiple levels of indi- | ||
+ | rection. | ||
+ | | ||
+ | able. If it is not set when the shell starts, bash assigns | ||
+ | it the full pathname of the current user's login shell. | ||
+ | | ||
+ | The value of this parameter is used as a format string specify- | ||
+ | ing how the timing information for pipelines prefixed | ||
+ | time reserved word should be displayed. | ||
+ | duces an escape sequence that is expanded to a time value or | ||
+ | other information. | ||
+ | as follows; the braces denote optional portions. | ||
+ | %% A literal %. | ||
+ | %[p][l]R | ||
+ | %[p][l]U | ||
+ | %[p][l]S | ||
+ | %P The CPU percentage, computed as (%U + %S) / %R. | ||
+ | |||
+ | The optional p is a digit specifying the precision, | ||
+ | of fractional digits after a decimal point. | ||
+ | no decimal point or fraction to be output. | ||
+ | after the decimal | ||
+ | than 3 are changed to 3. If p is not specified, the value 3 is | ||
+ | used. | ||
+ | |||
+ | The optional l specifies a longer format, including minutes, of | ||
+ | the form MMmSS.FFs. | ||
+ | the fraction is included. | ||
+ | |||
+ | If this variable | ||
+ | $' | ||
+ | timing | ||
+ | when the format string is displayed. | ||
+ | |||
+ | | ||
+ | default timeout for the read builtin. | ||
+ | nates if input does not arrive after TMOUT seconds when input is | ||
+ | coming | ||
+ | interpreted as the number of seconds to wait for input after | ||
+ | issuing | ||
+ | that number of seconds if input does not arrive. | ||
+ | |||
+ | | ||
+ | Bash creates temporary files for the shell' | ||
+ | |||
+ | | ||
+ | This variable controls how the shell interacts with the user and | ||
+ | job control. | ||
+ | mands without redirections are treated as candidates for resump- | ||
+ | tion of an existing stopped job. There is no ambiguity allowed; | ||
+ | if there is more than one job beginning with the string typed, | ||
+ | the job most recently accessed | ||
+ | stopped | ||
+ | it. If set to the value exact, the string supplied | ||
+ | the name of a stopped | ||
+ | string supplied needs to match a substring | ||
+ | stopped | ||
+ | gous to the %? job identifier (see JOB CONTROL below). | ||
+ | to any other value, the supplied string must be a prefix of a | ||
+ | stopped job's name; this provides functionality analogous to the | ||
+ | %string job identifier. | ||
+ | |||
+ | | ||
+ | The two or three characters which control history expansion and | ||
+ | tokenization (see HISTORY EXPANSION below). | ||
+ | is the history expansion character, the character which signals | ||
+ | the start of a history | ||
+ | character | ||
+ | shorthand for re-running the previous command | ||
+ | tuting | ||
+ | `^' | ||
+ | cates that the remainder of the line is a comment when found as | ||
+ | the first character of a word, normally `#' | ||
+ | ment character causes history substitution to be skipped for the | ||
+ | remaining words on the line. It does not necessarily cause the | ||
+ | shell parser to treat the rest of the line as a comment. | ||
+ | |||
+ | | ||
+ | | ||
+ | used as an array; the declare builtin will explicitly declare an array. | ||
+ | | ||
+ | that members be indexed or assigned contiguously. | ||
+ | using integers and are zero-based. | ||
+ | |||
+ | | ||
+ | the syntax name[subscript]=value. | ||
+ | | ||
+ | equal to zero. To explicitly declare an array, | ||
+ | (see SHELL BUILTIN COMMANDS below). | ||
+ | | ||
+ | array variable using the declare and readonly builtins. | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | of the element assigned is the last index assigned to by the statement | ||
+ | | ||
+ | the declare builtin. | ||
+ | using the name[subscript]=value syntax introduced above. | ||
+ | |||
+ | | ||
+ | The braces are required to avoid conflicts with pathname expansion. | ||
+ | | ||
+ | | ||
+ | the word is double-quoted, | ||
+ | value of each array member separated by the first character of the IFS | ||
+ | | ||
+ | arate word. When there are no array members, | ||
+ | | ||
+ | | ||
+ | | ||
+ | with the last part of the original word. | ||
+ | | ||
+ | | ||
+ | | ||
+ | ments in the array. | ||
+ | is equivalent to referencing element zero. | ||
+ | |||
+ | | ||
+ | | ||
+ | avoid unwanted side effects caused by filename generation. | ||
+ | where name is an array, or unset name[subscript], | ||
+ | or @, removes the entire array. | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | |||
+ | |||
+ | EXPANSION | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | tion, arithmetic expansion, word splitting, and pathname expansion. | ||
+ | |||
+ | The order of expansions is: brace expansion, tilde expansion, | ||
+ | | ||
+ | in a left-to-right fashion), word splitting, and pathname expansion. | ||
+ | |||
+ | On systems that can support it, there is an additional expansion avail- | ||
+ | able: process substitution. | ||
+ | |||
+ | Only brace expansion, word splitting, and pathname expansion can change | ||
+ | the number of words of the expansion; other expansions expand a single | ||
+ | | ||
+ | of " | ||
+ | |||
+ | Brace Expansion | ||
+ | Brace expansion is a mechanism by which arbitrary strings may be gener- | ||
+ | | ||
+ | names generated need not exist. | ||
+ | form of an optional preamble, followed by either a series of comma-sep- | ||
+ | | ||
+ | | ||
+ | | ||
+ | to each resulting string, expanding left to right. | ||
+ | |||
+ | | ||
+ | are not sorted; | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | ters are supplied, the expression expands | ||
+ | | ||
+ | of the same type. | ||
+ | |||
+ | Brace expansion is performed before any other expansions, and any char- | ||
+ | | ||
+ | | ||
+ | the context of the expansion or the text between the braces. | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | A { or , may be quoted with a backslash to prevent its being considered | ||
+ | | ||
+ | sion, the string ${ is not considered eligible for brace expansion. | ||
+ | |||
+ | This construct is typically used as shorthand when the common prefix of | ||
+ | the strings to be generated is longer than in the above example: | ||
+ | |||
+ | mkdir / | ||
+ | or | ||
+ | chown root / | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | Bash removes braces from words as a consequence | ||
+ | | ||
+ | the output. | ||
+ | | ||
+ | +B option or disable brace expansion with the +B option to the set com- | ||
+ | mand (see SHELL BUILTIN COMMANDS below). | ||
+ | |||
+ | Tilde Expansion | ||
+ | | ||
+ | | ||
+ | | ||
+ | the characters in the tilde-prefix are quoted, the characters | ||
+ | | ||
+ | If this login name is the null string, the tilde is replaced | ||
+ | | ||
+ | tory of the user executing the shell is substituted | ||
+ | | ||
+ | with the specified login name. | ||
+ | |||
+ | If the tilde-prefix is a `~+', the value of the shell variable | ||
+ | | ||
+ | the shell variable OLDPWD, if it is set, is substituted. | ||
+ | | ||
+ | | ||
+ | with the corresponding element from the directory stack, as it would be | ||
+ | | ||
+ | | ||
+ | sist of a number without a leading `+' or `-', `+' is assumed. | ||
+ | |||
+ | If the login name is invalid, or the tilde expansion fails, the word is | ||
+ | | ||
+ | |||
+ | Each variable assignment is checked for unquoted tilde-prefixes immedi- | ||
+ | ately following a : or the first =. In these cases, tilde expansion is | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | The `$' character introduces parameter expansion, command substitution, | ||
+ | or arithmetic expansion. | ||
+ | | ||
+ | | ||
+ | could be interpreted as part of the name. | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | The value of parameter is substituted. | ||
+ | when parameter | ||
+ | digit, or when parameter is followed by a character which is not | ||
+ | to be interpreted as part of its name. | ||
+ | |||
+ | If the first character of parameter is an exclamation point, a level of | ||
+ | | ||
+ | | ||
+ | this variable is then expanded and that value is used in the rest of | ||
+ | | ||
+ | known as indirect expansion. | ||
+ | | ||
+ | must immediately follow the left brace in order to introduce | ||
+ | tion. | ||
+ | |||
+ | In each of the cases below, word is subject to tilde expansion, parame- | ||
+ | ter expansion, command substitution, | ||
+ | | ||
+ | unset or null; omitting the colon results in a test only for a parame- | ||
+ | ter that is unset. | ||
+ | |||
+ | | ||
+ | Use Default | ||
+ | sion of word is substituted. | ||
+ | is substituted. | ||
+ | | ||
+ | Assign | ||
+ | expansion of word is assigned to parameter. | ||
+ | eter is then substituted. | ||
+ | parameters may not be assigned to in this way. | ||
+ | | ||
+ | Display Error if Null or Unset. | ||
+ | the expansion | ||
+ | not present) is written to the standard error and the shell, | ||
+ | it is not interactive, | ||
+ | is substituted. | ||
+ | | ||
+ | Use Alternate Value. | ||
+ | substituted, | ||
+ | | ||
+ | | ||
+ | Substring | ||
+ | parameter starting at the character | ||
+ | length | ||
+ | ing at the character specified by offset. | ||
+ | arithmetic | ||
+ | length must evaluate to a number greater than or equal to zero. | ||
+ | If offset | ||
+ | used as an offset from the end of the value of parameter. | ||
+ | parameter | ||
+ | beginning at offset. | ||
+ | or *, the result is the length members of the array beginning | ||
+ | with ${parameter[offset]}. | ||
+ | to one greater | ||
+ | Note that a negative offset must be separated from the colon by | ||
+ | at least one space to avoid being confused with the :- expan- | ||
+ | sion. Substring indexing is zero-based | ||
+ | parameters are used, in which case the indexing starts at 1. | ||
+ | |||
+ | | ||
+ | | ||
+ | Expands to the names of variables whose names begin with prefix, | ||
+ | separated by the first character of the IFS special variable. | ||
+ | |||
+ | | ||
+ | | ||
+ | If name is an array variable, | ||
+ | indices | ||
+ | expands to 0 if name is set and null otherwise. | ||
+ | and the expansion appears within double quotes, each key expands | ||
+ | to a separate word. | ||
+ | |||
+ | | ||
+ | The length in characters of the value of parameter | ||
+ | tuted. | ||
+ | number of positional parameters. | ||
+ | subscripted | ||
+ | elements in the array. | ||
+ | |||
+ | | ||
+ | | ||
+ | The word is expanded to produce a pattern just as in pathname | ||
+ | expansion. | ||
+ | parameter, then the result of the expansion | ||
+ | value of parameter with the shortest matching pattern (the ``#'' | ||
+ | case) or the longest matching pattern (the ``##'' | ||
+ | If parameter is @ or *, the pattern removal operation is applied | ||
+ | to each positional parameter in turn, and the expansion | ||
+ | resultant | ||
+ | with @ or *, the pattern removal operation is applied | ||
+ | member | ||
+ | list. | ||
+ | |||
+ | | ||
+ | | ||
+ | The word is expanded to produce a pattern just as in pathname | ||
+ | expansion. | ||
+ | expanded value of parameter, then the result of the expansion is | ||
+ | the expanded value of parameter with the shortest matching pat- | ||
+ | tern (the ``%'' | ||
+ | ``%%'' | ||
+ | removal operation is applied to each positional | ||
+ | turn, and the expansion is the resultant list. If parameter is | ||
+ | an array variable subscripted with @ or *, the pattern | ||
+ | operation | ||
+ | the expansion is the resultant list. | ||
+ | |||
+ | | ||
+ | The pattern is expanded to produce a pattern just as in pathname | ||
+ | expansion. | ||
+ | tern against its value is replaced | ||
+ | begins | ||
+ | Normally only the first match is replaced. | ||
+ | with #, it must match at the beginning of the expanded value of | ||
+ | parameter. | ||
+ | of the expanded value of parameter. | ||
+ | of pattern are deleted and the / following pattern may be omit- | ||
+ | ted. | ||
+ | applied to each positional parameter in turn, and the expansion | ||
+ | is the resultant list. If parameter is an array variable sub- | ||
+ | scripted with @ or *, the substitution operation is applied | ||
+ | each member | ||
+ | resultant list. | ||
+ | |||
+ | | ||
+ | | ||
+ | mand name. There are two forms: | ||
+ | |||
+ | |||
+ | $(command) | ||
+ | or | ||
+ | `command` | ||
+ | |||
+ | Bash performs the expansion by executing command and replacing the com- | ||
+ | mand substitution with the standard output of the command, | ||
+ | | ||
+ | may be removed during word splitting. | ||
+ | file) can be replaced by the equivalent but faster $(< file). | ||
+ | |||
+ | | ||
+ | | ||
+ | first backquote not preceded by a backslash terminates the command sub- | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | form, escape the inner backquotes with backslashes. | ||
+ | |||
+ | If the substitution appears within double quotes, | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | and the substitution of the result. | ||
+ | sion is: | ||
+ | |||
+ | $((expression)) | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | put connected to a FIFO or some file in / | ||
+ | | ||
+ | | ||
+ | | ||
+ | an argument should be read to obtain the output of list. | ||
+ | |||
+ | When available, process substitution is performed | ||
+ | | ||
+ | | ||
+ | |||
+ | Word Splitting | ||
+ | The shell scans the results of parameter expansion, | ||
+ | | ||
+ | for word splitting. | ||
+ | |||
+ | The shell treats each character of IFS as a delimiter, and splits | ||
+ | | ||
+ | is unset, or its value is exactly < | ||
+ | | ||
+ | has a value other than the default, then sequences | ||
+ | | ||
+ | word, as long as the whitespace character is in the value of IFS (an | ||
+ | IFS whitespace character). | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | null arguments, resulting from the expansion of parameters that have no | ||
+ | | ||
+ | | ||
+ | |||
+ | Note that if no expansion occurs, no splitting is performed. | ||
+ | |||
+ | | ||
+ | | ||
+ | each word for the characters *, ?, and [. If one of these characters | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | glob, and dotglob shell options. | ||
+ | |||
+ | The GLOBIGNORE shell variable may be used to restrict the set of file | ||
+ | | ||
+ | name that also matches one of the patterns | ||
+ | from the list of matches. | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | make ``.*'' | ||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | Any character that appears in a pattern, other than the special pattern | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | The special pattern characters have the following meanings: | ||
+ | |||
+ | | ||
+ | ? | ||
+ | | ||
+ | ters separated by a hyphen denotes a range expression; any char- | ||
+ | acter that sorts between those two characters, inclusive, using | ||
+ | the current locale' | ||
+ | matched. | ||
+ | then any character not enclosed is matched. | ||
+ | of characters in range expressions is determined by the current | ||
+ | locale and the value of the LC_COLLATE shell variable, | ||
+ | A - may be matched by including it as the first or last charac- | ||
+ | ter in the set. A ] may be matched by including it as the first | ||
+ | character in the set. | ||
+ | |||
+ | Within | ||
+ | syntax [:class:], where class is one of the following | ||
+ | defined in the POSIX standard: | ||
+ | alnum alpha ascii blank cntrl digit graph lower print punct | ||
+ | space upper word xdigit | ||
+ | A character class matches any character belonging to that class. | ||
+ | The word character class matches letters, digits, and the char- | ||
+ | acter _. | ||
+ | |||
+ | Within [ and ], an equivalence class can be specified using the | ||
+ | syntax | ||
+ | tion weight (as defined by the current locale) as the character | ||
+ | c. | ||
+ | |||
+ | Within [ and ], the syntax [.symbol.] matches the collating sym- | ||
+ | bol symbol. | ||
+ | |||
+ | If the extglob shell option is enabled using the shopt builtin, several | ||
+ | | ||
+ | | ||
+ | by a |. Composite patterns may be formed using one or more of the fol- | ||
+ | | ||
+ | |||
+ | ? | ||
+ | | ||
+ | *(pattern-list) | ||
+ | | ||
+ | +(pattern-list) | ||
+ | | ||
+ | @(pattern-list) | ||
+ | | ||
+ | !(pattern-list) | ||
+ | | ||
+ | |||
+ | Quote Removal | ||
+ | After the preceding expansions, all unquoted occurrences of the charac- | ||
+ | | ||
+ | are removed. | ||
+ | |||
+ | |||
+ | |||
+ | REDIRECTION | ||
+ | |||
+ | | ||
+ | | ||
+ | also be used to open and close files for the current | ||
+ | | ||
+ | | ||
+ | are processed in the order they appear, from left to right. | ||
+ | |||
+ | | ||
+ | ted, and the first character of the redirection operator is <, the re- | ||
+ | | ||
+ | first character of the redirection | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | sion, quote removal, pathname expansion, and word splitting. | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | ls > dirlist 2>&1 | ||
+ | |||
+ | | ||
+ | while the command | ||
+ | |||
+ | ls 2>&1 > dirlist | ||
+ | |||
+ | | ||
+ | error was duplicated as standard output before the standard output | ||
+ | | ||
+ | |||
+ | Bash handles several filenames specially when they are used in redirec- | ||
+ | | ||
+ | |||
+ | /dev/fd/fd | ||
+ | If fd is a valid integer, file descriptor | ||
+ | | ||
+ | /dev/stdin | ||
+ | File descriptor 0 is duplicated. | ||
+ | /dev/stdout | ||
+ | File descriptor 1 is duplicated. | ||
+ | /dev/stderr | ||
+ | File descriptor 2 is duplicated. | ||
+ | / | ||
+ | If host is a valid hostname or Internet address, and port | ||
+ | is an integer port number or service name, bash attempts | ||
+ | to open a TCP connection to the corresponding socket. | ||
+ | / | ||
+ | If host is a valid hostname or Internet address, and port | ||
+ | is an integer port number or service name, bash attempts | ||
+ | to open a UDP connection to the corresponding socket. | ||
+ | |||
+ | A failure to open or create a file causes the redirection to fail. | ||
+ | |||
+ | | ||
+ | care, as they may conflict with file descriptors the shell uses inter- | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | sion of word to be opened for reading on file descriptor | ||
+ | | ||
+ | |||
+ | The general format for redirecting input is: | ||
+ | |||
+ | [n]<word | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | does not exist it is created; if it does exist it is truncated to zero | ||
+ | size. | ||
+ | |||
+ | The general format for redirecting output is: | ||
+ | |||
+ | [n]>word | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | If the redirection operator is >|, or the redirection operator is > and | ||
+ | the noclobber option to the set builtin command is not enabled, the re- | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | The general format for appending output is: | ||
+ | |||
+ | [n]>> | ||
+ | |||
+ | |||
+ | | ||
+ | | ||
+ | dard error output (file descriptor 2) to be redirected | ||
+ | whose name is the expansion of word with this construct. | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | &> | ||
+ | and | ||
+ | >& | ||
+ | |||
+ | Of the two forms, the first is preferred. | ||
+ | lent to | ||
+ | |||
+ | >word 2>&1 | ||
+ | |||
+ | Here Documents | ||
+ | | ||
+ | | ||
+ | | ||
+ | as the standard input for a command. | ||
+ | |||
+ | The format of here-documents is: | ||
+ | |||
+ | << | ||
+ | here-document | ||
+ | delimiter | ||
+ | |||
+ | No parameter expansion, command substitution, | ||
+ | | ||
+ | | ||
+ | | ||
+ | lines of the here-document are subjected to parameter | ||
+ | | ||
+ | | ||
+ | the characters \, $, and `. | ||
+ | |||
+ | If the redirection operator is <<-, then all leading tab characters are | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | Here Strings | ||
+ | A variant of here documents, the format is: | ||
+ | |||
+ | <<< | ||
+ | |||
+ | The word is expanded and supplied to the command on its standard input. | ||
+ | |||
+ | | ||
+ | The redirection operator | ||
+ | |||
+ | [n]<& | ||
+ | |||
+ | is used to duplicate input file descriptors. | ||
+ | more digits, the file descriptor denoted by n is made to be a copy of | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | The operator | ||
+ | |||
+ | [n]>& | ||
+ | |||
+ | is used similarly to duplicate output file descriptors. | ||
+ | | ||
+ | | ||
+ | | ||
+ | does not expand to one or more digits, the standard output and standard | ||
+ | error are redirected as described previously. | ||
+ | |||
+ | | ||
+ | The redirection operator | ||
+ | |||
+ | [n]<& | ||
+ | |||
+ | | ||
+ | input (file descriptor 0) if n is not specified. | ||
+ | being duplicated to n. | ||
+ | |||
+ | | ||
+ | |||
+ | [n]>& | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | The redirection operator | ||
+ | |||
+ | [n]<> | ||
+ | |||
+ | | ||
+ | | ||
+ | if n is not specified. | ||
+ | |||
+ | |||
+ | |||
+ | ALIASES | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | $, `, and = and any of the shell metacharacters or quoting | ||
+ | | ||
+ | | ||
+ | | ||
+ | that is identical to an alias being expanded is not expanded | ||
+ | | ||
+ | bash does not try to recursively expand the replacement text. | ||
+ | | ||
+ | word following the alias is also checked for alias expansion. | ||
+ | |||
+ | | ||
+ | the unalias command. | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | shopt under SHELL BUILTIN COMMANDS below). | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | not take effect until the next line of input is read. | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | pound command. | ||
+ | | ||
+ | | ||
+ | pound commands. | ||
+ | |||
+ | For almost every purpose, aliases are superseded by shell functions. | ||
+ | |||
+ | |||
+ | |||
+ | FUNCTIONS | ||
+ | |||
+ | A shell function, defined | ||
+ | | ||
+ | shell function is used as a simple command name, the list of commands | ||
+ | | ||
+ | in the context of the current shell; | ||
+ | | ||
+ | When a function is executed, the arguments to the function | ||
+ | | ||
+ | | ||
+ | | ||
+ | tion while the function is executing. | ||
+ | | ||
+ | with the exception that the DEBUG and RETURN traps (see the description | ||
+ | | ||
+ | ited unless the function has been given the trace attribute | ||
+ | | ||
+ | | ||
+ | tions inherit the DEBUG and RETURN traps). | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | set will list the function names only (and optionally the source | ||
+ | | ||
+ | may be exported so that subshells automatically have them defined | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | |||
+ | |||
+ | ARITHMETIC EVALUATION | ||
+ | |||
+ | The shell allows arithmetic expressions to be evaluated, under certain | ||
+ | | ||
+ | | ||
+ | | ||
+ | The operators and their precedence, associativity, | ||
+ | | ||
+ | into levels of equal-precedence operators. | ||
+ | order of decreasing precedence. | ||
+ | |||
+ | id++ id-- | ||
+ | variable post-increment and post-decrement | ||
+ | ++id --id | ||
+ | variable pre-increment and pre-decrement | ||
+ | - + unary minus and plus | ||
+ | ! ~ logical and bitwise negation | ||
+ | | ||
+ | * / % multiplication, | ||
+ | + - addition, subtraction | ||
+ | << | ||
+ | <= >= < > | ||
+ | comparison | ||
+ | == != equality and inequality | ||
+ | & | ||
+ | | ||
+ | | ||
+ | && | ||
+ | | ||
+ | | ||
+ | conditional operator | ||
+ | = *= /= %= += -= <<= >>= &= ^= |= | ||
+ | assignment | ||
+ | expr1 , expr2 | ||
+ | comma | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | 0 when referenced by name without using the parameter expansion syntax. | ||
+ | The value of a variable is evaluated as an arithmetic | ||
+ | | ||
+ | | ||
+ | | ||
+ | to be used in an expression. | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | the arithmetic base, and n is a number in that base. If base# is omit- | ||
+ | ted, then base 10 is used. The digits greater than 9 are represented | ||
+ | | ||
+ | | ||
+ | | ||
+ | 35. | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | |||
+ | |||
+ | CONDITIONAL EXPRESSIONS | ||
+ | |||
+ | | ||
+ | | ||
+ | and arithmetic comparisons. | ||
+ | | ||
+ | | ||
+ | | ||
+ | / | ||
+ | is checked. | ||
+ | |||
+ | | ||
+ | bolic links and operate on the target of the link, rather than the link | ||
+ | | ||
+ | |||
+ | -a file | ||
+ | True if file exists. | ||
+ | -b file | ||
+ | True if file exists and is a block special file. | ||
+ | -c file | ||
+ | True if file exists and is a character special file. | ||
+ | -d file | ||
+ | True if file exists and is a directory. | ||
+ | -e file | ||
+ | True if file exists. | ||
+ | -f file | ||
+ | True if file exists and is a regular file. | ||
+ | -g file | ||
+ | True if file exists and is set-group-id. | ||
+ | -h file | ||
+ | True if file exists and is a symbolic link. | ||
+ | -k file | ||
+ | True if file exists and its ``sticky'' | ||
+ | -p file | ||
+ | True if file exists and is a named pipe (FIFO). | ||
+ | -r file | ||
+ | True if file exists and is readable. | ||
+ | -s file | ||
+ | True if file exists and has a size greater than zero. | ||
+ | -t fd True if file descriptor fd is open and refers to a terminal. | ||
+ | -u file | ||
+ | True if file exists and its set-user-id bit is set. | ||
+ | -w file | ||
+ | True if file exists and is writable. | ||
+ | -x file | ||
+ | True if file exists and is executable. | ||
+ | -O file | ||
+ | True if file exists and is owned by the effective user id. | ||
+ | -G file | ||
+ | True if file exists and is owned by the effective group id. | ||
+ | -L file | ||
+ | True if file exists and is a symbolic link. | ||
+ | -S file | ||
+ | True if file exists and is a socket. | ||
+ | -N file | ||
+ | True if file exists | ||
+ | read. | ||
+ | file1 -nt file2 | ||
+ | True if file1 is newer (according | ||
+ | file2, or if file1 exists and file2 does not. | ||
+ | file1 -ot file2 | ||
+ | True if file1 is older than file2, or if file2 exists and file1 | ||
+ | does not. | ||
+ | file1 -ef file2 | ||
+ | True if file1 and file2 refer to the same device and inode num- | ||
+ | bers. | ||
+ | -o optname | ||
+ | True if shell option | ||
+ | options under the description | ||
+ | builtin below. | ||
+ | -z string | ||
+ | True if the length of string is zero. | ||
+ | | ||
+ | -n string | ||
+ | True if the length of string is non-zero. | ||
+ | |||
+ | | ||
+ | True if the strings are equal. | ||
+ | strict POSIX compliance. | ||
+ | |||
+ | | ||
+ | True if the strings are not equal. | ||
+ | |||
+ | | ||
+ | True if string1 sorts before string2 | ||
+ | current locale. | ||
+ | |||
+ | | ||
+ | True if string1 | ||
+ | current locale. | ||
+ | |||
+ | arg1 OP arg2 | ||
+ | OP is one of -eq, -ne, -lt, -le, -gt, or -ge. These arithmetic | ||
+ | binary | ||
+ | less than, less than or equal to, greater than, or greater | ||
+ | or equal to arg2, respectively. | ||
+ | or negative integers. | ||
+ | |||
+ | |||
+ | |||
+ | SIMPLE COMMAND EXPANSION | ||
+ | |||
+ | When a simple command is executed, the shell performs | ||
+ | | ||
+ | |||
+ | | ||
+ | (those preceding the command name) and redirections | ||
+ | for later processing. | ||
+ | |||
+ | | ||
+ | expanded. | ||
+ | is taken to be the name of the command and the remaining words | ||
+ | are the arguments. | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | expansion, parameter expansion, command substitution, | ||
+ | expansion, | ||
+ | able. | ||
+ | |||
+ | If no command name results, the variable assignments affect the current | ||
+ | | ||
+ | ment of the executed command and do not affect the current shell envi- | ||
+ | | ||
+ | | ||
+ | zero status. | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | is the exit status of the last command | ||
+ | there were no command substitutions, | ||
+ | zero. | ||
+ | |||
+ | |||
+ | |||
+ | COMMAND EXECUTION | ||
+ | |||
+ | After a command has been split into words, if it results | ||
+ | | ||
+ | | ||
+ | |||
+ | If the command name contains no slashes, the shell attempts | ||
+ | | ||
+ | | ||
+ | | ||
+ | a match is found, that builtin is invoked. | ||
+ | |||
+ | If the name is neither a shell function nor a builtin, and contains | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | an exit status of 127. | ||
+ | |||
+ | | ||
+ | more slashes, the shell executes the named program in a separate execu- | ||
+ | tion environment. | ||
+ | ing arguments to the command are set to the arguments given, if any. | ||
+ | |||
+ | If this execution fails because the file is not in executable | ||
+ | | ||
+ | file containing shell commands. | ||
+ | | ||
+ | shell had been invoked to handle the script, with the exception | ||
+ | | ||
+ | under SHELL BUILTIN COMMANDS) are retained by the child. | ||
+ | |||
+ | If the program is a file beginning with #!, the remainder of the first | ||
+ | | ||
+ | | ||
+ | | ||
+ | a single optional argument following the interpreter name on the first | ||
+ | | ||
+ | the command arguments, if any. | ||
+ | |||
+ | |||
+ | |||
+ | COMMAND EXECUTION ENVIRONMENT | ||
+ | |||
+ | The shell has an execution environment, | ||
+ | ing: | ||
+ | |||
+ | |||
+ | | ||
+ | redirections supplied to the exec builtin | ||
+ | |||
+ | | ||
+ | inherited by the shell at invocation | ||
+ | |||
+ | | ||
+ | the shell' | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | or inherited from the shell' | ||
+ | |||
+ | | ||
+ | shell' | ||
+ | |||
+ | | ||
+ | mand-line arguments) or by set | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | value of $$, and the value of $PPID | ||
+ | |||
+ | When a simple command other than a builtin or shell function is to be | ||
+ | | ||
+ | sists of the following. | ||
+ | ited from the shell. | ||
+ | |||
+ | |||
+ | | ||
+ | specified by redirections to the command | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | variables exported for the command, passed in the environment | ||
+ | |||
+ | | ||
+ | the shell' | ||
+ | |||
+ | A command invoked | ||
+ | | ||
+ | |||
+ | | ||
+ | nous commands are invoked in a subshell environment that is a duplicate | ||
+ | | ||
+ | reset to the values that the shell inherited from its parent at invoca- | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | |||
+ | |||
+ | ENVIRONMENT | ||
+ | |||
+ | When a program is invoked it is given an array of strings | ||
+ | | ||
+ | | ||
+ | |||
+ | The shell provides several ways to manipulate | ||
+ | | ||
+ | for each name found, automatically marking it for export to child pro- | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | any additions via the export and declare -x commands. | ||
+ | |||
+ | The environment for any simple command or function | ||
+ | | ||
+ | above in PARAMETERS. | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | just those that precede the command name. | ||
+ | |||
+ | | ||
+ | full file name of the command and passed to that command in its envi- | ||
+ | | ||
+ | |||
+ | |||
+ | |||
+ | EXIT STATUS | ||
+ | |||
+ | For the shell' | ||
+ | has succeeded. | ||
+ | | ||
+ | | ||
+ | |||
+ | If a command is not found, the child process | ||
+ | | ||
+ | the return status is 126. | ||
+ | |||
+ | If a command fails because of an error during expansion or redirection, | ||
+ | the exit status is greater than zero. | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | |||
+ | |||
+ | SIGNALS | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | all cases, bash ignores SIGQUIT. | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | these inherited handlers. | ||
+ | | ||
+ | TOU, and SIGTSTP. | ||
+ | |||
+ | The shell exits by default upon receipt of a SIGHUP. | ||
+ | | ||
+ | | ||
+ | | ||
+ | job, it should be removed from the jobs table with the disown | ||
+ | | ||
+ | using disown -h. | ||
+ | |||
+ | If the huponexit shell option has been set with shopt, | ||
+ | | ||
+ | |||
+ | | ||
+ | which a trap has been set, the trap will not be executed until the com- | ||
+ | | ||
+ | the wait builtin, the reception of a signal for which a trap has been | ||
+ | set will cause the wait builtin to return immediately with an exit sta- | ||
+ | tus greater than 128, immediately after which the trap is executed. | ||
+ | |||
+ | |||
+ | |||
+ | JOB CONTROL | ||
+ | |||
+ | Job control refers to the ability to selectively | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | line that looks like: | ||
+ | |||
+ | [1] 25647 | ||
+ | |||
+ | | ||
+ | last process in the pipeline associated with this job is 25647. | ||
+ | the processes in a single pipeline are members of the same job. Bash | ||
+ | uses the job abstraction as the basis for job control. | ||
+ | |||
+ | | ||
+ | the operating system maintains the notion of a current terminal process | ||
+ | group ID. Members of this process group (processes whose process group | ||
+ | ID is equal to the current terminal process group ID) receive keyboard- | ||
+ | | ||
+ | the foreground. | ||
+ | | ||
+ | | ||
+ | write to the terminal. | ||
+ | | ||
+ | minal driver, which, unless caught, suspends the process. | ||
+ | |||
+ | | ||
+ | bash contains facilities to use it. Typing the suspend character (typ- | ||
+ | | ||
+ | be stopped and returns control to bash. | ||
+ | | ||
+ | when it attempts to read input from the terminal, | ||
+ | | ||
+ | using the bg command to continue it in the background, the fg command | ||
+ | to continue it in the foreground, or the kill command to kill it. A ^Z | ||
+ | takes effect immediately, | ||
+ | | ||
+ | |||
+ | There are a number of ways to refer to a job in the shell. | ||
+ | ter % introduces a job name. Job number n may be referred to as %n. A | ||
+ | | ||
+ | it, or using a substring that appears in its command line. | ||
+ | ple, %ce refers to a stopped ce job. If a prefix matches more than one | ||
+ | job, bash reports an error. | ||
+ | any job containing the string ce in its command line. If the substring | ||
+ | | ||
+ | | ||
+ | job stopped while it was in the foreground | ||
+ | | ||
+ | | ||
+ | | ||
+ | (with no accompanying job specification) also refers | ||
+ | job. | ||
+ | |||
+ | | ||
+ | a synonym for ``fg %1'', | ||
+ | | ||
+ | | ||
+ | |||
+ | The shell learns immediately whenever a job changes | ||
+ | bash waits until it is about to print a prompt before reporting changes | ||
+ | in a job's status so as to not interrupt any other output. | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | their status. | ||
+ | ing command, the shell does not print another warning, and the stopped | ||
+ | jobs are terminated. | ||
+ | |||
+ | |||
+ | |||
+ | PROMPTING | ||
+ | |||
+ | When executing interactively, | ||
+ | it is ready to read a command, and the secondary | ||
+ | | ||
+ | | ||
+ | | ||
+ | \a an ASCII bell character (07) | ||
+ | \d | ||
+ | | ||
+ | \D{format} | ||
+ | the format is passed to strftime(3) | ||
+ | | ||
+ | in a locale-specific time representation. | ||
+ | | ||
+ | \e an ASCII escape character (033) | ||
+ | \h the hostname up to the first `.' | ||
+ | \H the hostname | ||
+ | \j the number of jobs currently managed by the shell | ||
+ | \l the basename of the shell' | ||
+ | \n | ||
+ | \r | ||
+ | \s | ||
+ | | ||
+ | \t the current time in 24-hour HH:MM:SS format | ||
+ | \T the current time in 12-hour HH:MM:SS format | ||
+ | \@ the current time in 12-hour am/pm format | ||
+ | \A the current time in 24-hour HH:MM format | ||
+ | \u the username of the current user | ||
+ | \v the version of bash (e.g., 2.00) | ||
+ | \V the release of bash, version + patch level (e.g., 2.00.0) | ||
+ | \w | ||
+ | with a tilde | ||
+ | \W the basename of the current working directory, with $HOME | ||
+ | | ||
+ | \! the history number of this command | ||
+ | \# the command number of this command | ||
+ | \$ if the effective UID is 0, a #, otherwise a $ | ||
+ | \nnn the character corresponding to the octal number nnn | ||
+ | \\ a backslash | ||
+ | \[ | ||
+ | be used to embed a terminal | ||
+ | | ||
+ | \] end a sequence of non-printing characters | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | is decoded, it is expanded via parameter expansion, | ||
+ | | ||
+ | the promptvars shell option (see the description of the shopt command | ||
+ | under SHELL BUILTIN COMMANDS below). | ||
+ | |||
+ | |||
+ | |||
+ | READLINE | ||
+ | |||
+ | | ||
+ | tive shell, unless the --noediting option is given at shell invocation. | ||
+ | By default, the line editing commands are similar to those of emacs. | ||
+ | | ||
+ | | ||
+ | to the set builtin (see SHELL BUILTIN COMMANDS below). | ||
+ | |||
+ | | ||
+ | In this section, the emacs-style notation is used to denote keystrokes. | ||
+ | | ||
+ | | ||
+ | | ||
+ | then the x key. This makes ESC the meta prefix. | ||
+ | | ||
+ | while pressing the x key.) | ||
+ | |||
+ | | ||
+ | | ||
+ | that is significant. | ||
+ | | ||
+ | act in a backward direction. | ||
+ | | ||
+ | |||
+ | | ||
+ | for possible future retrieval (yanking). | ||
+ | kill ring. Consecutive kills cause the text to be accumulated into one | ||
+ | unit, which can be yanked all at once. Commands which do not kill text | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | (the inputrc file). | ||
+ | | ||
+ | | ||
+ | the initialization file is read, and the key bindings and variables are | ||
+ | | ||
+ | | ||
+ | # are comments. | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | For example, placing | ||
+ | |||
+ | M-Control-u: | ||
+ | or | ||
+ | C-Meta-u: universal-argument | ||
+ | | ||
+ | | ||
+ | |||
+ | The following symbolic character names are recognized: | ||
+ | ESC, LFD, NEWLINE, RET, RETURN, SPC, SPACE, and TAB. | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | The syntax for controlling key bindings in the inputrc file is simple. | ||
+ | | ||
+ | and a key sequence to which it should be bound. The name may be speci- | ||
+ | fied in one of two ways: as a symbolic key name, possibly with Meta- or | ||
+ | | ||
+ | |||
+ | When using the form keyname: | ||
+ | of a key spelled out in English. | ||
+ | |||
+ | Control-u: universal-argument | ||
+ | Meta-Rubout: | ||
+ | Control-o: "> output" | ||
+ | |||
+ | | ||
+ | M-DEL is bound to the function backward-kill-word, | ||
+ | | ||
+ | text ``> output'' | ||
+ | |||
+ | In the second form, " | ||
+ | | ||
+ | be specified by placing the sequence within double | ||
+ | | ||
+ | the symbolic character names are not recognized. | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | |||
+ | In this example, C-u is again bound to the function universal-argument. | ||
+ | | ||
+ | bound to insert the text ``Function Key 1'' | ||
+ | |||
+ | The full set of GNU Emacs style escape sequences is | ||
+ | \C- control prefix | ||
+ | \M- meta prefix | ||
+ | \e an escape character | ||
+ | \\ | ||
+ | \" | ||
+ | \' | ||
+ | |||
+ | In addition to the GNU Emacs style escape sequences, a second | ||
+ | | ||
+ | \a alert (bell) | ||
+ | \b | ||
+ | \d | ||
+ | \f form feed | ||
+ | \n | ||
+ | \r | ||
+ | \t | ||
+ | \v | ||
+ | \nnn | ||
+ | nnn (one to three digits) | ||
+ | \xHH the eight-bit character whose value is the hexadecimal | ||
+ | value HH (one or two hex digits) | ||
+ | |||
+ | When entering the text of a macro, single or double quotes must be used | ||
+ | to indicate a macro definition. | ||
+ | | ||
+ | are expanded. | ||
+ | text, including " and '. | ||
+ | |||
+ | | ||
+ | fied with the bind builtin command. | ||
+ | | ||
+ | mand (see SHELL BUILTIN COMMANDS below). | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | form | ||
+ | |||
+ | set variable-name value | ||
+ | |||
+ | | ||
+ | | ||
+ | When a variable value is read, empty or null values, " | ||
+ | | ||
+ | to Off. The variables and their default values are: | ||
+ | |||
+ | | ||
+ | Controls what happens when readline wants to ring the terminal | ||
+ | bell. If set to none, readline never rings the bell. If set to | ||
+ | visible, readline uses a visible bell if one is available. | ||
+ | set to audible, readline attempts to ring the terminal' | ||
+ | | ||
+ | If set to On, readline attempts to bind the control characters | ||
+ | treated specially by the kernel' | ||
+ | line equivalents. | ||
+ | | ||
+ | The string | ||
+ | command is executed. | ||
+ | and to # in vi command mode. | ||
+ | | ||
+ | If set to On, readline performs filename matching and completion | ||
+ | in a case-insensitive fashion. | ||
+ | | ||
+ | This determines when the user is queried about viewing the num- | ||
+ | ber of possible | ||
+ | tions command. | ||
+ | or equal to zero. | ||
+ | greater than or equal to the value of this variable, the user is | ||
+ | asked whether or not he wishes to view them; otherwise they are | ||
+ | simply listed on the terminal. | ||
+ | | ||
+ | If set to On, readline will convert characters with the eighth | ||
+ | bit set to an ASCII key sequence by stripping the eighth bit and | ||
+ | prefixing an escape character (in effect, using escape | ||
+ | meta prefix). | ||
+ | | ||
+ | If set to On, readline will inhibit word completion. | ||
+ | characters will be inserted into the line as if they had been | ||
+ | mapped to self-insert. | ||
+ | | ||
+ | Controls whether readline begins with a set of key bindings sim- | ||
+ | ilar to emacs or vi. editing-mode can be set to either emacs or | ||
+ | vi. | ||
+ | | ||
+ | When set to On, readline will try to enable the application key- | ||
+ | pad when it is called. | ||
+ | arrow keys. | ||
+ | | ||
+ | If set to on, tilde expansion | ||
+ | attempts word completion. | ||
+ | | ||
+ | If set to on, the history code attempts to place point at the | ||
+ | same location on each history line retrieved with previous-his- | ||
+ | tory or next-history. | ||
+ | | ||
+ | When set to On, makes readline use a single | ||
+ | scrolling the input horizontally on a single screen line when it | ||
+ | becomes longer than the screen width rather than wrapping | ||
+ | new line. | ||
+ | | ||
+ | If set to On, readline will enable eight-bit input (that is, it | ||
+ | will not strip the high bit from the characters | ||
+ | regardless of what the terminal claims it can support. | ||
+ | meta-flag is a synonym for this variable. | ||
+ | | ||
+ | The string of characters that should | ||
+ | search | ||
+ | mand. If this variable has not been given a value, the charac- | ||
+ | ters ESC and C-J will terminate an incremental search. | ||
+ | | ||
+ | Set the current readline keymap. | ||
+ | is emacs, emacs-standard, | ||
+ | mand, and vi-insert. | ||
+ | equivalent to emacs-standard. | ||
+ | value of editing-mode also affects the default keymap. | ||
+ | | ||
+ | If set to On, completed directory names have a slash appended. | ||
+ | | ||
+ | If set to On, history lines that have been modified are dis- | ||
+ | played with a preceding asterisk (*). | ||
+ | | ||
+ | If set to On, completed names which are symbolic links to direc- | ||
+ | tories | ||
+ | mark-directories). | ||
+ | | ||
+ | This variable, when set to On, causes readline | ||
+ | whose names begin with a `.' (hidden files) when performing | ||
+ | filename completion, unless the leading `.' is supplied | ||
+ | user in the filename to be completed. | ||
+ | | ||
+ | If set to On, readline will display characters with the eighth | ||
+ | bit set directly rather than as a meta-prefixed escape sequence. | ||
+ | | ||
+ | If set to On, readline uses an internal more-like pager to dis- | ||
+ | play a screenful of possible completions at a time. | ||
+ | | ||
+ | If set to On, readline will display | ||
+ | sorted | ||
+ | screen. | ||
+ | | ||
+ | This alters the default behavior of the completion | ||
+ | If set to on, words which have more than one possible completion | ||
+ | cause the matches to be listed immediately | ||
+ | the bell. | ||
+ | | ||
+ | This alters the default behavior of the completion functions in | ||
+ | a fashion similar to show-all-if-ambiguous. | ||
+ | which have more than one possible completion without any possi- | ||
+ | ble partial completion (the possible completions don' | ||
+ | common | ||
+ | instead of ringing the bell. | ||
+ | | ||
+ | If set to On, a character denoting a file's type as reported | ||
+ | stat(2) | ||
+ | pletions. | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | and variable settings to be performed as the result | ||
+ | are four parser directives used. | ||
+ | |||
+ | | ||
+ | ing mode, the terminal being used, or the application | ||
+ | readline. | ||
+ | no characters are required to isolate it. | ||
+ | |||
+ | mode The mode= form of the $if directive | ||
+ | | ||
+ | used in conjunction with the set keymap | ||
+ | | ||
+ | | ||
+ | emacs mode. | ||
+ | |||
+ | term | ||
+ | key bindings, perhaps to bind the key sequences output by | ||
+ | the terminal' | ||
+ | of the = is tested against the both full name of the ter- | ||
+ | | ||
+ | first -. This allows sun to match both sun and sun-cmd, | ||
+ | for instance. | ||
+ | |||
+ | application | ||
+ | The application construct is used to include application- | ||
+ | | ||
+ | | ||
+ | file can test for a particular value. | ||
+ | | ||
+ | | ||
+ | | ||
+ | Bash: | ||
+ | |||
+ | $if Bash | ||
+ | # Quote the current or previous word | ||
+ | " | ||
+ | | ||
+ | |||
+ | | ||
+ | command. | ||
+ | |||
+ | | ||
+ | test fails. | ||
+ | |||
+ | | ||
+ | This directive takes a single filename as an argument and reads | ||
+ | commands | ||
+ | ing directive would read / | ||
+ | |||
+ | $include | ||
+ | |||
+ | | ||
+ | | ||
+ | (see HISTORY below) for lines containing a specified string. | ||
+ | two search modes: incremental and non-incremental. | ||
+ | |||
+ | | ||
+ | | ||
+ | line displays the next entry from the history matching the string typed | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | To find other matching entries in the history list, type Control-S | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | nate the search and accept the line, thereby executing the command from | ||
+ | the history list. | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | by the user or be part of the contents of the current line. | ||
+ | |||
+ | | ||
+ | The following is a list of the names of the commands | ||
+ | key sequences to which they are bound. | ||
+ | | ||
+ | | ||
+ | a cursor position saved by the set-mark command. | ||
+ | point and mark is referred to as the region. | ||
+ | |||
+ | | ||
+ | | ||
+ | Move to the start of the current line. | ||
+ | | ||
+ | Move to the end of the line. | ||
+ | | ||
+ | Move forward a character. | ||
+ | | ||
+ | Move back a character. | ||
+ | | ||
+ | Move forward to the end of the next word. Words are composed of | ||
+ | alphanumeric characters (letters and digits). | ||
+ | | ||
+ | Move back to the start of the current or previous | ||
+ | are composed of alphanumeric characters (letters and digits). | ||
+ | | ||
+ | Clear the screen | ||
+ | screen. | ||
+ | clearing the screen. | ||
+ | | ||
+ | Refresh the current line. | ||
+ | |||
+ | | ||
+ | | ||
+ | Accept the line regardless of where the cursor is. If this line | ||
+ | is non-empty, add it to the history list according to the state | ||
+ | of the HISTCONTROL variable. | ||
+ | line, then restore the history line to its original state. | ||
+ | | ||
+ | Fetch the previous command from the history list, moving back in | ||
+ | the list. | ||
+ | | ||
+ | Fetch the next command from the history list, moving forward in | ||
+ | the list. | ||
+ | | ||
+ | Move to the first line in the history. | ||
+ | | ||
+ | Move to the end of the input history, i.e., the line currently | ||
+ | being entered. | ||
+ | | ||
+ | Search | ||
+ | through the history | ||
+ | search. | ||
+ | | ||
+ | Search | ||
+ | through the history | ||
+ | search. | ||
+ | | ||
+ | Search backward through the history starting at the current line | ||
+ | using a non-incremental search for a string | ||
+ | user. | ||
+ | | ||
+ | Search | ||
+ | search for a string supplied by the user. | ||
+ | | ||
+ | Search forward through the history for the string of characters | ||
+ | between | ||
+ | non-incremental search. | ||
+ | | ||
+ | Search backward through the history for the string of characters | ||
+ | between | ||
+ | non-incremental search. | ||
+ | | ||
+ | Insert the first argument to the previous command | ||
+ | second word on the previous line) at point. | ||
+ | insert the nth word from the previous command (the words in the | ||
+ | previous | ||
+ | inserts the nth word from the end of the previous command. | ||
+ | the argument n is computed, the argument is extracted as if the | ||
+ | " | ||
+ | | ||
+ | Insert the last argument to the previous command (the last word | ||
+ | of the previous | ||
+ | exactly like yank-nth-arg. | ||
+ | move back through the history list, inserting the last argument | ||
+ | of each line in turn. The history expansion facilities are used | ||
+ | to extract | ||
+ | had been specified. | ||
+ | | ||
+ | Expand the line as the shell does. This performs alias and his- | ||
+ | tory expansion as well as all of the shell word expansions. | ||
+ | HISTORY EXPANSION below for a description of history | ||
+ | | ||
+ | Perform | ||
+ | EXPANSION below for a description of history expansion. | ||
+ | | ||
+ | Perform history expansion on the current | ||
+ | space. | ||
+ | expansion. | ||
+ | | ||
+ | Perform alias expansion on the current line. See ALIASES | ||
+ | for a description of alias expansion. | ||
+ | | ||
+ | Perform history and alias expansion on the current line. | ||
+ | | ||
+ | A synonym for yank-last-arg. | ||
+ | | ||
+ | Accept | ||
+ | relative to the current line from the history for editing. | ||
+ | argument is ignored. | ||
+ | | ||
+ | Invoke | ||
+ | result as shell commands. | ||
+ | $EDITOR, and emacs as the editor, in that order. | ||
+ | |||
+ | | ||
+ | | ||
+ | Delete | ||
+ | the line, there are no characters in the line, and the last | ||
+ | character typed was not bound to delete-char, | ||
+ | | ||
+ | Delete | ||
+ | argument, save the deleted text on the kill ring. | ||
+ | | ||
+ | Delete the character under the cursor, unless the cursor | ||
+ | the end of the line, in which case the character behind the cur- | ||
+ | sor is deleted. | ||
+ | | ||
+ | Add the next character typed to the line verbatim. | ||
+ | to insert characters like C-q, for example. | ||
+ | | ||
+ | Insert a tab character. | ||
+ | | ||
+ | Insert the character typed. | ||
+ | | ||
+ | Drag the character | ||
+ | point, moving point forward as well. If point is at the end of | ||
+ | the line, then this transposes the two characters before point. | ||
+ | Negative arguments have no effect. | ||
+ | | ||
+ | Drag the word before point past the word after point, | ||
+ | point over that word as well. If point is at the end of the | ||
+ | line, this transposes the last two words on the line. | ||
+ | | ||
+ | Uppercase the current (or following) | ||
+ | argument, uppercase the previous word, but do not move point. | ||
+ | | ||
+ | Lowercase | ||
+ | argument, lowercase the previous word, but do not move point. | ||
+ | | ||
+ | Capitalize the current (or following) | ||
+ | argument, capitalize the previous word, but do not move point. | ||
+ | | ||
+ | Toggle | ||
+ | ment, switches to overwrite mode. With an explicit non-positive | ||
+ | numeric argument, switches to insert mode. This command affects | ||
+ | only emacs mode; vi mode does overwrite differently. | ||
+ | to readline() starts in insert mode. In overwrite mode, charac- | ||
+ | ters bound to self-insert replace the text at point rather | ||
+ | pushing | ||
+ | ward-delete-char replace | ||
+ | space. | ||
+ | |||
+ | | ||
+ | | ||
+ | Kill the text from point to the end of the line. | ||
+ | | ||
+ | Kill backward to the beginning of the line. | ||
+ | | ||
+ | Kill backward | ||
+ | killed text is saved on the kill-ring. | ||
+ | | ||
+ | Kill all characters on the current line, no matter | ||
+ | is. | ||
+ | | ||
+ | Kill from point to the end of the current word, or if between | ||
+ | words, to the end of the next word. | ||
+ | same as those used by forward-word. | ||
+ | | ||
+ | Kill the word behind | ||
+ | those used by backward-word. | ||
+ | | ||
+ | Kill the word behind point, using white space as a word bound- | ||
+ | ary. The killed text is saved on the kill-ring. | ||
+ | | ||
+ | Kill the word behind | ||
+ | character as the word boundaries. | ||
+ | the kill-ring. | ||
+ | | ||
+ | Delete all spaces and tabs around point. | ||
+ | | ||
+ | Kill the text in the current region. | ||
+ | | ||
+ | Copy the text in the region to the kill buffer. | ||
+ | | ||
+ | Copy the word before point to the kill buffer. | ||
+ | aries are the same as backward-word. | ||
+ | | ||
+ | Copy the word following point to the kill buffer. | ||
+ | boundaries are the same as forward-word. | ||
+ | yank (C-y) | ||
+ | Yank the top of the kill ring into the buffer at point. | ||
+ | | ||
+ | Rotate | ||
+ | ing yank or yank-pop. | ||
+ | |||
+ | | ||
+ | | ||
+ | Add this digit to the argument already accumulating, | ||
+ | new argument. | ||
+ | | ||
+ | This is another way to specify an argument. | ||
+ | followed by one or more digits, optionally with a leading | ||
+ | sign, those digits define the argument. | ||
+ | lowed by digits, executing | ||
+ | numeric | ||
+ | if this command is immediately followed by a character | ||
+ | neither | ||
+ | command is multiplied by four. The argument count is initially | ||
+ | one, so executing this function the first time makes the argu- | ||
+ | ment count four, a second time makes the argument count sixteen, | ||
+ | and so on. | ||
+ | |||
+ | | ||
+ | | ||
+ | Attempt | ||
+ | attempts completion treating the text as a variable (if the text | ||
+ | begins | ||
+ | (if the text begins with @), or command (including | ||
+ | functions) in turn. If none of these produces a match, filename | ||
+ | completion is attempted. | ||
+ | | ||
+ | List the possible completions of the text before point. | ||
+ | | ||
+ | Insert all completions of the text before point that would have | ||
+ | been generated by possible-completions. | ||
+ | | ||
+ | Similar | ||
+ | a single match from the list of possible completions. | ||
+ | execution | ||
+ | completions, | ||
+ | list of completions, | ||
+ | bell-style) and the original text is restored. | ||
+ | moves n positions | ||
+ | argument may be used to move backward through | ||
+ | command | ||
+ | default. | ||
+ | | ||
+ | Deletes the character under the cursor if not at the beginning | ||
+ | or end of the line (like delete-char). | ||
+ | line, behaves identically to possible-completions. | ||
+ | is unbound by default. | ||
+ | | ||
+ | Attempt filename completion on the text before point. | ||
+ | | ||
+ | List the possible completions of the text before point, treating | ||
+ | it as a filename. | ||
+ | | ||
+ | Attempt completion on the text before point, treating | ||
+ | username. | ||
+ | | ||
+ | List the possible completions of the text before point, treating | ||
+ | it as a username. | ||
+ | | ||
+ | Attempt completion on the text before point, treating | ||
+ | shell variable. | ||
+ | | ||
+ | List the possible completions of the text before point, treating | ||
+ | it as a shell variable. | ||
+ | | ||
+ | Attempt completion on the text before point, treating | ||
+ | hostname. | ||
+ | | ||
+ | List the possible completions of the text before point, treating | ||
+ | it as a hostname. | ||
+ | | ||
+ | Attempt completion on the text before point, treating | ||
+ | command | ||
+ | against | ||
+ | builtins, and finally executable filenames, in that order. | ||
+ | | ||
+ | List the possible completions of the text before point, treating | ||
+ | it as a command name. | ||
+ | | ||
+ | Attempt completion on the text before point, comparing the text | ||
+ | against | ||
+ | matches. | ||
+ | | ||
+ | Perform filename completion and insert the list of possible com- | ||
+ | pletions | ||
+ | shell (see Brace Expansion above). | ||
+ | |||
+ | | ||
+ | | ||
+ | Begin saving the characters | ||
+ | macro. | ||
+ | | ||
+ | Stop saving the characters typed into the current keyboard macro | ||
+ | and store the definition. | ||
+ | | ||
+ | Re-execute the last keyboard macro defined, by making the char- | ||
+ | acters in the macro appear as if typed at the keyboard. | ||
+ | |||
+ | | ||
+ | | ||
+ | Read in the contents of the inputrc file, and incorporate any | ||
+ | bindings or variable assignments found there. | ||
+ | abort (C-g) | ||
+ | Abort the current editing command and ring the terminal' | ||
+ | (subject to the setting of bell-style). | ||
+ | | ||
+ | If the metafied character x is lowercase, run the command that | ||
+ | is bound to the corresponding uppercase character. | ||
+ | | ||
+ | Metafy the next character typed. | ||
+ | undo (C-_, C-x C-u) | ||
+ | Incremental undo, separately remembered for each line. | ||
+ | | ||
+ | Undo all changes made to this line. This is like executing the | ||
+ | undo command enough times to return | ||
+ | state. | ||
+ | | ||
+ | Perform tilde expansion on the current word. | ||
+ | | ||
+ | Set the mark to the point. | ||
+ | the mark is set to that position. | ||
+ | | ||
+ | Swap the point with the mark. The current | ||
+ | set to the saved position, and the old cursor position is saved | ||
+ | as the mark. | ||
+ | | ||
+ | A character is read and point is moved to the next occurrence of | ||
+ | that character. | ||
+ | rences. | ||
+ | | ||
+ | A character is read and point is moved to the previous | ||
+ | rence of that character. | ||
+ | quent occurrences. | ||
+ | | ||
+ | Without a numeric argument, | ||
+ | ment-begin | ||
+ | line. If a numeric argument is supplied, this command acts as a | ||
+ | toggle: | ||
+ | match the value of comment-begin, | ||
+ | wise the characters in comment-begin are deleted from the begin- | ||
+ | ning of the line. In either case, the line is accepted as if a | ||
+ | newline | ||
+ | causes this command to make the current line a shell comment. | ||
+ | If a numeric | ||
+ | removed, the line will be executed by the shell. | ||
+ | | ||
+ | The word before point is treated | ||
+ | expansion, | ||
+ | is used to generate a list of matching file names for possible | ||
+ | completions. | ||
+ | | ||
+ | The word before | ||
+ | expansion, and the list of matching | ||
+ | replacing | ||
+ | asterisk is appended before pathname expansion. | ||
+ | | ||
+ | The list of expansions | ||
+ | glob-expand-word | ||
+ | numeric argument is supplied, an asterisk | ||
+ | pathname expansion. | ||
+ | | ||
+ | Print all of the functions and their key bindings to the read- | ||
+ | line output stream. | ||
+ | put is formatted | ||
+ | inputrc file. | ||
+ | | ||
+ | Print all of the settable readline variables and their values to | ||
+ | the readline output stream. | ||
+ | the output is formatted in such a way that it can be made part | ||
+ | of an inputrc file. | ||
+ | | ||
+ | Print all of the readline key sequences bound to macros and the | ||
+ | strings they output. | ||
+ | output is formatted in such a way that it can be made part of an | ||
+ | inputrc file. | ||
+ | | ||
+ | Display version information about the current instance of bash. | ||
+ | |||
+ | | ||
+ | | ||
+ | which a completion specification (a compspec) has been defined | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | for that command, the compspec is used to generate the list of possible | ||
+ | | ||
+ | | ||
+ | is found for the full pathname, an attempt is made to find a compspec | ||
+ | for the portion following the final slash. | ||
+ | |||
+ | | ||
+ | | ||
+ | tion as described above under Completing is performed. | ||
+ | |||
+ | | ||
+ | which are prefixed by the word being completed are returned. | ||
+ | | ||
+ | shell variable FIGNORE is used to filter the matches. | ||
+ | |||
+ | Any completions specified by a filename expansion | ||
+ | | ||
+ | match the word being completed. | ||
+ | used to filter the matches, but the FIGNORE variable is used. | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | then expanded using brace expansion, | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | also set. When the function or command is invoked, the first argument | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | Any function specified with -F is invoked first. | ||
+ | | ||
+ | | ||
+ | in the COMPREPLY array variable. | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | used to escape a newline, if necessary. | ||
+ | |||
+ | After all of the possible completions are generated, any filter | ||
+ | | ||
+ | tern as used for pathname expansion; a & in the pattern | ||
+ | | ||
+ | with a backslash; the backslash is removed before attempting | ||
+ | | ||
+ | A leading ! negates the pattern; in this case any completion not match- | ||
+ | ing the pattern will be removed. | ||
+ | |||
+ | | ||
+ | added to each member of the completion list, and the result is returned | ||
+ | to the readline completion code as the list of possible completions. | ||
+ | |||
+ | | ||
+ | -o dirnames option was supplied | ||
+ | | ||
+ | |||
+ | | ||
+ | was defined, directory name completion is attempted and any matches are | ||
+ | added to the results of the other actions. | ||
+ | |||
+ | | ||
+ | to the completion code as the full set of possible | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | if attempted, the default bash completions) generate no matches. | ||
+ | |||
+ | | ||
+ | the programmable completion functions force readline to append a slash | ||
+ | | ||
+ | the value of the mark-directories readline variable, regardless of the | ||
+ | | ||
+ | |||
+ | |||
+ | |||
+ | HISTORY | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | of the shell variables HISTIGNORE and HISTCONTROL. | ||
+ | |||
+ | On startup, the history is initialized from the file named by the vari- | ||
+ | | ||
+ | of HISTFILE is truncated, if necessary, to contain | ||
+ | | ||
+ | | ||
+ | tory list to $HISTFILE. | ||
+ | the description of shopt under SHELL BUILTIN COMMANDS below), the lines | ||
+ | | ||
+ | | ||
+ | | ||
+ | is truncated to contain no more than HISTFILESIZE lines. | ||
+ | SIZE is not set, no truncation is performed. | ||
+ | |||
+ | | ||
+ | to list or edit and re-execute a portion of the history list. The his- | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | The shell allows control over which commands are saved on the history | ||
+ | | ||
+ | shell to save only a subset of the commands entered. | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | |||
+ | |||
+ | HISTORY EXPANSION | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | mand (see SHELL BUILTIN COMMANDS below). | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | read, before the shell breaks it into words. | ||
+ | | ||
+ | use during substitution. | ||
+ | for inclusion into the current one. The line selected from the history | ||
+ | is the event, and the portions of that line that are acted upon are | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | line is being used, history substitutions are not immediately passed to | ||
+ | the shell parser. | ||
+ | | ||
+ | used, and the histreedit shell option is enabled, a failed history sub- | ||
+ | | ||
+ | | ||
+ | what a history expansion will do before using it. The -s option to the | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | The shell allows control of the various characters used by the history | ||
+ | | ||
+ | | ||
+ | |||
+ | Event Designators | ||
+ | An event designator is a reference to a command line entry in the his- | ||
+ | tory list. | ||
+ | |||
+ | | ||
+ | newline, carriage return, = or ( (when the extglob shell option | ||
+ | is enabled using the shopt builtin). | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | Refer to the most recent command starting with string. | ||
+ | | ||
+ | Refer to the most recent command containing string. | ||
+ | ing ? may be omitted if string is followed immediately by a new- | ||
+ | line. | ||
+ | | ||
+ | Quick substitution. | ||
+ | with string2. | ||
+ | ifiers below). | ||
+ | | ||
+ | |||
+ | Word Designators | ||
+ | | ||
+ | | ||
+ | | ||
+ | are numbered from the beginning of the line, with the first word being | ||
+ | | ||
+ | rated by single spaces. | ||
+ | |||
+ | 0 (zero) | ||
+ | The zeroth word. For the shell, this is the command word. | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | It is not an error to use * if there is just one word in the | ||
+ | event; the empty string is returned in that case. | ||
+ | | ||
+ | | ||
+ | |||
+ | If a word designator is supplied without an event specification, | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | or more of the following modifiers, each preceded by a `:'. | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | blanks and newlines. | ||
+ | | ||
+ | Substitute new for the first occurrence | ||
+ | line. | ||
+ | delimiter is optional if it is the last character of the event | ||
+ | line. The delimiter may be quoted in old and new with a single | ||
+ | backslash. | ||
+ | gle backslash | ||
+ | the last old substituted, | ||
+ | tions took place, the last string in a !? | ||
+ | & | ||
+ | | ||
+ | used in conjunction with `:s' (e.g., | ||
+ | If used with `:s', any delimiter can be used in place of /, and | ||
+ | the final delimiter is optional if it is the last character | ||
+ | the event line. An a may be used as a synonym for g. | ||
+ | | ||
+ | line. | ||
+ | |||
+ | |||
+ | |||
+ | SHELL BUILTIN COMMANDS | ||
+ | |||
+ | | ||
+ | as accepting options preceded by - accepts -- to signify the end of the | ||
+ | | ||
+ | | ||
+ | : [arguments] | ||
+ | No effect; | ||
+ | and performing any specified redirections. | ||
+ | returned. | ||
+ | |||
+ | . filename [arguments] | ||
+ | | ||
+ | Read and execute | ||
+ | environment and return the exit status of the last command | ||
+ | cuted from filename. | ||
+ | names in PATH are used to find the directory | ||
+ | name. | ||
+ | When bash is not in posix mode, the current | ||
+ | searched | ||
+ | to the shopt builtin command is turned | ||
+ | searched. | ||
+ | tional parameters when filename | ||
+ | positional | ||
+ | status of the last command exited within the script | ||
+ | commands | ||
+ | cannot be read. | ||
+ | |||
+ | alias [-p] [name[=value] ...] | ||
+ | Alias with no arguments or with the -p option prints the list of | ||
+ | aliases | ||
+ | arguments are supplied, an alias is defined for each name whose | ||
+ | value is given. | ||
+ | to be checked for alias substitution when the alias is expanded. | ||
+ | For each name in the argument list for which no value is sup- | ||
+ | plied, the name and value of the alias is printed. | ||
+ | returns | ||
+ | defined. | ||
+ | |||
+ | bg [jobspec ...] | ||
+ | Resume each suspended job jobspec in the background, | ||
+ | had been started with & | ||
+ | notion of the current job is used. bg jobspec returns 0 unless | ||
+ | run when job control is disabled or, when run with job control | ||
+ | enabled, any specified jobspec was not found or was started | ||
+ | without job control. | ||
+ | |||
+ | bind [-m keymap] [-lpsvPSV] | ||
+ | bind [-m keymap] [-q function] [-u function] [-r keyseq] | ||
+ | bind [-m keymap] -f filename | ||
+ | bind [-m keymap] -x keyseq: | ||
+ | bind [-m keymap] keyseq: | ||
+ | bind readline-command | ||
+ | Display | ||
+ | sequence to a readline function or macro, | ||
+ | variable. | ||
+ | appear in .inputrc, but each binding or command must be passed | ||
+ | as a separate argument; e.g., '" | ||
+ | Options, if supplied, have the following meanings: | ||
+ | -m keymap | ||
+ | Use keymap as the keymap to be affected by the subsequent | ||
+ | | ||
+ | dard, emacs-meta, emacs-ctlx, | ||
+ | | ||
+ | | ||
+ | -l List the names of all readline functions. | ||
+ | -p | ||
+ | way that they can be re-read. | ||
+ | -P List current readline function names and bindings. | ||
+ | -v | ||
+ | that they can be re-read. | ||
+ | -V List current readline variable names and values. | ||
+ | -s | ||
+ | | ||
+ | read. | ||
+ | -S | ||
+ | | ||
+ | -f filename | ||
+ | Read key bindings from filename. | ||
+ | -q function | ||
+ | Query about which keys invoke the named function. | ||
+ | -u function | ||
+ | | ||
+ | -r keyseq | ||
+ | | ||
+ | -x keyseq: | ||
+ | | ||
+ | | ||
+ | |||
+ | The return value is 0 unless an unrecognized option is given or | ||
+ | an error occurred. | ||
+ | |||
+ | break [n] | ||
+ | Exit from within a for, while, until, or select loop. If n is | ||
+ | specified, break n levels. | ||
+ | than the number | ||
+ | exited. | ||
+ | a loop when break is executed. | ||
+ | |||
+ | | ||
+ | Execute | ||
+ | return its exit status. | ||
+ | whose name is the same as a shell builtin, retaining the func- | ||
+ | tionality of the builtin within the function. | ||
+ | commonly | ||
+ | shell-builtin is not a shell builtin command. | ||
+ | |||
+ | cd [-L|-P] [dir] | ||
+ | Change the current directory to dir. The variable HOME is the | ||
+ | default | ||
+ | the directory containing dir. Alternative | ||
+ | CDPATH | ||
+ | CDPATH is the same as the current directory, | ||
+ | dir begins | ||
+ | option says to use the physical directory structure | ||
+ | following | ||
+ | builtin command); the -L option forces symbolic links to be fol- | ||
+ | lowed. | ||
+ | empty directory name from CDPATH is used, or if - is the first | ||
+ | argument, | ||
+ | pathname of the new working directory is written to the standard | ||
+ | output. | ||
+ | fully changed; false otherwise. | ||
+ | |||
+ | | ||
+ | Returns the context of any active subroutine call (a shell func- | ||
+ | tion or a script executed with the . or source builtins. | ||
+ | out expr, caller displays the line number and source filename of | ||
+ | the current subroutine call. If a non-negative integer is sup- | ||
+ | plied as expr, caller displays the line number, subroutine name, | ||
+ | and source | ||
+ | execution call stack. | ||
+ | example, | ||
+ | The return value is 0 unless the shell is not executing | ||
+ | routine | ||
+ | the call stack. | ||
+ | |||
+ | | ||
+ | Run command with args suppressing | ||
+ | lookup. | ||
+ | executed. | ||
+ | performed | ||
+ | find all of the standard utilities. | ||
+ | option is supplied, a description of command is printed. | ||
+ | option causes a single word indicating the command or file name | ||
+ | used to invoke command to be displayed; the -V option produces a | ||
+ | more verbose description. | ||
+ | the exit status | ||
+ | neither option is supplied and an error occurred or command can- | ||
+ | not be found, the exit status is 127. Otherwise, the exit sta- | ||
+ | tus of the command builtin is the exit status of command. | ||
+ | |||
+ | | ||
+ | Generate possible completion matches for word according | ||
+ | options, | ||
+ | builtin with the exception of -p and -r, and write the matches | ||
+ | to the standard | ||
+ | various shell variables | ||
+ | facilities, while available, will not have useful values. | ||
+ | |||
+ | The matches | ||
+ | grammable completion code had generated | ||
+ | completion specification with the same flags. | ||
+ | fied, only those completions matching word will be displayed. | ||
+ | |||
+ | The return value is true unless an invalid option | ||
+ | or no matches were generated. | ||
+ | |||
+ | | ||
+ | | ||
+ | [-X filterpat] [-F function] [-C command] name [name ...] | ||
+ | | ||
+ | Specify | ||
+ | -p option is supplied, or if no options are supplied, | ||
+ | completion | ||
+ | to be reused as input. | ||
+ | ification | ||
+ | pletion specifications. | ||
+ | |||
+ | The process of applying | ||
+ | word completion | ||
+ | grammable Completion. | ||
+ | |||
+ | Other options, if specified, have the following | ||
+ | arguments | ||
+ | -P and -S options) should be quoted to protect them from expan- | ||
+ | sion before the complete builtin is invoked. | ||
+ | -o comp-option | ||
+ | The comp-option | ||
+ | spec's behavior beyond the simple generation of comple- | ||
+ | tions. | ||
+ | bashdefault | ||
+ | Perform the rest of the default bash completions | ||
+ | if the compspec generates no matches. | ||
+ | default Use readline' | ||
+ | the compspec generates no matches. | ||
+ | dirnames | ||
+ | Perform | ||
+ | spec generates no matches. | ||
+ | filenames | ||
+ | Tell readline that the compspec generates | ||
+ | names, | ||
+ | processing (like adding | ||
+ | names or suppressing trailing spaces). | ||
+ | to be used with shell functions. | ||
+ | nospace Tell readline | ||
+ | default) | ||
+ | line. | ||
+ | plusdirs | ||
+ | After any matches defined by the compspec | ||
+ | generated, | ||
+ | attempted and any matches | ||
+ | results of the other actions. | ||
+ | -A action | ||
+ | The action | ||
+ | list of possible completions: | ||
+ | alias Alias names. | ||
+ | arrayvar | ||
+ | Array variable names. | ||
+ | binding Readline key binding names. | ||
+ | builtin Names of shell builtin commands. | ||
+ | specified as -b. | ||
+ | command Command names. | ||
+ | directory | ||
+ | Directory names. | ||
+ | disabled | ||
+ | Names of disabled shell builtins. | ||
+ | enabled Names of enabled shell builtins. | ||
+ | export | ||
+ | specified as -e. | ||
+ | file File names. | ||
+ | function | ||
+ | Names of shell functions. | ||
+ | group Group names. | ||
+ | helptopic | ||
+ | Help topics as accepted by the help builtin. | ||
+ | hostname | ||
+ | Hostnames, as taken from the file specified | ||
+ | the HOSTFILE shell variable. | ||
+ | job | ||
+ | be specified as -j. | ||
+ | keyword Shell reserved words. | ||
+ | -k. | ||
+ | running Names of running jobs, if job control is active. | ||
+ | service Service names. | ||
+ | setopt | ||
+ | builtin. | ||
+ | shopt | ||
+ | builtin. | ||
+ | signal | ||
+ | stopped Names of stopped jobs, if job control is active. | ||
+ | user User names. | ||
+ | variable | ||
+ | Names of all shell variables. | ||
+ | ified as -v. | ||
+ | -G globpat | ||
+ | The filename expansion pattern globpat | ||
+ | generate the possible completions. | ||
+ | -W wordlist | ||
+ | The wordlist | ||
+ | special variable as delimiters, and each resultant | ||
+ | is expanded. | ||
+ | of the resultant list which match the word being com- | ||
+ | pleted. | ||
+ | -C command | ||
+ | command | ||
+ | output is used as the possible completions. | ||
+ | -F function | ||
+ | The shell function function is executed in the current | ||
+ | shell environment. | ||
+ | pletions are retrieved from the value of the COMPREPLY | ||
+ | array variable. | ||
+ | -X filterpat | ||
+ | filterpat | ||
+ | It is applied to the list of possible completions gener- | ||
+ | ated by the preceding options and arguments, and each | ||
+ | completion matching filterpat is removed from the list. | ||
+ | A leading | ||
+ | case, any completion not matching filterpat is removed. | ||
+ | -P prefix | ||
+ | prefix | ||
+ | pletion after all other options have been applied. | ||
+ | -S suffix | ||
+ | suffix is appended to each possible completion after all | ||
+ | other options have been applied. | ||
+ | |||
+ | The return | ||
+ | an option other than -p or -r is supplied without a name argu- | ||
+ | ment, an attempt | ||
+ | for a name for which no specification exists, or an error occurs | ||
+ | adding a completion specification. | ||
+ | |||
+ | | ||
+ | Resume the next iteration of the enclosing for, while, until, or | ||
+ | select loop. If n is specified, resume | ||
+ | loop. | ||
+ | enclosing loops, the last enclosing | ||
+ | loop) is resumed. | ||
+ | executing a loop when continue is executed. | ||
+ | |||
+ | | ||
+ | | ||
+ | Declare variables and/or give them attributes. | ||
+ | given then display the values of variables. | ||
+ | display the attributes and values of each name. | ||
+ | used, additional | ||
+ | the display of function definitions; | ||
+ | attributes are printed. | ||
+ | using shopt, the source file name and line number | ||
+ | function | ||
+ | implies -f. The following options can be used to restrict | ||
+ | put to variables with the specified attribute or to give vari- | ||
+ | ables attributes: | ||
+ | -a Each name is an array variable (see Arrays above). | ||
+ | -f Use function names only. | ||
+ | -i The variable is treated as an integer; arithmetic evalua- | ||
+ | | ||
+ | | ||
+ | -r Make names readonly. | ||
+ | | ||
+ | -t | ||
+ | | ||
+ | | ||
+ | | ||
+ | -x Mark names for export | ||
+ | | ||
+ | |||
+ | Using `+' | ||
+ | the exception that +a may not be used to destroy an array vari- | ||
+ | able. | ||
+ | the local command. | ||
+ | the value of the variable is set to value. | ||
+ | 0 unless an invalid option is encountered, | ||
+ | define | ||
+ | assign a value to a readonly variable, an attempt | ||
+ | assign | ||
+ | assignment syntax (see Arrays above), one of the names is not a | ||
+ | valid shell variable name, an attempt is made to turn off read- | ||
+ | only status for a readonly variable, an attempt is made to turn | ||
+ | off array status for an array variable, or an attempt is made to | ||
+ | display a non-existent function with -f. | ||
+ | |||
+ | dirs [-clpv] [+n] [-n] | ||
+ | Without options, | ||
+ | directories. | ||
+ | directory names separated by spaces. | ||
+ | the list with the pushd command; | ||
+ | entries from the list. | ||
+ | +n | ||
+ | shown by dirs when invoked without options, starting with | ||
+ | zero. | ||
+ | -n | ||
+ | list shown by dirs when invoked without options, starting | ||
+ | with zero. | ||
+ | -c | ||
+ | | ||
+ | -l | ||
+ | uses a tilde to denote the home directory. | ||
+ | -p Print the directory stack with one entry per line. | ||
+ | -v Print the directory stack with one entry per line, pre- | ||
+ | | ||
+ | |||
+ | The return value is 0 unless an invalid option is supplied or n | ||
+ | indexes beyond the end of the directory stack. | ||
+ | |||
+ | | ||
+ | Without options, each jobspec | ||
+ | active | ||
+ | removed from the table, but is marked so that SIGHUP is not sent | ||
+ | to the job if the shell receives a SIGHUP. | ||
+ | present, and neither the -a nor the -r option is supplied, | ||
+ | current | ||
+ | means to remove or mark all jobs; the -r option without | ||
+ | spec argument | ||
+ | value is 0 unless a jobspec does not specify a valid job. | ||
+ | |||
+ | echo [-neE] [arg ...] | ||
+ | Output the args, separated by spaces, | ||
+ | The return status is always 0. If -n is specified, the trailing | ||
+ | newline is suppressed. | ||
+ | tion of the following backslash-escaped characters is enabled. | ||
+ | The -E option disables the interpretation of these escape | ||
+ | acters, | ||
+ | The xpg_echo shell option may be used to dynamically | ||
+ | whether | ||
+ | echo does not interpret -- to mean the end of options. | ||
+ | interprets the following escape sequences: | ||
+ | \a alert (bell) | ||
+ | \b | ||
+ | \c | ||
+ | \e an escape character | ||
+ | \f form feed | ||
+ | \n new line | ||
+ | \r | ||
+ | \t | ||
+ | \v | ||
+ | \\ | ||
+ | \0nnn the eight-bit | ||
+ | nnn (zero to three octal digits) | ||
+ | \xHH the eight-bit character whose value is the hexadecimal | ||
+ | value HH (one or two hex digits) | ||
+ | |||
+ | | ||
+ | Enable | ||
+ | allows a disk command which has the same name as a shell builtin | ||
+ | to be executed without specifying a full pathname, even though | ||
+ | the shell normally searches for builtins before | ||
+ | If -n is used, each name is disabled; otherwise, names are | ||
+ | enabled. | ||
+ | instead | ||
+ | The -f option means to load the new builtin | ||
+ | shared object filename, on systems that support dynamic loading. | ||
+ | The -d option will delete a builtin previously loaded | ||
+ | If no name arguments are given, or if the -p option is supplied, | ||
+ | a list of shell builtins is printed. | ||
+ | ments, | ||
+ | is supplied, only disabled builtins are printed. | ||
+ | plied, | ||
+ | tion of whether or not each is enabled. | ||
+ | output | ||
+ | value is 0 unless a name is not a shell builtin or there is an | ||
+ | error loading a new builtin from a shared object. | ||
+ | |||
+ | eval [arg ...] | ||
+ | The args are read and concatenated together into a single com- | ||
+ | mand. This command is then read and executed by the shell, | ||
+ | its exit status is returned as the value of eval. If there are | ||
+ | no args, or only null arguments, eval returns 0. | ||
+ | |||
+ | exec [-cl] [-a name] [command [arguments]] | ||
+ | If command is specified, it replaces the shell. | ||
+ | is created. | ||
+ | the -l option is supplied, the shell places a dash at the begin- | ||
+ | ning of the zeroth arg passed to command. | ||
+ | does. The -c option causes command to be executed with an empty | ||
+ | environment. | ||
+ | zeroth argument to the executed command. | ||
+ | executed | ||
+ | the shell option execfail is enabled, in which case it returns | ||
+ | failure. | ||
+ | not be executed. | ||
+ | take effect | ||
+ | If there is a redirection error, the return status is 1. | ||
+ | |||
+ | exit [n] | ||
+ | Cause the shell to exit with a status of n. If n is omitted, | ||
+ | the exit status is that of the last command executed. | ||
+ | EXIT is executed before the shell terminates. | ||
+ | |||
+ | | ||
+ | | ||
+ | The supplied names are marked for automatic export to the envi- | ||
+ | ronment | ||
+ | given, the names refer to functions. | ||
+ | if the -p option | ||
+ | exported in this shell is printed. | ||
+ | export | ||
+ | name is followed by =word, the value of the variable is set to | ||
+ | word. | ||
+ | option is encountered, | ||
+ | variable name, or -f is supplied with a name that is not a func- | ||
+ | tion. | ||
+ | |||
+ | fc [-e ename] [-nlr] [first] [last] | ||
+ | fc -s [pat=rep] [cmd] | ||
+ | Fix Command. | ||
+ | to last is selected from the history list. First and last may | ||
+ | be specified as a string (to locate the last command | ||
+ | with that string) | ||
+ | list, where a negative number is used as an offset from the cur- | ||
+ | rent command number). | ||
+ | current command for listing (so that ``fc -l -10'' | ||
+ | last 10 commands) and to first otherwise. | ||
+ | ified it is set to the previous command for editing and -16 for | ||
+ | listing. | ||
+ | |||
+ | The -n option suppresses the command numbers when listing. | ||
+ | -r option reverses the order of the commands. | ||
+ | is given, | ||
+ | wise, the editor given by ename is invoked on a file containing | ||
+ | those commands. | ||
+ | variable is used, and the value of EDITOR if FCEDIT is not set. | ||
+ | If neither | ||
+ | plete, the edited commands are echoed and executed. | ||
+ | |||
+ | In the second form, command is re-executed after each instance | ||
+ | of pat is replaced by rep. A useful alias to use with this is | ||
+ | ``r=" | ||
+ | beginning with ``cc'' | ||
+ | mand. | ||
+ | |||
+ | If the first form is used, the return | ||
+ | invalid | ||
+ | lines out of range. | ||
+ | value is the value of the last command executed or failure if an | ||
+ | error occurs with the temporary file of commands. | ||
+ | form is used, the return status is that of the command re-exe- | ||
+ | cuted, unless cmd does not specify | ||
+ | which case fc returns failure. | ||
+ | |||
+ | fg [jobspec] | ||
+ | Resume | ||
+ | If jobspec is not present, the shell' | ||
+ | is used. | ||
+ | the foreground, or failure if run when job control | ||
+ | or, when run with job control enabled, if jobspec does not spec- | ||
+ | ify a valid job or jobspec specifies | ||
+ | without job control. | ||
+ | |||
+ | | ||
+ | getopts | ||
+ | ters. optstring contains the option | ||
+ | nized; | ||
+ | expected to have an argument, which should be separated from it | ||
+ | by white space. | ||
+ | be used as option characters. | ||
+ | places | ||
+ | name if it does not exist, and the index of the next argument to | ||
+ | be processed into the variable OPTIND. | ||
+ | 1 each time the shell or a shell script | ||
+ | option | ||
+ | the variable OPTARG. | ||
+ | cally; | ||
+ | getopts within the same shell invocation if a new set of parame- | ||
+ | ters is to be used. | ||
+ | |||
+ | When the end of options is encountered, | ||
+ | return value greater than zero. OPTIND is set to the index of | ||
+ | the first non-option argument, and name is set to ?. | ||
+ | |||
+ | getopts | ||
+ | arguments are given in args, getopts parses those instead. | ||
+ | |||
+ | getopts can report errors in two ways. If the first character | ||
+ | of optstring | ||
+ | normal operation diagnostic messages are printed | ||
+ | options | ||
+ | variable OPTERR is set to 0, no error messages | ||
+ | played, even if the first character of optstring is not a colon. | ||
+ | |||
+ | If an invalid option is seen, getopts places ? into name and, if | ||
+ | not silent, | ||
+ | getopts is silent, the option | ||
+ | OPTARG and no diagnostic message is printed. | ||
+ | |||
+ | If a required argument is not found, and getopts is not silent, | ||
+ | a question mark (?) is placed in name, OPTARG is unset, | ||
+ | diagnostic | ||
+ | colon (:) is placed in name and OPTARG | ||
+ | character found. | ||
+ | |||
+ | getopts | ||
+ | found. | ||
+ | an error occurs. | ||
+ | |||
+ | hash [-lr] [-p filename] [-dt] [name] | ||
+ | For each name, the full file name of the command is determined | ||
+ | by searching the directories in $PATH and remembered. | ||
+ | option is supplied, no path search is performed, and filename is | ||
+ | used as the full file name of the command. | ||
+ | the shell to forget | ||
+ | causes the shell to forget the remembered location of each name. | ||
+ | If the -t option is supplied, the full pathname to which each | ||
+ | name corresponds is printed. | ||
+ | supplied | ||
+ | pathname. | ||
+ | mat that may be reused as input. | ||
+ | if only -l is supplied, information about remembered commands is | ||
+ | printed. | ||
+ | or an invalid option is supplied. | ||
+ | |||
+ | help [-s] [pattern] | ||
+ | Display helpful information about builtin commands. | ||
+ | is specified, help gives detailed help on all commands matching | ||
+ | pattern; otherwise help for all the builtins and shell control | ||
+ | structures | ||
+ | displayed to a short usage synopsis. | ||
+ | unless no command matches pattern. | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | With no options, display the command history list with line num- | ||
+ | bers. Lines listed with a * have been modified. | ||
+ | n lists only the last n lines. | ||
+ | FORMAT is set and not null, it is used as a format | ||
+ | strftime(3) | ||
+ | played history entry. | ||
+ | the formatted | ||
+ | supplied, it is used as the name of the history | ||
+ | the value of HISTFILE is used. Options, if supplied, have the | ||
+ | following meanings: | ||
+ | -c Clear the history list by deleting all the entries. | ||
+ | -d offset | ||
+ | | ||
+ | -a | ||
+ | | ||
+ | | ||
+ | -n Read the history lines not already read from the history | ||
+ | | ||
+ | | ||
+ | | ||
+ | -r Read the contents of the history file and use them as the | ||
+ | | ||
+ | -w Write the current history to the history file, overwrit- | ||
+ | ing the history file's contents. | ||
+ | -p | ||
+ | | ||
+ | | ||
+ | | ||
+ | -s Store the args in the history list as a single | ||
+ | | ||
+ | the args are added. | ||
+ | |||
+ | If the HISTTIMEFORMAT is set, the time stamp information associ- | ||
+ | ated with each history | ||
+ | The return value is 0 unless an invalid option | ||
+ | an error occurs | ||
+ | invalid offset is supplied as an argument to -d, or the history | ||
+ | expansion supplied as an argument to -p fails. | ||
+ | |||
+ | jobs [-lnprs] [ jobspec ... ] | ||
+ | jobs -x command [ args ... ] | ||
+ | The first form lists the active jobs. The options have the fol- | ||
+ | lowing meanings: | ||
+ | -l List process IDs in addition to the normal information. | ||
+ | -p List only the process | ||
+ | | ||
+ | -n | ||
+ | | ||
+ | -r | ||
+ | -s | ||
+ | |||
+ | If jobspec | ||
+ | that job. The return status is 0 unless an invalid | ||
+ | encountered or an invalid jobspec is supplied. | ||
+ | |||
+ | If the -x option is supplied, jobs replaces any jobspec found in | ||
+ | command or args with the corresponding | ||
+ | executes command passing it args, returning its exit status. | ||
+ | |||
+ | kill [-s sigspec | -n signum | -sigspec] [pid | jobspec] ... | ||
+ | kill -l [sigspec | exit_status] | ||
+ | Send the signal | ||
+ | named by pid or jobspec. | ||
+ | signal | ||
+ | a signal number; signum is a signal number. | ||
+ | present, | ||
+ | signal names. | ||
+ | the names of the signals | ||
+ | listed, and the return status is 0. The exit_status argument to | ||
+ | -l is a number | ||
+ | status of a process terminated by a signal. | ||
+ | if at least one signal was successfully sent, or false if an | ||
+ | error occurs or an invalid option is encountered. | ||
+ | |||
+ | let arg [arg ...] | ||
+ | Each arg is an arithmetic expression to be evaluated (see ARITH- | ||
+ | METIC EVALUATION). | ||
+ | 1; 0 is returned otherwise. | ||
+ | |||
+ | local [option] [name[=value] ...] | ||
+ | For each argument, a local variable named name is created, | ||
+ | assigned | ||
+ | by declare. | ||
+ | variable | ||
+ | tion and its children. | ||
+ | local variables | ||
+ | local when not within a function. | ||
+ | local is used outside a function, an invalid name is supplied, | ||
+ | or name is a readonly variable. | ||
+ | |||
+ | | ||
+ | |||
+ | popd [-n] [+n] [-n] | ||
+ | Removes entries from the directory stack. | ||
+ | removes | ||
+ | the new top directory. | ||
+ | ing meanings: | ||
+ | +n | ||
+ | shown by dirs, starting with zero. For example: | ||
+ | | ||
+ | -n | ||
+ | | ||
+ | | ||
+ | last. | ||
+ | -n | ||
+ | | ||
+ | | ||
+ | |||
+ | If the popd command is successful, a dirs is performed as well, | ||
+ | and the return status is 0. popd returns false if an invalid | ||
+ | option is encountered, | ||
+ | tent directory stack entry is specified, or the directory change | ||
+ | fails. | ||
+ | |||
+ | | ||
+ | Write the formatted arguments to the standard output under the | ||
+ | control of the format. | ||
+ | contains | ||
+ | simply copied to standard output, | ||
+ | which are converted and copied to the standard output, and for- | ||
+ | mat specifications, | ||
+ | successive argument. | ||
+ | mats, %b causes printf to expand backslash escape | ||
+ | the corresponding | ||
+ | backslashes in \', \", and \? are not removed, and octal escapes | ||
+ | beginning | ||
+ | printf to output the corresponding argument in a format that can | ||
+ | be reused as shell input. | ||
+ | |||
+ | The -v option causes the output to be assigned to the variable | ||
+ | var rather than being printed to the standard output. | ||
+ | |||
+ | The format is reused as necessary to consume all of the argu- | ||
+ | ments. | ||
+ | the extra format specifications behave as if a zero value or | ||
+ | null string, | ||
+ | value is zero on success, non-zero on failure. | ||
+ | |||
+ | pushd [-n] [dir] | ||
+ | pushd [-n] [+n] [-n] | ||
+ | Adds a directory to the top of the directory stack, | ||
+ | the stack, | ||
+ | directory. | ||
+ | and returns 0, unless the directory stack is empty. | ||
+ | if supplied, have the following meanings: | ||
+ | +n | ||
+ | | ||
+ | zero) is at the top. | ||
+ | -n | ||
+ | | ||
+ | zero) is at the top. | ||
+ | -n | ||
+ | | ||
+ | | ||
+ | dir Adds dir to the directory stack at the top, making it the | ||
+ | new current working directory. | ||
+ | |||
+ | If the pushd command is successful, a dirs is performed as well. | ||
+ | If the first form is used, pushd returns 0 unless the cd to dir | ||
+ | fails. | ||
+ | tory stack is empty, a non-existent directory stack element | ||
+ | specified, | ||
+ | directory fails. | ||
+ | |||
+ | pwd [-LP] | ||
+ | Print the absolute pathname of the current | ||
+ | The pathname printed contains no symbolic links if the -P option | ||
+ | is supplied or the -o physical option to the set builtin command | ||
+ | is enabled. | ||
+ | contain symbolic links. | ||
+ | occurs | ||
+ | invalid option is supplied. | ||
+ | |||
+ | read [-ers] [-u fd] [-t timeout] [-a aname] [-p prompt] [-n nchars] [-d | ||
+ | | ||
+ | One line is read from the standard | ||
+ | descriptor | ||
+ | first word is assigned to the first name, the second word to the | ||
+ | second | ||
+ | ing separators assigned to the last name. If there are fewer | ||
+ | words read from the input stream than names, the remaining names | ||
+ | are assigned empty values. | ||
+ | split the line into words. | ||
+ | used to remove any special meaning for the next character | ||
+ | and for line continuation. | ||
+ | lowing meanings: | ||
+ | -a aname | ||
+ | The words are assigned to sequential indices of the array | ||
+ | | ||
+ | | ||
+ | | ||
+ | -d delim | ||
+ | | ||
+ | input line, rather than newline. | ||
+ | -e If the standard input is coming from a terminal, readline | ||
+ | (see READLINE above) is used to obtain the line. | ||
+ | -n nchars | ||
+ | | ||
+ | | ||
+ | -p prompt | ||
+ | | ||
+ | line, before attempting to read any input. | ||
+ | | ||
+ | -r | ||
+ | | ||
+ | lar, a backslash-newline pair may not be used as a line | ||
+ | | ||
+ | -s | ||
+ | ters are not echoed. | ||
+ | -t timeout | ||
+ | Cause read to time out and return failure if a complete | ||
+ | | ||
+ | | ||
+ | the terminal or a pipe. | ||
+ | -u fd Read input from file descriptor fd. | ||
+ | |||
+ | If no names are supplied, the line read is assigned to the vari- | ||
+ | able REPLY. | ||
+ | encountered, | ||
+ | supplied as the argument to -u. | ||
+ | |||
+ | | ||
+ | The given names are marked readonly; the values of these names | ||
+ | may not be changed by subsequent assignment. | ||
+ | is supplied, the functions corresponding to the names are so | ||
+ | marked. | ||
+ | name arguments are given, or if the -p option | ||
+ | list of all readonly | ||
+ | output to be displayed in a format that may be reused as input. | ||
+ | If a variable name is followed by =word, the value of the vari- | ||
+ | able is set to word. The return status is 0 unless | ||
+ | option | ||
+ | variable name, or -f is supplied with a name that is not a func- | ||
+ | tion. | ||
+ | |||
+ | | ||
+ | Causes | ||
+ | If n is omitted, the return status is that of the last command | ||
+ | executed | ||
+ | during execution of a script by the . | ||
+ | causes the shell to stop executing that script and return either | ||
+ | n or the exit status of the last command | ||
+ | script | ||
+ | function and not during execution of a script by ., the return | ||
+ | status is false. | ||
+ | executed before execution resumes after the function or script. | ||
+ | |||
+ | set [--abefhkmnptuvxBCHP] [-o option] [arg ...] | ||
+ | Without | ||
+ | displayed in a format that can be reused as input for setting or | ||
+ | resetting the currently-set variables. | ||
+ | not be reset. | ||
+ | The output | ||
+ | options are specified, they set or unset shell attributes. | ||
+ | arguments | ||
+ | as values for the positional parameters | ||
+ | order, to $1, $2, ... $n. Options, if specified, have the fol- | ||
+ | lowing meanings: | ||
+ | -a Automatically mark variables | ||
+ | modified | ||
+ | subsequent commands. | ||
+ | -b Report the status of terminated background jobs immedi- | ||
+ | ately, rather than before the next primary prompt. | ||
+ | is effective only when job control is enabled. | ||
+ | -e Exit immediately if a simple command (see SHELL GRAMMAR | ||
+ | above) exits with a non-zero status. | ||
+ | exit if the command that fails is part of the command | ||
+ | list immediately | ||
+ | part of the test in an if statement, part of a && or || | ||
+ | list, or if the command' | ||
+ | via !. A trap on ERR, if set, is executed | ||
+ | shell exits. | ||
+ | -f Disable pathname expansion. | ||
+ | -h Remember | ||
+ | for execution. | ||
+ | -k All arguments in the form of assignment | ||
+ | placed | ||
+ | that precede the command name. | ||
+ | -m Monitor mode. Job control is enabled. | ||
+ | on by default | ||
+ | support it (see JOB CONTROL | ||
+ | cesses | ||
+ | taining their exit status is printed upon their comple- | ||
+ | tion. | ||
+ | -n Read commands but do not execute them. This may be used | ||
+ | to check a shell script | ||
+ | ignored by interactive shells. | ||
+ | -o option-name | ||
+ | The option-name can be one of the following: | ||
+ | allexport | ||
+ | Same as -a. | ||
+ | braceexpand | ||
+ | Same as -B. | ||
+ | emacs | ||
+ | face. This is enabled by default when the shell | ||
+ | is interactive, | ||
+ | the --noediting option. | ||
+ | errtrace | ||
+ | Same as -E. | ||
+ | functrace | ||
+ | Same as -T. | ||
+ | errexit Same as -e. | ||
+ | hashall Same as -h. | ||
+ | histexpand | ||
+ | Same as -H. | ||
+ | history Enable command history, as described above under | ||
+ | HISTORY. | ||
+ | active shells. | ||
+ | ignoreeof | ||
+ | The effect | ||
+ | ``IGNOREEOF=10'' | ||
+ | Variables above). | ||
+ | keyword Same as -k. | ||
+ | monitor Same as -m. | ||
+ | noclobber | ||
+ | Same as -C. | ||
+ | noexec | ||
+ | noglob | ||
+ | notify | ||
+ | nounset Same as -u. | ||
+ | onecmd | ||
+ | physical | ||
+ | Same as -P. | ||
+ | pipefail | ||
+ | If set, the return value of a pipeline | ||
+ | value of the last (rightmost) command to exit | ||
+ | with a non-zero status, or zero if all commands | ||
+ | in the pipeline exit successfully. | ||
+ | is disabled by default. | ||
+ | posix | ||
+ | operation | ||
+ | match the standard (posix mode). | ||
+ | privileged | ||
+ | Same as -p. | ||
+ | verbose Same as -v. | ||
+ | vi Use a vi-style command line editing interface. | ||
+ | xtrace | ||
+ | If -o is supplied with no option-name, | ||
+ | current | ||
+ | option-name, | ||
+ | current | ||
+ | output. | ||
+ | -p Turn on privileged mode. In this mode, the $ENV and | ||
+ | $BASH_ENV | ||
+ | not inherited from the environment, | ||
+ | variable, | ||
+ | If the shell is started with the effective user (group) | ||
+ | id not equal to the real user (group) id, and the -p | ||
+ | option is not supplied, these actions are taken and the | ||
+ | effective user id is set to the real user id. If the -p | ||
+ | option is supplied at startup, the effective user id is | ||
+ | not reset. | ||
+ | user and group ids to be set to the real user and group | ||
+ | ids. | ||
+ | -t Exit after reading and executing one command. | ||
+ | -u Treat unset variables as an error when performing param- | ||
+ | eter expansion. | ||
+ | variable, the shell prints an error message, and, if not | ||
+ | interactive, | ||
+ | -v Print shell input lines as they are read. | ||
+ | -x After expanding each simple command, for command, | ||
+ | command, select command, or arithmetic for command, dis- | ||
+ | play the expanded value of PS4, followed by the command | ||
+ | and its expanded arguments or associated word list. | ||
+ | -B The shell performs brace expansion (see Brace Expansion | ||
+ | above). | ||
+ | -C If set, bash does not overwrite an existing | ||
+ | the >, >&, | ||
+ | overridden when creating output files by using the redi- | ||
+ | rection operator >| instead of >. | ||
+ | -E If set, any trap on ERR is inherited by shell functions, | ||
+ | command substitutions, | ||
+ | shell environment. | ||
+ | ited in such cases. | ||
+ | -H Enable ! style history substitution. | ||
+ | by default when the shell is interactive. | ||
+ | -P If set, the shell does not follow symbolic links when | ||
+ | executing commands such as cd that change | ||
+ | working | ||
+ | structure instead. | ||
+ | chain of directories | ||
+ | change the current directory. | ||
+ | -T If set, any traps on DEBUG and RETURN are inherited | ||
+ | shell functions, | ||
+ | executed in a subshell | ||
+ | RETURN traps are normally not inherited in such cases. | ||
+ | -- If no arguments follow this option, then the positional | ||
+ | parameters are unset. | ||
+ | ters are set to the args, even if some of them begin | ||
+ | with a -. | ||
+ | - | ||
+ | be assigned to the positional parameters. | ||
+ | options are turned off. If there are no args, the posi- | ||
+ | tional parameters remain unchanged. | ||
+ | |||
+ | The options are off by default unless otherwise noted. | ||
+ | rather than - causes | ||
+ | options | ||
+ | the shell. | ||
+ | return status is always true unless an invalid option is encoun- | ||
+ | tered. | ||
+ | |||
+ | shift [n] | ||
+ | The positional parameters from n+1 ... are renamed | ||
+ | Parameters | ||
+ | unset. | ||
+ | $#. | ||
+ | it is assumed to be 1. If n is greater than $#, the positional | ||
+ | parameters | ||
+ | zero if n is greater than $# or less than zero; otherwise 0. | ||
+ | |||
+ | shopt [-pqsu] [-o] [optname ...] | ||
+ | Toggle the values of variables controlling optional shell behav- | ||
+ | ior. With no options, or with the -p option, a list of all set- | ||
+ | table options is displayed, with an indication of whether or not | ||
+ | each is set. The -p option causes output to be displayed in a | ||
+ | form that may be reused as input. | ||
+ | lowing meanings: | ||
+ | -s | ||
+ | -u | ||
+ | -q | ||
+ | | ||
+ | | ||
+ | tus is zero if all optnames are enabled; non-zero | ||
+ | wise. | ||
+ | -o | ||
+ | the -o option to the set builtin. | ||
+ | |||
+ | If either -s or -u is used with no optname arguments, | ||
+ | play is limited to those options which are set or unset, respec- | ||
+ | tively. | ||
+ | (unset) by default. | ||
+ | |||
+ | The return | ||
+ | are enabled, non-zero | ||
+ | options, | ||
+ | valid shell option. | ||
+ | |||
+ | The list of shopt options is: | ||
+ | |||
+ | cdable_vars | ||
+ | If set, an argument to the cd builtin | ||
+ | not a directory is assumed to be the name of a variable | ||
+ | whose value is the directory to change to. | ||
+ | cdspell If set, minor errors in the spelling of a directory com- | ||
+ | ponent | ||
+ | checked for are transposed characters, a missing charac- | ||
+ | ter, and one character | ||
+ | found, the corrected file name is printed, and the com- | ||
+ | mand proceeds. | ||
+ | shells. | ||
+ | checkhash | ||
+ | If set, bash checks that a command found in the hash ta- | ||
+ | ble exists | ||
+ | command no longer exists, a normal path search | ||
+ | formed. | ||
+ | checkwinsize | ||
+ | If set, bash checks the window size after each command | ||
+ | and, if necessary, updates the values of LINES and COL- | ||
+ | UMNS. | ||
+ | cmdhist If set, bash attempts to save all lines of a multiple- | ||
+ | line command in the same history | ||
+ | easy re-editing of multi-line commands. | ||
+ | dotglob If set, bash includes filenames beginning with a `.' in | ||
+ | the results of pathname expansion. | ||
+ | execfail | ||
+ | If set, a non-interactive shell will not exit if it can- | ||
+ | not execute | ||
+ | exec builtin command. | ||
+ | exit if exec fails. | ||
+ | expand_aliases | ||
+ | If set, aliases | ||
+ | ALIASES. | ||
+ | tive shells. | ||
+ | extdebug | ||
+ | If set, behavior | ||
+ | enabled: | ||
+ | 1. The -F option to the declare builtin displays the | ||
+ | | ||
+ | each function name supplied as an argument. | ||
+ | 2. If the command run by the DEBUG trap returns | ||
+ | | ||
+ | not executed. | ||
+ | 3. If the command run by the DEBUG trap returns | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | 4. | ||
+ | in their descriptions above. | ||
+ | 5. | ||
+ | tion, shell functions, and subshells invoked with | ||
+ | ( command ) inherit the DEBUG and RETURN traps. | ||
+ | 6. | ||
+ | shell functions, and subshells | ||
+ | | ||
+ | extglob If set, the extended pattern matching features described | ||
+ | above under Pathname Expansion are enabled. | ||
+ | extquote | ||
+ | If set, $' | ||
+ | within | ||
+ | quotes. | ||
+ | failglob | ||
+ | If set, patterns which fail to match filenames | ||
+ | pathname expansion result in an expansion error. | ||
+ | force_fignore | ||
+ | If set, the suffixes | ||
+ | variable cause words to be ignored when performing | ||
+ | completion even if the ignored words are the only possi- | ||
+ | ble completions. | ||
+ | description | ||
+ | default. | ||
+ | gnu_errfmt | ||
+ | If set, shell error messages are written in the standard | ||
+ | GNU error message format. | ||
+ | histappend | ||
+ | If set, the history list is appended to the file named | ||
+ | by the value of the HISTFILE | ||
+ | exits, rather than overwriting the file. | ||
+ | histreedit | ||
+ | If set, and readline is being used, a user is given the | ||
+ | opportunity to re-edit a failed history substitution. | ||
+ | histverify | ||
+ | If set, and readline is being used, the results of his- | ||
+ | tory substitution | ||
+ | shell parser. | ||
+ | into the readline editing buffer, allowing further modi- | ||
+ | fication. | ||
+ | hostcomplete | ||
+ | If set, and readline is being used, bash will attempt to | ||
+ | perform | ||
+ | is being completed | ||
+ | above). | ||
+ | huponexit | ||
+ | If set, bash will send SIGHUP to all jobs when an inter- | ||
+ | active login shell exits. | ||
+ | interactive_comments | ||
+ | If set, allow a word beginning with # to cause that word | ||
+ | and all remaining characters on that line to be ignored | ||
+ | in an interactive | ||
+ | option is enabled by default. | ||
+ | lithist If set, and the cmdhist option is enabled, multi-line | ||
+ | commands are saved to the history with embedded newlines | ||
+ | rather than using semicolon separators where possible. | ||
+ | login_shell | ||
+ | The shell sets this option if it is started as a login | ||
+ | shell (see INVOCATION above). | ||
+ | changed. | ||
+ | mailwarn | ||
+ | If set, and a file that bash is checking for mail has | ||
+ | been accessed since the last time it was checked, | ||
+ | message | ||
+ | played. | ||
+ | no_empty_cmd_completion | ||
+ | If set, and readline | ||
+ | attempt to search the PATH for possible completions when | ||
+ | completion is attempted on an empty line. | ||
+ | nocaseglob | ||
+ | If set, bash matches | ||
+ | fashion when performing pathname expansion (see Pathname | ||
+ | Expansion above). | ||
+ | nocasematch | ||
+ | If set, bash matches | ||
+ | fashion when performing matching while executing case or | ||
+ | [[ conditional commands. | ||
+ | nullglob | ||
+ | If set, bash allows patterns which match no files (see | ||
+ | Pathname | ||
+ | rather than themselves. | ||
+ | progcomp | ||
+ | If set, the programmable completion facilities (see Pro- | ||
+ | grammable Completion above) are enabled. | ||
+ | enabled by default. | ||
+ | promptvars | ||
+ | If set, prompt strings undergo parameter expansion, com- | ||
+ | mand | ||
+ | removal after being expanded as described | ||
+ | above. | ||
+ | restricted_shell | ||
+ | The | ||
+ | restricted mode (see RESTRICTED SHELL below). | ||
+ | may not be changed. | ||
+ | files are executed, allowing the startup files to dis- | ||
+ | cover whether or not a shell is restricted. | ||
+ | shift_verbose | ||
+ | If set, the shift builtin prints an error message when | ||
+ | the shift count exceeds the number of positional parame- | ||
+ | ters. | ||
+ | sourcepath | ||
+ | If set, the source (.) builtin uses the value of PATH to | ||
+ | find the directory containing the file supplied | ||
+ | argument. | ||
+ | xpg_echo | ||
+ | If | ||
+ | sequences by default. | ||
+ | | ||
+ | Suspend the execution of this shell until it receives a SIGCONT | ||
+ | signal. | ||
+ | shell; just suspend anyway. | ||
+ | shell is a login shell and -f is not supplied, or if job control | ||
+ | is not enabled. | ||
+ | test expr | ||
+ | [ expr ] | ||
+ | Return a status of 0 or 1 depending on the evaluation | ||
+ | conditional | ||
+ | a separate argument. | ||
+ | described | ||
+ | accept any options, nor does it accept and ignore an argument of | ||
+ | -- as signifying the end of options. | ||
+ | |||
+ | Expressions | ||
+ | listed in decreasing order of precedence. | ||
+ | ! expr True if expr is false. | ||
+ | ( expr ) | ||
+ | | ||
+ | the normal precedence of operators. | ||
+ | expr1 -a expr2 | ||
+ | True if both expr1 and expr2 are true. | ||
+ | expr1 -o expr2 | ||
+ | True if either expr1 or expr2 is true. | ||
+ | |||
+ | test and [ evaluate conditional expressions using a set of rules | ||
+ | based on the number of arguments. | ||
+ | |||
+ | 0 arguments | ||
+ | The expression is false. | ||
+ | 1 argument | ||
+ | The expression is true if and only if the argument is not | ||
+ | null. | ||
+ | 2 arguments | ||
+ | If the first argument is !, the expression is true if and | ||
+ | only if the second argument is null. If the first argu- | ||
+ | | ||
+ | above under CONDITIONAL EXPRESSIONS, | ||
+ | true if the unary test is true. If the first argument is | ||
+ | not a valid unary conditional operator, the expression is | ||
+ | | ||
+ | 3 arguments | ||
+ | | ||
+ | | ||
+ | | ||
+ | using the first and third arguments as operands. | ||
+ | | ||
+ | | ||
+ | If the first argument is exactly ( and the third argument | ||
+ | is exactly ), the result is the one-argument test of the | ||
+ | | ||
+ | The -a and -o operators are considered | ||
+ | in this case. | ||
+ | 4 arguments | ||
+ | If the first argument is !, the result is the negation of | ||
+ | the three-argument expression composed of the remaining | ||
+ | | ||
+ | uated according to precedence | ||
+ | | ||
+ | 5 or more arguments | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | for processes run from the shell. | ||
+ | |||
+ | trap [-lp] [[arg] sigspec ...] | ||
+ | The command | ||
+ | receives signal(s) sigspec. | ||
+ | single | ||
+ | original disposition (the value it had upon entrance | ||
+ | shell). | ||
+ | sigspec is ignored by the shell and by the commands it invokes. | ||
+ | If arg is not present and -p has been supplied, then the trap | ||
+ | commands associated with each sigspec | ||
+ | arguments | ||
+ | list of commands associated with each signal. | ||
+ | causes | ||
+ | responding numbers. | ||
+ | defined | ||
+ | case insensitive and the SIG prefix is optional. | ||
+ | is EXIT (0) the command arg is executed on exit from the shell. | ||
+ | If a sigspec is DEBUG, the command arg is executed before | ||
+ | simple command, for command, case command, select command, every | ||
+ | arithmetic for command, and before the first command executes in | ||
+ | a shell function | ||
+ | description of the extdebug option | ||
+ | details | ||
+ | the command arg is executed whenever | ||
+ | non-zero | ||
+ | ERR trap is not executed if the failed command is part of the | ||
+ | command | ||
+ | part of the test in an if statement, part of a && or || list, or | ||
+ | if the command' | ||
+ | are the same conditions obeyed by the errexit | ||
+ | sigspec is RETURN, the command arg is executed each time a shell | ||
+ | function or a script executed with the . or source builtins fin- | ||
+ | ishes executing. | ||
+ | be trapped or reset. | ||
+ | are reset to their original values in a child process when it is | ||
+ | created. | ||
+ | otherwise trap returns true. | ||
+ | |||
+ | type [-aftpP] name [name ...] | ||
+ | With no options, indicate how each name would be interpreted if | ||
+ | used as a command name. If the -t option is used, type prints a | ||
+ | string | ||
+ | file if name is an alias, | ||
+ | builtin, | ||
+ | then nothing | ||
+ | returned. | ||
+ | name of the disk file that would be executed if name were speci- | ||
+ | fied as a command name, or nothing if ``type -t name'' | ||
+ | return file. The -P option forces a PATH search for each name, | ||
+ | even if ``type -t name'' | ||
+ | hashed, -p and -P print the hashed value, | ||
+ | file that appears first in PATH. If the -a option is used, type | ||
+ | prints all of the places that contain an executable named name. | ||
+ | This includes | ||
+ | option is not also used. The table of hashed | ||
+ | consulted | ||
+ | tion lookup, as with the command builtin. | ||
+ | any of the arguments are found, false if none are found. | ||
+ | |||
+ | | ||
+ | Provides | ||
+ | to processes started by it, on systems that allow such control. | ||
+ | The -H and -S options specify that the hard or soft limit is set | ||
+ | for the given resource. | ||
+ | it is set; a soft limit may be increased up to the value of the | ||
+ | hard limit. | ||
+ | and hard limits are set. The value of limit can be a number in | ||
+ | the unit specified for the resource or one of the special values | ||
+ | hard, soft, or unlimited, | ||
+ | limit, the current soft limit, and no limit, | ||
+ | limit is omitted, | ||
+ | resource is printed, unless the -H option is given. | ||
+ | than one resource | ||
+ | printed before the value. | ||
+ | lows: | ||
+ | -a All current limits are reported | ||
+ | -c The maximum size of core files created | ||
+ | -d The maximum size of a process' | ||
+ | -e The maximum scheduling priority (" | ||
+ | -f | ||
+ | | ||
+ | -i The maximum number of pending signals | ||
+ | -l The maximum size that may be locked into memory | ||
+ | -m The maximum resident set size | ||
+ | -n The maximum number of open file descriptors (most systems | ||
+ | do not allow this value to be set) | ||
+ | -p The pipe size in 512-byte blocks (this may not be set) | ||
+ | -q The maximum number of bytes in POSIX message queues | ||
+ | -r The maximum real-time scheduling priority | ||
+ | -s The maximum stack size | ||
+ | -t The maximum amount of cpu time in seconds | ||
+ | -u | ||
+ | user | ||
+ | -v The maximum amount of virtual | ||
+ | shell | ||
+ | -x The maximum number of file locks | ||
+ | |||
+ | If limit is given, it is the new value of the specified resource | ||
+ | (the -a option is display only). | ||
+ | is assumed. | ||
+ | which is in seconds, -p, which is in units of 512-byte | ||
+ | and -n and -u, which are unscaled values. | ||
+ | 0 unless an invalid option or argument is supplied, or an error | ||
+ | occurs while setting a new limit. | ||
+ | |||
+ | umask [-p] [-S] [mode] | ||
+ | The user file-creation mask is set to mode. If mode begins with | ||
+ | a digit, it is interpreted as an octal number; otherwise | ||
+ | interpreted | ||
+ | chmod(1). | ||
+ | printed. | ||
+ | bolic form; the default output is an octal number. | ||
+ | option is supplied, and mode is omitted, the output is in a form | ||
+ | that may be reused as input. | ||
+ | was successfully | ||
+ | and false otherwise. | ||
+ | |||
+ | | ||
+ | Remove each name from the list of defined | ||
+ | supplied, | ||
+ | is true unless a supplied name is not a defined alias. | ||
+ | |||
+ | unset [-fv] [name ...] | ||
+ | For each name, remove the corresponding | ||
+ | If no options are supplied, or the -v option is given, each name | ||
+ | refers to a shell variable. | ||
+ | unset. | ||
+ | tion, and the function definition is removed. | ||
+ | able or function is removed from the environment passed to sub- | ||
+ | sequent commands. | ||
+ | FUNCNAME, GROUPS, or DIRSTACK are unset, they lose their special | ||
+ | properties, even if they are subsequently reset. | ||
+ | tus is true unless a name is readonly. | ||
+ | |||
+ | wait [n ...] | ||
+ | Wait for each specified process and return its termination sta- | ||
+ | tus. Each n may be a process ID or a job specification; | ||
+ | job spec is given, | ||
+ | waited for. If n is not given, all currently active child pro- | ||
+ | cesses | ||
+ | specifies a non-existent process or job, the return | ||
+ | 127. | ||
+ | last process or job waited for. | ||
+ | |||
+ | |||
+ | |||
+ | RESTRICTED SHELL | ||
+ | |||
+ | If bash is started with the name rbash, or the -r option is supplied at | ||
+ | | ||
+ | to set up an environment more controlled than the standard | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | builtin command | ||
+ | |||
+ | | ||
+ | -p option to the hash builtin command | ||
+ | |||
+ | | ||
+ | startup | ||
+ | |||
+ | | ||
+ | startup | ||
+ | |||
+ | | ||
+ | ion operators | ||
+ | |||
+ | | ||
+ | command | ||
+ | |||
+ | | ||
+ | to the enable builtin command | ||
+ | |||
+ | | ||
+ | builtins | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | These restrictions are enforced after any startup files are read. | ||
+ | |||
+ | When a command that is found to be a shell script is executed (see COM- | ||
+ | MAND EXECUTION above), rbash turns off any restrictions | ||
+ | | ||
+ | |||
+ | |||
+ | |||
+ | SEE ALSO | ||
+ | |||
+ | Bash Reference Manual, Brian Fox and Chet Ramey | ||
+ | The Gnu Readline Library, Brian Fox and Chet Ramey | ||
+ | The Gnu History Library, Brian Fox and Chet Ramey | ||
+ | | ||
+ | ties, IEEE | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | |||
+ | FILES | ||
+ | |||
+ | / | ||
+ | The bash executable | ||
+ | / | ||
+ | The systemwide initialization file, executed for login shells | ||
+ | | ||
+ | The personal initialization file, executed for login shells | ||
+ | | ||
+ | The individual per-interactive-shell startup file | ||
+ | | ||
+ | The individual | ||
+ | shell exits | ||
+ | | ||
+ | Individual readline initialization file | ||
+ | |||
+ | |||
+ | |||
+ | AUTHORS | ||
+ | |||
+ | Brian Fox, Free Software Foundation | ||
+ | | ||
+ | |||
+ | Chet Ramey, Case Western Reserve University | ||
+ | | ||
+ | |||
+ | |||
+ | |||
+ | BUG REPORTS | ||
+ | |||
+ | If you find a bug in bash, you should report it. But first, you should | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | be mailed | ||
+ | | ||
+ | |||
+ | ALL bug reports should include: | ||
+ | |||
+ | The version number of bash | ||
+ | The hardware and operating system | ||
+ | The compiler used to compile | ||
+ | A description of the bug behaviour | ||
+ | A short script or `recipe' | ||
+ | |||
+ | | ||
+ | it provides for filing a bug report. | ||
+ | |||
+ | | ||
+ | to chet@po.cwru.edu. | ||
+ | |||
+ | |||
+ | |||
+ | BUGS | ||
+ | |||
+ | | ||
+ | |||
+ | There are some subtle differences between bash and traditional versions | ||
+ | of sh, mostly because of the POSIX specification. | ||
+ | |||
+ | | ||
+ | |||
+ | Shell builtin commands and functions are not stoppable/ | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | unit. | ||
+ | |||
+ | | ||
+ | | ||
+ | time after the command is entered. | ||
+ | even inside shell comments, will result in error messages | ||
+ | | ||
+ | |||
+ | Array variables may not (yet) be exported. | ||
+ | |||
+ | |||
+ | |||
+ | GNU Bash-3.2 | ||
+ | |||