This is bashref.info, produced by makeinfo version 4.0f from
bashref.texi.

INFO-DIR-SECTION Utilities
START-INFO-DIR-ENTRY
* Bash: (bash).                     The GNU Bourne-Again SHell.
END-INFO-DIR-ENTRY

This text is a brief description of the features that are present in
the Bash shell.

This is Edition 2.5a, last updated 13 November 2001,
of `The GNU Bash Reference Manual',
for `Bash', Version 2.05a.

Copyright (C) 1991-2001 Free Software Foundation, Inc.

Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
are preserved on all copies.

Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the entire
resulting derived work is distributed under the terms of a permission
notice identical to this one.

Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions,
except that this permission notice may be stated in a translation approved
by the Free Software Foundation.


File: bashref.info,  Node: Bourne Shell Builtins,  Next: Bash Builtins,  Up: Shell Builtin Commands

Bourne Shell Builtins
=====================

   The following shell builtin commands are inherited from the Bourne
Shell.  These commands are implemented as specified by the POSIX 1003.2
standard.

`:    (a colon)'
          : [ARGUMENTS]
     Do nothing beyond expanding ARGUMENTS and performing redirections.
     The return status is zero.

`.    (a period)'
          . FILENAME [ARGUMENTS]
     Read and execute commands from the FILENAME argument in the
     current shell context.  If FILENAME does not contain a slash, the
     `PATH' variable is used to find FILENAME.  When Bash is not in
     POSIX mode, the current directory is searched if FILENAME is not
     found in `$PATH'.  If any ARGUMENTS are supplied, they become the
     positional parameters when FILENAME is executed.  Otherwise the
     positional parameters are unchanged.  The return status is the
     exit status of the last command executed, or zero if no commands
     are executed.  If FILENAME is not found, or cannot be read, the
     return status is non-zero.  This builtin is equivalent to `source'.

`break'
          break [N]
     Exit from a `for', `while', `until', or `select' loop.  If N is
     supplied, the Nth enclosing loop is exited.  N must be greater
     than or equal to 1.  The return status is zero unless N is not
     greater than or equal to 1.

`cd'
          cd [-LP] [DIRECTORY]
     Change the current working directory to DIRECTORY.  If DIRECTORY
     is not given, the value of the `HOME' shell variable is used.  If
     the shell variable `CDPATH' exists, it is used as a search path.
     If DIRECTORY begins with a slash, `CDPATH' is not used.  The `-P'
     option means to not follow symbolic links; symbolic links are
     followed by default or with the `-L' option.  If DIRECTORY is `-',
     it is equivalent to `$OLDPWD'.  The return status is zero if the
     directory is successfully changed, non-zero otherwise.

`continue'
          continue [N]
     Resume the next iteration of an enclosing `for', `while', `until',
     or `select' loop.  If N is supplied, the execution of the Nth
     enclosing loop is resumed.  N must be greater than or equal to 1.
     The return status is zero unless N is not greater than or equal to
     1.

`eval'
          eval [ARGUMENTS]
     The arguments are concatenated together into a single command,
     which is then read and executed, and its exit status returned as
     the exit status of `eval'.  If there are no arguments or only
     empty arguments, the return status is zero.

`exec'
          exec [-cl] [-a NAME] [COMMAND [ARGUMENTS]]
     If COMMAND is supplied, it replaces the shell without creating a
     new process.  If the `-l' option is supplied, the shell places a
     dash at the beginning of the zeroth arg passed to COMMAND.  This
     is what the `login' program does.  The `-c' option causes COMMAND
     to be executed with an empty environment.  If `-a' is supplied,
     the shell passes NAME as the zeroth argument to COMMAND.  If no
     COMMAND is specified, redirections may be used to affect the
     current shell environment.  If there are no redirection errors, the
     return status is zero; otherwise the return status is non-zero.

`exit'
          exit [N]
     Exit the shell, returning a status of N to the shell's parent.  If
     N is omitted, the exit status is that of the last command executed.
     Any trap on `EXIT' is executed before the shell terminates.

`export'
          export [-fn] [-p] [NAME[=VALUE]]
     Mark each NAME to be passed to child processes in the environment.
     If the `-f' option is supplied, the NAMEs refer to shell
     functions; otherwise the names refer to shell variables.  The `-n'
     option means to no longer mark each NAME for export.  If no NAMES
     are supplied, or if the `-p' option is given, a list of exported
     names is displayed.  The `-p' option displays output in a form
     that may be reused as input.  The return status is zero unless an
     invalid option is supplied, one of the names is not a valid shell
     variable name, or `-f' is supplied with a name that is not a shell
     function.

`getopts'
          getopts OPTSTRING NAME [ARGS]
     `getopts' is used by shell scripts to parse positional parameters.
     OPTSTRING contains the option characters to be recognized; if a
     character is followed by a colon, the option is expected to have an
     argument, which should be separated from it by white space.  The
     colon (`:') and question mark (`?') may not be used as option
     characters.  Each time it is invoked, `getopts' places the next
     option in the shell variable NAME, initializing NAME if it does
     not exist, and the index of the next argument to be processed into
     the variable `OPTIND'.  `OPTIND' is initialized to 1 each time the
     shell or a shell script is invoked.  When an option requires an
     argument, `getopts' places that argument into the variable
     `OPTARG'.  The shell does not reset `OPTIND' automatically; it
     must be manually reset between multiple calls to `getopts' within
     the same shell invocation if a new set of parameters is to be used.

     When the end of options is encountered, `getopts' exits with a
     return value greater than zero.  `OPTIND' is set to the index of
     the first non-option argument, and `name' is set to `?'.

     `getopts' normally parses the positional parameters, but if more
     arguments are given in ARGS, `getopts' parses those instead.

     `getopts' can report errors in two ways.  If the first character of
     OPTSTRING is a colon, SILENT error reporting is used.  In normal
     operation diagnostic messages are printed when invalid options or
     missing option arguments are encountered.  If the variable `OPTERR'
     is set to 0, no error messages will be displayed, 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, prints an error message and unsets `OPTARG'.  If
     `getopts' is silent, the option character found is placed in
     `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, and a
     diagnostic message is printed.  If `getopts' is silent, then a
     colon (`:') is placed in NAME and `OPTARG' is set to the option
     character found.

`hash'
          hash [-r] [-p FILENAME] [-t] [NAME]
     Remember the full pathnames of commands specified as NAME
     arguments, so they need not be searched for on subsequent
     invocations.  The commands are found by searching through the
     directories listed in `$PATH'.  The `-p' option inhibits the path
     search, and FILENAME is used as the location of NAME.  The `-r'
     option causes the shell to forget all remembered locations.  If
     the `-t' option is supplied, the full pathname to which each NAME
     corresponds is printed.  If multiple NAME arguments are supplied
     with `-t' the NAME is printed before the hashed full pathname.  If
     no arguments are given, information about remembered commands is
     printed.  The return status is zero unless a NAME is not found or
     an invalid option is supplied.

`pwd'
          pwd [-LP]
     Print the absolute pathname of the current working directory.  If
     the `-P' option is supplied, the pathname printed will not contain
     symbolic links.  If the `-L' option is supplied, the pathname
     printed may contain symbolic links.  The return status is zero
     unless an error is encountered while determining the name of the
     current directory or an invalid option is supplied.

`readonly'
          readonly [-apf] [NAME] ...
     Mark each NAME as readonly.  The values of these names may not be
     changed by subsequent assignment.  If the `-f' option is supplied,
     each NAME refers to a shell function.  The `-a' option means each
     NAME refers to an array variable.  If no NAME arguments are given,
     or if the `-p' option is supplied, a list of all readonly names is
     printed.  The `-p' option causes output to be displayed in a
     format that may be reused as input.  The return status is zero
     unless an invalid option is supplied, one of the NAME arguments is
     not a valid shell variable or function name, or the `-f' option is
     supplied with a name that is not a shell function.

`return'
          return [N]
     Cause a shell function to exit with the return value N.  If N is
     not supplied, the return value is the exit status of the last
     command executed in the function.  This may also be used to
     terminate execution of a script being executed with the `.' (or
     `source') builtin, returning either N or the exit status of the
     last command executed within the script as the exit status of the
     script.  The return status is non-zero if `return' is used outside
     a function and not during the execution of a script by `.' or
     `source'.

`shift'
          shift [N]
     Shift the positional parameters to the left by N.  The positional
     parameters from N+1 ... `$#' are renamed to `$1' ... `$#'-N+1.
     Parameters represented by the numbers `$#' to N+1 are unset.  N
     must be a non-negative number less than or equal to `$#'.  If N is
     zero or greater than `$#', the positional parameters are not
     changed.  If N is not supplied, it is assumed to be 1.  The return
     status is zero unless N is greater than `$#' or less than zero,
     non-zero otherwise.

`test'
`['
     Evaluate a conditional expression EXPR.  Each operator and operand
     must be a separate argument.  Expressions are composed of the
     primaries described below in *Note Bash Conditional Expressions::.

     When the `[' form is used, the last argument to the command must
     be a `]'.

     Expressions may be combined using the following operators, listed
     in decreasing order of precedence.

    `! EXPR'
          True if EXPR is false.

    `( EXPR )'
          Returns the value of EXPR.  This may be used to override 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.

     The `test' and `[' builtins 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 argument
          is one of the unary conditional operators (*note Bash
          Conditional Expressions::), the expression is true if the
          unary test is true.  If the first argument is not a valid
          unary operator, the expression is false.

    3 arguments
          If the second argument is one of the binary conditional
          operators (*note Bash Conditional Expressions::), the result
          of the expression is the result of the binary test using the
          first and third arguments as operands.  If the first argument
          is `!', the value is the negation of the two-argument test
          using the second and third arguments.  If the first argument
          is exactly `(' and the third argument is exactly `)', the
          result is the one-argument test of the second argument.
          Otherwise, the expression is false.  The `-a' and `-o'
          operators are considered binary operators in this case.

    4 arguments
          If the first argument is `!', the result is the negation of
          the three-argument expression composed of the remaining
          arguments.  Otherwise, the expression is parsed and evaluated
          according to precedence using the rules listed above.

    5 or more arguments
          The expression is parsed and evaluated according to precedence
          using the rules listed above.

`times'
          times
     Print out the user and system times used by the shell and its
     children.  The return status is zero.

`trap'
          trap [-lp] [ARG] [SIGSPEC ...]
     The commands in ARG are to be read and executed when the shell
     receives signal SIGSPEC.  If ARG is absent or equal to `-', all
     specified signals are reset to the values they had when the shell
     was started.  If ARG is the null string, then the signal specified
     by each SIGSPEC is ignored by the shell and commands it invokes.
     If ARG is not present and `-p' has been supplied, the shell
     displays the trap commands associated with each SIGSPEC.  If no
     arguments are supplied, or only `-p' is given, `trap' prints the
     list of commands associated with each signal number in a form that
     may be reused as shell input.  Each SIGSPEC is either a signal
     name such as `SIGINT' (with or without the `SIG' prefix) or a
     signal number.  If a SIGSPEC is `0' or `EXIT', ARG is executed
     when the shell exits.  If a SIGSPEC is `DEBUG', the command ARG is
     executed after every simple command.  If a SIGSPEC is `ERR', the
     command ARG is executed whenever a simple command has a non-zero
     exit status.  The `ERR' trap is not executed if the failed command
     is part of an `until' or `while' loop, part of an `if' statement,
     part of a `&&' or `||' list, or if the command's return status is
     being inverted using `!'.  The `-l' option causes the shell to
     print a list of signal names and their corresponding numbers.

     Signals ignored upon entry to the shell cannot be trapped or reset.
     Trapped signals are reset to their original values in a child
     process when it is created.

     The return status is zero unless a SIGSPEC does not specify a
     valid signal.

`umask'
          umask [-p] [-S] [MODE]
     Set the shell process's file creation mask to MODE.  If MODE
     begins with a digit, it is interpreted as an octal number; if not,
     it is interpreted as a symbolic mode mask similar to that accepted
     by the `chmod' command.  If MODE is omitted, the current value of
     the mask is printed.  If the `-S' option is supplied without a
     MODE argument, the mask is printed in a symbolic format.  If the
     `-p' option is supplied, and MODE is omitted, the output is in a
     form that may be reused as input.  The return status is zero if
     the mode is successfully changed or if no MODE argument is
     supplied, and non-zero otherwise.

     Note that when the mode is interpreted as an octal number, each
     number of the umask is subtracted from `7'.  Thus, a umask of `022'
     results in permissions of `755'.

`unset'
          unset [-fv] [NAME]
     Each variable or function NAME is removed.  If no options are
     supplied, or the `-v' option is given, each NAME refers to a shell
     variable.  If the `-f' option is given, the NAMEs refer to shell
     functions, and the function definition is removed.  Readonly
     variables and functions may not be unset.  The return status is
     zero unless a NAME does not exist or is readonly.


File: bashref.info,  Node: Bash Builtins,  Next: The Set Builtin,  Prev: Bourne Shell Builtins,  Up: Shell Builtin Commands

Bash Builtin Commands
=====================

   This section describes builtin commands which are unique to or have
been extended in Bash.  Some of these commands are specified in the
POSIX 1003.2 standard.

`alias'
          alias [`-p'] [NAME[=VALUE] ...]

     Without arguments or with the `-p' option, `alias' prints the list
     of aliases on the standard output in a form that allows them to be
     reused as input.  If arguments are supplied, an alias is defined
     for each NAME whose VALUE is given.  If no VALUE is given, the name
     and value of the alias is printed.  Aliases are described in *Note
     Aliases::.

`bind'
          bind [-m KEYMAP] [-lpsvPSV]
          bind [-m KEYMAP] [-q FUNCTION] [-u FUNCTION] [-r KEYSEQ]
          bind [-m KEYMAP] -f FILENAME
          bind [-m KEYMAP] -x KEYSEQ:SHELL-COMMAND
          bind [-m KEYMAP] KEYSEQ:FUNCTION-NAME

     Display current Readline (*note Command Line Editing::) key and
     function bindings, or bind a key sequence to a Readline function
     or macro.  The binding syntax accepted is identical to that of a
     Readline initialization file (*note Readline Init File::), but
     each binding must be passed as a separate argument:  e.g.,
     `"\C-x\C-r":re-read-init-file'.  Options, if supplied, have the
     following meanings:

    `-m KEYMAP'
          Use KEYMAP as the keymap to be affected by the subsequent
          bindings.  Acceptable KEYMAP names are `emacs',
          `emacs-standard', `emacs-meta', `emacs-ctlx', `vi', `vi-move',
          `vi-command', and `vi-insert'.  `vi' is equivalent to
          `vi-command'; `emacs' is equivalent to `emacs-standard'.

    `-l'
          List the names of all Readline functions.

    `-p'
          Display Readline function names and bindings in such a way
          that they can be used as input or in a Readline
          initialization file.

    `-P'
          List current Readline function names and bindings.

    `-v'
          Display Readline variable names and values in such a way that
          they can be used as input or in a Readline initialization
          file.

    `-V'
          List current Readline variable names and values.

    `-s'
          Display Readline key sequences bound to macros and the
          strings they output in such a way that they can be used as
          input or in a Readline initialization file.

    `-S'
          Display Readline key sequences bound to macros and the
          strings they output.

    `-f FILENAME'
          Read key bindings from FILENAME.

    `-q FUNCTION'
          Query about which keys invoke the named FUNCTION.

    `-u FUNCTION'
          Unbind all keys bound to the named FUNCTION.

    `-r KEYSEQ'
          Remove any current binding for KEYSEQ.

    `-x KEYSEQ:SHELL-COMMAND'
          Cause SHELL-COMMAND to be executed whenever KEYSEQ is entered.

     The return status is zero unless an invalid option is supplied or
     an error occurs.

`builtin'
          builtin [SHELL-BUILTIN [ARGS]]
     Run a shell builtin, passing it ARGS, and return its exit status.
     This is useful when defining a shell function with the same name
     as a shell builtin, retaining the functionality of the builtin
     within the function.  The return status is non-zero if
     SHELL-BUILTIN is not a shell builtin command.

`command'
          command [-pVv] COMMAND [ARGUMENTS ...]
     Runs COMMAND with ARGUMENTS ignoring any shell function named
     COMMAND.  Only shell builtin commands or commands found by
     searching the `PATH' are executed.  If there is a shell function
     named `ls', running `command ls' within the function will execute
     the external command `ls' instead of calling the function
     recursively.  The `-p' option means to use a default value for
     `PATH' that is guaranteed to find all of the standard utilities.
     The return status in this case is 127 if COMMAND cannot be found
     or an error occurred, and the exit status of COMMAND otherwise.

     If either the `-V' or `-v' option is supplied, a description of
     COMMAND is printed.  The `-v' 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.
     In this case, the return status is zero if COMMAND is found, and
     non-zero if not.

`declare'
          declare [-afFrxi] [-p] [NAME[=VALUE]]

     Declare variables and give them attributes.  If no NAMEs are
     given, then display the values of variables instead.

     The `-p' option will display the attributes and values of each
     NAME.  When `-p' is used, additional options are ignored.  The
     `-F' option inhibits the display of function definitions; only the
     function name and attributes are printed.  `-F' implies `-f'.  The
     following options can be used to restrict output to variables with
     the specified attributes or to give variables attributes:

    `-a'
          Each NAME is an array variable (*note Arrays::).

    `-f'
          Use function names only.

    `-i'
          The variable is to be treated as an integer; arithmetic
          evaluation (*note Shell Arithmetic::) is performed when the
          variable is assigned a value.

    `-r'
          Make NAMEs readonly.  These names cannot then be assigned
          values by subsequent assignment statements or unset.

    `-x'
          Mark each NAME for export to subsequent commands via the
          environment.

     Using `+' instead of `-' turns off the attribute instead.  When
     used in a function, `declare' makes each NAME local, as with the
     `local' command.

     The return status is zero unless an invalid option is encountered,
     an attempt is made to define a function using `-f foo=bar', an
     attempt is made to assign a value to a readonly variable, an
     attempt is made to assign a value to an array variable without
     using the compound assignment syntax (*note Arrays::), one of the
     NAMES is not a valid shell variable name, an attempt is made to
     turn off readonly 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'.

`echo'
          echo [-neE] [ARG ...]
     Output the ARGs, separated by spaces, terminated with a newline.
     The return status is always 0.  If `-n' is specified, the trailing
     newline is suppressed.  If the `-e' option is given,
     interpretation of the following backslash-escaped characters is
     enabled.  The `-E' option disables the interpretation of these
     escape characters, even on systems where they are interpreted by
     default.  The `xpg_echo' shell option may be used to dynamically
     determine whether or not `echo' expands these escape characters by
     default.  `echo' interprets the following escape sequences:
    `\a'
          alert (bell)

    `\b'
          backspace

    `\c'
          suppress trailing newline

    `\e'
          escape

    `\f'
          form feed

    `\n'
          new line

    `\r'
          carriage return

    `\t'
          horizontal tab

    `\v'
          vertical tab

    `\\'
          backslash

    `\NNN'
          the eight-bit character whose value is the octal value NNN
          (one to three digits)

    `\xHH'
          the eight-bit character whose value is the hexadecimal value
          HH (one or two hex digits)

`enable'
          enable [-n] [-p] [-f FILENAME] [-ads] [NAME ...]
     Enable and disable builtin shell commands.  Disabling a builtin
     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 disk commands.  If
     `-n' is used, the NAMEs become disabled.  Otherwise NAMEs are
     enabled.  For example, to use the `test' binary found via `$PATH'
     instead of the shell builtin version, type `enable -n test'.

     If the `-p' option is supplied, or no NAME arguments appear, a
     list of shell builtins is printed.  With no other arguments, the
     list consists of all enabled shell builtins.  The `-a' option
     means to list each builtin with an indication of whether or not it
     is enabled.

     The `-f' option means to load the new builtin command NAME from
     shared object FILENAME, on systems that support dynamic loading.
     The `-d' option will delete a builtin loaded with `-f'.

     If there are no options, a list of the shell builtins is displayed.
     The `-s' option restricts `enable' to the POSIX special builtins.
     If `-s' is used with `-f', the new builtin becomes a special
     builtin (*note Special Builtins::).

     The return status is zero unless a NAME is not a shell builtin or
     there is an error loading a new builtin from a shared object.

`help'
          help [-s] [PATTERN]
     Display helpful information about builtin commands.  If PATTERN is
     specified, `help' gives detailed help on all commands matching
     PATTERN, otherwise a list of the builtins is printed.  The `-s'
     option restricts the information displayed to a short usage
     synopsis.  The return status is zero unless no command matches
     PATTERN.

`let'
          let EXPRESSION [EXPRESSION]
     The `let' builtin allows arithmetic to be performed on shell
     variables.  Each EXPRESSION is evaluated according to the rules
     given below in *Note Shell Arithmetic::.  If the last EXPRESSION
     evaluates to 0, `let' returns 1; otherwise 0 is returned.

`local'
          local [OPTION] NAME[=VALUE]
     For each argument, a local variable named NAME is created, and
     assigned VALUE.  The OPTION can be any of the options accepted by
     `declare'.  `local' can only be used within a function; it makes
     the variable NAME have a visible scope restricted to that function
     and its children.  The return status is zero unless `local' is
     used outside a function, an invalid NAME is supplied, or NAME is a
     readonly variable.

`logout'
          logout [N]
     Exit a login shell, returning a status of N to the shell's parent.

`printf'
          `printf' FORMAT [ARGUMENTS]
     Write the formatted ARGUMENTS to the standard output under the
     control of the FORMAT.  The FORMAT is a character string which
     contains three types of objects: plain characters, which are
     simply copied to standard output, character escape sequences,
     which are converted and copied to the standard output, and format
     specifications, each of which causes printing of the next
     successive ARGUMENT.  In addition to the standard `printf(1)'
     formats, `%b' causes `printf' to expand backslash escape sequences
     in the corresponding ARGUMENT, and `%q' causes `printf' to output
     the corresponding ARGUMENT in a format that can be reused as shell
     input.

     The FORMAT is reused as necessary to consume all of the ARGUMENTS.
     If the FORMAT requires more ARGUMENTS than are supplied, the extra
     format specifications behave as if a zero value or null string, as
     appropriate, had been supplied.  The return value is zero on
     success, non-zero on failure.

`read'
          read [-ers] [-a ANAME] [-p PROMPT] [-t TIMEOUT] [-n NCHARS] [-d DELIM] [NAME ...]
     One line is read from the standard input, and the first word is
     assigned to the first NAME, the second word to the second NAME,
     and so on, with leftover words and their intervening separators
     assigned to the last NAME.  If there are fewer words read from the
     standard input than names, the remaining names are assigned empty
     values.  The characters in the value of the `IFS' variable are
     used to split the line into words.  The backslash character `\'
     may be used to remove any special meaning for the next character
     read and for line continuation.  If no names are supplied, the
     line read is assigned to the variable `REPLY'.  The return code is
     zero, unless end-of-file is encountered or `read' times out.
     Options, if supplied, have the following meanings:

    `-a ANAME'
          The words are assigned to sequential indices of the array
          variable ANAME, starting at 0.  All elements are removed from
          ANAME before the assignment.  Other NAME arguments are
          ignored.

    `-d DELIM'
          The first character of DELIM is used to terminate the input
          line, rather than newline.

    `-e'
          Readline (*note Command Line Editing::) is used to obtain the
          line.

    `-n NCHARS'
          `read' returns after reading NCHARS characters rather than
          waiting for a complete line of input.

    `-p PROMPT'
          Display PROMPT, without a trailing newline, before attempting
          to read any input.  The prompt is displayed only if input is
          coming from a terminal.

    `-r'
          If this option is given, backslash does not act as an escape
          character.  The backslash is considered to be part of the
          line.  In particular, a backslash-newline pair may not be
          used as a line continuation.

    `-s'
          Silent mode.  If input is coming from a terminal, characters
          are not echoed.

    `-t TIMEOUT'
          Cause `read' to time out and return failure if a complete
          line of input is not read within TIMEOUT seconds.  This
          option has no effect if `read' is not reading input from the
          terminal or a pipe.

`shopt'
          shopt [-pqsu] [-o] [OPTNAME ...]
     Toggle the values of variables controlling optional shell behavior.
     With no options, or with the `-p' option, a list of all settable
     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.  Other options have the following meanings:

    `-s'
          Enable (set) each OPTNAME.

    `-u'
          Disable (unset) each OPTNAME.

    `-q'
          Suppresses normal output; the return status indicates whether
          the OPTNAME is set or unset.  If multiple OPTNAME arguments
          are given with `-q', the return status is zero if all
          OPTNAMES are enabled; non-zero otherwise.

    `-o'
          Restricts the values of OPTNAME to be those defined for the
          `-o' option to the `set' builtin (*note The Set Builtin::).

     If either `-s' or `-u' is used with no OPTNAME arguments, the
     display is limited to those options which are set or unset,
     respectively.

     Unless otherwise noted, the `shopt' options are disabled (off) by
     default.

     The return status when listing options is zero if all OPTNAMES are
     enabled, non-zero otherwise.  When setting or unsetting options,
     the return status is zero unless an OPTNAME is not a valid shell
     option.

     The list of `shopt' options is:
    `cdable_vars'
          If this is set, an argument to the `cd' builtin command that
          is 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 component
          in a `cd' command will be corrected.  The errors checked for
          are transposed characters, a missing character, and a
          character too many.  If a correction is found, the corrected
          path is printed, and the command proceeds.  This option is
          only used by interactive shells.

    `checkhash'
          If this is set, Bash checks that a command found in the hash
          table exists before trying to execute it.  If a hashed
          command no longer exists, a normal path search is performed.

    `checkwinsize'
          If set, Bash checks the window size after each command and,
          if necessary, updates the values of `LINES' and `COLUMNS'.

    `cmdhist'
          If set, Bash attempts to save all lines of a multiple-line
          command in the same history entry.  This allows easy
          re-editing of multi-line commands.

    `dotglob'
          If set, Bash includes filenames beginning with a `.' in the
          results of filename expansion.

    `execfail'
          If this is set, a non-interactive shell will not exit if it
          cannot execute the file specified as an argument to the `exec'
          builtin command.  An interactive shell does not exit if `exec'
          fails.

    `expand_aliases'
          If set, aliases are expanded as described below under Aliases,
          *Note Aliases::.  This option is enabled by default for
          interactive shells.

    `extglob'
          If set, the extended pattern matching features described above
          (*note Pattern Matching::) are enabled.

    `histappend'
          If set, the history list is appended to the file named by the
          value of the `HISTFILE' variable when the shell 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 history
          substitution are not immediately passed to the shell parser.
          Instead, the resulting line is loaded into the Readline
          editing buffer, allowing further modification.

    `hostcomplete'
          If set, and Readline is being used, Bash will attempt to
          perform hostname completion when a word containing a `@' is
          being completed (*note Commands For Completion::).  This
          option is enabled by default.

    `huponexit'
          If set, Bash will send `SIGHUP' to all jobs when an
          interactive login shell exits (*note Signals::).

    `interactive_comments'
          Allow a word beginning with `#' to cause that word and all
          remaining characters on that line to be ignored in an
          interactive shell.  This option is enabled by default.

    `lithist'
          If enabled, 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
          (*note Invoking Bash::).  The value may not be changed.

    `mailwarn'
          If set, and a file that Bash is checking for mail has been
          accessed since the last time it was checked, the message
          `"The mail in MAILFILE has been read"' is displayed.

    `no_empty_cmd_completion'
          If set, and Readline is being used, Bash will not attempt to
          search the `PATH' for possible completions when completion is
          attempted on an empty line.

    `nocaseglob'
          If set, Bash matches filenames in a case-insensitive fashion
          when performing filename expansion.

    `nullglob'
          If set, Bash allows filename patterns which match no files to
          expand to a null string, rather than themselves.

    `progcomp'
          If set, the programmable completion facilities (*note
          Programmable Completion::) are enabled.  This option is
          enabled by default.

    `promptvars'
          If set, prompt strings undergo variable and parameter
          expansion after being expanded (*note Printing a Prompt::).
          This option is enabled by default.

    `restricted_shell'
          The shell sets this option if it is started in restricted mode
          (*note The Restricted Shell::).  The value may not be changed.
          This is not reset when the startup files are executed,
          allowing the startup files to discover whether or not a shell
          is restricted.

    `shift_verbose'
          If this is set, the `shift' builtin prints an error message
          when the shift count exceeds the number of positional
          parameters.

    `sourcepath'
          If set, the `source' builtin uses the value of `PATH' to find
          the directory containing the file supplied as an argument.
          This option is enabled by default.

    `xpg_echo'
          If set, the `echo' builtin expands backslash-escape sequences
          by default.

     The return status when listing options is zero if all OPTNAMES are
     enabled, non-zero otherwise.  When setting or unsetting options,
     the return status is zero unless an OPTNAME is not a valid shell
     option.

`source'
          source FILENAME
     A synonym for `.' (*note Bourne Shell Builtins::).

`type'
          type [-atp] [NAME ...]
     For each NAME, indicate how it would be interpreted if used as a
     command name.

     If the `-t' option is used, `type' prints a single word which is
     one of `alias', `function', `builtin', `file' or `keyword', if
     NAME is an alias, shell function, shell builtin, disk file, or
     shell reserved word, respectively.  If the NAME is not found, then
     nothing is printed, and `type' returns a failure status.

     If the `-p' option is used, `type' either returns the name of the
     disk file that would be executed, or nothing if `-t' would not
     return `file'.

     If the `-a' option is used, `type' returns all of the places that
     contain an executable named FILE.  This includes aliases and
     functions, if and only if the `-p' option is not also used.

     The return status is zero if any of the NAMES are found, non-zero
     if none are found.

`typeset'
          typeset [-afFrxi] [-p] [NAME[=VALUE]]
     The `typeset' command is supplied for compatibility with the Korn
     shell; however, it has been deprecated in favor of the `declare'
     builtin command.

`ulimit'
          ulimit [-acdflmnpstuvSH] [LIMIT]
     `ulimit' provides control over the resources available to processes
     started by the shell, on systems that allow such control.  If an
     option is given, it is interpreted as follows:
    `-S'
          Change and report the soft limit associated with a resource.

    `-H'
          Change and report the hard limit associated with a resource.

    `-a'
          All current limits are reported.

    `-c'
          The maximum size of core files created.

    `-d'
          The maximum size of a process's data segment.

    `-f'
          The maximum size of files created by the shell.

    `-l'
          The maximum size that may be locked into memory.

    `-m'
          The maximum resident set size.

    `-n'
          The maximum number of open file descriptors.

    `-p'
          The pipe buffer size.

    `-s'
          The maximum stack size.

    `-t'
          The maximum amount of cpu time in seconds.

    `-u'
          The maximum number of processes available to a single user.

    `-v'
          The maximum amount of virtual memory available to the process.

     If LIMIT is given, it is the new value of the specified resource;
     the special LIMIT values `hard', `soft', and `unlimited' stand for
     the current hard limit, the current soft limit, and no limit,
     respectively.  Otherwise, the current value of the soft limit for
     the specified resource is printed, unless the `-H' option is
     supplied.  When setting new limits, if neither `-H' nor `-S' is
     supplied, both the hard and soft limits are set.  If no option is
     given, then `-f' is assumed.  Values are in 1024-byte increments,
     except for `-t', which is in seconds, `-p', which is in units of
     512-byte blocks, and `-n' and `-u', which are unscaled values.

     The return status is zero unless an invalid option or argument is
     supplied, or an error occurs while setting a new limit.

`unalias'
          unalias [-a] [NAME ... ]

     Remove each NAME from the list of aliases.  If `-a' is supplied,
     all aliases are removed.  Aliases are described in *Note Aliases::.


File: bashref.info,  Node: The Set Builtin,  Next: Special Builtins,  Prev: Bash Builtins,  Up: Shell Builtin Commands

The Set Builtin
===============

   This builtin is so complicated that it deserves its own section.

`set'
          set [--abefhkmnptuvxBCHP] [-o OPTION] [ARGUMENT ...]

     If no options or arguments are supplied, `set' displays the names
     and values of all shell variables and functions, sorted according
     to the current locale, in a format that may be reused as input.

     When options are supplied, they set or unset shell attributes.
     Options, if specified, have the following meanings:

    `-a'
          Mark variables and function which are modified or created for
          export to the environment of subsequent commands.

    `-b'
          Cause the status of terminated background jobs to be reported
          immediately, rather than before printing the next primary
          prompt.

    `-e'
          Exit immediately if a simple command (*note Simple
          Commands::) exits with a non-zero status, unless the command
          that fails is part of an `until' or `while' loop, part of an
          `if' statement, part of a `&&' or `||' list, or if the
          command's return status is being inverted using `!'.  A trap
          on `ERR', if set, is executed before the shell exits.

    `-f'
          Disable file name generation (globbing).

    `-h'
          Locate and remember (hash) commands as they are looked up for
          execution.  This option is enabled by default.

    `-k'
          All arguments in the form of assignment statements are placed
          in the environment for a command, not just those that precede
          the command name.

    `-m'
          Job control is enabled (*note Job Control::).

    `-n'
          Read commands but do not execute them; this may be used to
          check a script for syntax errors.  This option is ignored by
          interactive shells.

    `-o OPTION-NAME'
          Set the option corresponding to OPTION-NAME:

         `allexport'
               Same as `-a'.

         `braceexpand'
               Same as `-B'.

         `emacs'
               Use an `emacs'-style line editing interface (*note
               Command Line Editing::).

         `errexit'
               Same as `-e'.

         `hashall'
               Same as `-h'.

         `histexpand'
               Same as `-H'.

         `history'
               Enable command history, as described in *Note Bash
               History Facilities::.  This option is on by default in
               interactive shells.

         `ignoreeof'
               An interactive shell will not exit upon reading EOF.

         `keyword'
               Same as `-k'.

         `monitor'
               Same as `-m'.

         `noclobber'
               Same as `-C'.

         `noexec'
               Same as `-n'.

         `noglob'
               Same as `-f'.

         `nolog'
               Currently ignored.

         `notify'
               Same as `-b'.

         `nounset'
               Same as `-u'.

         `onecmd'
               Same as `-t'.

         `physical'
               Same as `-P'.

         `posix'
               Change the behavior of Bash where the default operation
               differs from the POSIX 1003.2 standard to match the
               standard (*note Bash POSIX Mode::).  This is intended to
               make Bash behave as a strict superset of that standard.

         `privileged'
               Same as `-p'.

         `verbose'
               Same as `-v'.

         `vi'
               Use a `vi'-style line editing interface.

         `xtrace'
               Same as `-x'.

    `-p'
          Turn on privileged mode.  In this mode, the `$BASH_ENV' and
          `$ENV' files are not processed, shell functions are not
          inherited from the environment, and the `SHELLOPTS' variable,
          if it appears in the environment, is ignored.  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.  Turning this option off
          causes the effective 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 parameter
          expansion.  An error message will be written to the standard
          error, and a non-interactive shell will exit.

    `-v'
          Print shell input lines as they are read.

    `-x'
          Print a trace of simple commands and their arguments after
          they are expanded and before they are executed.

    `-B'
          The shell will perform brace expansion (*note Brace
          Expansion::).  This option is on by default.

    `-C'
          Prevent output redirection using `>', `>&', and `<>' from
          overwriting existing files.

    `-H'
          Enable `!' style history substitution (*note History
          Interaction::).  This option is on by default for interactive
          shells.

    `-P'
          If set, do not follow symbolic links when performing commands
          such as `cd' which change the current directory.  The
          physical directory is used instead.  By default, Bash follows
          the logical chain of directories when performing commands
          which change the current directory.

          For example, if `/usr/sys' is a symbolic link to
          `/usr/local/sys' then:
               $ cd /usr/sys; echo $PWD
               /usr/sys
               $ cd ..; pwd
               /usr

          If `set -P' is on, then:
               $ cd /usr/sys; echo $PWD
               /usr/local/sys
               $ cd ..; pwd
               /usr/local

    `--'
          If no arguments follow this option, then the positional
          parameters are unset.  Otherwise, the positional parameters
          are set to the ARGUMENTS, even if some of them begin with a
          `-'.

    `-'
          Signal the end of options, cause all remaining ARGUMENTS to
          be assigned to the positional parameters.  The `-x' and `-v'
          options are turned off.  If there are no arguments, the
          positional parameters remain unchanged.

     Using `+' rather than `-' causes these options to be turned off.
     The options can also be used upon invocation of the shell.  The
     current set of options may be found in `$-'.

     The remaining N ARGUMENTS are positional parameters and are
     assigned, in order, to `$1', `$2', ...  `$N'.  The special
     parameter `#' is set to N.

     The return status is always zero unless an invalid option is
     supplied.


File: bashref.info,  Node: Special Builtins,  Prev: The Set Builtin,  Up: Shell Builtin Commands

Special Builtins
================

   For historical reasons, the POSIX 1003.2 standard has classified
several builtin commands as _special_.  When Bash is executing in POSIX
mode, the special builtins differ from other builtin commands in three
respects:

  1. Special builtins are found before shell functions during command
     lookup.

  2. If a special builtin returns an error status, a non-interactive
     shell exits.

  3. Assignment statements preceding the command stay in effect in the
     shell environment after the command completes.

   When Bash is not executing in POSIX mode, these builtins behave no
differently than the rest of the Bash builtin commands.  The Bash POSIX
mode is described in *Note Bash POSIX Mode::.

   These are the POSIX special builtins:
     break : . continue eval exec exit export readonly return set
     shift trap unset


File: bashref.info,  Node: Shell Variables,  Next: Bash Features,  Prev: Shell Builtin Commands,  Up: Top

Shell Variables
***************

* Menu:

* Bourne Shell Variables::	Variables which Bash uses in the same way
				as the Bourne Shell.
* Bash Variables::		List of variables that exist in Bash.

   This chapter describes the shell variables that Bash uses.  Bash
automatically assigns default values to a number of variables.


File: bashref.info,  Node: Bourne Shell Variables,  Next: Bash Variables,  Up: Shell Variables

Bourne Shell Variables
======================

   Bash uses certain shell variables in the same way as the Bourne
shell.  In some cases, Bash assigns a default value to the variable.

`CDPATH'
     A colon-separated list of directories used as a search path for
     the `cd' builtin command.

`HOME'
     The current user's home directory; the default for the `cd' builtin
     command.  The value of this variable is also used by tilde
     expansion (*note Tilde Expansion::).

`IFS'
     A list of characters that separate fields; used when the shell
     splits words as part of expansion.

`MAIL'
     If this parameter is set to a filename and the `MAILPATH' variable
     is not set, Bash informs the user of the arrival of mail in the
     specified file.

`MAILPATH'
     A colon-separated list of filenames which the shell periodically
     checks for new mail.  Each list entry can specify the message that
     is printed when new mail arrives in the mail file by separating
     the file name from the message with a `?'.  When used in the text
     of the message, `$_' expands to the name of the current mail file.

`OPTARG'
     The value of the last option argument processed by the `getopts'
     builtin.

`OPTIND'
     The index of the last option argument processed by the `getopts'
     builtin.

`PATH'
     A colon-separated list of directories in which the shell looks for
     commands.

`PS1'
     The primary prompt string.  The default value is `\s-\v\$ '.
     *Note Printing a Prompt::, for the complete list of escape
     sequences that are expanded before `PS1' is displayed.

`PS2'
     The secondary prompt string.  The default value is `> '.

