home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / osr5 / shells / bash-2.02 / usr / local / man / cat.1 / bash.1.Z / bash.1
Encoding:
Text File  |  1998-07-12  |  273.2 KB  |  5,545 lines

  1.  
  2.  
  3.  
  4. BASH(1)                                                   BASH(1)
  5.  
  6.  
  7. NNAAMMEE
  8.        bash - GNU Bourne-Again SHell
  9.  
  10. SSYYNNOOPPSSIISS
  11.        bbaasshh [options] [file]
  12.  
  13. CCOOPPYYRRIIGGHHTT
  14.        Bash  is Copyright (C) 1989, 1991, 1993, 1995, 1996 by the
  15.        Free Software Foundation, Inc.
  16.  
  17. DDEESSCCRRIIPPTTIIOONN
  18.        BBaasshh is an sshh-compatible command language interpreter that
  19.        executes  commands  read from the standard input or from a
  20.        file.  BBaasshh also incorporates  useful  features  from  the
  21.        _K_o_r_n and _C shells (kksshh and ccsshh).
  22.  
  23.        BBaasshh  is intended to be a conformant implementation of the
  24.        IEEE POSIX Shell and  Tools  specification  (IEEE  Working
  25.        Group 1003.2).
  26.  
  27. OOPPTTIIOONNSS
  28.        In  addition  to  the single-character shell options docu-
  29.        mented in the description of the sseett builtin command, bbaasshh
  30.        interprets the following options when it is invoked:
  31.  
  32.        --cc _s_t_r_i_n_g If  the  --cc option is present, then commands are
  33.                  read from _s_t_r_i_n_g.  If there are arguments  after
  34.                  the  _s_t_r_i_n_g, they are assigned to the positional
  35.                  parameters, starting with $$00.
  36.        --rr        If the --rr option is present, the  shell  becomes
  37.                  _r_e_s_t_r_i_c_t_e_d (see RREESSTTRRIICCTTEEDD SSHHEELLLL below).
  38.        --ii        If the --ii option is present, the shell is _i_n_t_e_r_-
  39.                  _a_c_t_i_v_e.
  40.        --ss        If the --ss option is present, or if no  arguments
  41.                  remain  after  option  processing, then commands
  42.                  are read from the standard input.   This  option
  43.                  allows  the positional parameters to be set when
  44.                  invoking an interactive shell.
  45.        --DD        A list of all double-quoted strings preceded  by
  46.                  $$  is  printed on the standard ouput.  These are
  47.                  the strings that are subject to language  trans-
  48.                  lation  when  the  current  locale  is  not C or
  49.                  POSIX.  This implies the --nn option; no  commands
  50.                  will be executed.
  51.        ----        A  ----  signals  the  end of options and disables
  52.                  further option processing.  Any arguments  after
  53.                  the  ----  are treated as filenames and arguments.
  54.                  An argument of -- is equivalent to ----.
  55.  
  56.        BBaasshh also interprets a number of multi-character  options.
  57.        These  options  must appear on the command line before the
  58.        single-character options in order for them  to  be  recog-
  59.        nized.
  60.  
  61.  
  62.  
  63.  
  64. GNU                         1998 Apr 1                          1
  65.  
  66.  
  67.  
  68.  
  69.  
  70. BASH(1)                                                   BASH(1)
  71.  
  72.  
  73.        ----dduummpp--ppoo--ssttrriinnggss
  74.               Equivalent to --DD, but the output is in the GNU _g_e_t_-
  75.               _t_e_x_t ppoo (portable object) file format.
  76.        ----dduummpp--ssttrriinnggss
  77.               Equivalent to --DD.
  78.        ----hheellpp Display a usage message on standard output and exit
  79.               successfully.
  80.        ----llooggiinn
  81.               Make  bbaasshh act as if it had been invoked as a login
  82.               shell (see IINNVVOOCCAATTIIOONN below).
  83.        ----nnooeeddiittiinngg
  84.               Do not use the GNU rreeaaddlliinnee library to read command
  85.               lines if interactive.
  86.        ----nnoopprrooffiillee
  87.               Do  not  read  either  the system-wide startup file
  88.               _/_e_t_c_/_p_r_o_f_i_l_e or any of the personal  initialization
  89.               files  _~_/_._b_a_s_h___p_r_o_f_i_l_e,  _~_/_._b_a_s_h___l_o_g_i_n,  or _~_/_._p_r_o_-
  90.               _f_i_l_e.  By default, bbaasshh reads these files  when  it
  91.               is invoked as a login shell (see IINNVVOOCCAATTIIOONN below).
  92.        ----nnoorrcc Do not read and execute the personal initialization
  93.               file  _~_/_._b_a_s_h_r_c  if the shell is interactive.  This
  94.               option is on by default if the shell is invoked  as
  95.               sshh.
  96.        ----ppoossiixx
  97.               Change the behavior of bbaasshh where the default oper-
  98.               ation differs from the  POSIX  1003.2  standard  to
  99.               match the standard.
  100.        ----rrccffiillee _f_i_l_e
  101.               Execute  commands from _f_i_l_e instead of the standard
  102.               personal initialization file _~_/_._b_a_s_h_r_c if the shell
  103.               is interactive (see IINNVVOOCCAATTIIOONN below).
  104.        ----rreessttrriicctteedd
  105.               The  shell becomes restricted (see RREESSTTRRIICCTTEEDD SSHHEELLLL
  106.               below).
  107.        ----vveerrbboossee
  108.               Equivalent to  --vv.
  109.        ----vveerrssiioonn
  110.               Show version information for this instance of  bbaasshh
  111.               on the standard output and exit successfully.
  112.  
  113. AARRGGUUMMEENNTTSS
  114.        If  arguments  remain after option processing, and neither
  115.        the --cc nor the --ss option  has  been  supplied,  the  first
  116.        argument  is  assumed  to be the name of a file containing
  117.        shell commands.  If bbaasshh is invoked in this fashion, $$00 is
  118.        set to the name of the file, and the positional parameters
  119.        are set to the remaining arguments.  BBaasshh reads  and  exe-
  120.        cutes  commands  from  this file, then exits.  BBaasshh's exit
  121.        status is the exit status of the last command executed  in
  122.        the  script.  If no commands are executed, the exit status
  123.        is 0.
  124.  
  125. IINNVVOOCCAATTIIOONN
  126.        A _l_o_g_i_n _s_h_e_l_l is one whose  first  character  of  argument
  127.  
  128.  
  129.  
  130. GNU                         1998 Apr 1                          2
  131.  
  132.  
  133.  
  134.  
  135.  
  136. BASH(1)                                                   BASH(1)
  137.  
  138.  
  139.        zero is a --, or one started with the ----llooggiinn option.
  140.  
  141.        An  _i_n_t_e_r_a_c_t_i_v_e shell is one whose standard input and out-
  142.        put are both connected  to  terminals  (as  determined  by
  143.        _i_s_a_t_t_y(3)), or one started with the --ii option.  PPSS11 is set
  144.        and $$-- includes ii if bbaasshh is interactive, allowing a shell
  145.        script or a startup file to test this state.
  146.  
  147.        The  following  paragraphs  describe how bbaasshh executes its
  148.        startup files.  If any of the files exist  but  cannot  be
  149.        read,  bbaasshh reports an error.  Tildes are expanded in file
  150.        names as described below  under  TTiillddee  EExxppaannssiioonn  in  the
  151.        EEXXPPAANNSSIIOONN section.
  152.  
  153.        When  bbaasshh  is  invoked  as an interactive login shell, it
  154.        first reads and executes commands from the file  _/_e_t_c_/_p_r_o_-
  155.        _f_i_l_e,  if  that  file exists.  After reading that file, it
  156.        looks for _~_/_._b_a_s_h___p_r_o_f_i_l_e, _~_/_._b_a_s_h___l_o_g_i_n, and  _~_/_._p_r_o_f_i_l_e,
  157.        in  that  order,  and reads and executes commands from the
  158.        first one that exists and is  readable.   The  ----nnoopprrooffiillee
  159.        option  may  be  used when the shell is started to inhibit
  160.        this behavior.
  161.  
  162.        When a login shell exits, bbaasshh reads and executes commands
  163.        from the file _~_/_._b_a_s_h___l_o_g_o_u_t, if it exists.
  164.  
  165.        When  an  interactive  shell  that is not a login shell is
  166.        started, bbaasshh reads and executes commands from  _~_/_._b_a_s_h_r_c,
  167.        if  that  file exists.  This may be inhibited by using the
  168.        ----nnoorrcc option.  The ----rrccffiillee _f_i_l_e option will  force  bbaasshh
  169.        to   read  and  execute  commands  from  _f_i_l_e  instead  of
  170.        _~_/_._b_a_s_h_r_c.
  171.  
  172.        When bbaasshh is started non-interactively,  to  run  a  shell
  173.        script, for example, it looks for the variable BBAASSHH__EENNVV in
  174.        the environment, expands its value if  it  appears  there,
  175.        and  uses the expanded value as the name of a file to read
  176.        and execute.  BBaasshh behaves as  if  the  following  command
  177.        were executed:
  178.               if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi
  179.        bbuutt  tthhee  vvaalluuee ooff tthhee PPAATTHH variable is not used to search
  180.        for the file name.
  181.  
  182.        If bbaasshh is invoked with the name sshh, it tries to mimic the
  183.        startup  behavior  of historical versions of sshh as closely
  184.        as possible, while conforming to  the  POSIX  standard  as
  185.        well.   When  invoked  as  an  interactive login shell, it
  186.        first attempts to read and execute commands from _/_e_t_c_/_p_r_o_-
  187.        _f_i_l_e  and  _~_/_._p_r_o_f_i_l_e,  in  that  order.   The ----nnoopprrooffiillee
  188.        option may be used to inhibit this behavior.  When invoked
  189.        as  an  interactive shell with the name sshh, bbaasshh looks for
  190.        the variable EENNVV, expands its value if it is defined,  and
  191.        uses  the expanded value as the name of a file to read and
  192.        execute.  Since a shell invoked as sshh does not attempt  to
  193.  
  194.  
  195.  
  196. GNU                         1998 Apr 1                          3
  197.  
  198.  
  199.  
  200.  
  201.  
  202. BASH(1)                                                   BASH(1)
  203.  
  204.  
  205.        read  and  execute  commands from any other startup files,
  206.        the ----rrccffiillee option  has  no  effect.   A  non-interactive
  207.        shell  invoked  with  the name sshh does not attempt to read
  208.        any startup files.  When invoked as sshh, bbaasshh enters  _p_o_s_i_x
  209.        mode after the startup files are read.
  210.  
  211.        When  bbaasshh  is  started in _p_o_s_i_x mode, as with the ----ppoossiixx
  212.        command line option, it follows  the  POSIX  standard  for
  213.        startup  files.   In  this mode, interactive shells expand
  214.        the EENNVV variable and commands are read and  executed  from
  215.        the  file  whose  name  is  the  expanded value.  No other
  216.        startup files are read.
  217.  
  218.        BBaasshh attempts to determine when it is  being  run  by  the
  219.        remote  shell daemon, usually _r_s_h_d.  If bbaasshh determines it
  220.        is being run by _r_s_h_d, it reads and executes commands  from
  221.        _~_/_._b_a_s_h_r_c,  if  that file exists and is readable.  It will
  222.        not do this if invoked as sshh.  The ----nnoorrcc  option  may  be
  223.        used to inhibit this behavior, and the ----rrccffiillee option may
  224.        be used to force another file to be read,  but  _r_s_h_d  does
  225.        not generally invoke the shell with those options or allow
  226.        them to be specified.
  227.  
  228. DDEEFFIINNIITTIIOONNSS
  229.        The following definitions are used throughout the rest  of
  230.        this document.
  231.        bbllaannkk  A space or tab.
  232.        wwoorrdd   A  sequence  of  characters  considered as a single
  233.               unit by the shell.  Also known as a ttookkeenn.
  234.        nnaammee   A _w_o_r_d consisting only of  alphanumeric  characters
  235.               and  underscores,  and beginning with an alphabetic
  236.               character or an underscore.  Also referred to as an
  237.               iiddeennttiiffiieerr.
  238.        mmeettaacchhaarraacctteerr
  239.               A  character  that, when unquoted, separates words.
  240.               One of the following:
  241.               ||  && ;; (( )) << >> ssppaaccee ttaabb
  242.        ccoonnttrrooll ooppeerraattoorr
  243.               A _t_o_k_e_n that performs a control  function.   It  is
  244.               one of the following symbols:
  245.               |||| && &&&& ;; ;;;; (( )) || <<nneewwlliinnee>>
  246.  
  247. RREESSEERRVVEEDD WWOORRDDSS
  248.        _R_e_s_e_r_v_e_d  _w_o_r_d_s  are  words that have a special meaning to
  249.        the shell.  The following words are recognized as reserved
  250.        when  unquoted  and either the first word of a simple com-
  251.        mand (see SSHHEELLLL GGRRAAMMMMAARR below) or the third word of a ccaassee
  252.        or ffoorr command:
  253.  
  254.        !!  ccaassee   ddoo  ddoonnee  eelliiff  eellssee  eessaacc ffii ffoorr ffuunnccttiioonn iiff iinn
  255.        sseelleecctt tthheenn uunnttiill wwhhiillee {{ }} ttiimmee [[[[ ]]]]
  256.  
  257. SSHHEELLLL GGRRAAMMMMAARR
  258.  
  259.  
  260.  
  261.  
  262. GNU                         1998 Apr 1                          4
  263.  
  264.  
  265.  
  266.  
  267.  
  268. BASH(1)                                                   BASH(1)
  269.  
  270.  
  271.    SSiimmppllee CCoommmmaannddss
  272.        A _s_i_m_p_l_e  _c_o_m_m_a_n_d  is  a  sequence  of  optional  variable
  273.        assignments followed by bbllaannkk-separated words and redirec-
  274.        tions, and terminated by a _c_o_n_t_r_o_l  _o_p_e_r_a_t_o_r.   The  first
  275.        word  specifies the command to be executed.  The remaining
  276.        words are passed as arguments to the invoked command.
  277.  
  278.        The return value of a _s_i_m_p_l_e _c_o_m_m_a_n_d is its  exit  status,
  279.        or 128+_n if the command is terminated by signal _n.
  280.  
  281.    PPiippeelliinneess
  282.        A _p_i_p_e_l_i_n_e is a sequence of one or more commands separated
  283.        by the character ||.  The format for a pipeline is:
  284.  
  285.               [ttiimmee [--pp]] [ ! ] _c_o_m_m_a_n_d [ || _c_o_m_m_a_n_d_2 ... ]
  286.  
  287.        The standard output of _c_o_m_m_a_n_d is connected to  the  stan-
  288.        dard  input  of  _c_o_m_m_a_n_d_2.   This  connection is performed
  289.        before any redirections  specified  by  the  command  (see
  290.        RREEDDIIRREECCTTIIOONN below).
  291.  
  292.        If the reserved word !!  precedes a pipeline, the exit sta-
  293.        tus of that pipeline is the logical NOT of the exit status
  294.        of  the  last  command.   Otherwise,  the  status  of  the
  295.        pipeline is the exit status  of  the  last  command.   The
  296.        shell  waits for all commands in the pipeline to terminate
  297.        before returning a value.
  298.  
  299.        If the ttiimmee reserved word precedes a pipeline, the elapsed
  300.        as  well as user and system time consumed by its execution
  301.        are reported when the pipeline terminates.  The --pp  option
  302.        changes the output format to that specified by POSIX.  The
  303.        TTIIMMEEFFOORRMMAATT variable may be set to  a  format  string  that
  304.        specifies  how the timing information should be displayed;
  305.        see the description of TTIIMMEEFFOORRMMAATT  under  SShheellll  VVaarriiaabblleess
  306.        below.
  307.  
  308.        Each  command in a pipeline is executed as a separate pro-
  309.        cess (i.e., in a subshell).
  310.  
  311.    LLiissttss
  312.        A _l_i_s_t is a sequence of one or more pipelines separated by
  313.        one  of the operators ;;, &&, &&&&, or ||||, and optionally ter-
  314.        minated by one of ;;, &&, or <<nneewwlliinnee>>.
  315.  
  316.        Of these list operators, &&&& and |||| have equal  precedence,
  317.        followed by ;; and &&,, which have equal precedence.
  318.  
  319.        If  a command is terminated by the control operator &&, the
  320.        shell executes the command in the  _b_a_c_k_g_r_o_u_n_d  in  a  sub-
  321.        shell.  The shell does not wait for the command to finish,
  322.        and the return status is 0.  Commands separated by a ;; are
  323.        executed sequentially; the shell waits for each command to
  324.        terminate in turn.  The return status is the  exit  status
  325.  
  326.  
  327.  
  328. GNU                         1998 Apr 1                          5
  329.  
  330.  
  331.  
  332.  
  333.  
  334. BASH(1)                                                   BASH(1)
  335.  
  336.  
  337.        of the last command executed.
  338.  
  339.        The  control  operators  &&&& and |||| denote AND lists and OR
  340.        lists, respectively.  An AND list has the form
  341.  
  342.               _c_o_m_m_a_n_d &&&& _c_o_m_m_a_n_d_2
  343.  
  344.        _c_o_m_m_a_n_d_2 is executed if, and only if, _c_o_m_m_a_n_d  returns  an
  345.        exit status of zero.
  346.  
  347.        An OR list has the form
  348.  
  349.               _c_o_m_m_a_n_d |||| _c_o_m_m_a_n_d_2
  350.  
  351.  
  352.        _c_o_m_m_a_n_d_2 is executed if and only if _c_o_m_m_a_n_d returns a non-
  353.        zero exit status.  The return status of AND and  OR  lists
  354.        is  the  exit  status  of the last command executed in the
  355.        list.
  356.  
  357.    CCoommppoouunndd CCoommmmaannddss
  358.        A _c_o_m_p_o_u_n_d _c_o_m_m_a_n_d is one of the following:
  359.  
  360.        (_l_i_s_t) _l_i_s_t is executed in a subshell.   Variable  assign-
  361.               ments  and builtin commands that affect the shell's
  362.               environment do not remain in effect after the  com-
  363.               mand completes.  The return status is the exit sta-
  364.               tus of _l_i_s_t.
  365.  
  366.        { _l_i_s_t; }
  367.               _l_i_s_t is simply executed in the current shell  envi-
  368.               ronment.  _l_i_s_t must be terminated with a newline or
  369.               semicolon.  This is known as a _g_r_o_u_p _c_o_m_m_a_n_d.   The
  370.               return status is the exit status of _l_i_s_t.
  371.  
  372.        ((_e_x_p_r_e_s_s_i_o_n))
  373.               The  _e_x_p_r_e_s_s_i_o_n is evaluated according to the rules
  374.               described below under  AARRIITTHHMMEETTIICC  EEVVAALLUUAATTIIOONN.   If
  375.               the value of the expression is non-zero, the return
  376.               status is 0; otherwise  the  return  status  is  1.
  377.               This is exactly equivalent to lleett ""_e_x_p_r_e_s_s_i_o_n"".
  378.  
  379.        [[[[ _e_x_p_r_e_s_s_i_o_n ]]]]
  380.               Return  a status of 0 or 1 depending on the evalua-
  381.               tion  of  the  conditional  expression  _e_x_p_r_e_s_s_i_o_n.
  382.               Expressions are composed of the primaries described
  383.               below under CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS.   Word  split-
  384.               ting  and  pathname  expansion are not performed on
  385.               the words between the [[[[ and ]]]];  tilde  expansion,
  386.               parameter and variable expansion, arithmetic expan-
  387.               sion, command substitution,  process  substitution,
  388.               and quote removal are performed.
  389.  
  390.               When  the  ==== and !!== operators are used, the string
  391.  
  392.  
  393.  
  394. GNU                         1998 Apr 1                          6
  395.  
  396.  
  397.  
  398.  
  399.  
  400. BASH(1)                                                   BASH(1)
  401.  
  402.  
  403.               to the right of the operator is considered  a  pat-
  404.               tern  and  matched according to the rules described
  405.               below under PPaatttteerrnn MMaattcchhiinngg.  The return value  is
  406.               0  if the string matches or does not match the pat-
  407.               tern, respectively, and 1 otherwise.  Any  part  of
  408.               the pattern may be quoted to force it to be matched
  409.               as a string.
  410.  
  411.               Expressions may be  combined  using  the  following
  412.               operators,  listed  in  decreasing  order of prece-
  413.               dence:
  414.  
  415.               (( _e_x_p_r_e_s_s_i_o_n ))
  416.                      Returns the value of _e_x_p_r_e_s_s_i_o_n.   This  may
  417.                      be used to override the normal precedence of
  418.                      operators.
  419.               !! _e_x_p_r_e_s_s_i_o_n
  420.                      True if _e_x_p_r_e_s_s_i_o_n is false.
  421.               _e_x_p_r_e_s_s_i_o_n_1 &&&& _e_x_p_r_e_s_s_i_o_n_2
  422.                      True if both _e_x_p_r_e_s_s_i_o_n_1 and _e_x_p_r_e_s_s_i_o_n_2 are
  423.                      true.
  424.               _e_x_p_r_e_s_s_i_o_n_1 |||| _e_x_p_r_e_s_s_i_o_n_2
  425.                      True if either _e_x_p_r_e_s_s_i_o_n_1 or _e_x_p_r_e_s_s_i_o_n_2 is
  426.                      true.
  427.  
  428.        The &&&& and |||| operators do not execute _e_x_p_r_e_s_s_i_o_n_2 if  the
  429.        value of _e_x_p_r_e_s_s_i_o_n_1 is sufficient to determine the return
  430.        value of the entire conditional expression.
  431.  
  432.        ffoorr _n_a_m_e [ iinn _w_o_r_d; ] ddoo _l_i_s_t ; ddoonnee
  433.               The list of words following iinn is expanded,  gener-
  434.               ating a list of items.  The variable _n_a_m_e is set to
  435.               each element of this list in turn, and _l_i_s_t is exe-
  436.               cuted  each  time.   If the iinn _w_o_r_d is omitted, the
  437.               ffoorr command executes _l_i_s_t once for each  positional
  438.               parameter  that is set (see PPAARRAAMMEETTEERRSS below).  The
  439.               return status is the exit status of the  last  com-
  440.               mand  that executes.  If the expansion of the items
  441.               following iinn results in an empty list, no  commands
  442.               are executed, and the return status is 0.
  443.  
  444.        sseelleecctt _n_a_m_e [ iinn _w_o_r_d; ] ddoo _l_i_s_t ; ddoonnee
  445.               The  list of words following iinn is expanded, gener-
  446.               ating a list of items.  The set of  expanded  words
  447.               is  printed on the standard error, each preceded by
  448.               a number.  If the iinn _w_o_r_d  is  omitted,  the  posi-
  449.               tional   parameters  are  printed  (see  PPAARRAAMMEETTEERRSS
  450.               below).  The PPSS33 prompt is  then  displayed  and  a
  451.               line  read  from  the  standard input.  If the line
  452.               consists of a number corresponding to  one  of  the
  453.               displayed  words,  then the value of _n_a_m_e is set to
  454.               that word.  If the line is  empty,  the  words  and
  455.               prompt  are  displayed  again.  If EOF is read, the
  456.               command completes.  Any  other  value  read  causes
  457.  
  458.  
  459.  
  460. GNU                         1998 Apr 1                          7
  461.  
  462.  
  463.  
  464.  
  465.  
  466. BASH(1)                                                   BASH(1)
  467.  
  468.  
  469.               _n_a_m_e  to be set to null.  The line read is saved in
  470.               the variable RREEPPLLYY.  The  _l_i_s_t  is  executed  after
  471.               each  selection  until a bbrreeaakk or rreettuurrnn command is
  472.               executed.  The exit status of sseelleecctt  is  the  exit
  473.               status  of  the  last  command executed in _l_i_s_t, or
  474.               zero if no commands were executed.
  475.  
  476.        ccaassee _w_o_r_d iinn [ ( _p_a_t_t_e_r_n [ || _p_a_t_t_e_r_n ] ... ) _l_i_s_t ;; ] ...
  477.               eessaacc
  478.               A  ccaassee  command  first  expands _w_o_r_d, and tries to
  479.               match it against each _p_a_t_t_e_r_n in  turn,  using  the
  480.               same  matching rules as for pathname expansion (see
  481.               PPaatthhnnaammee EExxppaannssiioonn below).  When a match is  found,
  482.               the  corresponding  _l_i_s_t  is  executed.   After the
  483.               first match, no subsequent matches  are  attempted.
  484.               The  exit  status  is  zero  if no pattern matches.
  485.               Otherwise, it is the exit status of the  last  com-
  486.               mand executed in _l_i_s_t.
  487.  
  488.        iiff  _l_i_s_t; tthheenn _l_i_s_t_; [ eelliiff _l_i_s_t; tthheenn _l_i_s_t; ] ... [ eellssee
  489.               _l_i_s_t; ] ffii
  490.               The  iiff  _l_i_s_t  is  executed.  If its exit status is
  491.               zero, the tthheenn _l_i_s_t is executed.   Otherwise,  each
  492.               eelliiff _l_i_s_t is executed in turn, and if its exit sta-
  493.               tus is zero, the corresponding tthheenn  _l_i_s_t  is  exe-
  494.               cuted  and  the  command completes.  Otherwise, the
  495.               eellssee _l_i_s_t is executed, if present.  The exit status
  496.               is the exit status of the last command executed, or
  497.               zero if no condition tested true.
  498.  
  499.        wwhhiillee _l_i_s_t; ddoo _l_i_s_t; ddoonnee
  500.        uunnttiill _l_i_s_t; ddoo _l_i_s_t; ddoonnee
  501.               The wwhhiillee command continuously executes the ddoo _l_i_s_t
  502.               as long as the last command in _l_i_s_t returns an exit
  503.               status of zero.  The uunnttiill command is identical  to
  504.               the wwhhiillee command, except that the test is negated;
  505.               the ddoo _l_i_s_t is executed as long as the last command
  506.               in  _l_i_s_t  returns a non-zero exit status.  The exit
  507.               status of the wwhhiillee and uunnttiill commands is the  exit
  508.               status  of  the  last  ddoo _l_i_s_t command executed, or
  509.               zero if none was executed.
  510.  
  511.        [ ffuunnccttiioonn ] _n_a_m_e () { _l_i_s_t; }
  512.               This defines a function named _n_a_m_e.   The  _b_o_d_y  of
  513.               the  function is the _l_i_s_t of commands between { and
  514.               }.  This list is executed whenever _n_a_m_e  is  speci-
  515.               fied  as  the  name  of a simple command.  The exit
  516.               status of a function is the exit status of the last
  517.               command  executed  in  the  body.   (See  FFUUNNCCTTIIOONNSS
  518.               below.)
  519.  
  520. CCOOMMMMEENNTTSS
  521.        In a non-interactive shell, or  an  interactive  shell  in
  522.        which the iinntteerraaccttiivvee__ccoommmmeennttss option to the sshhoopptt builtin
  523.  
  524.  
  525.  
  526. GNU                         1998 Apr 1                          8
  527.  
  528.  
  529.  
  530.  
  531.  
  532. BASH(1)                                                   BASH(1)
  533.  
  534.  
  535.        is enabled (see SSHHEELLLL  BBUUIILLTTIINN  CCOOMMMMAANNDDSS  below),  a  word
  536.        beginning  with ## causes that word and all remaining char-
  537.        acters on that line to be ignored.  An  interactive  shell
  538.        without  the  iinntteerraaccttiivvee__ccoommmmeennttss option enabled does not
  539.        allow comments.  The iinntteerraaccttiivvee__ccoommmmeennttss option is on  by
  540.        default in interactive shells.
  541.  
  542. QQUUOOTTIINNGG
  543.        _Q_u_o_t_i_n_g  is  used to remove the special meaning of certain
  544.        characters or words to the shell.  Quoting can be used  to
  545.        disable  special treatment for special characters, to pre-
  546.        vent reserved words from being recognized as such, and  to
  547.        prevent parameter expansion.
  548.  
  549.        Each  of the _m_e_t_a_c_h_a_r_a_c_t_e_r_s listed above under DDEEFFIINNIITTIIOONNSS
  550.        has special meaning to the shell and  must  be  quoted  if
  551.        they are to represent themselves.  There are three quoting
  552.        mechanisms: the _e_s_c_a_p_e _c_h_a_r_a_c_t_e_r, single quotes, and  dou-
  553.        ble quotes.
  554.  
  555.        A  non-quoted  backslash  (\\) is the _e_s_c_a_p_e _c_h_a_r_a_c_t_e_r.  It
  556.        preserves the literal value of  the  next  character  that
  557.        follows, with the exception of <newline>.  If a \\<newline>
  558.        pair appears, and the backslash is not itself quoted,  the
  559.        \\<newline>  is treated as a line continuation (that is, it
  560.        is removed from the input stream and effectively ignored).
  561.  
  562.        Enclosing  characters  in single quotes preserves the lit-
  563.        eral value of each character within the quotes.  A  single
  564.        quote  may not occur between single quotes, even when pre-
  565.        ceded by a backslash.
  566.  
  567.        Enclosing characters in double quotes preserves  the  lit-
  568.        eral  value  of all characters within the quotes, with the
  569.        exception of $$, ``, and \\.  The characters $$ and  ``  retain
  570.        their special meaning within double quotes.  The backslash
  571.        retains its special meaning only when followed by  one  of
  572.        the  following  characters:  $$,  ``, "", \\, or <<nneewwlliinnee>>.  A
  573.        double quote may be quoted within double quotes by preced-
  574.        ing it with a backslash.
  575.  
  576.        The  special  parameters ** and @@ have special meaning when
  577.        in double quotes (see PPAARRAAMMEETTEERRSS below).
  578.  
  579.        Words of the form $$'_s_t_r_i_n_g' are  treated  specially.   The
  580.        word  expands to _s_t_r_i_n_g, with backslash-escaped characters
  581.        replaced as specifed by the ANSI  C  standard.   Backslash
  582.        escape sequences, if present, are decoded as follows:
  583.               \\aa     alert (bell)
  584.               \\bb     backspace
  585.               \\ee     an escape character
  586.               \\ff     form feed
  587.               \\nn     new line
  588.               \\rr     carriage return
  589.  
  590.  
  591.  
  592. GNU                         1998 Apr 1                          9
  593.  
  594.  
  595.  
  596.  
  597.  
  598. BASH(1)                                                   BASH(1)
  599.  
  600.  
  601.               \\tt     horizontal tab
  602.               \\vv     vertical tab
  603.               \\\\     backslash
  604.               \\_n_n_n   the  character whose ASCII code is the octal
  605.                      value _n_n_n (one to three digits)
  606.               \\xx_n_n_n  the character whose ASCII code is  the  hex-
  607.                      adecimal value _n_n_n (one to three digits)
  608.  
  609.        The  translated  result is single-quoted, as if the dollar
  610.        sign had not been present.
  611.  
  612.        A double-quoted string preceded by a dollar sign ($$)  will
  613.        cause the string to be translated according to the current
  614.        locale.  If the current locale is CC or PPOOSSIIXX,  the  dollar
  615.        sign   is  ignored.   If  the  string  is  translated  and
  616.        replaced, the replacement is double-quoted.
  617.  
  618. PPAARRAAMMEETTEERRSS
  619.        A _p_a_r_a_m_e_t_e_r is an entity that stores values.  It can be  a
  620.        _n_a_m_e,  a  number,  or one of the special characters listed
  621.        below under SSppeecciiaall PPaarraammeetteerrss.  For the shell's purposes,
  622.        a _v_a_r_i_a_b_l_e is a parameter denoted by a _n_a_m_e.
  623.  
  624.        A  parameter  is set if it has been assigned a value.  The
  625.        null string is a valid value.  Once a variable is set,  it
  626.        may  be unset only by using the uunnsseett builtin command (see
  627.        SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below).
  628.  
  629.        A _v_a_r_i_a_b_l_e may be assigned to by a statement of the form
  630.  
  631.               _n_a_m_e=[_v_a_l_u_e]
  632.  
  633.        If _v_a_l_u_e is not given, the variable is assigned  the  null
  634.        string.  All _v_a_l_u_e_s undergo tilde expansion, parameter and
  635.        variable expansion, string  expansion,  command  substitu-
  636.        tion,  arithmetic expansion, and quote removal (see EEXXPPAANN--
  637.        SSIIOONN below).  If the variable has  its  iinntteeggeerr  attribute
  638.        set  (see  ddeeccllaarree  below  in SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS) then
  639.        _v_a_l_u_e is subject  to  arithmetic  expansion  even  if  the
  640.        $((...))  expansion  is not used (see AArriitthhmmeettiicc EExxppaannssiioonn
  641.        below).  Word splitting is not performed, with the  excep-
  642.        tion  of ""$$@@"" as explained below under SSppeecciiaall PPaarraammeetteerrss.
  643.        Pathname expansion is not performed.
  644.  
  645.    PPoossiittiioonnaall PPaarraammeetteerrss
  646.        A _p_o_s_i_t_i_o_n_a_l _p_a_r_a_m_e_t_e_r is a parameter denoted  by  one  or
  647.        more  digits,  other  than the single digit 0.  Positional
  648.        parameters are assigned from the shell's arguments when it
  649.        is  invoked,  and  may be reassigned using the sseett builtin
  650.        command.  Positional parameters may  not  be  assigned  to
  651.        with assignment statements.  The positional parameters are
  652.        temporarily replaced when a  shell  function  is  executed
  653.        (see FFUUNNCCTTIIOONNSS below).
  654.  
  655.  
  656.  
  657.  
  658. GNU                         1998 Apr 1                         10
  659.  
  660.  
  661.  
  662.  
  663.  
  664. BASH(1)                                                   BASH(1)
  665.  
  666.  
  667.        When a positional parameter consisting of more than a sin-
  668.        gle digit is expanded, it must be enclosed in braces  (see
  669.        EEXXPPAANNSSIIOONN below).
  670.  
  671.    SSppeecciiaall PPaarraammeetteerrss
  672.        The  shell  treats  several  parameters  specially.  These
  673.        parameters may only be referenced; assignment to  them  is
  674.        not allowed.
  675.        **      Expands to the positional parameters, starting from
  676.               one.   When  the  expansion  occurs  within  double
  677.               quotes,  it expands to a single word with the value
  678.               of each parameter separated by the first  character
  679.               of  the  IIFFSS  special  variable.   That is, "$$**" is
  680.               equivalent to "$$11_c$$22_c......", where  _c  is  the  first
  681.               character of the value of the IIFFSS variable.  If IIFFSS
  682.               is unset, the parameters are separated  by  spaces.
  683.               If  IIFFSS  is null, the parameters are joined without
  684.               intervening separators.
  685.        @@      Expands to the positional parameters, starting from
  686.               one.   When  the  expansion  occurs  within  double
  687.               quotes, each parameter expands to a separate  word.
  688.               That  is, "$$@@" is equivalent to "$$11" "$$22" ...  When
  689.               there are no positional  parameters,  "$$@@"  and  $$@@
  690.               expand to nothing (i.e., they are removed).
  691.        ##      Expands  to  the number of positional parameters in
  692.               decimal.
  693.        ??      Expands to the status of the most recently executed
  694.               foreground pipeline.
  695.        --      Expands  to  the  current option flags as specified
  696.               upon invocation, by the  sseett  builtin  command,  or
  697.               those  set  by  the  shell  itself  (such as the --ii
  698.               option).
  699.        $$      Expands to the process ID of the shell.   In  a  ()
  700.               subshell,  it expands to the process ID of the cur-
  701.               rent shell, not the subshell.
  702.        !!      Expands to the process ID of the most recently exe-
  703.               cuted background (asynchronous) command.
  704.        00      Expands  to  the name of the shell or shell script.
  705.               This is set at shell initialization.   If  bbaasshh  is
  706.               invoked  with  a file of commands, $$00 is set to the
  707.               name of that file.  If bbaasshh is started with the  --cc
  708.               option,  then $$00 is set to the first argument after
  709.               the string to be executed, if one is present.  Oth-
  710.               erwise,  it  is set to the file name used to invoke
  711.               bbaasshh, as given by argument zero.
  712.        __      At shell startup, set to the absolute file name  of
  713.               the  shell or shell script being executed as passed
  714.               in the argument list.  Subsequently, expands to the
  715.               last argument to the previous command, after expan-
  716.               sion.  Also set to the full file name of each  com-
  717.               mand   executed   and  placed  in  the  environment
  718.               exported to that command.  When checking mail, this
  719.               parameter holds the name of the mail file currently
  720.               being checked.
  721.  
  722.  
  723.  
  724. GNU                         1998 Apr 1                         11
  725.  
  726.  
  727.  
  728.  
  729.  
  730. BASH(1)                                                   BASH(1)
  731.  
  732.  
  733.    SShheellll VVaarriiaabblleess
  734.        The following variables are set by the shell:
  735.  
  736.        PPPPIIDD   The process ID of the shell's parent.   This  vari-
  737.               able is readonly.
  738.        PPWWDD    The current working directory as set by the ccdd com-
  739.               mand.
  740.        OOLLDDPPWWDD The previous working directory as  set  by  the  ccdd
  741.               command.
  742.        RREEPPLLYY  Set  to  the line of input read by the rreeaadd builtin
  743.               command when no arguments are supplied.
  744.        UUIIDD    Expands to the user ID of the  current  user,  ini-
  745.               tialized  at shell startup.  This variable is read-
  746.               only.
  747.        EEUUIIDD   Expands to the effective user  ID  of  the  current
  748.               user,  initialized at shell startup.  This variable
  749.               is readonly.
  750.        GGRROOUUPPSS An array variable containing the list of groups  of
  751.               which  the current user is a member.  This variable
  752.               is readonly.
  753.        BBAASSHH   Expands to the full file name used to  invoke  this
  754.               instance of bbaasshh.
  755.        BBAASSHH__VVEERRSSIIOONN
  756.               Expands  to a string describing the version of this
  757.               instance of bbaasshh.
  758.        BBAASSHH__VVEERRSSIINNFFOO
  759.               A readonly array variable whose members  hold  ver-
  760.               sion  information  for  this instance of bbaasshh.  The
  761.               values assigned to the array members  are  as  fol-
  762.               lows:
  763.               BBAASSHH__VVEERRSSIINNFFOO[[0]]        The  major  version  number
  764.                                       (the _r_e_l_e_a_s_e).
  765.               BBAASSHH__VVEERRSSIINNFFOO[[1]]        The  minor  version  number
  766.                                       (the _v_e_r_s_i_o_n).
  767.               BBAASSHH__VVEERRSSIINNFFOO[[2]]        The patch level.
  768.               BBAASSHH__VVEERRSSIINNFFOO[[3]]        The build version.
  769.               BBAASSHH__VVEERRSSIINNFFOO[[4]]        The  release  status (e.g.,
  770.                                       _b_e_t_a_1).
  771.               BBAASSHH__VVEERRSSIINNFFOO[[5]]        The value of MMAACCHHTTYYPPEE.
  772.  
  773.        SSHHLLVVLL  Incremented by one each time an instance of bbaasshh is
  774.               started.
  775.  
  776.        RRAANNDDOOMM Each  time  this  parameter is referenced, a random
  777.               integer between 0  and  32767  is  generated.   The
  778.               sequence  of  random  numbers may be initialized by
  779.               assigning a value to RRAANNDDOOMM.  If RRAANNDDOOMM  is  unset,
  780.               it loses its special properties, even if it is sub-
  781.               sequently reset.
  782.  
  783.        SSEECCOONNDDSS
  784.               Each time this parameter is referenced, the  number
  785.               of  seconds since shell invocation is returned.  If
  786.               a value is assigned to SSEECCOONNDDSS, the value  returned
  787.  
  788.  
  789.  
  790. GNU                         1998 Apr 1                         12
  791.  
  792.  
  793.  
  794.  
  795.  
  796. BASH(1)                                                   BASH(1)
  797.  
  798.  
  799.               upon subsequent references is the number of seconds
  800.               since the assignment plus the value  assigned.   If
  801.               SSEECCOONNDDSS  is unset, it loses its special properties,
  802.               even if it is subsequently reset.
  803.  
  804.        LLIINNEENNOO Each time this parameter is referenced,  the  shell
  805.               substitutes  a decimal number representing the cur-
  806.               rent  sequential  line  number  (starting  with  1)
  807.               within  a script or function.  When not in a script
  808.               or function, the value substituted is  not  guaran-
  809.               teed  to  be  meaningful.   If  LLIINNEENNOO is unset, it
  810.               loses its special properties, even if it is  subse-
  811.               quently reset.
  812.  
  813.        HHIISSTTCCMMDD
  814.               The  history  number, or index in the history list,
  815.               of the current command.  If HHIISSTTCCMMDD  is  unset,  it
  816.               loses  its special properties, even if it is subse-
  817.               quently reset.
  818.  
  819.        DDIIRRSSTTAACCKK
  820.               An array variable (see AArrrraayyss below) containing the
  821.               current  contents of the directory stack.  Directo-
  822.               ries appear in the stack in the order they are dis-
  823.               played  by  the ddiirrss builtin.  Assigning to members
  824.               of this array variable may be used to modify direc-
  825.               tories already in the stack, but the ppuusshhdd and ppooppdd
  826.               builtins must be used to add  and  remove  directo-
  827.               ries.   Assignment to this variable will not change
  828.               the current directory.  If DDIIRRSSTTAACCKK  is  unset,  it
  829.               loses  its special properties, even if it is subse-
  830.               quently reset.
  831.  
  832.        PPIIPPEESSTTAATTUUSS
  833.               An array variable (see AArrrraayyss below)  containing  a
  834.               list  of  exit  status values from the processes in
  835.               the  most-recently-executed   foreground   pipeline
  836.               (which may contain only a single command).
  837.  
  838.        OOPPTTAARRGG The  value of the last option argument processed by
  839.               the ggeettooppttss builtin command (see SSHHEELLLL BBUUIILLTTIINN CCOOMM--
  840.               MMAANNDDSS below).
  841.  
  842.        OOPPTTIINNDD The  index  of the next argument to be processed by
  843.               the ggeettooppttss builtin command (see SSHHEELLLL BBUUIILLTTIINN CCOOMM--
  844.               MMAANNDDSS below).
  845.  
  846.        HHOOSSTTNNAAMMEE
  847.               Automatically  set to the name of the current host.
  848.  
  849.        HHOOSSTTTTYYPPEE
  850.               Automatically  set  to  a  string   that   uniquely
  851.               describes the type of machine on which bbaasshh is exe-
  852.               cuting.  The default is system-dependent.
  853.  
  854.  
  855.  
  856. GNU                         1998 Apr 1                         13
  857.  
  858.  
  859.  
  860.  
  861.  
  862. BASH(1)                                                   BASH(1)
  863.  
  864.  
  865.        OOSSTTYYPPEE Automatically set to a string  that  describes  the
  866.               operating  system  on which bbaasshh is executing.  The
  867.               default is system-dependent.
  868.  
  869.        MMAACCHHTTYYPPEE
  870.               Automatically set to a string that fully  describes
  871.               the  system type on which bbaasshh is executing, in the
  872.               standard  GNU   _c_p_u_-_c_o_m_p_a_n_y_-_s_y_s_t_e_m   format.    The
  873.               default is system-dependent.
  874.  
  875.        SSHHEELLLLOOPPTTSS
  876.               A  colon-separated  list  of enabled shell options.
  877.               Each word in the list is a valid argument  for  the
  878.               --oo  option  to  the  sseett builtin command (see SSHHEELLLL
  879.               BBUUIILLTTIINN CCOOMMMMAANNDDSS below).  The options appearing  in
  880.               SSHHEELLLLOOPPTTSS  are  those reported as _o_n by sseett --oo.  If
  881.               this variable  is  in  the  environment  when  bbaasshh
  882.               starts  up,  each  shell option in the list will be
  883.               enabled before reading  any  startup  files.   This
  884.               variable is read-only.
  885.  
  886.        The  following  variables  are used by the shell.  In some
  887.        cases, bbaasshh assigns a default value to a  variable;  these
  888.        cases are noted below.
  889.  
  890.        IIFFSS    The  _I_n_t_e_r_n_a_l _F_i_e_l_d _S_e_p_a_r_a_t_o_r that is used for word
  891.               splitting after expansion and to split  lines  into
  892.               words  with  the rreeaadd builtin command.  The default
  893.               value is ``<space><tab><newline>''.
  894.        PPAATTHH   The search path for commands.  It is a  colon-sepa-
  895.               rated  list of directories in which the shell looks
  896.               for commands (see CCOOMMMMAANNDD  EEXXEECCUUTTIIOONN  below).   The
  897.               default path is system-dependent, and is set by the
  898.               administrator who installs bbaasshh.  A common value is
  899.               ``/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin:.''.
  900.        HHOOMMEE   The home directory of the current user; the default
  901.               argument  for the ccdd builtin command.  The value of
  902.               this variable is also used  when  performing  tilde
  903.               expansion.
  904.        CCDDPPAATTHH The  search  path  for  the  ccdd command.  This is a
  905.               colon-separated list of directories  in  which  the
  906.               shell  looks  for destination directories specified
  907.               by the ccdd command.  A sample value is ``.:~:/usr''.
  908.        BBAASSHH__EENNVV
  909.               If  this  parameter is set when bbaasshh is executing a
  910.               shell script, its value is interpreted as  a  file-
  911.               name  containing  commands to initialize the shell,
  912.               as in _~_/_._b_a_s_h_r_c.  The value  of  BBAASSHH__EENNVV  is  sub-
  913.               jected  to  parameter  expansion, command substitu-
  914.               tion, and arithmetic expansion before being  inter-
  915.               preted  as a file name.  PPAATTHH is not used to search
  916.               for the resultant file name.
  917.        MMAAIILL   If this parameter is set to a  file  name  and  the
  918.               MMAAIILLPPAATTHH variable is not set, bbaasshh informs the user
  919.  
  920.  
  921.  
  922. GNU                         1998 Apr 1                         14
  923.  
  924.  
  925.  
  926.  
  927.  
  928. BASH(1)                                                   BASH(1)
  929.  
  930.  
  931.               of the arrival of mail in the specified file.
  932.        MMAAIILLCCHHEECCKK
  933.               Specifies how often (in seconds)  bbaasshh  checks  for
  934.               mail.   The default is 60 seconds.  When it is time
  935.               to check for mail, the shell does  so  before  dis-
  936.               playing  the  primary  prompt.  If this variable is
  937.               unset, the shell disables mail checking.
  938.        MMAAIILLPPAATTHH
  939.               A colon-separated list of file names to be  checked
  940.               for  mail.   The  message  to  be printed when mail
  941.               arrives in a particular file may  be  specified  by
  942.               separating  the  file  name from the message with a
  943.               `?'.  When used in the  text  of  the  message,  $$__
  944.               expands to the name of the current mailfile.  Exam-
  945.               ple:
  946.               MMAAIILLPPAATTHH='/usr/spool/mail/bfox?"You            have
  947.               mail":~/shell-mail?"$_ has mail!"'
  948.               BBaasshh  supplies  a  default value for this variable,
  949.               but the location of the user  mail  files  that  it
  950.               uses      is      system      dependent      (e.g.,
  951.               /usr/spool/mail/$$UUSSEERR).
  952.        PPSS11    The  value  of  this  parameter  is  expanded  (see
  953.               PPRROOMMPPTTIINNGG  below)  and  used  as the primary prompt
  954.               string.  The default value is ``\\ss--\\vv\\$$ ''.
  955.        PPSS22    The value of this parameter is expanded as with PPSS11
  956.               and  used  as  the  secondary  prompt  string.  The
  957.               default is ``>> ''.
  958.        PPSS33    The value of this parameter is used as  the  prompt
  959.               for the sseelleecctt command (see SSHHEELLLL GGRRAAMMMMAARR above).
  960.        PPSS44    The value of this parameter is expanded as with PPSS11
  961.               and the value is printed before each  command  bbaasshh
  962.               displays  during  an  execution  trace.   The first
  963.               character of PPSS44 is replicated multiple  times,  as
  964.               necessary,  to indicate multiple levels of indirec-
  965.               tion.  The default is ``++ ''.
  966.        TTIIMMEEFFOORRMMAATT
  967.               The value of this parameter is  used  as  a  format
  968.               string  specifying  how  the timing information for
  969.               pipelines prefixed  with  the  ttiimmee  reserved  word
  970.               should be displayed.  The %% character introduces an
  971.               escape sequence that is expanded to a time value or
  972.               other  information.  The escape sequences and their
  973.               meanings are as follows; the braces denote optional
  974.               portions.
  975.               %%%%        A literal %%.
  976.               %%[[_p]][[ll]]RR  The elapsed time in seconds.
  977.               %%[[_p]][[ll]]UU  The  number  of CPU seconds spent in user
  978.                         mode.
  979.               %%[[_p]][[ll]]SS  The number of CPU seconds spent in system
  980.                         mode.
  981.               %%PP        The CPU percentage, computed as (%U + %S)
  982.                         / %R.
  983.  
  984.               The optional _p is a digit specifying the _p_r_e_c_i_s_i_o_n,
  985.  
  986.  
  987.  
  988. GNU                         1998 Apr 1                         15
  989.  
  990.  
  991.  
  992.  
  993.  
  994. BASH(1)                                                   BASH(1)
  995.  
  996.  
  997.               the  number  of  fractional  digits after a decimal
  998.               point.  A value of 0 causes  no  decimal  point  or
  999.               fraction  to be output.  At most three places after
  1000.               the decimal point may be  specified;  values  of  _p
  1001.               greater than 3 are changed to 3.  If _p is not spec-
  1002.               ified, the value 3 is used.
  1003.  
  1004.               The optional ll specifies a longer format, including
  1005.               minutes,  of  the  form  _M_Mm_S_S._F_Fs.  The value of _p
  1006.               determines whether or not the fraction is included.
  1007.  
  1008.               If this variable is not set, bbaasshh acts as if it had
  1009.               the value $$''\\nnrreeaall\\tt%%33llRR\\nnuusseerr\\tt%%33llUU\\nnssyyss%%33llSS''.  If
  1010.               the  value  is  null, no timing information is dis-
  1011.               played.  A trailing newline is added when the  for-
  1012.               mat string is displayed.
  1013.  
  1014.        HHIISSTTSSIIZZEE
  1015.               The  number  of commands to remember in the command
  1016.               history (see HHIISSTTOORRYY below).  The default value  is
  1017.               500.
  1018.  
  1019.        HHIISSTTFFIILLEE
  1020.               The  name  of  the file in which command history is
  1021.               saved (see HHIISSTTOORRYY below).  The  default  value  is
  1022.               _~_/_._b_a_s_h___h_i_s_t_o_r_y.   If unset, the command history is
  1023.               not saved when an interactive shell exits.
  1024.  
  1025.        HHIISSTTFFIILLEESSIIZZEE
  1026.               The maximum number of lines contained in  the  his-
  1027.               tory file.  When this variable is assigned a value,
  1028.               the history file is  truncated,  if  necessary,  to
  1029.               contain  no  more  than  that number of lines.  The
  1030.               default value is 500.  The  history  file  is  also
  1031.               truncated  to  this  size  after writing it when an
  1032.               interactive shell exits.
  1033.  
  1034.        OOPPTTEERRRR If set to the value 1, bbaasshh displays error messages
  1035.               generated by the ggeettooppttss builtin command (see SSHHEELLLL
  1036.               BBUUIILLTTIINN CCOOMMMMAANNDDSS below).  OOPPTTEERRRR is initialized  to
  1037.               1  each time the shell is invoked or a shell script
  1038.               is executed.
  1039.  
  1040.        LLAANNGG   Used to determine the locale category for any cate-
  1041.               gory  not  specifically  selected  with  a variable
  1042.               starting with LLCC__.
  1043.  
  1044.        LLCC__AALLLL This variable overrides the value of LLAANNGG  and  any
  1045.               other LLCC__ variable specifying a locale category.
  1046.  
  1047.        LLCC__CCOOLLLLAATTEE
  1048.               This  variable  determines the collation order used
  1049.               when sorting the results of pathname expansion, and
  1050.               determines   the  behavior  of  range  expressions,
  1051.  
  1052.  
  1053.  
  1054. GNU                         1998 Apr 1                         16
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060. BASH(1)                                                   BASH(1)
  1061.  
  1062.  
  1063.               equivalence classes, and collating sequences within
  1064.               pathname expansion and pattern matching.
  1065.  
  1066.        LLCC__CCTTYYPPEE
  1067.               This  variable  determines  the  interpretation  of
  1068.               characters and the behavior  of  character  classes
  1069.               within pathname expansion and pattern matching.
  1070.  
  1071.        LLCC__MMEESSSSAAGGEESS
  1072.               This  variable determines the locale used to trans-
  1073.               late double-quoted strings preceded by a $$.
  1074.  
  1075.        PPRROOMMPPTT__CCOOMMMMAANNDD
  1076.               If set, the value is executed as a command prior to
  1077.               issuing each primary prompt.
  1078.  
  1079.        IIGGNNOORREEEEOOFF
  1080.               Controls  the  action  of  an  interactive shell on
  1081.               receipt of an EEOOFF character as the sole input.   If
  1082.               set,  the  value  is  the number of consecutive EEOOFF
  1083.               characters which must be typed as the first charac-
  1084.               ters  on  an  input line before bbaasshh exits.  If the
  1085.               variable exists but does not have a numeric  value,
  1086.               or  has  no  value, the default value is 10.  If it
  1087.               does not exist, EEOOFF signifies the end of  input  to
  1088.               the shell.
  1089.  
  1090.        TTMMOOUUTT  If  set  to a value greater than zero, the value is
  1091.               interpreted as the number of seconds  to  wait  for
  1092.               input  after issuing the primary prompt.  BBaasshh ter-
  1093.               minates after waiting for that number of seconds if
  1094.               input does not arrive.
  1095.  
  1096.        FFCCEEDDIITT The default editor for the ffcc builtin command.
  1097.  
  1098.        FFIIGGNNOORREE
  1099.               A  colon-separated  list of suffixes to ignore when
  1100.               performing  filename   completion   (see   RREEAADDLLIINNEE
  1101.               below).  A filename whose suffix matches one of the
  1102.               entries in FFIIGGNNOORREE is excluded  from  the  list  of
  1103.               matched filenames.  A sample value is ``.o:~''.
  1104.  
  1105.        GGLLOOBBIIGGNNOORREE
  1106.               A colon-separated list of patterns defining the set
  1107.               of filenames to be ignored by  pathname  expansion.
  1108.               If  a filename matched by a pathname expansion pat-
  1109.               tern also matches one of the  patterns  in  GGLLOOBBIIGG--
  1110.               NNOORREE, it is removed from the list of matches.
  1111.  
  1112.        IINNPPUUTTRRCC
  1113.               The  filename  for the rreeaaddlliinnee startup file, over-
  1114.               riding the  default  of  _~_/_._i_n_p_u_t_r_c  (see  RREEAADDLLIINNEE
  1115.               below).
  1116.  
  1117.  
  1118.  
  1119.  
  1120. GNU                         1998 Apr 1                         17
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126. BASH(1)                                                   BASH(1)
  1127.  
  1128.  
  1129.        HHIISSTTCCOONNTTRROOLL
  1130.               If set to a value of _i_g_n_o_r_e_s_p_a_c_e, lines which begin
  1131.               with a ssppaaccee character are not entered on the  his-
  1132.               tory  list.  If set to a value of _i_g_n_o_r_e_d_u_p_s, lines
  1133.               matching the last history line are not entered.   A
  1134.               value  of  _i_g_n_o_r_e_b_o_t_h combines the two options.  If
  1135.               unset, or if set to  any  other  value  than  those
  1136.               above,  all  lines  read by the parser are saved on
  1137.               the history list, subject to the value  of  HHIISSTTIIGG--
  1138.               NNOORREE.   This  variable's  function is superseded by
  1139.               HHIISSTTIIGGNNOORREE.  The second and subsequent lines  of  a
  1140.               multi-line compound command are not tested, and are
  1141.               added to the history regardless  of  the  value  of
  1142.               HHIISSTTCCOONNTTRROOLL.
  1143.  
  1144.        HHIISSTTIIGGNNOORREE
  1145.               A  colon-separated  list of patterns used to decide
  1146.               which command lines should be saved on the  history
  1147.               list.  Each pattern is anchored at the beginning of
  1148.               the line  and  must  fully  specify  the  line  (no
  1149.               implicit  `**' is appended).  Each pattern is tested
  1150.               against the line  after  the  checks  specified  by
  1151.               HHIISSTTCCOONNTTRROOLL are applied.  In addition to the normal
  1152.               shell pattern matching characters, `&&' matches  the
  1153.               previous  history line.  `&&' may be escaped using a
  1154.               backslash.   The  backslash   is   removed   before
  1155.               attempting  a  match.   The  second  and subsequent
  1156.               lines of a  multi-line  compound  command  are  not
  1157.               tested,  and are added to the history regardless of
  1158.               the value of HHIISSTTIIGGNNOORREE.
  1159.  
  1160.        hhiissttcchhaarrss
  1161.               The two or three characters which  control  history
  1162.               expansion  and  tokenization (see HHIISSTTOORRYY EEXXPPAANNSSIIOONN
  1163.               below).  The first character is the _h_i_s_t_o_r_y  _e_x_p_a_n_-
  1164.               _s_i_o_n  _c_h_a_r_a_c_t_e_r,  the  character  which signals the
  1165.               start of a history expansion,  normally  `!!'.   The
  1166.               second  character is the _q_u_i_c_k _s_u_b_s_t_i_t_u_t_i_o_n charac-
  1167.               ter, which is used as shorthand for re-running  the
  1168.               previous  command  entered, substituting one string
  1169.               for another in the command.  The  default  is  `^^'.
  1170.               The optional third character is the character which
  1171.               indicates that the remainder of the line is a  com-
  1172.               ment  when  found as the first character of a word,
  1173.               normally `##'.  The history comment character causes
  1174.               history  substitution to be skipped for the remain-
  1175.               ing words on the line.   It  does  not  necessarily
  1176.               cause  the  shell  parser  to treat the rest of the
  1177.               line as a comment.
  1178.  
  1179.        HHOOSSTTFFIILLEE
  1180.               Contains the name of a file in the same  format  as
  1181.               _/_e_t_c_/_h_o_s_t_s that should be read when the shell needs
  1182.               to complete a hostname.  The file  may  be  changed
  1183.  
  1184.  
  1185.  
  1186. GNU                         1998 Apr 1                         18
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192. BASH(1)                                                   BASH(1)
  1193.  
  1194.  
  1195.               interactively; the next time hostname completion is
  1196.               attempted bbaasshh adds the contents of the new file to
  1197.               the already existing database.
  1198.  
  1199.        aauuttoo__rreessuummee
  1200.               This variable controls how the shell interacts with
  1201.               the user and job control.  If this variable is set,
  1202.               single  word  simple  commands without redirections
  1203.               are treated as  candidates  for  resumption  of  an
  1204.               existing   stopped  job.   There  is  no  ambiguity
  1205.               allowed; if there is more than  one  job  beginning
  1206.               with  the  string  typed,  the  job  most  recently
  1207.               accessed is selected.  The _n_a_m_e of a  stopped  job,
  1208.               in  this context, is the command line used to start
  1209.               it.  If set to the value _e_x_a_c_t, the string supplied
  1210.               must  match  the  name of a stopped job exactly; if
  1211.               set to _s_u_b_s_t_r_i_n_g,  the  string  supplied  needs  to
  1212.               match  a  substring  of  the name of a stopped job.
  1213.               The _s_u_b_s_t_r_i_n_g value provides  functionality  analo-
  1214.               gous  to  the  %%??   job identifier (see JJOOBB CCOONNTTRROOLL
  1215.               below).  If set to any other  value,  the  supplied
  1216.               string  must  be  a prefix of a stopped job's name;
  1217.               this provides functionality analogous to the %%  job
  1218.               identifier.
  1219.  
  1220.    AArrrraayyss
  1221.        BBaasshh  provides one-dimensional array variables.  Any vari-
  1222.        able may be used as an array;  the  ddeeccllaarree  builtin  will
  1223.        explicitly declare an array.  There is no maximum limit on
  1224.        the size of an array, nor any requirement that members  be
  1225.        indexed  or  assigned  contiguously.   Arrays  are indexed
  1226.        using integers and are zero-based.
  1227.  
  1228.        An array is  created  automatically  if  any  variable  is
  1229.        assigned  to  using the syntax _n_a_m_e[_s_u_b_s_c_r_i_p_t]=_v_a_l_u_e.  The
  1230.        _s_u_b_s_c_r_i_p_t is treated as an arithmetic expression that must
  1231.        evaluate  to  a  number greater than or equal to zero.  To
  1232.        explicitly declare an array,  use  ddeeccllaarree  --aa  _n_a_m_e  (see
  1233.        SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below).  ddeeccllaarree --aa _n_a_m_e[[_s_u_b_s_c_r_i_p_t]]
  1234.        is also accepted; the _s_u_b_s_c_r_i_p_t  is  ignored.   Attributes
  1235.        may  be  specified for an array variable using the ddeeccllaarree
  1236.        and rreeaaddoonnllyy builtins.  Each attribute applies to all mem-
  1237.        bers of an array.
  1238.  
  1239.        Arrays  are  assigned to using compound assignments of the
  1240.        form _n_a_m_e=((value_1 ... value_n)), where each _v_a_l_u_e is of  the
  1241.        form [_s_u_b_s_c_r_i_p_t]=_s_t_r_i_n_g.  Only _s_t_r_i_n_g is required.  If the
  1242.        optional brackets and subscript are supplied,  that  index
  1243.        is  assigned  to;  otherwise  the  index  of  the  element
  1244.        assigned is the last index assigned to  by  the  statement
  1245.        plus  one.   Indexing starts at zero.  This syntax is also
  1246.        accepted by the ddeeccllaarree builtin.   Individual  array  ele-
  1247.        ments  may  be assigned to using the _n_a_m_e[_s_u_b_s_c_r_i_p_t]=_v_a_l_u_e
  1248.        syntax introduced above.
  1249.  
  1250.  
  1251.  
  1252. GNU                         1998 Apr 1                         19
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258. BASH(1)                                                   BASH(1)
  1259.  
  1260.  
  1261.        Any  element  of  an  array  may   be   referenced   using
  1262.        ${_n_a_m_e[_s_u_b_s_c_r_i_p_t]}.  The braces are required to avoid con-
  1263.        flicts with pathname expansion.  If _s_u_b_s_c_r_i_p_t is @@  or  **,
  1264.        the word expands to all members of _n_a_m_e.  These subscripts
  1265.        differ only when the word appears  within  double  quotes.
  1266.        If the word is double-quoted, ${_n_a_m_e[*]} expands to a sin-
  1267.        gle word with the value of each array member separated  by
  1268.        the  first  character  of  the  IIFFSS  special variable, and
  1269.        ${_n_a_m_e[@]} expands each element  of  _n_a_m_e  to  a  separate
  1270.        word.  When there are no array members, ${_n_a_m_e[@]} expands
  1271.        to nothing.  This is analogous to  the  expansion  of  the
  1272.        special parameters ** and @@ (see SSppeecciiaall PPaarraammeetteerrss above).
  1273.        ${#_n_a_m_e[_s_u_b_s_c_r_i_p_t]} expands to the length  of  ${_n_a_m_e[_s_u_b_-
  1274.        _s_c_r_i_p_t]}.   If  _s_u_b_s_c_r_i_p_t  is ** or @@, the expansion is the
  1275.        number of elements in the  array.   Referencing  an  array
  1276.        variable  without a subscript is equivalent to referencing
  1277.        element zero.
  1278.  
  1279.        The uunnsseett  builtin  is  used  to  destroy  arrays.   uunnsseett
  1280.        nnaammee[_s_u_b_s_c_r_i_p_t]  destroys  the array element at index _s_u_b_-
  1281.        _s_c_r_i_p_t.  uunnsseett _n_a_m_e, where _n_a_m_e  is  an  array,  or  uunnsseett
  1282.        _n_a_m_e[_s_u_b_s_c_r_i_p_t],  where  _s_u_b_s_c_r_i_p_t  is ** or @@, removes the
  1283.        entire array.
  1284.  
  1285.        The ddeeccllaarree, llooccaall, and rreeaaddoonnllyy builtins each accept a --aa
  1286.        option to specify an array.  The rreeaadd builtin accepts a --aa
  1287.        option to assign a list of words read  from  the  standard
  1288.        input  to  an array.  The sseett and ddeeccllaarree builtins display
  1289.        array values in a way that allows them  to  be  reused  as
  1290.        assignments.
  1291.  
  1292. EEXXPPAANNSSIIOONN
  1293.        Expansion  is  performed  on the command line after it has
  1294.        been split into words.  There are seven kinds of expansion
  1295.        performed: _b_r_a_c_e _e_x_p_a_n_s_i_o_n, _t_i_l_d_e _e_x_p_a_n_s_i_o_n, _p_a_r_a_m_e_t_e_r _a_n_d
  1296.        _v_a_r_i_a_b_l_e  _e_x_p_a_n_s_i_o_n,  _c_o_m_m_a_n_d   _s_u_b_s_t_i_t_u_t_i_o_n,   _a_r_i_t_h_m_e_t_i_c
  1297.        _e_x_p_a_n_s_i_o_n, _w_o_r_d _s_p_l_i_t_t_i_n_g, and _p_a_t_h_n_a_m_e _e_x_p_a_n_s_i_o_n.
  1298.  
  1299.        The  order of expansions is: brace expansion, tilde expan-
  1300.        sion, parameter, variable  and  arithmetic  expansion  and
  1301.        command  substitution  (done  in a left-to-right fashion),
  1302.        word splitting, and pathname expansion.
  1303.  
  1304.        On systems that can support it,  there  is  an  additional
  1305.        expansion available: _p_r_o_c_e_s_s _s_u_b_s_t_i_t_u_t_i_o_n.
  1306.  
  1307.        Only  brace expansion, word splitting, and pathname expan-
  1308.        sion can change the number  of  words  of  the  expansion;
  1309.        other  expansions  expand  a single word to a single word.
  1310.        The only exceptions to this are the expansions of "$$@@" and
  1311.        "$${{_n_a_m_e[[@@]]}}" as explained above (see PPAARRAAMMEETTEERRSS).
  1312.  
  1313.    BBrraaccee EExxppaannssiioonn
  1314.        _B_r_a_c_e  _e_x_p_a_n_s_i_o_n is a mechanism by which arbitrary strings
  1315.  
  1316.  
  1317.  
  1318. GNU                         1998 Apr 1                         20
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324. BASH(1)                                                   BASH(1)
  1325.  
  1326.  
  1327.        may be generated.  This mechanism is similar  to  _p_a_t_h_n_a_m_e
  1328.        _e_x_p_a_n_s_i_o_n,  but  the  filenames  generated need not exist.
  1329.        Patterns to be brace expanded take the form of an optional
  1330.        _p_r_e_a_m_b_l_e,  followed by a series of comma-separated strings
  1331.        between  a  pair  of  braces,  followed  by  an   optional
  1332.        _p_o_s_t_s_c_r_i_p_t.   The preamble is prefixed to each string con-
  1333.        tained within the  braces,  and  the  postscript  is  then
  1334.        appended  to  each  resulting  string,  expanding  left to
  1335.        right.
  1336.  
  1337.        Brace expansions may  be  nested.   The  results  of  each
  1338.        expanded  string  are  not  sorted; left to right order is
  1339.        preserved.  For example, a{{d,c,b}}e expands into  `ade  ace
  1340.        abe'.
  1341.  
  1342.        Brace  expansion is performed before any other expansions,
  1343.        and any characters special to other  expansions  are  pre-
  1344.        served  in the result.  It is strictly textual.  BBaasshh does
  1345.        not apply any syntactic interpretation to the  context  of
  1346.        the expansion or the text between the braces.
  1347.  
  1348.        A  correctly-formed  brace expansion must contain unquoted
  1349.        opening and closing braces,  and  at  least  one  unquoted
  1350.        comma.   Any  incorrectly  formed  brace expansion is left
  1351.        unchanged.  A {{ or ,, may be quoted  with  a  backslash  to
  1352.        prevent its being considered part of a brace expression.
  1353.  
  1354.        This  construct  is  typically  used as shorthand when the
  1355.        common prefix of the strings to  be  generated  is  longer
  1356.        than in the above example:
  1357.  
  1358.               mkdir /usr/local/src/bash/{old,new,dist,bugs}
  1359.        or
  1360.               chown root /usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}}
  1361.  
  1362.        Brace expansion introduces a slight  incompatibility  with
  1363.        historical  versions  of sshh.  sshh does not treat opening or
  1364.        closing braces specially when they appear  as  part  of  a
  1365.        word,  and  preserves  them  in  the output.  BBaasshh removes
  1366.        braces from words as a  consequence  of  brace  expansion.
  1367.        For  example,  a  word  entered to sshh as _f_i_l_e_{_1_,_2_} appears
  1368.        identically in the output.  The same  word  is  output  as
  1369.        _f_i_l_e_1  _f_i_l_e_2  after expansion by bbaasshh.  If strict compati-
  1370.        bility with sshh is desired, start bbaasshh with the  ++BB  option
  1371.        or  disable  brace expansion with the ++BB option to the sseett
  1372.        command (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below).
  1373.  
  1374.    TTiillddee EExxppaannssiioonn
  1375.        If a word begins with an unquoted tilde  character  (`~~'),
  1376.        all  of  the characters preceding the first unquoted slash
  1377.        (or all characters, if there is  no  unquoted  slash)  are
  1378.        considered  a  _t_i_l_d_e_-_p_r_e_f_i_x.  If none of the characters in
  1379.        the tilde-prefix are quoted, the characters in the  tilde-
  1380.        prefix following the tilde are treated as a possible _l_o_g_i_n
  1381.  
  1382.  
  1383.  
  1384. GNU                         1998 Apr 1                         21
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390. BASH(1)                                                   BASH(1)
  1391.  
  1392.  
  1393.        _n_a_m_e.  If this login name is the null string, the tilde is
  1394.        replaced  with  the value of the shell parameter HHOOMMEE.  If
  1395.        HHOOMMEE is unset, the home directory of  the  user  executing
  1396.        the  shell  is substituted instead.  Otherwise, the tilde-
  1397.        prefix is replaced with the home directory associated with
  1398.        the specified login name.
  1399.  
  1400.        If  the  tilde-prefix  is  a  `~+', the value of the shell
  1401.        variable PPWWDD replaces the tilde-prefix.  If the tilde-pre-
  1402.        fix  is a `~-', the value of the shell variable OOLLDDPPWWDD, if
  1403.        it is set, is substituted.  If  the  characters  following
  1404.        the  tilde  in  the  tilde-prefix  consist  of a number _N,
  1405.        optionally prefixed by a `+' or a `-', the tilde-prefix is
  1406.        replaced with the corresponding element from the directory
  1407.        stack, as it  would  be  displayed  by  the  ddiirrss  builtin
  1408.        invoked  with  the  tilde-prefix  as  an argument.  If the
  1409.        characters following the tilde in the tilde-prefix consist
  1410.        of  a number without a leading `+' or `-', `+' is assumed.
  1411.  
  1412.        If the login name  is  invalid,  or  the  tilde  expansion
  1413.        fails, the word is unchanged.
  1414.  
  1415.        Each  variable  assignment  is checked for unquoted tilde-
  1416.        prefixes immediately following a :: or ==.  In these  cases,
  1417.        tilde  expansion is also performed.  Consequently, one may
  1418.        use file names with tildes in assignments to  PPAATTHH,  MMAAIILL--
  1419.        PPAATTHH,  and  CCDDPPAATTHH,  and  the  shell  assigns the expanded
  1420.        value.
  1421.  
  1422.    PPaarraammeetteerr EExxppaannssiioonn
  1423.        The `$$' character introduces parameter expansion,  command
  1424.        substitution, or arithmetic expansion.  The parameter name
  1425.        or symbol to be expanded may be enclosed in braces,  which
  1426.        are  optional  but  serve  to  protect  the variable to be
  1427.        expanded from characters immediately  following  it  which
  1428.        could be interpreted as part of the name.
  1429.  
  1430.        When  braces  are  used,  the matching ending brace is the
  1431.        first `}}' not escaped by a backslash or  within  a  quoted
  1432.        string,  and  not within an embedded arithmetic expansion,
  1433.        command substitution, or paramter expansion.
  1434.  
  1435.        ${_p_a_r_a_m_e_t_e_r}
  1436.               The value of _p_a_r_a_m_e_t_e_r is substituted.  The  braces
  1437.               are required when _p_a_r_a_m_e_t_e_r is a positional parame-
  1438.               ter with more than one digit, or when _p_a_r_a_m_e_t_e_r  is
  1439.               followed  by  a character which is not to be inter-
  1440.               preted as part of its name.
  1441.  
  1442.        If the first character  of  _p_a_r_a_m_e_t_e_r  is  an  exclamation
  1443.        point,  a  level  of  variable  indirection is introduced.
  1444.        BBaasshh uses the value of the variable formed from  the  rest
  1445.        of _p_a_r_a_m_e_t_e_r as the name of the variable; this variable is
  1446.        then expanded and that value  used  in  the  rest  of  the
  1447.  
  1448.  
  1449.  
  1450. GNU                         1998 Apr 1                         22
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456. BASH(1)                                                   BASH(1)
  1457.  
  1458.  
  1459.        substitution,  rather  than the value of _p_a_r_a_m_e_t_e_r itself.
  1460.        This is known as _i_n_d_i_r_e_c_t _e_x_p_a_n_s_i_o_n.
  1461.  
  1462.        In each of the cases  below,  _w_o_r_d  is  subject  to  tilde
  1463.        expansion,  parameter expansion, command substitution, and
  1464.        arithmetic  expansion.   When  not  performing   substring
  1465.        expansion,  bbaasshh  tests  for  a parameter that is unset or
  1466.        null; omitting the colon results in  a  test  only  for  a
  1467.        parameter that is unset.
  1468.  
  1469.        ${_p_a_r_a_m_e_t_e_r::--_w_o_r_d}
  1470.               UUssee DDeeffaauulltt VVaalluueess.  If _p_a_r_a_m_e_t_e_r is unset or null,
  1471.               the expansion of _w_o_r_d is  substituted.   Otherwise,
  1472.               the value of _p_a_r_a_m_e_t_e_r is substituted.
  1473.        ${_p_a_r_a_m_e_t_e_r::==_w_o_r_d}
  1474.               AAssssiiggnn  DDeeffaauulltt  VVaalluueess.   If _p_a_r_a_m_e_t_e_r is unset or
  1475.               null, the expansion of _w_o_r_d is assigned to  _p_a_r_a_m_e_-
  1476.               _t_e_r.   The  value of _p_a_r_a_m_e_t_e_r is then substituted.
  1477.               Positional parameters and  special  parameters  may
  1478.               not be assigned to in this way.
  1479.        ${_p_a_r_a_m_e_t_e_r::??_w_o_r_d}
  1480.               DDiissppllaayy  EErrrroorr  iiff  NNuullll oorr UUnnsseett.  If _p_a_r_a_m_e_t_e_r is
  1481.               null or unset, the expansion of _w_o_r_d (or a  message
  1482.               to  that  effect if _w_o_r_d is not present) is written
  1483.               to the standard error and the shell, if it  is  not
  1484.               interactive, exits.  Otherwise, the value of _p_a_r_a_m_-
  1485.               _e_t_e_r is substituted.
  1486.        ${_p_a_r_a_m_e_t_e_r::++_w_o_r_d}
  1487.               UUssee AAlltteerrnnaattee  VVaalluuee.   If  _p_a_r_a_m_e_t_e_r  is  null  or
  1488.               unset, nothing is substituted, otherwise the expan-
  1489.               sion of _w_o_r_d is substituted.
  1490.        ${_p_a_r_a_m_e_t_e_r::_o_f_f_s_e_t}
  1491.        ${_p_a_r_a_m_e_t_e_r::_o_f_f_s_e_t::_l_e_n_g_t_h}
  1492.               SSuubbssttrriinngg EExxppaannssiioonn..  Expands to up to _l_e_n_g_t_h char-
  1493.               acters  of  _p_a_r_a_m_e_t_e_r,  starting  at the characters
  1494.               specified by _o_f_f_s_e_t.  If _l_e_n_g_t_h is omitted, expands
  1495.               to  the  substring  of  _p_a_r_a_m_e_t_e_r,  starting at the
  1496.               character specified by _o_f_f_s_e_t.  _l_e_n_g_t_h  and  _o_f_f_s_e_t
  1497.               are  arithmetic expressions (see AARRIITTHHMMEETTIICC EEVVAALLUUAA--
  1498.               TTIIOONN below).  _l_e_n_g_t_h  must  evaluate  to  a  number
  1499.               greater than or equal to zero.  If _o_f_f_s_e_t evaluates
  1500.               to a number less than zero, the value is used as an
  1501.               offset  from the end of the value of _p_a_r_a_m_e_t_e_r.  If
  1502.               _p_a_r_a_m_e_t_e_r is @@, the  result  is  _l_e_n_g_t_h  positional
  1503.               parameters beginning at _o_f_f_s_e_t.  If _p_a_r_a_m_e_t_e_r is an
  1504.               array name indexed by @ or *,  the  result  is  the
  1505.               _l_e_n_g_t_h members of the array beginning with ${_p_a_r_a_m_-
  1506.               _e_t_e_r[_o_f_f_s_e_t]}.  Substring  indexing  is  zero-based
  1507.               unless the positional parameters are used, in which
  1508.               case the indexing starts at 1.
  1509.  
  1510.        ${##_p_a_r_a_m_e_t_e_r}
  1511.               The length in characters of the value of  _p_a_r_a_m_e_t_e_r
  1512.               is  substituted.  If _p_a_r_a_m_e_t_e_r is ** or @@, the value
  1513.  
  1514.  
  1515.  
  1516. GNU                         1998 Apr 1                         23
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522. BASH(1)                                                   BASH(1)
  1523.  
  1524.  
  1525.               substituted is the number of positional parameters.
  1526.               If  _p_a_r_a_m_e_t_e_r  is an array name subscripted by ** or
  1527.               @@, the value substituted is the number of  elements
  1528.               in the array.
  1529.  
  1530.        ${_p_a_r_a_m_e_t_e_r##_w_o_r_d}
  1531.        ${_p_a_r_a_m_e_t_e_r####_w_o_r_d}
  1532.               The  _w_o_r_d  is expanded to produce a pattern just as
  1533.               in pathname expansion.  If the pattern matches  the
  1534.               beginning  of  the  value  of  _p_a_r_a_m_e_t_e_r,  then the
  1535.               result of the expansion is the  expanded  value  of
  1536.               _p_a_r_a_m_e_t_e_r  with  the shortest matching pattern (the
  1537.               ``##'' case) or the longest  matching  pattern  (the
  1538.               ``####''  case) deleted.  If _p_a_r_a_m_e_t_e_r is @@ or **, the
  1539.               pattern removal operation is applied to each  posi-
  1540.               tional  parameter in turn, and the expansion is the
  1541.               resultant list.  If _p_a_r_a_m_e_t_e_r is an array  variable
  1542.               subscripted with @@ or **, the pattern removal opera-
  1543.               tion is applied to each  member  of  the  array  in
  1544.               turn, and the expansion is the resultant list.
  1545.  
  1546.        ${_p_a_r_a_m_e_t_e_r%%_w_o_r_d}
  1547.        ${_p_a_r_a_m_e_t_e_r%%%%_w_o_r_d}
  1548.               The  _w_o_r_d  is expanded to produce a pattern just as
  1549.               in pathname expansion.  If the  pattern  matches  a
  1550.               trailing  portion  of the expanded value of _p_a_r_a_m_e_-
  1551.               _t_e_r, then  the  result  of  the  expansion  is  the
  1552.               expanded  value  of  _p_a_r_a_m_e_t_e_r  with  the  shortest
  1553.               matching pattern (the ``%%'' case)  or  the  longest
  1554.               matching  pattern  (the  ``%%%%''  case) deleted.  If
  1555.               _p_a_r_a_m_e_t_e_r is @@ or **, the pattern removal  operation
  1556.               is  applied  to  each positional parameter in turn,
  1557.               and the expansion is the resultant list.  If _p_a_r_a_m_-
  1558.               _e_t_e_r  is an array variable subscripted with @@ or **,
  1559.               the pattern removal operation is  applied  to  each
  1560.               member  of  the array in turn, and the expansion is
  1561.               the resultant list.
  1562.  
  1563.        ${_p_a_r_a_m_e_t_e_r//_p_a_t_t_e_r_n//_s_t_r_i_n_g}
  1564.        ${_p_a_r_a_m_e_t_e_r////_p_a_t_t_e_r_n//_s_t_r_i_n_g}
  1565.               The _p_a_t_t_e_r_n is expanded to produce a  pattern  just
  1566.               as  in  pathname  expansion.  _P_a_r_a_m_e_t_e_r is expanded
  1567.               and the longest match of _p_a_t_t_e_r_n against its  value
  1568.               is  replaced  with _s_t_r_i_n_g.  In the first form, only
  1569.               the first  match  is  replaced.   The  second  form
  1570.               causes  all  matches of _p_a_t_t_e_r_n to be replaced with
  1571.               _s_t_r_i_n_g.  If _p_a_t_t_e_r_n begins with ##, it must match at
  1572.               the beginning of _s_t_r_i_n_g.  If _p_a_t_t_e_r_n begins with %%,
  1573.               it must match at the end of _s_t_r_i_n_g.  If  _s_t_r_i_n_g  is
  1574.               null, matches of _p_a_t_t_e_r_n are deleted and the // fol-
  1575.               lowing _p_a_t_t_e_r_n may be omitted.  If _p_a_r_a_m_e_t_e_r  is  @@
  1576.               or **, the substitution operation is applied to each
  1577.               positional parameter in turn, and the expansion  is
  1578.               the  resultant  list.   If  _p_a_r_a_m_e_t_e_r  is  an array
  1579.  
  1580.  
  1581.  
  1582. GNU                         1998 Apr 1                         24
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588. BASH(1)                                                   BASH(1)
  1589.  
  1590.  
  1591.               variable subscripted with @@ or **, the  substitution
  1592.               operation is applied to each member of the array in
  1593.               turn, and the expansion is the resultant list.
  1594.  
  1595.    CCoommmmaanndd SSuubbssttiittuuttiioonn
  1596.        _C_o_m_m_a_n_d _s_u_b_s_t_i_t_u_t_i_o_n allows the output  of  a  command  to
  1597.        replace the command name.  There are two forms:
  1598.  
  1599.  
  1600.               $$((_c_o_m_m_a_n_d))
  1601.        or
  1602.               ``_c_o_m_m_a_n_d``
  1603.  
  1604.        BBaasshh  performs  the  expansion  by  executing  _c_o_m_m_a_n_d and
  1605.        replacing the command substitution with the standard  out-
  1606.        put  of  the  command, with any trailing newlines deleted.
  1607.        Embedded newlines are not deleted, but they may be removed
  1608.        during  word  splitting.   The  command substitution $$((ccaatt
  1609.        _f_i_l_e)) can be replaced by the  equivalent  but  faster  $$((<<
  1610.        _f_i_l_e)).
  1611.  
  1612.        When the old-style backquote form of substitution is used,
  1613.        backslash retains its literal meaning except when followed
  1614.        by  $$,  ``,  or  \\.   The first backquote not preceded by a
  1615.        backslash terminates the command substitution.  When using
  1616.        the  $(_c_o_m_m_a_n_d) form, all characters between the parenthe-
  1617.        ses make up the command; none are treated specially.
  1618.  
  1619.        Command substitutions may be nested.  To nest  when  using
  1620.        the  backquoted  form,  escape  the  inner backquotes with
  1621.        backslashes.
  1622.  
  1623.        If the substitution appears  within  double  quotes,  word
  1624.        splitting  and pathname expansion are not performed on the
  1625.        results.
  1626.  
  1627.    AArriitthhmmeettiicc EExxppaannssiioonn
  1628.        Arithmetic expansion allows the evaluation  of  an  arith-
  1629.        metic  expression and the substitution of the result.  The
  1630.        format for arithmetic expansion is:
  1631.  
  1632.               $$((((_e_x_p_r_e_s_s_i_o_n))))
  1633.  
  1634.        The _e_x_p_r_e_s_s_i_o_n is treated as  if  it  were  within  double
  1635.        quotes,  but  a double quote inside the parentheses is not
  1636.        treated specially.  All tokens in the  expression  undergo
  1637.        parameter  expansion,  string expansion, command substitu-
  1638.        tion, and quote removal.  Arithmetic substitutions may  be
  1639.        nested.
  1640.  
  1641.        The  evaluation is performed according to the rules listed
  1642.        below  under  AARRIITTHHMMEETTIICC  EEVVAALLUUAATTIIOONN.   If  _e_x_p_r_e_s_s_i_o_n  is
  1643.        invalid,  bbaasshh  prints a message indicating failure and no
  1644.        substitution occurs.
  1645.  
  1646.  
  1647.  
  1648. GNU                         1998 Apr 1                         25
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654. BASH(1)                                                   BASH(1)
  1655.  
  1656.  
  1657.    PPrroocceessss SSuubbssttiittuuttiioonn
  1658.        _P_r_o_c_e_s_s _s_u_b_s_t_i_t_u_t_i_o_n is supported on systems that  support
  1659.        named  pipes  (_F_I_F_O_s) or the //ddeevv//ffdd method of naming open
  1660.        files.  It takes the form of <<((_l_i_s_t)) or >>((_l_i_s_t)).  The pro-
  1661.        cess  _l_i_s_t  is run with its input or output connected to a
  1662.        _F_I_F_O or some file in //ddeevv//ffdd.  The name of  this  file  is
  1663.        passed as an argument to the current command as the result
  1664.        of the expansion.  If the >>((_l_i_s_t)) form is used, writing to
  1665.        the file will provide input for _l_i_s_t.  If the <<((_l_i_s_t)) form
  1666.        is used, the file passed as an argument should be read  to
  1667.        obtain the output of _l_i_s_t.
  1668.  
  1669.        When available, _p_r_o_c_e_s_s _s_u_b_s_t_i_t_u_t_i_o_n is performed simulta-
  1670.        neously with parameter  and  variable  expansion,  command
  1671.        substitution, and arithmetic expansion.
  1672.  
  1673.    WWoorrdd SSpplliittttiinngg
  1674.        The  shell  scans the results of parameter expansion, com-
  1675.        mand substitution, and arithmetic expansion that  did  not
  1676.        occur within double quotes for _w_o_r_d _s_p_l_i_t_t_i_n_g.
  1677.  
  1678.        The shell treats each character of IIFFSS as a delimiter, and
  1679.        splits the results of the other expansions into  words  on
  1680.        these  characters.   If  IIFFSS  is  unset,  or  its value is
  1681.        exactly  <<ssppaaccee>><<ttaabb>><<nneewwlliinnee>>,  the  default,  then   any
  1682.        sequence  of  IIFFSS  characters serves to delimit words.  If
  1683.        IIFFSS has a value other than the default, then sequences  of
  1684.        the whitespace characters ssppaaccee and ttaabb are ignored at the
  1685.        beginning and end of the word, as long as  the  whitespace
  1686.        character  is in the value of IIFFSS (an IIFFSS whitespace char-
  1687.        acter).  Any character in IIFFSS that is not IIFFSS  whitespace,
  1688.        along  with any adjacent IIFFSS whitespace characters, delim-
  1689.        its a field.  A sequence of IIFFSS whitespace  characters  is
  1690.        also treated as a delimiter.  If the value of IIFFSS is null,
  1691.        no word splitting occurs.
  1692.  
  1693.        Explicit null arguments ("""" or '''') are retained.  Unquoted
  1694.        implicit  null  arguments, resulting from the expansion of
  1695.        _p_a_r_a_m_e_t_e_r_s that have no values, are removed.  If a parame-
  1696.        ter with no value is expanded within double quotes, a null
  1697.        argument results and is retained.
  1698.  
  1699.        Note that if no expansion occurs,  no  splitting  is  per-
  1700.        formed.
  1701.  
  1702.    PPaatthhnnaammee EExxppaannssiioonn
  1703.        After  word  splitting, unless the --ff option has been set,
  1704.        bbaasshh scans each word for the characters **, ??,  ((,  and  [[.
  1705.        If  one  of  these  characters  appears,  then the word is
  1706.        regarded as a _p_a_t_t_e_r_n, and replaced with an alphabetically
  1707.        sorted  list  of  file  names matching the pattern.  If no
  1708.        matching file names are found, and the shell option  nnuullll--
  1709.        gglloobb  is  disabled,  the  word  is left unchanged.  If the
  1710.        nnuullllgglloobb option is set, and no matches are found, the word
  1711.  
  1712.  
  1713.  
  1714. GNU                         1998 Apr 1                         26
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720. BASH(1)                                                   BASH(1)
  1721.  
  1722.  
  1723.        is  removed.   If  the shell option nnooccaasseegglloobb is enabled,
  1724.        the match is performed  without  regard  to  the  case  of
  1725.        alphabetic  characters.   When a pattern is used for path-
  1726.        name expansion, the character ````..''''  at  the  start  of  a
  1727.        name  or  immediately  following  a  slash must be matched
  1728.        explicitly, unless the shell option ddoottgglloobb is set.   When
  1729.        matching  a  pathname,  the slash character must always be
  1730.        matched explicitly.  In other cases, the ````..''''   character
  1731.        is  not  treated  specially.  See the description of sshhoopptt
  1732.        below under SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS for  a  description  of
  1733.        the nnooccaasseegglloobb, nnuullllgglloobb, and ddoottgglloobb shell options.
  1734.  
  1735.        The  GGLLOOBBIIGGNNOORREE shell variable may be used to restrict the
  1736.        set of file names matching a _p_a_t_t_e_r_n.   If  GGLLOOBBIIGGNNOORREE  is
  1737.        set,  each matching file name that also matches one of the
  1738.        patterns  in  GGLLOOBBIIGGNNOORREE  is  removed  from  the  list  of
  1739.        matches.   The  file  names  ````..''''  and ````....''''  are always
  1740.        ignored, even when GGLLOOBBIIGGNNOORREE is  set.   However,  setting
  1741.        GGLLOOBBIIGGNNOORREE  has  the  effect of enabling the ddoottgglloobb shell
  1742.        option, so all other file names  beginning  with  a  ````..''''
  1743.        will  match.   To  get  the  old behavior of ignoring file
  1744.        names beginning with a ````..'''', make ````..**''''  one of the pat-
  1745.        terns  in GGLLOOBBIIGGNNOORREE.  The ddoottgglloobb option is disabled when
  1746.        GGLLOOBBIIGGNNOORREE is unset.
  1747.  
  1748.        PPaatttteerrnn MMaattcchhiinngg
  1749.  
  1750.        Any character that appears in a pattern,  other  than  the
  1751.        special   pattern   characters  described  below,  matches
  1752.        itself.  The NUL character may not  occur  in  a  pattern.
  1753.        The  special pattern characters must be quoted if they are
  1754.        to be matched literally.
  1755.  
  1756.        The special pattern characters have  the  following  mean-
  1757.        ings:
  1758.  
  1759.        **      Matches any string, including the null string.
  1760.        ??      Matches any single character.
  1761.        [[......]]  Matches any one of the enclosed characters.  A pair
  1762.               of characters separated by a minus sign  denotes  a
  1763.               _r_a_n_g_e;  any  character  lexically between those two
  1764.               characters, inclusive, is matched.   If  the  first
  1765.               character  following  the [[ is a !!  or a ^^ then any
  1766.               character not enclosed is  matched.   A  --  may  be
  1767.               matched  by including it as the first or last char-
  1768.               acter in the set.  A ]] may be matched by  including
  1769.               it as the first character in the set.
  1770.  
  1771.               Within  [[ and ]], _c_h_a_r_a_c_t_e_r _c_l_a_s_s_e_s can be specified
  1772.               using the syntax [[::_c_l_a_s_s::]], where _c_l_a_s_s is  one  of
  1773.               the  following classes defined in the POSIX.2 stan-
  1774.               dard:
  1775.               aallnnuumm aallpphhaa aasscciiii bbllaannkk  ccnnttrrll  ddiiggiitt  ggrraapphh  lloowweerr
  1776.               pprriinntt ppuunncctt ssppaaccee uuppppeerr xxddiiggiitt
  1777.  
  1778.  
  1779.  
  1780. GNU                         1998 Apr 1                         27
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786. BASH(1)                                                   BASH(1)
  1787.  
  1788.  
  1789.               A  character  class matches any character belonging
  1790.               to that class.
  1791.  
  1792.               Within [[ and ]], an _e_q_u_i_v_a_l_e_n_c_e _c_l_a_s_s can be  speci-
  1793.               fied  using  the  syntax  [[==_c==]],  which matches all
  1794.               characters  with  the  same  collation  weight  (as
  1795.               defined  by the current locale) as the character _c.
  1796.  
  1797.               Within [[ and ]], the syntax [[.._s_y_m_b_o_l..]]  matches  the
  1798.               collating symbol _s_y_m_b_o_l.
  1799.  
  1800.        If  the  eexxttgglloobb  shell  option is enabled using the sshhoopptt
  1801.        builtin, several extended pattern matching  operators  are
  1802.        recognized.   In the following description, a _p_a_t_t_e_r_n_-_l_i_s_t
  1803.        is a list of one or more patterns separated by a ||.   Com-
  1804.        posite  patterns  may  be  formed using one or more of the
  1805.        following sub-patterns:
  1806.  
  1807.               ??((_p_a_t_t_e_r_n_-_l_i_s_t))
  1808.                      Matches zero or one occurrence of the  given
  1809.                      patterns
  1810.               **((_p_a_t_t_e_r_n_-_l_i_s_t))
  1811.                      Matches  zero  or  more  occurrences  of the
  1812.                      given patterns
  1813.               ++((_p_a_t_t_e_r_n_-_l_i_s_t))
  1814.                      Matches one or more occurrences of the given
  1815.                      patterns
  1816.               @@((_p_a_t_t_e_r_n_-_l_i_s_t))
  1817.                      Matches exactly one of the given patterns
  1818.               !!((_p_a_t_t_e_r_n_-_l_i_s_t))
  1819.                      Matches  anything  except  one  of the given
  1820.                      patterns
  1821.  
  1822.    QQuuoottee RReemmoovvaall
  1823.        After the preceding expansions, all  unquoted  occurrences
  1824.        of the characters \\, '', and "" that did not result from one
  1825.        of the above expansions are removed.
  1826.  
  1827. RREEDDIIRREECCTTIIOONN
  1828.        Before a command is executed, its input and output may  be
  1829.        _r_e_d_i_r_e_c_t_e_d  using  a  special  notation interpreted by the
  1830.        shell.  Redirection may also be used  to  open  and  close
  1831.        files  for  the  current shell execution environment.  The
  1832.        following redirection operators may precede or appear any-
  1833.        where  within  a  _s_i_m_p_l_e  _c_o_m_m_a_n_d or may follow a _c_o_m_m_a_n_d.
  1834.        Redirections are processed in the order they appear,  from
  1835.        left to right.
  1836.  
  1837.        In the following descriptions, if the file descriptor num-
  1838.        ber is omitted, and the first character of the redirection
  1839.        operator  is  <<,  the  redirection  refers to the standard
  1840.        input (file descriptor 0).  If the first character of  the
  1841.        redirection  operator  is >>, the redirection refers to the
  1842.        standard output (file descriptor 1).
  1843.  
  1844.  
  1845.  
  1846. GNU                         1998 Apr 1                         28
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852. BASH(1)                                                   BASH(1)
  1853.  
  1854.  
  1855.        The word following the redirection operator in the follow-
  1856.        ing  descriptions, unless otherwise noted, is subjected to
  1857.        brace expansion,  tilde  expansion,  parameter  expansion,
  1858.        command substitution, arithmetic expansion, quote removal,
  1859.        and pathname expansion.  If it expands to  more  than  one
  1860.        word, bbaasshh reports an error.
  1861.  
  1862.        Note  that  the order of redirections is significant.  For
  1863.        example, the command
  1864.  
  1865.               ls >> dirlist 2>>&&1
  1866.  
  1867.        directs both standard output and  standard  error  to  the
  1868.        file _d_i_r_l_i_s_t, while the command
  1869.  
  1870.               ls 2>>&&1 >> dirlist
  1871.  
  1872.        directs  only the standard output to file _d_i_r_l_i_s_t, because
  1873.        the standard  error  was  duplicated  as  standard  output
  1874.        before the standard output was redirected to _d_i_r_l_i_s_t.
  1875.  
  1876.        A  failure to open or create a file causes the redirection
  1877.        to fail.
  1878.  
  1879.    RReeddiirreeccttiinngg IInnppuutt
  1880.        Redirection of input causes the file  whose  name  results
  1881.        from  the  expansion  of  _w_o_r_d to be opened for reading on
  1882.        file descriptor _n, or the standard input (file  descriptor
  1883.        0) if _n is not specified.
  1884.  
  1885.        The general format for redirecting input is:
  1886.  
  1887.               [_n]<<_w_o_r_d
  1888.  
  1889.    RReeddiirreeccttiinngg OOuuttppuutt
  1890.        Redirection  of  output causes the file whose name results
  1891.        from the expansion of _w_o_r_d to be  opened  for  writing  on
  1892.        file descriptor _n, or the standard output (file descriptor
  1893.        1) if _n is not specified.  If the file does not  exist  it
  1894.        is created; if it does exist it is truncated to zero size.
  1895.  
  1896.        The general format for redirecting output is:
  1897.  
  1898.               [_n]>>_w_o_r_d
  1899.  
  1900.        If the redirection operator is >>, and the nnoocclloobbbbeerr option
  1901.        to  the sseett builtin has been enabled, the redirection will
  1902.        fail if the filename whose name results from the expansion
  1903.        of  _w_o_r_d exists and is a regular file.  If the redirection
  1904.        operator is >>||, or the redirection operator is >>  and  the
  1905.        nnoocclloobbbbeerr  option  to  the  sseett  builtin  command  is  not
  1906.        enabled, the redirection is attempted  even  if  the  file
  1907.        named by _w_o_r_d exists.
  1908.  
  1909.  
  1910.  
  1911.  
  1912. GNU                         1998 Apr 1                         29
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918. BASH(1)                                                   BASH(1)
  1919.  
  1920.  
  1921.    AAppppeennddiinngg RReeddiirreecctteedd OOuuttppuutt
  1922.        Redirection  of  output  in  this  fashion causes the file
  1923.        whose name results from the expansion of _w_o_r_d to be opened
  1924.        for appending on file descriptor _n, or the standard output
  1925.        (file descriptor 1) if _n is not specified.   If  the  file
  1926.        does not exist it is created.
  1927.  
  1928.        The general format for appending output is:
  1929.  
  1930.               [_n]>>>>_w_o_r_d
  1931.  
  1932.  
  1933.    RReeddiirreeccttiinngg SSttaannddaarrdd OOuuttppuutt aanndd SSttaannddaarrdd EErrrroorr
  1934.        BBaasshh  allows  both the standard output (file descriptor 1)
  1935.        and the standard error output (file descriptor  2)  to  be
  1936.        redirected to the file whose name is the expansion of _w_o_r_d
  1937.        with this construct.
  1938.  
  1939.        There are two formats for redirecting standard output  and
  1940.        standard error:
  1941.  
  1942.               &&>>_w_o_r_d
  1943.        and
  1944.               >>&&_w_o_r_d
  1945.  
  1946.        Of  the two forms, the first is preferred.  This is seman-
  1947.        tically equivalent to
  1948.  
  1949.               >>_w_o_r_d 2>>&&1
  1950.  
  1951.    HHeerree DDooccuummeennttss
  1952.        This type of redirection instructs the shell to read input
  1953.        from  the current source until a line containing only _w_o_r_d
  1954.        (with no trailing blanks) is seen.  All of the lines  read
  1955.        up to that point are then used as the standard input for a
  1956.        command.
  1957.  
  1958.        The format of here-documents is as follows:
  1959.  
  1960.               <<<<[--]_w_o_r_d
  1961.                       _h_e_r_e_-_d_o_c_u_m_e_n_t
  1962.               _d_e_l_i_m_i_t_e_r
  1963.  
  1964.        No parameter  expansion,  command  substitution,  pathname
  1965.        expansion,  or  arithmetic expansion is performed on _w_o_r_d.
  1966.        If any characters in _w_o_r_d are quoted, the _d_e_l_i_m_i_t_e_r is the
  1967.        result  of  quote  removal  on  _w_o_r_d, and the lines in the
  1968.        here-document are not expanded.  If _w_o_r_d is unquoted,  all
  1969.        lines  of  the  here-document  are  subjected to parameter
  1970.        expansion, command substitution, and arithmetic expansion.
  1971.        In  the latter case, the pair \\<<nneewwlliinnee>> is ignored, and \\
  1972.        must be used to quote the characters \\, $$, and ``.
  1973.  
  1974.        If the redirection operator is <<<<--, then all  leading  tab
  1975.  
  1976.  
  1977.  
  1978. GNU                         1998 Apr 1                         30
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984. BASH(1)                                                   BASH(1)
  1985.  
  1986.  
  1987.        characters are stripped from input lines and the line con-
  1988.        taining  _d_e_l_i_m_i_t_e_r.   This  allows  here-documents  within
  1989.        shell scripts to be indented in a natural fashion.
  1990.  
  1991.    DDuupplliiccaattiinngg FFiillee DDeessccrriippttoorrss
  1992.        The redirection operator
  1993.  
  1994.               [_n]<<&&_w_o_r_d
  1995.  
  1996.        is  used  to  duplicate  input  file descriptors.  If _w_o_r_d
  1997.        expands to one or more digits, the file descriptor denoted
  1998.        by _n is made to be a copy of that file descriptor.  If the
  1999.        digits in _w_o_r_d do not specify a file descriptor  open  for
  2000.        input,  a  redirection error occurs.  If _w_o_r_d evaluates to
  2001.        --, file descriptor _n is closed.  If _n  is  not  specified,
  2002.        the standard input (file descriptor 0) is used.
  2003.  
  2004.        The operator
  2005.  
  2006.               [_n]>>&&_w_o_r_d
  2007.  
  2008.        is  used  similarly  to duplicate output file descriptors.
  2009.        If _n is not specified, the standard output (file  descrip-
  2010.        tor  1)  is  used.  If the digits in _w_o_r_d do not specify a
  2011.        file descriptor  open  for  output,  a  redirection  error
  2012.        occurs.  As a special case, if _n is omitted, and _w_o_r_d does
  2013.        not expand to one or more digits, the standard output  and
  2014.        standard error are redirected as described previously.
  2015.  
  2016.    OOppeenniinngg FFiillee DDeessccrriippttoorrss ffoorr RReeaaddiinngg aanndd WWrriittiinngg
  2017.        The redirection operator
  2018.  
  2019.               [_n]<<>>_w_o_r_d
  2020.  
  2021.        causes  the file whose name is the expansion of _w_o_r_d to be
  2022.        opened for both reading and writing on file descriptor  _n,
  2023.        or  on  file  descriptor  0 if _n is not specified.  If the
  2024.        file does not exist, it is created.
  2025.  
  2026. AALLIIAASSEESS
  2027.        Aliases allow a string to be substituted for a  word  when
  2028.        it  is  used  as  the first word of a simple command.  The
  2029.        shell maintains a list of _a_l_i_a_s_e_s  that  may  be  set  and
  2030.        unset  with  the  aalliiaass  and uunnaalliiaass builtin commands (see
  2031.        SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below).  The  first  word  of  each
  2032.        command,  if  unquoted,  is  checked  to  see if it has an
  2033.        alias.  If so, that word is replaced by the  text  of  the
  2034.        alias.   The  alias name and the replacement text may con-
  2035.        tain any valid shell input, including  the  _m_e_t_a_c_h_a_r_a_c_t_e_r_s
  2036.        listed  above,  with the exception that the alias name may
  2037.        not contain _=.  The first word of the replacement text  is
  2038.        tested  for  aliases,  but  a word that is identical to an
  2039.        alias being expanded is not expanded a second time.   This
  2040.        means  that  one  may alias llss to llss --FF, for instance, and
  2041.  
  2042.  
  2043.  
  2044. GNU                         1998 Apr 1                         31
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050. BASH(1)                                                   BASH(1)
  2051.  
  2052.  
  2053.        bbaasshh does not try to recursively  expand  the  replacement
  2054.        text.   If  the  last  character  of  the alias value is a
  2055.        _b_l_a_n_k, then the next command word following the  alias  is
  2056.        also checked for alias expansion.
  2057.  
  2058.        Aliases are created and listed with the aalliiaass command, and
  2059.        removed with the uunnaalliiaass command.
  2060.  
  2061.        There is no mechanism for using arguments in the  replace-
  2062.        ment  text.   If  arguments  are  needed, a shell function
  2063.        should be used.
  2064.  
  2065.        Aliases are not expanded when the shell  is  not  interac-
  2066.        tive,  unless the eexxppaanndd__aalliiaasseess shell option is set using
  2067.        sshhoopptt (see the description of sshhoopptt  under  SSHHEELLLL  BBUUIILLTTIINN
  2068.        CCOOMMMMAANNDDSS below).
  2069.  
  2070.        The rules concerning the definition and use of aliases are
  2071.        somewhat confusing.  BBaasshh always reads at least  one  com-
  2072.        plete  line  of input before executing any of the commands
  2073.        on that line.  Aliases are  expanded  when  a  command  is
  2074.        read,  not when it is executed.  Therefore, an alias defi-
  2075.        nition appearing on the same line as another command  does
  2076.        not take effect until the next line of input is read.  The
  2077.        commands following the alias definition on that  line  are
  2078.        not  affected  by the new alias.  This behavior is also an
  2079.        issue when functions are executed.  Aliases  are  expanded
  2080.        when  a function definition is read, not when the function
  2081.        is executed, because a function  definition  is  itself  a
  2082.        compound  command.  As a consequence, aliases defined in a
  2083.        function are not available until after  that  function  is
  2084.        executed.   To  be safe, always put alias definitions on a
  2085.        separate line, and do not use aalliiaass in compound  commands.
  2086.  
  2087.        For  almost every purpose, aliases are superseded by shell
  2088.        functions.
  2089.  
  2090. FFUUNNCCTTIIOONNSS
  2091.        A shell function, defined as described above  under  SSHHEELLLL
  2092.        GGRRAAMMMMAARR,  stores a series of commands for later execution.
  2093.        Functions are executed  in  the  context  of  the  current
  2094.        shell;  no  new process is created to interpret them (con-
  2095.        trast this with the execution of a shell script).  When  a
  2096.        function is executed, the arguments to the function become
  2097.        the positional parameters during its execution.  The  spe-
  2098.        cial  parameter ## is updated to reflect the change.  Posi-
  2099.        tional parameter 0 is unchanged.  All other aspects of the
  2100.        shell  execution environment are identical between a func-
  2101.        tion and its caller with the exception that the DDEEBBUUGG trap
  2102.        (see  the  description  of  the  ttrraapp  builtin under SSHHEELLLL
  2103.        BBUUIILLTTIINN CCOOMMMMAANNDDSS below) is not inherited.
  2104.  
  2105.        Variables local to the function may be declared  with  the
  2106.        llooccaall  builtin  command.   Ordinarily, variables and their
  2107.  
  2108.  
  2109.  
  2110. GNU                         1998 Apr 1                         32
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116. BASH(1)                                                   BASH(1)
  2117.  
  2118.  
  2119.        values are shared between the function and its caller.
  2120.  
  2121.        If the builtin command rreettuurrnn is executed in  a  function,
  2122.        the function completes and execution resumes with the next
  2123.        command after the function call.   When  a  function  com-
  2124.        pletes,  the  values  of the positional parameters and the
  2125.        special parameter ## are restored to the  values  they  had
  2126.        prior to the function's execution.
  2127.  
  2128.        Function  names  and definitions may be listed with the --ff
  2129.        option to the ddeeccllaarree or ttyyppeesseett builtin commands.  The --FF
  2130.        option  to ddeeccllaarree or ttyyppeesseett will list the function names
  2131.        only.  Functions may be exported so that  subshells  auto-
  2132.        matically  have  them  defined  with  the --ff option to the
  2133.        eexxppoorrtt builtin.
  2134.  
  2135.        Functions may be recursive.  No limit is  imposed  on  the
  2136.        number of recursive calls.
  2137.  
  2138. AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN
  2139.        The  shell  allows arithmetic expressions to be evaluated,
  2140.        under certain circumstances (see the lleett  builtin  command
  2141.        and  AArriitthhmmeettiicc  EExxppaannssiioonn).   Evaluation  is done in long
  2142.        integers with no check for overflow, though division by  0
  2143.        is trapped and flagged as an error.  The following list of
  2144.        operators is grouped into levels of equal-precedence oper-
  2145.        ators.   The  levels  are  listed  in  order of decreasing
  2146.        precedence.
  2147.  
  2148.        -- ++    unary minus and plus
  2149.        !! ~~    logical and bitwise negation
  2150.        ****     exponentiation
  2151.        ** // %%  multiplication, division, remainder
  2152.        ++ --    addition, subtraction
  2153.        <<<< >>>>  left and right bitwise shifts
  2154.        <<== >>== << >>
  2155.               comparison
  2156.        ==== !!==  equality and inequality
  2157.        &&      bitwise AND
  2158.        ^^      bitwise exclusive OR
  2159.        ||      bitwise OR
  2160.        &&&&     logical AND
  2161.        ||||     logical OR
  2162.        _e_x_p_r??_e_x_p_r::_e_x_p_r
  2163.               conditional evaluation
  2164.        == **== //== %%== ++== --== <<<<== >>>>== &&== ^^== ||==
  2165.               assignment
  2166.  
  2167.        Shell variables are allowed as operands; parameter  expan-
  2168.        sion is performed before the expression is evaluated.  The
  2169.        value of a parameter is coerced to a long  integer  within
  2170.        an expression.  A shell variable need not have its integer
  2171.        attribute turned on to be used in an expression.
  2172.  
  2173.  
  2174.  
  2175.  
  2176. GNU                         1998 Apr 1                         33
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182. BASH(1)                                                   BASH(1)
  2183.  
  2184.  
  2185.        Constants with a leading 0 are interpreted as  octal  num-
  2186.        bers.  A leading 0x or 0X denotes hexadecimal.  Otherwise,
  2187.        numbers take the form [_b_a_s_e_#]n, where _b_a_s_e  is  a  decimal
  2188.        number  between 2 and 64 representing the arithmetic base,
  2189.        and _n is a number in that base.  If _b_a_s_e is omitted,  then
  2190.        base  10  is  used.   The digits greater than 9 are repre-
  2191.        sented by the lowercase letters, the uppercase letters, _,
  2192.        and  @,  in  that order.  If _b_a_s_e is less than or equal to
  2193.        36, lowercase and uppercase letters  may  be  used  inter-
  2194.        changably to represent numbers between 10 and 35.
  2195.  
  2196.        Operators  are  evaluated  in  order  of precedence.  Sub-
  2197.        expressions in parentheses are  evaluated  first  and  may
  2198.        override the precedence rules above.
  2199.  
  2200. CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS
  2201.        Conditional  expressions  are used by the [[[[ compound com-
  2202.        mand and the tteesstt and [[  builtin  commands  to  test  file
  2203.        attributes  and perform string and arithmetic comparisons.
  2204.        Expressions are formed from the following unary or  binary
  2205.        primaries.   If  any _f_i_l_e argument to one of the primaries
  2206.        is of the  form  /dev/fd/_n,  then  file  descriptor  _n  is
  2207.        checked.
  2208.  
  2209.        --aa _f_i_l_e
  2210.               True if _f_i_l_e exists.
  2211.        --bb _f_i_l_e
  2212.               True if _f_i_l_e exists and is a block special file.
  2213.        --cc _f_i_l_e
  2214.               True  if  _f_i_l_e  exists  and  is a character special
  2215.               file.
  2216.        --dd _f_i_l_e
  2217.               True if _f_i_l_e exists and is a directory.
  2218.        --ee _f_i_l_e
  2219.               True if _f_i_l_e exists.
  2220.        --ff _f_i_l_e
  2221.               True if _f_i_l_e exists and is a regular file.
  2222.        --gg _f_i_l_e
  2223.               True if _f_i_l_e exists and is set-group-id.
  2224.        --kk _f_i_l_e
  2225.               True if _f_i_l_e exists and its ``sticky'' bit is  set.
  2226.        --pp _f_i_l_e
  2227.               True if _f_i_l_e exists and is a named pipe (FIFO).
  2228.        --rr _f_i_l_e
  2229.               True if _f_i_l_e exists and is readable.
  2230.        --ss _f_i_l_e
  2231.               True  if  _f_i_l_e  exists  and has a size greater than
  2232.               zero.
  2233.        --tt _f_d  True if file descriptor _f_d is open and refers to  a
  2234.               terminal.
  2235.        --uu _f_i_l_e
  2236.               True if _f_i_l_e exists and its set-user-id bit is set.
  2237.        --ww _f_i_l_e
  2238.               True if _f_i_l_e exists and is writable.
  2239.  
  2240.  
  2241.  
  2242. GNU                         1998 Apr 1                         34
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248. BASH(1)                                                   BASH(1)
  2249.  
  2250.  
  2251.        --xx _f_i_l_e
  2252.               True if _f_i_l_e exists and is executable.
  2253.        --OO _f_i_l_e
  2254.               True if _f_i_l_e exists and is owned by  the  effective
  2255.               user id.
  2256.        --GG _f_i_l_e
  2257.               True  if  _f_i_l_e exists and is owned by the effective
  2258.               group id.
  2259.        --LL _f_i_l_e
  2260.               True if _f_i_l_e exists and is a symbolic link.
  2261.        --SS _f_i_l_e
  2262.               True if _f_i_l_e exists and is a socket.
  2263.        --NN _f_i_l_e
  2264.               True if _f_i_l_e exists and has been modified since  it
  2265.               was last read.
  2266.        _f_i_l_e_1 -nntt _f_i_l_e_2
  2267.               True  if  _f_i_l_e_1 is newer (according to modification
  2268.               date) than _f_i_l_e_2.
  2269.        _f_i_l_e_1 -oott _f_i_l_e_2
  2270.               True if _f_i_l_e_1 is older than _f_i_l_e_2.
  2271.        _f_i_l_e_1 --eeff _f_i_l_e_2
  2272.               True if _f_i_l_e_1 and _f_i_l_e_2 have the  same  device  and
  2273.               inode numbers.
  2274.        --oo _o_p_t_n_a_m_e
  2275.               True  if  shell option _o_p_t_n_a_m_e is enabled.  See the
  2276.               list of options under the  description  of  the  --oo
  2277.               option to the sseett builtin below.
  2278.        --zz _s_t_r_i_n_g
  2279.               True if the length of _s_t_r_i_n_g is zero.
  2280.        --nn _s_t_r_i_n_g
  2281.        _s_t_r_i_n_g True if the length of _s_t_r_i_n_g is non-zero.
  2282.        _s_t_r_i_n_g_1 ==== _s_t_r_i_n_g_2
  2283.               True  if  the  strings are equal.  == may be used in
  2284.               place of ====.
  2285.        _s_t_r_i_n_g_1 !!== _s_t_r_i_n_g_2
  2286.               True if the strings are not equal.
  2287.        _s_t_r_i_n_g_1 << _s_t_r_i_n_g_2
  2288.               True if _s_t_r_i_n_g_1 sorts before _s_t_r_i_n_g_2  lexicographi-
  2289.               cally in the current locale.
  2290.        _s_t_r_i_n_g_1 >> _s_t_r_i_n_g_2
  2291.               True  if  _s_t_r_i_n_g_1 sorts after _s_t_r_i_n_g_2 lexicographi-
  2292.               cally in the current locale.
  2293.        _a_r_g_1 OOPP _a_r_g_2
  2294.               OOPP is one of --eeqq,  --nnee,  --lltt,  --llee,  --ggtt,  or  --ggee.
  2295.               These  arithmetic  binary  operators return true if
  2296.               _a_r_g_1 is equal to, not equal  to,  less  than,  less
  2297.               than  or equal to, greater than, or greater than or
  2298.               equal to _a_r_g_2, respectively.  _A_r_g_1 and _a_r_g_2 may  be
  2299.               positive or negative integers.
  2300.  
  2301. SSIIMMPPLLEE CCOOMMMMAANNDD EEXXPPAANNSSIIOONN
  2302.        When  a simple command is executed, the shell performs the
  2303.        following expansions, assignments, and redirections,  from
  2304.        left to right.
  2305.  
  2306.  
  2307.  
  2308. GNU                         1998 Apr 1                         35
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314. BASH(1)                                                   BASH(1)
  2315.  
  2316.  
  2317.        1.     The  words  that  the parser has marked as variable
  2318.               assignments (those preceding the command name)  and
  2319.               redirections are saved for later processing.
  2320.  
  2321.        2.     The  words  that  are  not  variable assignments or
  2322.               redirections are expanded.   If  any  words  remain
  2323.               after  expansion, the first word is taken to be the
  2324.               name of the command and the remaining words are the
  2325.               arguments.
  2326.  
  2327.        3.     Redirections are performed as described above under
  2328.               RREEDDIIRREECCTTIIOONN.
  2329.  
  2330.        4.     The text after the == in  each  variable  assignment
  2331.               undergoes  tilde  expansion,  parameter  expansion,
  2332.               command  substitution,  arithmetic  expansion,  and
  2333.               quote  removal  before  being assigned to the vari-
  2334.               able.
  2335.  
  2336.        If no  command  name  results,  the  variable  assignments
  2337.        affect  the  current  shell  environment.   Otherwise, the
  2338.        variables are added to the  environment  of  the  executed
  2339.        command  and  do not affect the current shell environment.
  2340.        If any of the assignments attempts to assign a value to  a
  2341.        readonly  variable, an error occurs, and the command exits
  2342.        with a non-zero status.
  2343.  
  2344.        If no command name results,  redirections  are  performed,
  2345.        but  do not affect the current shell environment.  A redi-
  2346.        rection error causes the command to exit with  a  non-zero
  2347.        status.
  2348.  
  2349.        If there is a command name left after expansion, execution
  2350.        proceeds  as  described  below.   Otherwise,  the  command
  2351.        exits.   If one of the expansions contained a command sub-
  2352.        stitution, the exit status of the command is the exit sta-
  2353.        tus  of the last command substitution performed.  If there
  2354.        were no command substitutions, the command  exits  with  a
  2355.        status of zero.
  2356.  
  2357. CCOOMMMMAANNDD EEXXEECCUUTTIIOONN
  2358.        After  a  command has been split into words, if it results
  2359.        in a simple command and an optional list of arguments, the
  2360.        following actions are taken.
  2361.  
  2362.        If  the  command  name  contains  no  slashes,  the  shell
  2363.        attempts to locate it.  If there exists a  shell  function
  2364.        by  that name, that function is invoked as described above
  2365.        in FFUUNNCCTTIIOONNSS.  If the name does not match a function,  the
  2366.        shell searches for it in the list of shell builtins.  If a
  2367.        match is found, that builtin is invoked.
  2368.  
  2369.        If the name is neither a shell function nor a builtin, and
  2370.        contains  no  slashes,  bbaasshh  searches each element of the
  2371.  
  2372.  
  2373.  
  2374. GNU                         1998 Apr 1                         36
  2375.  
  2376.  
  2377.  
  2378.  
  2379.  
  2380. BASH(1)                                                   BASH(1)
  2381.  
  2382.  
  2383.        PPAATTHH for a directory containing an executable file by that
  2384.        name.   BBaasshh  uses  a hash table to remember the full file
  2385.        names of executable files (see hhaasshh  under  SSHHEELLLL  BBUUIILLTTIINN
  2386.        CCOOMMMMAANNDDSS below).  A full search of the directories in PPAATTHH
  2387.        is performed only if the command is not found in the  hash
  2388.        table.  If the search is unsuccessful, the shell prints an
  2389.        error message and returns an exit status of 127.
  2390.  
  2391.        If the search is successful, or if the command  name  con-
  2392.        tains  one  or  more slashes, the shell executes the named
  2393.        program in a separate execution environment.   Argument  0
  2394.        is  set  to the name given, and the remaining arguments to
  2395.        the command are set to the arguments given, if any.
  2396.  
  2397.        If this execution fails because the file is  not  in  exe-
  2398.        cutable  format,  and  the  file is not a directory, it is
  2399.        assumed to be a _s_h_e_l_l _s_c_r_i_p_t, a file containing shell com-
  2400.        mands.   A  subshell  is spawned to execute it.  This sub-
  2401.        shell reinitializes itself, so that the effect is as if  a
  2402.        new  shell had been invoked to handle the script, with the
  2403.        exception that the locations of commands remembered by the
  2404.        parent  (see  hhaasshh below under SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS) are
  2405.        retained by the child.
  2406.  
  2407.        If the program is a file beginning with ##!!, the  remainder
  2408.        of  the  first  line specifies an interpreter for the pro-
  2409.        gram.  The shell executes  the  specified  interpreter  on
  2410.        operating  systems that do not handle this executable for-
  2411.        mat themselves.  The arguments to the interpreter  consist
  2412.        of  a  single  optional argument following the interpreter
  2413.        name on the first line of the  program,  followed  by  the
  2414.        name of the program, followed by the command arguments, if
  2415.        any.
  2416.  
  2417. CCOOMMMMAANNDD EEXXEECCUUTTIIOONN EENNVVIIRROONNMMEENNTT
  2418.        The shell has an _e_x_e_c_u_t_i_o_n _e_n_v_i_r_o_n_m_e_n_t, which consists  of
  2419.        the following:
  2420.  
  2421.  
  2422.        +o      open files inherited by the shell at invocation, as
  2423.               modified  by  redirections  supplied  to  the  eexxeecc
  2424.               builtin
  2425.  
  2426.        +o      the  current working directory as set by ccdd, ppuusshhdd,
  2427.               or ppooppdd, or inherited by the shell at invocation
  2428.  
  2429.        +o      the file creation mode mask  as  set  by  uummaasskk  or
  2430.               inherited from the shell's parent
  2431.  
  2432.        +o      current traps set by ttrraapp
  2433.  
  2434.        +o      shell  parameters  that are set by variable assign-
  2435.               ment or with sseett or inherited from the shell's par-
  2436.               ent in the environment
  2437.  
  2438.  
  2439.  
  2440. GNU                         1998 Apr 1                         37
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446. BASH(1)                                                   BASH(1)
  2447.  
  2448.  
  2449.        +o      shell  functions defined during execution or inher-
  2450.               ited from the shell's parent in the environment
  2451.  
  2452.        +o      options enabled at invocation (either by default or
  2453.               with command-line arguments) or by sseett
  2454.  
  2455.        +o      options enabled by sshhoopptt
  2456.  
  2457.        +o      shell aliases defined with aalliiaass
  2458.  
  2459.        +o      various  process IDs, including those of background
  2460.               jobs, the value of $$$$, and the value of $$PPPPIIDD
  2461.  
  2462.        When a simple command other than a builtin or shell  func-
  2463.        tion is to be executed, it is invoked in a separate execu-
  2464.        tion environment that consists of the  following.   Unless
  2465.        otherwise  noted, the values are inherited from the shell.
  2466.  
  2467.  
  2468.        +o      the shell's open files, plus any modifications  and
  2469.               additions specified by redirections to the command
  2470.  
  2471.        +o      the current working directory
  2472.  
  2473.        +o      the file creation mode mask
  2474.  
  2475.        +o      shell variables marked for export, along with vari-
  2476.               ables exported for the command, passed in the envi-
  2477.               ronment
  2478.  
  2479.        +o      traps  caught  by the shell are reset to the values
  2480.               the inherited from the shell's  parent,  and  traps
  2481.               ignored by the shell are ignored
  2482.  
  2483.        A  command  invoked  in  this  separate environment cannot
  2484.        affect the shell's execution environment.
  2485.  
  2486.        Command substitution and asynchronous commands are invoked
  2487.        in a subshell environment that is a duplicate of the shell
  2488.        environment, except that traps caught  by  the  shell  are
  2489.        reset to the values that the shell inherited from its par-
  2490.        ent at invocation.  Builtin commands that are  invoked  as
  2491.        part  of  a pipeline are also executed in a subshell envi-
  2492.        ronment.  Changes made to the subshell environment  cannot
  2493.        affect the shell's execution environment.
  2494.  
  2495. EENNVVIIRROONNMMEENNTT
  2496.        When  a program is invoked it is given an array of strings
  2497.        called the _e_n_v_i_r_o_n_m_e_n_t.  This  is  a  list  of  _n_a_m_e-_v_a_l_u_e
  2498.        pairs, of the form _n_a_m_e=_v_a_l_u_e.
  2499.  
  2500.        The shell allows you to manipulate the environment in sev-
  2501.        eral ways.  On invocation, the shell scans its  own  envi-
  2502.        ronment  and  creates  a  parameter  for  each name found,
  2503.  
  2504.  
  2505.  
  2506. GNU                         1998 Apr 1                         38
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512. BASH(1)                                                   BASH(1)
  2513.  
  2514.  
  2515.        automatically marking it for _e_x_p_o_r_t  to  child  processes.
  2516.        Executed commands inherit the environment.  The eexxppoorrtt and
  2517.        ddeeccllaarree --xx commands allow parameters and functions  to  be
  2518.        added  to  and deleted from the environment.  If the value
  2519.        of a parameter in the environment  is  modified,  the  new
  2520.        value  becomes part of the environment, replacing the old.
  2521.        The environment inherited by any executed command consists
  2522.        of  the  shell's  initial environment, whose values may be
  2523.        modified in the shell, less any pairs removed by the uunnsseett
  2524.        command,  plus any additions via the eexxppoorrtt and ddeeccllaarree --xx
  2525.        commands.
  2526.  
  2527.        The environment for any _s_i_m_p_l_e _c_o_m_m_a_n_d or function may  be
  2528.        augmented  temporarily  by  prefixing  it  with  parameter
  2529.        assignments, as  described  above  in  PPAARRAAMMEETTEERRSS.   These
  2530.        assignment  statements affect only the environment seen by
  2531.        that command.
  2532.  
  2533.        If the --kk option is  set  (see  the  sseett  builtin  command
  2534.        below),  then  _a_l_l parameter assignments are placed in the
  2535.        environment for a command, not just those that precede the
  2536.        command name.
  2537.  
  2538.        When  bbaasshh  invokes an external command, the variable __ is
  2539.        set to the full file name of the  command  and  passed  to
  2540.        that command in its environment.
  2541.  
  2542. EEXXIITT SSTTAATTUUSS
  2543.        For  the  shell's  purposes,  a command which exits with a
  2544.        zero exit status has succeeded.  An exit  status  of  zero
  2545.        indicates success.  A non-zero exit status indicates fail-
  2546.        ure.  When a command terminates on a  fatal  signal,  bbaasshh
  2547.        uses the value of 128+ssiiggnnaall as the exit status.
  2548.  
  2549.        If  a  command  is not found, the child process created to
  2550.        execute it returns a status of 127.  If a command is found
  2551.        but is not executable, the return status is 126.
  2552.  
  2553.        If a command fails because of an error during expansion or
  2554.        redirection, the exit status is greater than zero.
  2555.  
  2556.        Shell builtin commands return a status of 0 (_t_r_u_e) if suc-
  2557.        cessful,  and  non-zero  (_f_a_l_s_e)  if an error occurs while
  2558.        they execute.  All builtins return an exit status of 2  to
  2559.        indicate incorrect usage.
  2560.  
  2561.        BBaasshh  itself  returns  the exit status of the last command
  2562.        executed, unless a syntax error occurs, in which  case  it
  2563.        exits  with  a  non-zero value.  See also the eexxiitt builtin
  2564.        command below.
  2565.  
  2566. SSIIGGNNAALLSS
  2567.        When bbaasshh is interactive, in the absence of any traps,  it
  2568.        ignores   SSIIGGTTEERRMM  (so  that  kkiillll  00  does  not  kill  an
  2569.  
  2570.  
  2571.  
  2572. GNU                         1998 Apr 1                         39
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578. BASH(1)                                                   BASH(1)
  2579.  
  2580.  
  2581.        interactive shell), and SSIIGGIINNTT is caught and  handled  (so
  2582.        that  the  wwaaiitt  builtin is interruptible).  In all cases,
  2583.        bbaasshh ignores SSIIGGQQUUIITT.  If job control is in  effect,  bbaasshh
  2584.        ignores SSIIGGTTTTIINN, SSIIGGTTTTOOUU, and SSIIGGTTSSTTPP.
  2585.  
  2586.        Synchronous  jobs started by bbaasshh have signal handlers set
  2587.        to the values inherited by  the  shell  from  its  parent.
  2588.        When  job  control is not in effect, asynchronous commands
  2589.        ignore SSIIGGIINNTT and SSIIGGQQUUIITT as  well.   Commands  run  as  a
  2590.        result  of command substitution ignore the keyboard-gener-
  2591.        ated job control signals SSIIGGTTTTIINN, SSIIGGTTTTOOUU, and SSIIGGTTSSTTPP.
  2592.  
  2593.        The shell exits by  default  upon  receipt  of  a  SSIIGGHHUUPP.
  2594.        Before exiting, it resends the SSIIGGHHUUPP to all jobs, running
  2595.        or stopped.  Stopped jobs are sent SSIIGGCCOONNTT to ensure  that
  2596.        they  receive the SSIIGGHHUUPP.  To prevent the shell from send-
  2597.        ing the signal to a particular job, it should  be  removed
  2598.        from  the  jobs  table  with the ddiissoowwnn builtin (see SSHHEELLLL
  2599.        BBUUIILLTTIINN CCOOMMMMAANNDDSS below) or marked to  not  receive  SSIIGGHHUUPP
  2600.        using ddiissoowwnn --hh.
  2601.  
  2602.        If  the  hhuuppoonneexxiitt  shell  option has been set with sshhoopptt,
  2603.        bbaasshh sends a SSIIGGHHUUPP to all jobs when an interactive  login
  2604.        shell exits.
  2605.  
  2606.        When  bbaasshh receives a signal for which a trap has been set
  2607.        while waiting for a command to complete, the trap will not
  2608.        be  executed  until  the  command completes.  When bbaasshh is
  2609.        waiting for an asynchronous command via the wwaaiitt  builtin,
  2610.        the  reception  of  a signal for which a trap has been set
  2611.        will cause the wwaaiitt builtin to return immediately with  an
  2612.        exit  status greater than 128, immediately after which the
  2613.        trap is executed.
  2614.  
  2615. JJOOBB CCOONNTTRROOLL
  2616.        _J_o_b _c_o_n_t_r_o_l refers to  the  ability  to  selectively  stop
  2617.        (_s_u_s_p_e_n_d) the execution of processes and continue (_r_e_s_u_m_e)
  2618.        their execution  at  a  later  point.   A  user  typically
  2619.        employs  this  facility  via an interactive interface sup-
  2620.        plied jointly by the system's terminal driver and bbaasshh.
  2621.  
  2622.        The shell associates a _j_o_b with each pipeline.  It keeps a
  2623.        table  of  currently  executing  jobs, which may be listed
  2624.        with the jjoobbss command.   When  bbaasshh  starts  a  job  asyn-
  2625.        chronously  (in  the  _b_a_c_k_g_r_o_u_n_d),  it  prints a line that
  2626.        looks like:
  2627.  
  2628.               [1] 25647
  2629.  
  2630.        indicating that this job is job number 1 and that the pro-
  2631.        cess  ID  of  the  last process in the pipeline associated
  2632.        with this job is 25647.  All of the processes in a  single
  2633.        pipeline  are  members of the same job.  BBaasshh uses the _j_o_b
  2634.        abstraction as the basis for job control.
  2635.  
  2636.  
  2637.  
  2638. GNU                         1998 Apr 1                         40
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644. BASH(1)                                                   BASH(1)
  2645.  
  2646.  
  2647.        To facilitate the implementation of the user interface  to
  2648.        job  control, the system maintains the notion of a _c_u_r_r_e_n_t
  2649.        _t_e_r_m_i_n_a_l _p_r_o_c_e_s_s _g_r_o_u_p _I_D.  Members of this process  group
  2650.        (processes  whose process group ID is equal to the current
  2651.        terminal process group ID) receive keyboard-generated sig-
  2652.        nals  such  as  SSIIGGIINNTT.  These processes are said to be in
  2653.        the _f_o_r_e_g_r_o_u_n_d.  _B_a_c_k_g_r_o_u_n_d processes are those whose pro-
  2654.        cess  group ID differs from the terminal's; such processes
  2655.        are immune to keyboard-generated signals.  Only foreground
  2656.        processes  are allowed to read from or write to the termi-
  2657.        nal.  Background processes  which  attempt  to  read  from
  2658.        (write  to) the terminal are sent a SSIIGGTTTTIINN ((SSIIGGTTTTOOUU)) sig-
  2659.        nal by the terminal driver, which, unless caught, suspends
  2660.        the process.
  2661.  
  2662.        If  the operating system on which bbaasshh is running supports
  2663.        job control, bbaasshh allows you to use it.  Typing  the  _s_u_s_-
  2664.        _p_e_n_d  character  (typically ^^ZZ, Control-Z) while a process
  2665.        is running causes that process to be stopped  and  returns
  2666.        you  to bbaasshh.  Typing the _d_e_l_a_y_e_d _s_u_s_p_e_n_d character (typi-
  2667.        cally ^^YY, Control-Y) causes the process to be stopped when
  2668.        it  attempts  to read input from the terminal, and control
  2669.        to be returned to bbaasshh.  The user may then manipulate  the
  2670.        state  of this job, using the bbgg command to continue it in
  2671.        the background, the ffgg command to continue it in the fore-
  2672.        ground, or the kkiillll command to kill it.  A ^^ZZ takes effect
  2673.        immediately, and has the additional side effect of causing
  2674.        pending output and typeahead to be discarded.
  2675.  
  2676.        There are a number of ways to refer to a job in the shell.
  2677.        The character %% introduces a job name.  Job number  _n  may
  2678.        be referred to as %%nn.  A job may also be referred to using
  2679.        a prefix of the name used to start it,  or  using  a  sub-
  2680.        string that appears in its command line.  For example, %%ccee
  2681.        refers to a stopped ccee job.  If a prefix matches more than
  2682.        one  job, bbaasshh reports an error.  Using %%??ccee, on the other
  2683.        hand, refers to any job containing the string  ccee  in  its
  2684.        command line.  If the substring matches more than one job,
  2685.        bbaasshh reports an error.  The symbols %%%% and %%++ refer to the
  2686.        shell's  notion  of the _c_u_r_r_e_n_t _j_o_b, which is the last job
  2687.        stopped while it was in the foreground or started  in  the
  2688.        background.   The _p_r_e_v_i_o_u_s _j_o_b may be referenced using %%--.
  2689.        In output pertaining to jobs (e.g., the output of the jjoobbss
  2690.        command),  the current job is always flagged with a ++, and
  2691.        the previous job with a --.
  2692.  
  2693.        Simply naming a job can be used to bring it into the fore-
  2694.        ground: %%11 is a synonym for ````ffgg %%11'''', bringing job 1 from
  2695.        the background into the foreground.  Similarly,  ````%%11  &&''''
  2696.        resumes  job 1 in the background, equivalent to ````bbgg %%11''''.
  2697.  
  2698.        The shell learns immediately whenever a job changes state.
  2699.        Normally,  bbaasshh  waits until it is about to print a prompt
  2700.        before reporting changes in a job's status so  as  to  not
  2701.  
  2702.  
  2703.  
  2704. GNU                         1998 Apr 1                         41
  2705.  
  2706.  
  2707.  
  2708.  
  2709.  
  2710. BASH(1)                                                   BASH(1)
  2711.  
  2712.  
  2713.        interrupt  any  other output.  If the --bb option to the sseett
  2714.        builtin command is  enabled,  bbaasshh  reports  such  changes
  2715.        immediately.
  2716.  
  2717.        If an attempt to exit bbaasshh is made while jobs are stopped,
  2718.        the shell prints a warning message.  The jjoobbss command  may
  2719.        then be used to inspect their status.  If a second attempt
  2720.        to exit is made without an intervening command, the  shell
  2721.        does  not  print another warning, and the stopped jobs are
  2722.        terminated.
  2723.  
  2724. PPRROOMMPPTTIINNGG
  2725.        When executing interactively, bbaasshh  displays  the  primary
  2726.        prompt  PPSS11  when  it  is ready to read a command, and the
  2727.        secondary prompt PPSS22 when it needs more input to  complete
  2728.        a  command.   BBaasshh  allows these prompt strings to be cus-
  2729.        tomized by inserting a number of backslash-escaped special
  2730.        characters that are decoded as follows:
  2731.               \\aa     an ASCII bell character (07)
  2732.               \\dd     the  date  in  "Weekday  Month  Date" format
  2733.                      (e.g., "Tue May 26")
  2734.               \\ee     an ASCII escape character (033)
  2735.               \\hh     the hostname up to the first `.'
  2736.               \\HH     the hostname
  2737.               \\nn     newline
  2738.               \\rr     carriage return
  2739.               \\ss     the name of the shell, the  basename  of  $$00
  2740.                      (the portion following the final slash)
  2741.               \\tt     the current time in 24-hour HH:MM:SS format
  2742.               \\TT     the current time in 12-hour HH:MM:SS format
  2743.               \\@@     the current time in 12-hour am/pm format
  2744.               \\uu     the username of the current user
  2745.               \\vv     the version of bbaasshh (e.g., 2.00)
  2746.               \\VV     the  release  of  bbaasshh, version + patchlevel
  2747.                      (e.g., 2.00.0)
  2748.               \\ww     the current working directory
  2749.               \\WW     the basename of the current  working  direc-
  2750.                      tory
  2751.               \\!!     the history number of this command
  2752.               \\##     the command number of this command
  2753.               \\$$     if  the effective UID is 0, a ##, otherwise a
  2754.                      $$
  2755.               \\_n_n_n   the character  corresponding  to  the  octal
  2756.                      number _n_n_n
  2757.               \\\\     a backslash
  2758.               \\[[     begin a sequence of non-printing characters,
  2759.                      which could be used to embed a terminal con-
  2760.                      trol sequence into the prompt
  2761.               \\]]     end a sequence of non-printing characters
  2762.  
  2763.        The command number and the history number are usually dif-
  2764.        ferent: the history number of a command is its position in
  2765.        the history list, which may include commands restored from
  2766.        the history file (see HHIISSTTOORRYY below),  while  the  command
  2767.  
  2768.  
  2769.  
  2770. GNU                         1998 Apr 1                         42
  2771.  
  2772.  
  2773.  
  2774.  
  2775.  
  2776. BASH(1)                                                   BASH(1)
  2777.  
  2778.  
  2779.        number  is  the  position in the sequence of commands exe-
  2780.        cuted during the current shell session.  After the  string
  2781.        is  decoded,  it is expanded via parameter expansion, com-
  2782.        mand substitution, arithmetic expansion, string expansion,
  2783.        and  quote removal, subject to the value of the pprroommppttvvaarrss
  2784.        shell option (see the description  of  the  sshhoopptt  command
  2785.        under SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below).
  2786.  
  2787. RREEAADDLLIINNEE
  2788.        This  is the library that handles reading input when using
  2789.        an interactive shell, unless  the  ----nnooeeddiittiinngg  option  is
  2790.        given  at  shell invocation.  By default, the line editing
  2791.        commands are similar to those of emacs.  A  vi-style  line
  2792.        editing  interface  is  also  available.  To turn off line
  2793.        editing after the shell is running, use the ++oo eemmaaccss or ++oo
  2794.        vvii  options to the sseett builtin (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
  2795.        below).
  2796.  
  2797.    RReeaaddlliinnee NNoottaattiioonn
  2798.        In this section,  the  emacs-style  notation  is  used  to
  2799.        denote  keystrokes.   Control  keys  are denoted by C-_k_e_y,
  2800.        e.g., C-n  means  Control-N.   Similarly,  _m_e_t_a  keys  are
  2801.        denoted  by  M-_k_e_y,  so  M-x  means Meta-X.  (On keyboards
  2802.        without a _m_e_t_a key, M-_x  means  ESC  _x,  i.e.,  press  the
  2803.        Escape  key  then the _x key.  This makes ESC the _m_e_t_a _p_r_e_-
  2804.        _f_i_x.  The combination M-C-_x means ESC-Control-_x, or  press
  2805.        the  Escape  key  then hold the Control key while pressing
  2806.        the _x key.)
  2807.  
  2808.        Readline commands may be given  numeric  _a_r_g_u_m_e_n_t_s,  which
  2809.        normally act as a repeat count.  Sometimes, however, it is
  2810.        the sign of the argument that is significant.   Passing  a
  2811.        negative  argument  to  a command that acts in the forward
  2812.        direction (e.g., kkiillll--lliinnee) causes that command to act  in
  2813.        a  backward direction.  Commands whose behavior with argu-
  2814.        ments deviates from this are noted below.
  2815.  
  2816.        When a command is described  as  _k_i_l_l_i_n_g  text,  the  text
  2817.        deleted  is saved for possible future retrieval (_y_a_n_k_i_n_g).
  2818.        The killed text is saved  in  a  _k_i_l_l  _r_i_n_g.   Consecutive
  2819.        kills  cause  the  text  to  be accumulated into one unit,
  2820.        which can be yanked all at once.  Commands  which  do  not
  2821.        kill text separate the chunks of text on the kill ring.
  2822.  
  2823.    RReeaaddlliinnee IInniittiiaalliizzaattiioonn
  2824.        Readline  is customized by putting commands in an initial-
  2825.        ization file (the _i_n_p_u_t_r_c file).  The name of this file is
  2826.        taken  from  the  value  of the IINNPPUUTTRRCC variable.  If that
  2827.        variable is unset, the default is _~_/_._i_n_p_u_t_r_c.  When a pro-
  2828.        gram  which  uses the readline library starts up, the ini-
  2829.        tialization file is read, and the key bindings  and  vari-
  2830.        ables  are  set.   There  are  only a few basic constructs
  2831.        allowed in the readline initialization file.  Blank  lines
  2832.        are  ignored.   Lines  beginning  with  a  ## are comments.
  2833.  
  2834.  
  2835.  
  2836. GNU                         1998 Apr 1                         43
  2837.  
  2838.  
  2839.  
  2840.  
  2841.  
  2842. BASH(1)                                                   BASH(1)
  2843.  
  2844.  
  2845.        Lines beginning with a $$ indicate conditional  constructs.
  2846.        Other lines denote key bindings and variable settings.
  2847.  
  2848.        The  default  key-bindings  may be changed with an _i_n_p_u_t_r_c
  2849.        file.  Other programs that use this library may add  their
  2850.        own commands and bindings.
  2851.  
  2852.        For example, placing
  2853.  
  2854.               M-Control-u: universal-argument
  2855.        or
  2856.               C-Meta-u: universal-argument
  2857.        into  the  _i_n_p_u_t_r_c  would  make M-C-u execute the readline
  2858.        command _u_n_i_v_e_r_s_a_l_-_a_r_g_u_m_e_n_t.
  2859.  
  2860.        The following symbolic  character  names  are  recognized:
  2861.        _R_U_B_O_U_T,  _D_E_L,  _E_S_C, _L_F_D, _N_E_W_L_I_N_E, _R_E_T, _R_E_T_U_R_N, _S_P_C, _S_P_A_C_E,
  2862.        and _T_A_B.  In addition to command  names,  readline  allows
  2863.        keys to be bound to a string that is inserted when the key
  2864.        is pressed (a _m_a_c_r_o).
  2865.  
  2866.    RReeaaddlliinnee KKeeyy BBiinnddiinnggss
  2867.        The syntax for controlling key  bindings  in  the  _i_n_p_u_t_r_c
  2868.        file  is  simple.  All that is required is the name of the
  2869.        command or the text of a macro and a key sequence to which
  2870.        it  should  be  bound. The name may be specified in one of
  2871.        two ways: as a symbolic key name, possibly with  _M_e_t_a_-  or
  2872.        _C_o_n_t_r_o_l_-  prefixes,  or as a key sequence.  When using the
  2873.        form kkeeyynnaammee:_f_u_n_c_t_i_o_n_-_n_a_m_e or _m_a_c_r_o, _k_e_y_n_a_m_e is  the  name
  2874.        of a key spelled out in English.  For example:
  2875.  
  2876.               Control-u: universal-argument
  2877.               Meta-Rubout: backward-kill-word
  2878.               Control-o: "> output"
  2879.  
  2880.        In the above example, _C_-_u is bound to the function uunniivveerr--
  2881.        ssaall--aarrgguummeenntt,  _M_-_D_E_L  is  bound  to  the  function   bbaacckk--
  2882.        wwaarrdd--kkiillll--wwoorrdd,   and  _C_-_o  is  bound  to  run  the  macro
  2883.        expressed on the right hand side (that is, to  insert  the
  2884.        text _> _o_u_t_p_u_t into the line).
  2885.  
  2886.        In  the second form, ""kkeeyysseeqq"":_f_u_n_c_t_i_o_n_-_n_a_m_e or _m_a_c_r_o, kkeeyy--
  2887.        sseeqq differs from kkeeyynnaammee above in that strings denoting an
  2888.        entire  key  sequence  may  be  specified  by  placing the
  2889.        sequence within double quotes.  Some GNU Emacs  style  key
  2890.        escapes can be used, as in the following example.
  2891.  
  2892.               "\C-u": universal-argument
  2893.               "\C-x\C-r": re-read-init-file
  2894.               "\e[11~": "Function Key 1"
  2895.  
  2896.        In  this  example, _C_-_u is again bound to the function uunnii--
  2897.        vveerrssaall--aarrgguummeenntt.   _C_-_x  _C_-_r  is  bound  to  the   function
  2898.        rree--rreeaadd--iinniitt--ffiillee,  and _E_S_C _[ _1 _1 _~ is bound to insert the
  2899.  
  2900.  
  2901.  
  2902. GNU                         1998 Apr 1                         44
  2903.  
  2904.  
  2905.  
  2906.  
  2907.  
  2908. BASH(1)                                                   BASH(1)
  2909.  
  2910.  
  2911.        text FFuunnccttiioonn KKeeyy 11.  The full  set  of  GNU  Emacs  style
  2912.        escape sequences is
  2913.               \\CC--    control prefix
  2914.               \\MM--    meta prefix
  2915.               \\ee     an escape character
  2916.               \\\\     backslash
  2917.               \\""     literal "
  2918.               \\''     literal '
  2919.  
  2920.        In  addition  to  the  GNU Emacs style escape sequences, a
  2921.        second set of backslash escapes is available:
  2922.               \\aa     alert (bell)
  2923.               \\bb     backspace
  2924.               \\dd     delete
  2925.               \\ff     form feed
  2926.               \\nn     newline
  2927.               \\rr     carriage return
  2928.               \\tt     horizontal tab
  2929.               \\vv     vertical tab
  2930.               \\_n_n_n   the character whose ASCII code is the  octal
  2931.                      value _n_n_n (one to three digits)
  2932.               \\xx_n_n_n  the  character  whose ASCII code is the hex-
  2933.                      adecimal value _n_n_n (one to three digits)
  2934.  
  2935.        When entering the text of a macro, single or double quotes
  2936.        must  be  used  to  indicate a macro definition.  Unquoted
  2937.        text is assumed to be a function name.  In the macro body,
  2938.        the backslash escapes described above are expanded.  Back-
  2939.        slash will quote any other character in  the  macro  text,
  2940.        including " and '.
  2941.  
  2942.        BBaasshh  allows  the current readline key bindings to be dis-
  2943.        played or modified with the  bbiinndd  builtin  command.   The
  2944.        editing  mode  may  be  switched during interactive use by
  2945.        using the --oo option to the sseett builtin command (see  SSHHEELLLL
  2946.        BBUUIILLTTIINN CCOOMMMMAANNDDSS below).
  2947.  
  2948.    RReeaaddlliinnee VVaarriiaabblleess
  2949.        Readline  has  variables  that can be used to further cus-
  2950.        tomize its behavior.  A variable may be set in the _i_n_p_u_t_r_c
  2951.        file with a statement of the form
  2952.  
  2953.               sseett _v_a_r_i_a_b_l_e_-_n_a_m_e _v_a_l_u_e
  2954.  
  2955.        Except where noted, readline variables can take the values
  2956.        OOnn or OOffff.  The variables and their default values are:
  2957.  
  2958.        bbeellll--ssttyyllee ((aauuddiibbllee))
  2959.               Controls what happens when readline wants  to  ring
  2960.               the  terminal bell.  If set to nnoonnee, readline never
  2961.               rings the bell.  If set to vviissiibbllee, readline uses a
  2962.               visible  bell if one is available.  If set to aauuddii--
  2963.               bbllee, readline attempts to ring the terminal's bell.
  2964.  
  2965.  
  2966.  
  2967.  
  2968. GNU                         1998 Apr 1                         45
  2969.  
  2970.  
  2971.  
  2972.  
  2973.  
  2974. BASH(1)                                                   BASH(1)
  2975.  
  2976.  
  2977.        ccoommmmeenntt--bbeeggiinn ((````##''''))
  2978.               The  string  that  is  inserted  when  the rreeaaddlliinnee
  2979.               iinnsseerrtt--ccoommmmeenntt command is executed.   This  command
  2980.               is  bound  to MM--## in emacs mode and to ## in vi com-
  2981.               mand mode.
  2982.        ccoommpplleettiioonn--iiggnnoorree--ccaassee ((OOffff))
  2983.               If set to OOnn, readline performs  filename  matching
  2984.               and completion in a case-insensitive fashion.
  2985.        ccoommpplleettiioonn--qquueerryy--iitteemmss ((110000))
  2986.               This  determines  when  the  user  is queried about
  2987.               viewing the number of possible  completions  gener-
  2988.               ated  by  the ppoossssiibbllee--ccoommpplleettiioonnss command.  It may
  2989.               be set to any integer value greater than  or  equal
  2990.               to  zero.  If the number of possible completions is
  2991.               greater than or equal to the value  of  this  vari-
  2992.               able, the user is asked whether or not he wishes to
  2993.               view them; otherwise they are simply listed on  the
  2994.               terminal.
  2995.        ccoonnvveerrtt--mmeettaa ((OOnn))
  2996.               If set to OOnn, readline will convert characters with
  2997.               the eighth bit set to  an  ASCII  key  sequence  by
  2998.               stripping  the  eighth bit and prepending an escape
  2999.               character (in effect, using escape as the _m_e_t_a _p_r_e_-
  3000.               _f_i_x).
  3001.        ddiissaabbllee--ccoommpplleettiioonn ((OOffff))
  3002.               If  set  to  OOnn, readline will inhibit word comple-
  3003.               tion.  Completion characters will be inserted  into
  3004.               the line as if they had been mapped to sseellff--iinnsseerrtt.
  3005.        eeddiittiinngg--mmooddee ((eemmaaccss))
  3006.               Controls whether readline begins with a set of  key
  3007.               bindings  similar to _e_m_a_c_s or _v_i.  eeddiittiinngg--mmooddee can
  3008.               be set to either eemmaaccss or vvii.
  3009.        eennaabbllee--kkeeyyppaadd ((OOffff))
  3010.               When set to OOnn, readline will  try  to  enable  the
  3011.               application keypad when it is called.  Some systems
  3012.               need this to enable the arrow keys.
  3013.        eexxppaanndd--ttiillddee ((OOffff))
  3014.               If set to oonn, tilde  expansion  is  performed  when
  3015.               readline attempts word completion.
  3016.        hhoorriizzoonnttaall--ssccrroollll--mmooddee ((OOffff))
  3017.               When  set  to  OOnn, makes readline use a single line
  3018.               for display, scrolling the input horizontally on  a
  3019.               single  screen line when it becomes longer than the
  3020.               screen width rather than wrapping to a new line.
  3021.        iinnppuutt--mmeettaa ((OOffff))
  3022.               If set to OOnn, readline will enable eight-bit  input
  3023.               (that  is,  it will not strip the high bit from the
  3024.               characters it reads), regardless of what the termi-
  3025.               nal claims it can support.  The name mmeettaa--ffllaagg is a
  3026.               synonym for this variable.
  3027.        kkeeyymmaapp ((eemmaaccss))
  3028.               Set the current readline keymap.  The set of  valid
  3029.               keymap  names is _e_m_a_c_s_, _e_m_a_c_s_-_s_t_a_n_d_a_r_d_, _e_m_a_c_s_-_m_e_t_a_,
  3030.               _e_m_a_c_s_-_c_t_l_x_, _v_i_, _v_i_-_c_o_m_m_a_n_d, and _v_i_-_i_n_s_e_r_t.   _v_i  is
  3031.  
  3032.  
  3033.  
  3034. GNU                         1998 Apr 1                         46
  3035.  
  3036.  
  3037.  
  3038.  
  3039.  
  3040. BASH(1)                                                   BASH(1)
  3041.  
  3042.  
  3043.               equivalent  to  _v_i_-_c_o_m_m_a_n_d;  _e_m_a_c_s is equivalent to
  3044.               _e_m_a_c_s_-_s_t_a_n_d_a_r_d.  The default value  is  _e_m_a_c_s;  the
  3045.               value  of  eeddiittiinngg--mmooddee  also  affects  the default
  3046.               keymap.
  3047.        mmaarrkk--ddiirreeccttoorriieess ((OOnn))
  3048.               If set to OOnn,  completed  directory  names  have  a
  3049.               slash appended.
  3050.        mmaarrkk--mmooddiiffiieedd--lliinneess ((OOffff))
  3051.               If set to OOnn, history lines that have been modified
  3052.               are displayed with a preceding asterisk (**).
  3053.        oouuttppuutt--mmeettaa ((OOffff))
  3054.               If set to OOnn, readline will display characters with
  3055.               the  eighth bit set directly rather than as a meta-
  3056.               prefixed escape sequence.
  3057.        pprriinntt--ccoommpplleettiioonnss--hhoorriizzoonnttaallllyy ((OOffff))
  3058.               If set to OOnn,  readline  will  display  completions
  3059.               with  matches  sorted  horizontally in alphabetical
  3060.               order, rather than down the screen.
  3061.        sshhooww--aallll--iiff--aammbbiigguuoouuss ((OOffff))
  3062.               This alters the default behavior of the  completion
  3063.               functions.   If  set  to  oonn, words which have more
  3064.               than one possible completion cause the  matches  to
  3065.               be  listed immediately instead of ringing the bell.
  3066.        vviissiibbllee--ssttaattss ((OOffff))
  3067.               If set to OOnn, a character denoting a file's type as
  3068.               reported  by  _s_t_a_t(2)  is  appended to the filename
  3069.               when listing possible completions.
  3070.  
  3071.    RReeaaddlliinnee CCoonnddiittiioonnaall CCoonnssttrruuccttss
  3072.        Readline implements a facility similar in  spirit  to  the
  3073.        conditional  compilation  features  of  the C preprocessor
  3074.        which allows key bindings and variable settings to be per-
  3075.        formed  as  the  result  of  tests.  There are four parser
  3076.        directives used.
  3077.  
  3078.        $$iiff    The $$iiff construct allows bindings to be made  based
  3079.               on  the  editing  mode, the terminal being used, or
  3080.               the application using readline.  The  text  of  the
  3081.               test  extends to the end of the line; no characters
  3082.               are required to isolate it.
  3083.  
  3084.               mmooddee   The mmooddee== form of the $$iiff directive is  used
  3085.                      to  test  whether readline is in emacs or vi
  3086.                      mode.  This may be used in conjunction  with
  3087.                      the sseett kkeeyymmaapp command, for instance, to set
  3088.                      bindings   in   the    _e_m_a_c_s_-_s_t_a_n_d_a_r_d    and
  3089.                      _e_m_a_c_s_-_c_t_l_x   keymaps  only  if  readline  is
  3090.                      starting out in emacs mode.
  3091.  
  3092.               tteerrmm   The tteerrmm== form may be used to include termi-
  3093.                      nal-specific  key  bindings, perhaps to bind
  3094.                      the key sequences output by  the  terminal's
  3095.                      function  keys.   The word on the right side
  3096.                      of the == is tested  against  the  both  full
  3097.  
  3098.  
  3099.  
  3100. GNU                         1998 Apr 1                         47
  3101.  
  3102.  
  3103.  
  3104.  
  3105.  
  3106. BASH(1)                                                   BASH(1)
  3107.  
  3108.  
  3109.                      name  of the terminal and the portion of the
  3110.                      terminal name  before  the  first  --.   This
  3111.                      allows  _s_u_n  to  match both _s_u_n and _s_u_n_-_c_m_d,
  3112.                      for instance.
  3113.  
  3114.               aapppplliiccaattiioonn
  3115.                      The aapppplliiccaattiioonn construct is used to include
  3116.                      application-specific settings.  Each program
  3117.                      using the readline library sets the _a_p_p_l_i_c_a_-
  3118.                      _t_i_o_n  _n_a_m_e,  and  an initialization file can
  3119.                      test for a particular value.  This could  be
  3120.                      used to bind key sequences to functions use-
  3121.                      ful for a specific program.   For  instance,
  3122.                      the  following  command  adds a key sequence
  3123.                      that quotes the current or previous word  in
  3124.                      Bash:
  3125.  
  3126.                      $$iiff Bash
  3127.                      # Quote the current or previous word
  3128.                      "\C-xq": "\eb\"\ef\""
  3129.                      $$eennddiiff
  3130.  
  3131.        $$eennddiiff This command, as seen in the previous example, ter-
  3132.               minates an $$iiff command.
  3133.  
  3134.        $$eellssee  Commands in this branch of the  $$iiff  directive  are
  3135.               executed if the test fails.
  3136.  
  3137.        $$iinncclluuddee
  3138.               This  directive takes a single filename as an argu-
  3139.               ment and reads  commands  and  bindings  from  that
  3140.               file.   For  example, the following directive would
  3141.               read _/_e_t_c_/_i_n_p_u_t_r_c:
  3142.  
  3143.               $$iinncclluuddee  _/_e_t_c_/_i_n_p_u_t_r_c
  3144.  
  3145.    SSeeaarrcchhiinngg
  3146.        Readline provides commands for searching through the  com-
  3147.        mand  history  (see  HHIISSTTOORRYY below) for lines containing a
  3148.        specified string.  There are two search modes: _i_n_c_r_e_m_e_n_t_a_l
  3149.        and _n_o_n_-_i_n_c_r_e_m_e_n_t_a_l.
  3150.  
  3151.        Incremental  searches  begin  before the user has finished
  3152.        typing the search string.  As each character of the search
  3153.        string is typed, readline displays the next entry from the
  3154.        history matching the string typed so far.  An  incremental
  3155.        search  requires only as many characters as needed to find
  3156.        the desired history entry.  The Escape character  is  used
  3157.        to  terminate  an incremental search.  Control-J will also
  3158.        terminate the search.  Control-G will abort an incremental
  3159.        search  and restore the original line.  When the search is
  3160.        terminated, the history entry containing the search string
  3161.        becomes  the current line.  To find other matching entries
  3162.        in the  history  list,  type  Control-S  or  Control-R  as
  3163.  
  3164.  
  3165.  
  3166. GNU                         1998 Apr 1                         48
  3167.  
  3168.  
  3169.  
  3170.  
  3171.  
  3172. BASH(1)                                                   BASH(1)
  3173.  
  3174.  
  3175.        appropriate.   This will search backward or forward in the
  3176.        history for the next  entry  matching  the  search  string
  3177.        typed  so far.  Any other key sequence bound to a readline
  3178.        command will terminate the search and  execute  that  com-
  3179.        mand.   For  instance, a _n_e_w_l_i_n_e will terminate the search
  3180.        and accept the line, thereby executing  the  command  from
  3181.        the history list.
  3182.  
  3183.        Non-incremental  searches  read  the  entire search string
  3184.        before starting to search for matching history lines.  The
  3185.        search  string  may be typed by the user or be part of the
  3186.        contents of the current line.
  3187.  
  3188.    RReeaaddlliinnee CCoommmmaanndd NNaammeess
  3189.        The following is a list of the names of the  commands  and
  3190.        the  default  key sequences to which they are bound.  Com-
  3191.        mand  names  without  an  accompanying  key  sequence  are
  3192.        unbound by default.
  3193.  
  3194.    CCoommmmaannddss ffoorr MMoovviinngg
  3195.        bbeeggiinnnniinngg--ooff--lliinnee ((CC--aa))
  3196.               Move to the start of the current line.
  3197.        eenndd--ooff--lliinnee ((CC--ee))
  3198.               Move to the end of the line.
  3199.        ffoorrwwaarrdd--cchhaarr ((CC--ff))
  3200.               Move forward a character.
  3201.        bbaacckkwwaarrdd--cchhaarr ((CC--bb))
  3202.               Move back a character.
  3203.        ffoorrwwaarrdd--wwoorrdd ((MM--ff))
  3204.               Move  forward  to  the end of the next word.  Words
  3205.               are composed of  alphanumeric  characters  (letters
  3206.               and digits).
  3207.        bbaacckkwwaarrdd--wwoorrdd ((MM--bb))
  3208.               Move  back  to  the start of this, or the previous,
  3209.               word.  Words are composed of  alphanumeric  charac-
  3210.               ters (letters and digits).
  3211.        cclleeaarr--ssccrreeeenn ((CC--ll))
  3212.               Clear  the  screen  leaving the current line at the
  3213.               top of the screen.  With an argument,  refresh  the
  3214.               current line without clearing the screen.
  3215.        rreeddrraaww--ccuurrrreenntt--lliinnee
  3216.               Refresh the current line.
  3217.  
  3218.    CCoommmmaannddss ffoorr MMaanniippuullaattiinngg tthhee HHiissttoorryy
  3219.        aacccceepptt--lliinnee ((NNeewwlliinnee,, RReettuurrnn))
  3220.               Accept  the line regardless of where the cursor is.
  3221.               If this line is non-empty, add it  to  the  history
  3222.               list  according  to  the  state  of the HHIISSTTCCOONNTTRROOLL
  3223.               variable.  If the line is a modified history  line,
  3224.               then  restore  the  history  line  to  its original
  3225.               state.
  3226.        pprreevviioouuss--hhiissttoorryy ((CC--pp))
  3227.               Fetch the previous command from the  history  list,
  3228.               moving back in the list.
  3229.  
  3230.  
  3231.  
  3232. GNU                         1998 Apr 1                         49
  3233.  
  3234.  
  3235.  
  3236.  
  3237.  
  3238. BASH(1)                                                   BASH(1)
  3239.  
  3240.  
  3241.        nneexxtt--hhiissttoorryy ((CC--nn))
  3242.               Fetch  the next command from the history list, mov-
  3243.               ing forward in the list.
  3244.        bbeeggiinnnniinngg--ooff--hhiissttoorryy ((MM--<<))
  3245.               Move to the first line in the history.
  3246.        eenndd--ooff--hhiissttoorryy ((MM-->>))
  3247.               Move to the end of the  input  history,  i.e.,  the
  3248.               line currently being entered.
  3249.        rreevveerrssee--sseeaarrcchh--hhiissttoorryy ((CC--rr))
  3250.               Search  backward  starting  at the current line and
  3251.               moving `up' through the history as necessary.  This
  3252.               is an incremental search.
  3253.        ffoorrwwaarrdd--sseeaarrcchh--hhiissttoorryy ((CC--ss))
  3254.               Search  forward  starting  at  the current line and
  3255.               moving `down' through  the  history  as  necessary.
  3256.               This is an incremental search.
  3257.        nnoonn--iinnccrreemmeennttaall--rreevveerrssee--sseeaarrcchh--hhiissttoorryy ((MM--pp))
  3258.               Search backward through the history starting at the
  3259.               current line using a non-incremental search  for  a
  3260.               string supplied by the user.
  3261.        nnoonn--iinnccrreemmeennttaall--ffoorrwwaarrdd--sseeaarrcchh--hhiissttoorryy ((MM--nn))
  3262.               Search  forward  through  the  history using a non-
  3263.               incremental search for a  string  supplied  by  the
  3264.               user.
  3265.        hhiissttoorryy--sseeaarrcchh--ffoorrwwaarrdd
  3266.               Search  forward  through the history for the string
  3267.               of characters between the start of the current line
  3268.               and  the current cursor position (the _p_o_i_n_t).  This
  3269.               is a non-incremental search.
  3270.        hhiissttoorryy--sseeaarrcchh--bbaacckkwwaarrdd
  3271.               Search backward through the history for the  string
  3272.               of characters between the start of the current line
  3273.               and the point.  This is a non-incremental search.
  3274.        yyaannkk--nntthh--aarrgg ((MM--CC--yy))
  3275.               Insert the first argument to the  previous  command
  3276.               (usually  the  second word on the previous line) at
  3277.               point (the current cursor position).  With an argu-
  3278.               ment  _n, insert the _nth word from the previous com-
  3279.               mand (the words in the previous command begin  with
  3280.               word  0).  A negative argument inserts the _nth word
  3281.               from the end of the previous command.
  3282.        yyaannkk--llaasstt--aarrgg ((MM--..,, MM--__))
  3283.               Insert the last argument to  the  previous  command
  3284.               (the  last  word  of  the  previous history entry).
  3285.               With an argument, behave exactly like yyaannkk--nntthh--aarrgg.
  3286.               Successive calls to yyaannkk--llaasstt--aarrgg move back through
  3287.               the history list, inserting the  last  argument  of
  3288.               each line in turn.
  3289.        sshheellll--eexxppaanndd--lliinnee ((MM--CC--ee))
  3290.               Expand  the  line as the shell does.  This performs
  3291.               alias and history expansion as well as all  of  the
  3292.               shell word expansions.  See HHIISSTTOORRYY EEXXPPAANNSSIIOONN below
  3293.               for a description of history expansion.
  3294.  
  3295.  
  3296.  
  3297.  
  3298. GNU                         1998 Apr 1                         50
  3299.  
  3300.  
  3301.  
  3302.  
  3303.  
  3304. BASH(1)                                                   BASH(1)
  3305.  
  3306.  
  3307.        hhiissttoorryy--eexxppaanndd--lliinnee ((MM--^^))
  3308.               Perform history expansion on the current line.  See
  3309.               HHIISSTTOORRYY  EEXXPPAANNSSIIOONN  below for a description of his-
  3310.               tory expansion.
  3311.        mmaaggiicc--ssppaaccee
  3312.               Perform history expansion on the current  line  and
  3313.               insert  a space.  See HHIISSTTOORRYY EEXXPPAANNSSIIOONN below for a
  3314.               description of history expansion.
  3315.        aalliiaass--eexxppaanndd--lliinnee
  3316.               Perform alias expansion on the current  line.   See
  3317.               AALLIIAASSEESS above for a description of alias expansion.
  3318.        hhiissttoorryy--aanndd--aalliiaass--eexxppaanndd--lliinnee
  3319.               Perform history and alias expansion on the  current
  3320.               line.
  3321.        iinnsseerrtt--llaasstt--aarrgguummeenntt ((MM--..,, MM--__))
  3322.               A synonym for yyaannkk--llaasstt--aarrgg.
  3323.        ooppeerraattee--aanndd--ggeett--nneexxtt ((CC--oo))
  3324.               Accept the current line for execution and fetch the
  3325.               next line relative to the  current  line  from  the
  3326.               history for editing.  Any argument is ignored.
  3327.  
  3328.    CCoommmmaannddss ffoorr CChhaannggiinngg TTeexxtt
  3329.        ddeelleettee--cchhaarr ((CC--dd))
  3330.               Delete the character under the cursor.  If point is
  3331.               at the beginning of the line, there are no  charac-
  3332.               ters  in the line, and the last character typed was
  3333.               not bound to ddeelleettee--cchhaarr, then return EEOOFF.
  3334.        bbaacckkwwaarrdd--ddeelleettee--cchhaarr ((RRuubboouutt))
  3335.               Delete the character behind the cursor.  When given
  3336.               a  numeric  argument,  save the deleted text on the
  3337.               kill ring.
  3338.        qquuootteedd--iinnsseerrtt ((CC--qq,, CC--vv))
  3339.               Add the next character typed to the line  verbatim.
  3340.               This  is  how  to  insert  characters like CC--qq, for
  3341.               example.
  3342.        ttaabb--iinnsseerrtt ((CC--vv TTAABB))
  3343.               Insert a tab character.
  3344.        sseellff--iinnsseerrtt ((aa,, bb,, AA,, 11,, !!,, ......))
  3345.               Insert the character typed.
  3346.        ttrraannssppoossee--cchhaarrss ((CC--tt))
  3347.               Drag the character before point  forward  over  the
  3348.               character  at  point.  Point moves forward as well.
  3349.               If point is at the end of the line, then  transpose
  3350.               the  two  characters  before point.  Negative argu-
  3351.               ments don't work.
  3352.        ttrraannssppoossee--wwoorrddss ((MM--tt))
  3353.               Drag the word behind the cursor past  the  word  in
  3354.               front  of  the  cursor  moving the cursor over that
  3355.               word as well.
  3356.        uuppccaassee--wwoorrdd ((MM--uu))
  3357.               Uppercase the current (or following) word.  With  a
  3358.               negative argument, uppercase the previous word, but
  3359.               do not move point.
  3360.  
  3361.  
  3362.  
  3363.  
  3364. GNU                         1998 Apr 1                         51
  3365.  
  3366.  
  3367.  
  3368.  
  3369.  
  3370. BASH(1)                                                   BASH(1)
  3371.  
  3372.  
  3373.        ddoowwnnccaassee--wwoorrdd ((MM--ll))
  3374.               Lowercase the current (or following) word.  With  a
  3375.               negative argument, lowercase the previous word, but
  3376.               do not move point.
  3377.        ccaappiittaalliizzee--wwoorrdd ((MM--cc))
  3378.               Capitalize the current (or following) word.  With a
  3379.               negative  argument,  capitalize  the previous word,
  3380.               but do not move point.
  3381.  
  3382.    KKiilllliinngg aanndd YYaannkkiinngg
  3383.        kkiillll--lliinnee ((CC--kk))
  3384.               Kill the text from the current cursor  position  to
  3385.               the end of the line.
  3386.        bbaacckkwwaarrdd--kkiillll--lliinnee ((CC--xx RRuubboouutt))
  3387.               Kill backward to the beginning of the line.
  3388.        uunniixx--lliinnee--ddiissccaarrdd ((CC--uu))
  3389.               Kill  backward  from  point to the beginning of the
  3390.               line.  The killed text is saved on the kill-ring.
  3391.  
  3392.        kkiillll--wwhhoollee--lliinnee
  3393.               Kill all characters on the current line, no  matter
  3394.               where the cursor is.
  3395.        kkiillll--wwoorrdd ((MM--dd))
  3396.               Kill  from  the  cursor  to  the end of the current
  3397.               word, or if between words, to the end of  the  next
  3398.               word.   Word  boundaries are the same as those used
  3399.               by ffoorrwwaarrdd--wwoorrdd.
  3400.        bbaacckkwwaarrdd--kkiillll--wwoorrdd ((MM--RRuubboouutt))
  3401.               Kill the word behind the cursor.   Word  boundaries
  3402.               are the same as those used by bbaacckkwwaarrdd--wwoorrdd.
  3403.        uunniixx--wwoorrdd--rruubboouutt ((CC--ww))
  3404.               Kill  the word behind the cursor, using white space
  3405.               as a word boundary.  The word boundaries  are  dif-
  3406.               ferent from bbaacckkwwaarrdd--kkiillll--wwoorrdd.
  3407.        ddeelleettee--hhoorriizzoonnttaall--ssppaaccee ((MM--\\))
  3408.               Delete all spaces and tabs around point.
  3409.        kkiillll--rreeggiioonn
  3410.               Kill  the  text  between  the point and _m_a_r_k (saved
  3411.               cursor position).  This text is referred to as  the
  3412.               _r_e_g_i_o_n.
  3413.        ccooppyy--rreeggiioonn--aass--kkiillll
  3414.               Copy the text in the region to the kill buffer.
  3415.        ccooppyy--bbaacckkwwaarrdd--wwoorrdd
  3416.               Copy the word before point to the kill buffer.  The
  3417.               word boundaries are the same as bbaacckkwwaarrdd--wwoorrdd.
  3418.        ccooppyy--ffoorrwwaarrdd--wwoorrdd
  3419.               Copy the word following point to the  kill  buffer.
  3420.               The word boundaries are the same as ffoorrwwaarrdd--wwoorrdd.
  3421.        yyaannkk ((CC--yy))
  3422.               Yank  the  top  of the kill ring into the buffer at
  3423.               the cursor.
  3424.        yyaannkk--ppoopp ((MM--yy))
  3425.               Rotate the kill ring, and yank the new  top.   Only
  3426.               works following yyaannkk or yyaannkk--ppoopp.
  3427.  
  3428.  
  3429.  
  3430. GNU                         1998 Apr 1                         52
  3431.  
  3432.  
  3433.  
  3434.  
  3435.  
  3436. BASH(1)                                                   BASH(1)
  3437.  
  3438.  
  3439.    NNuummeerriicc AArrgguummeennttss
  3440.        ddiiggiitt--aarrgguummeenntt ((MM--00,, MM--11,, ......,, MM----))
  3441.               Add  this  digit to the argument already accumulat-
  3442.               ing, or start a new argument.  M-- starts  a  nega-
  3443.               tive argument.
  3444.        uunniivveerrssaall--aarrgguummeenntt
  3445.               This  is  another  way  to specify an argument.  If
  3446.               this command is followed by  one  or  more  digits,
  3447.               optionally  with a leading minus sign, those digits
  3448.               define the argument.  If the command is followed by
  3449.               digits, executing uunniivveerrssaall--aarrgguummeenntt again ends the
  3450.               numeric argument, but is otherwise ignored.   As  a
  3451.               special  case,  if this command is immediately fol-
  3452.               lowed by a character that is  neither  a  digit  or
  3453.               minus sign, the argument count for the next command
  3454.               is multiplied by four.  The argument count is  ini-
  3455.               tially  one,  so  executing this function the first
  3456.               time makes the argument count four, a  second  time
  3457.               makes the argument count sixteen, and so on.
  3458.  
  3459.    CCoommpplleettiinngg
  3460.        ccoommpplleettee ((TTAABB))
  3461.               Attempt  to  perform  completion on the text before
  3462.               point.  BBaasshh attempts completion treating the  text
  3463.               as a variable (if the text begins with $$), username
  3464.               (if the text begins with ~~), hostname (if the  text
  3465.               begins  with  @@), or command (including aliases and
  3466.               functions) in turn.  If none of  these  produces  a
  3467.               match, filename completion is attempted.
  3468.        ppoossssiibbllee--ccoommpplleettiioonnss ((MM--??))
  3469.               List  the  possible  completions of the text before
  3470.               point.
  3471.        iinnsseerrtt--ccoommpplleettiioonnss ((MM--**))
  3472.               Insert all completions of  the  text  before  point
  3473.               that  would have been generated by ppoossssiibbllee--ccoommppllee--
  3474.               ttiioonnss.
  3475.        mmeennuu--ccoommpplleettee
  3476.               Similar to ccoommpplleettee, but replaces the  word  to  be
  3477.               completed with a single match from the list of pos-
  3478.               sible completions.  Repeated execution of mmeennuu--ccoomm--
  3479.               pplleettee  steps  through  the list of possible comple-
  3480.               tions, inserting each match in turn.  At the end of
  3481.               the  list  of completions, the bell is rung and the
  3482.               original text is restored.  An argument of _n  moves
  3483.               _n positions forward in the list of matches; a nega-
  3484.               tive argument may be used to move backward  through
  3485.               the  list.  This command is intended to be bound to
  3486.               TTAABB, but is unbound by default.
  3487.        ccoommpplleettee--ffiilleennaammee ((MM--//))
  3488.               Attempt filename  completion  on  the  text  before
  3489.               point.
  3490.        ppoossssiibbllee--ffiilleennaammee--ccoommpplleettiioonnss ((CC--xx //))
  3491.               List  the  possible  completions of the text before
  3492.               point, treating it as a filename.
  3493.  
  3494.  
  3495.  
  3496. GNU                         1998 Apr 1                         53
  3497.  
  3498.  
  3499.  
  3500.  
  3501.  
  3502. BASH(1)                                                   BASH(1)
  3503.  
  3504.  
  3505.        ccoommpplleettee--uusseerrnnaammee ((MM--~~))
  3506.               Attempt completion on the text before point, treat-
  3507.               ing it as a username.
  3508.        ppoossssiibbllee--uusseerrnnaammee--ccoommpplleettiioonnss ((CC--xx ~~))
  3509.               List  the  possible  completions of the text before
  3510.               point, treating it as a username.
  3511.        ccoommpplleettee--vvaarriiaabbllee ((MM--$$))
  3512.               Attempt completion on the text before point, treat-
  3513.               ing it as a shell variable.
  3514.        ppoossssiibbllee--vvaarriiaabbllee--ccoommpplleettiioonnss ((CC--xx $$))
  3515.               List  the  possible  completions of the text before
  3516.               point, treating it as a shell variable.
  3517.        ccoommpplleettee--hhoossttnnaammee ((MM--@@))
  3518.               Attempt completion on the text before point, treat-
  3519.               ing it as a hostname.
  3520.        ppoossssiibbllee--hhoossttnnaammee--ccoommpplleettiioonnss ((CC--xx @@))
  3521.               List  the  possible  completions of the text before
  3522.               point, treating it as a hostname.
  3523.        ccoommpplleettee--ccoommmmaanndd ((MM--!!))
  3524.               Attempt completion on the text before point, treat-
  3525.               ing  it  as  a  command  name.   Command completion
  3526.               attempts  to  match  the  text   against   aliases,
  3527.               reserved  words,  shell  functions, shell builtins,
  3528.               and finally executable filenames, in that order.
  3529.        ppoossssiibbllee--ccoommmmaanndd--ccoommpplleettiioonnss ((CC--xx !!))
  3530.               List the possible completions of  the  text  before
  3531.               point, treating it as a command name.
  3532.        ddyynnaammiicc--ccoommpplleettee--hhiissttoorryy ((MM--TTAABB))
  3533.               Attempt  completion  on the text before point, com-
  3534.               paring the text against lines from the history list
  3535.               for possible completion matches.
  3536.        ccoommpplleettee--iinnttoo--bbrraacceess ((MM--{{))
  3537.               Perform  filename completion and return the list of
  3538.               possible completions enclosed within braces so  the
  3539.               list is available to the shell (see BBrraaccee EExxppaannssiioonn
  3540.               above).
  3541.  
  3542.    KKeeyybbooaarrdd MMaaccrrooss
  3543.        ssttaarrtt--kkbbdd--mmaaccrroo ((CC--xx (())
  3544.               Begin saving the characters typed into the  current
  3545.               keyboard macro.
  3546.        eenndd--kkbbdd--mmaaccrroo ((CC--xx ))))
  3547.               Stop  saving  the characters typed into the current
  3548.               keyboard macro and store the definition.
  3549.        ccaallll--llaasstt--kkbbdd--mmaaccrroo ((CC--xx ee))
  3550.               Re-execute the last keyboard macro defined, by mak-
  3551.               ing  the characters in the macro appear as if typed
  3552.               at the keyboard.
  3553.  
  3554.    MMiisscceellllaanneeoouuss
  3555.        rree--rreeaadd--iinniitt--ffiillee ((CC--xx CC--rr))
  3556.               Read in the  contents  of  the  _i_n_p_u_t_r_c  file,  and
  3557.               incorporate  any  bindings  or variable assignments
  3558.               found there.
  3559.  
  3560.  
  3561.  
  3562. GNU                         1998 Apr 1                         54
  3563.  
  3564.  
  3565.  
  3566.  
  3567.  
  3568. BASH(1)                                                   BASH(1)
  3569.  
  3570.  
  3571.        aabboorrtt ((CC--gg))
  3572.               Abort the current editing command and ring the ter-
  3573.               minal's   bell   (subject   to   the   setting   of
  3574.               bbeellll--ssttyyllee).
  3575.        ddoo--uuppppeerrccaassee--vveerrssiioonn ((MM--aa,, MM--bb,, MM--_x,, ......))
  3576.               If the metafied character _x is lowercase,  run  the
  3577.               command  that  is bound to the corresponding upper-
  3578.               case character.
  3579.        pprreeffiixx--mmeettaa ((EESSCC))
  3580.               Metafy the next character typed.  EESSCC ff is  equiva-
  3581.               lent to MMeettaa--ff.
  3582.        uunnddoo ((CC--__,, CC--xx CC--uu))
  3583.               Incremental  undo,  separately  remembered for each
  3584.               line.
  3585.        rreevveerrtt--lliinnee ((MM--rr))
  3586.               Undo all changes made to this line.  This  is  like
  3587.               executing  the  uunnddoo command enough times to return
  3588.               the line to its initial state.
  3589.        ttiillddee--eexxppaanndd ((MM--~~))
  3590.               Perform tilde expansion on the current word.
  3591.        sseett--mmaarrkk ((CC--@@,, MM--<<ssppaaccee>>))
  3592.               Set the mark to the current point.   If  a  numeric
  3593.               argument is supplied, the mark is set to that posi-
  3594.               tion.
  3595.        eexxcchhaannggee--ppooiinntt--aanndd--mmaarrkk ((CC--xx CC--xx))
  3596.               Swap the point with the mark.  The  current  cursor
  3597.               position  is set to the saved position, and the old
  3598.               cursor position is saved as the mark.
  3599.        cchhaarraacctteerr--sseeaarrcchh ((CC--]]))
  3600.               A character is read and point is moved to the  next
  3601.               occurrence  of  that  character.   A negative count
  3602.               searches for previous occurrences.
  3603.        cchhaarraacctteerr--sseeaarrcchh--bbaacckkwwaarrdd ((MM--CC--]]))
  3604.               A character is read and point is moved to the  pre-
  3605.               vious  occurrence  of  that  character.  A negative
  3606.               count searches for subsequent occurrences.
  3607.        iinnsseerrtt--ccoommmmeenntt ((MM--##))
  3608.               The value of the rreeaaddlliinnee ccoommmmeenntt--bbeeggiinn variable is
  3609.               inserted  at the beginning of the current line, and
  3610.               the line is accepted  as  if  a  newline  had  been
  3611.               typed.   This  makes  the current line a shell com-
  3612.               ment.
  3613.        gglloobb--eexxppaanndd--wwoorrdd ((CC--xx **))
  3614.               The word before point is treated as a  pattern  for
  3615.               pathname  expansion,  and the list of matching file
  3616.               names is inserted, replacing the word.
  3617.        gglloobb--lliisstt--eexxppaannssiioonnss ((CC--xx gg))
  3618.               The list of expansions that would have been  gener-
  3619.               ated by gglloobb--eexxppaanndd--wwoorrdd is displayed, and the line
  3620.               is redrawn.
  3621.        dduummpp--ffuunnccttiioonnss
  3622.               Print all of the functions and their  key  bindings
  3623.               to  the readline output stream.  If a numeric argu-
  3624.               ment is supplied, the output is formatted in such a
  3625.  
  3626.  
  3627.  
  3628. GNU                         1998 Apr 1                         55
  3629.  
  3630.  
  3631.  
  3632.  
  3633.  
  3634. BASH(1)                                                   BASH(1)
  3635.  
  3636.  
  3637.               way that it can be made part of an _i_n_p_u_t_r_c file.
  3638.        dduummpp--vvaarriiaabblleess
  3639.               Print  all  of  the settable readline variables and
  3640.               their values to the readline output stream.   If  a
  3641.               numeric argument is supplied, the output is format-
  3642.               ted in such a way that it can be made  part  of  an
  3643.               _i_n_p_u_t_r_c file.
  3644.        dduummpp--mmaaccrrooss
  3645.               Print  all  of  the readline key sequences bound to
  3646.               macros and the strings they ouput.   If  a  numeric
  3647.               argument  is  supplied,  the output is formatted in
  3648.               such a way that it can be made part of  an  _i_n_p_u_t_r_c
  3649.               file.
  3650.        ddiissppllaayy--sshheellll--vveerrssiioonn ((CC--xx CC--vv))
  3651.               Display   version  information  about  the  current
  3652.               instance of bbaasshh.
  3653.  
  3654. HHIISSTTOORRYY
  3655.        When the --oo hhiissttoorryy option to the sseett builtin is  enabled,
  3656.        the shell provides access to the _c_o_m_m_a_n_d _h_i_s_t_o_r_y, the list
  3657.        of commands previously typed.  The text of the last  HHIISSTT--
  3658.        SSIIZZEE  commands  (default  500) is saved in a history list.
  3659.        The shell stores each command in the history list prior to
  3660.        parameter and variable expansion (see EEXXPPAANNSSIIOONN above) but
  3661.        after history expansion is performed, subject to the  val-
  3662.        ues of the shell variables HHIISSTTIIGGNNOORREE and HHIISSTTCCOONNTTRROOLL.  On
  3663.        startup, the history is initialized from the file named by
  3664.        the variable HHIISSTTFFIILLEE (default _~_/_._b_a_s_h___h_i_s_t_o_r_y).  HHIISSTTFFIILLEE
  3665.        is truncated, if necessary, to contain no more than  HHIISSTT--
  3666.        FFIILLEESSIIZZEE lines.  When an interactive shell exits, the last
  3667.        HHIISSTTSSIIZZEE lines are copied from the history list  to  HHIISSTT--
  3668.        FFIILLEE.   If the hhiissttaappppeenndd shell option is enabled (see the
  3669.        description of sshhoopptt under SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS  below),
  3670.        the  lines are appended to the history file, otherwise the
  3671.        history file is overwritten.  If HHIISSTTFFIILLEE is unset, or  if
  3672.        the  history file is unwritable, the history is not saved.
  3673.        After saving the history, the history file is truncated to
  3674.        contain  no more than HHIISSTTFFIILLEESSIIZZEE lines.  If HHIISSTTFFIILLEESSIIZZEE
  3675.        is not set, no truncation is performed.
  3676.  
  3677.        The builtin command ffcc (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS  below)
  3678.        may  be  used  to list or edit and re-execute a portion of
  3679.        the history list.  The hhiissttoorryy builtin can be used to dis-
  3680.        play or modify the history list and manipulate the history
  3681.        file.  When using the command-line  editing,  search  com-
  3682.        mands  are  available  in  each  editing mode that provide
  3683.        access to the history list.
  3684.  
  3685.        The shell allows control over which commands are saved  on
  3686.        the  history  list.   The HHIISSTTCCOONNTTRROOLL and HHIISSTTIIGGNNOORREE vari-
  3687.        ables may be set to cause the shell to save only a  subset
  3688.        of  the  commands  entered.   The ccmmddhhiisstt shell option, if
  3689.        enabled, causes the shell to attempt to save each line  of
  3690.        a  multi-line  command  in  the same history entry, adding
  3691.  
  3692.  
  3693.  
  3694. GNU                         1998 Apr 1                         56
  3695.  
  3696.  
  3697.  
  3698.  
  3699.  
  3700. BASH(1)                                                   BASH(1)
  3701.  
  3702.  
  3703.        semicolons where necessary to preserve syntactic  correct-
  3704.        ness.   The  lliitthhiisstt shell option causes the shell to save
  3705.        the command with embedded newlines instead of  semicolons.
  3706.        See the description of the sshhoopptt builtin below under SSHHEELLLL
  3707.        BBUUIILLTTIINN CCOOMMMMAANNDDSS for information on setting and  unsetting
  3708.        shell options.
  3709.  
  3710. HHIISSTTOORRYY EEXXPPAANNSSIIOONN
  3711.        The  shell  supports  a  history expansion feature that is
  3712.        similar to the history expansion  in  ccsshh..   This  section
  3713.        describes  what  syntax features are available.  This fea-
  3714.        ture is enabled by default for interactive shells, and can
  3715.        be disabled using the ++HH option to the sseett builtin command
  3716.        (see  SSHHEELLLL  BBUUIILLTTIINN  CCOOMMMMAANNDDSS  below).    Non-interactive
  3717.        shells do not perform history expansion by default.
  3718.  
  3719.        History  expansions  introduce words from the history list
  3720.        into the input stream, making it easy to repeat  commands,
  3721.        insert  the  arguments to a previous command into the cur-
  3722.        rent input  line,  or  fix  errors  in  previous  commands
  3723.        quickly.
  3724.  
  3725.        History  expansion  is  performed immediately after a com-
  3726.        plete line is read, before the shell breaks it into words.
  3727.        It  takes  place  in two parts.  The first is to determine
  3728.        which line from the history list to use  during  substitu-
  3729.        tion.   The  second is to select portions of that line for
  3730.        inclusion into the current one.  The  line  selected  from
  3731.        the  history  is  the _e_v_e_n_t, and the portions of that line
  3732.        that are acted upon  are  _w_o_r_d_s.   Various  _m_o_d_i_f_i_e_r_s  are
  3733.        available  to  manipulate the selected words.  The line is
  3734.        broken into words in the  same  fashion  as  when  reading
  3735.        input,  so that several _m_e_t_a_c_h_a_r_a_c_t_e_r-separated words sur-
  3736.        rounded by quotes are considered one word.  History expan-
  3737.        sions  are  introduced  by  the  appearance of the history
  3738.        expansion character, which is !! by  default.   Only  back-
  3739.        slash  (\\)  and single quotes can quote the history expan-
  3740.        sion character.
  3741.  
  3742.        Several shell options settable with the sshhoopptt builtin  may
  3743.        be  used  to tailor the behavior of history expansion.  If
  3744.        the hhiissttvveerriiffyy shell option is enabled (see  the  descrip-
  3745.        tion  of  the  sshhoopptt builtin), and rreeaaddlliinnee is being used,
  3746.        history substitutions are not immediately  passed  to  the
  3747.        shell parser.  Instead, the expanded line is reloaded into
  3748.        the rreeaaddlliinnee editing buffer for further modification.   If
  3749.        rreeaaddlliinnee is being used, and the hhiissttrreeeeddiitt shell option is
  3750.        enabled, a failed history substitution  will  be  reloaded
  3751.        into  the  rreeaaddlliinnee editing buffer for correction.  The --pp
  3752.        option to the hhiissttoorryy builtin command may be used  to  see
  3753.        what  a history expansion will do before using it.  The --ss
  3754.        option to the hhiissttoorryy builtin may be used to add  commands
  3755.        to  the end of the history list without actually executing
  3756.        them, so that they are available for subsequent recall.
  3757.  
  3758.  
  3759.  
  3760. GNU                         1998 Apr 1                         57
  3761.  
  3762.  
  3763.  
  3764.  
  3765.  
  3766. BASH(1)                                                   BASH(1)
  3767.  
  3768.  
  3769.        The shell allows control of the various characters used by
  3770.        the  history  expansion  mechanism (see the description of
  3771.        hhiissttcchhaarrss above under SShheellll VVaarriiaabblleess).
  3772.  
  3773.    EEvveenntt DDeessiiggnnaattoorrss
  3774.        An event designator is a reference to a command line entry
  3775.        in the history list.
  3776.  
  3777.        !!      Start  a history substitution, except when followed
  3778.               by a bbllaannkk, newline, = or (.
  3779.        !!_n     Refer to command line _n.
  3780.        !!--_n    Refer to the current command line minus _n.
  3781.        !!!!     Refer to the previous command.  This is  a  synonym
  3782.               for `!-1'.
  3783.        !!_s_t_r_i_n_g
  3784.               Refer  to  the  most  recent  command starting with
  3785.               _s_t_r_i_n_g.
  3786.        !!??_s_t_r_i_n_g[[??]]
  3787.               Refer to the most recent command containing _s_t_r_i_n_g.
  3788.               The trailing ?? may be omitted if _s_t_r_i_n_g is followed
  3789.               immediately by a newline.
  3790.        ^^_s_t_r_i_n_g_1^^_s_t_r_i_n_g_2^^
  3791.               Quick  substitution.   Repeat  the  last   command,
  3792.               replacing  _s_t_r_i_n_g_1  with  _s_t_r_i_n_g_2.   Equivalent  to
  3793.               ``!!:s/_s_t_r_i_n_g_1/_s_t_r_i_n_g_2/'' (see MMooddiiffiieerrss below).
  3794.        !!##     The entire command line typed so far.
  3795.  
  3796.    WWoorrdd DDeessiiggnnaattoorrss
  3797.        Word designators are used to select desired words from the
  3798.        event.   A  ::  separates  the event specification from the
  3799.        word designator.  It may be omitted if the word designator
  3800.        begins  with  a ^^, $$, **, --, or %%.  Words are numbered from
  3801.        the beginning of the  line,  with  the  first  word  being
  3802.        denoted  by 0 (zero).  Words are inserted into the current
  3803.        line separated by single spaces.
  3804.  
  3805.        00 ((zzeerroo))
  3806.               The zeroth word.  For the shell, this is  the  com-
  3807.               mand word.
  3808.        _n      The _nth word.
  3809.        ^^      The first argument.  That is, word 1.
  3810.        $$      The last argument.
  3811.        %%      The  word  matched  by  the  most recent `?_s_t_r_i_n_g?'
  3812.               search.
  3813.        _x--_y    A range of words; `-_y' abbreviates `0-_y'.
  3814.        **      All of the words but the zeroth.  This is a synonym
  3815.               for `_1_-_$'.  It is not an error to use ** if there is
  3816.               just one word in the event;  the  empty  string  is
  3817.               returned in that case.
  3818.        xx**     Abbreviates _x_-_$.
  3819.        xx--     Abbreviates _x_-_$ like xx**, but omits the last word.
  3820.  
  3821.        If a word designator is supplied without an event specifi-
  3822.        cation, the previous command is used as the event.
  3823.  
  3824.  
  3825.  
  3826. GNU                         1998 Apr 1                         58
  3827.  
  3828.  
  3829.  
  3830.  
  3831.  
  3832. BASH(1)                                                   BASH(1)
  3833.  
  3834.  
  3835.    MMooddiiffiieerrss
  3836.        After the optional word designator,  there  may  appear  a
  3837.        sequence  of  one or more of the following modifiers, each
  3838.        preceded by a `:'.
  3839.  
  3840.        hh      Remove a trailing file name component, leaving only
  3841.               the head.
  3842.        tt      Remove  all  leading  file name components, leaving
  3843.               the tail.
  3844.        rr      Remove a trailing suffix of the form _._x_x_x,  leaving
  3845.               the basename.
  3846.        ee      Remove all but the trailing suffix.
  3847.        pp      Print the new command but do not execute it.
  3848.        qq      Quote  the substituted words, escaping further sub-
  3849.               stitutions.
  3850.        xx      Quote the substituted words as with  qq,  but  break
  3851.               into words at bbllaannkkss and newlines.
  3852.        ss//_o_l_d//_n_e_w//
  3853.               Substitute  _n_e_w  for the first occurrence of _o_l_d in
  3854.               the event line.  Any delimiter can be used in place
  3855.               of /.  The final delimiter is optional if it is the
  3856.               last character of the event  line.   The  delimiter
  3857.               may  be  quoted  in _o_l_d and _n_e_w with a single back-
  3858.               slash.  If & appears in _n_e_w, it is replaced by _o_l_d.
  3859.               A  single  backslash  will  quote the &.  If _o_l_d is
  3860.               null, it is set to the last _o_l_d substituted, or, if
  3861.               no  previous  history substitutions took place, the
  3862.               last _s_t_r_i_n_g in a !!??_s_t_r_i_n_g[[??]]  search.
  3863.        &&      Repeat the previous substitution.
  3864.        gg      Cause changes to be applied over the  entire  event
  3865.               line.  This is used in conjunction with `::ss' (e.g.,
  3866.               `::ggss//_o_l_d//_n_e_w//') or `::&&'.  If used  with  `::ss',  any
  3867.               delimiter  can be used in place of /, and the final
  3868.               delimiter is optional if it is the  last  character
  3869.               of the event line.
  3870.  
  3871. SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
  3872.        Unless otherwise noted, each builtin command documented in
  3873.        this section as accepting options preceded by -- accepts ----
  3874.        to signify the end of the options.
  3875.        :: [_a_r_g_u_m_e_n_t_s]
  3876.               No  effect; the command does nothing beyond expand-
  3877.               ing _a_r_g_u_m_e_n_t_s and performing any specified redirec-
  3878.               tions.  A zero exit code is returned.
  3879.  
  3880.         ..  _f_i_l_e_n_a_m_e [_a_r_g_u_m_e_n_t_s]
  3881.        ssoouurrccee _f_i_l_e_n_a_m_e [_a_r_g_u_m_e_n_t_s]
  3882.               Read and execute commands from _f_i_l_e_n_a_m_e in the cur-
  3883.               rent shell environment and return the  exit  status
  3884.               of  the  last  command  executed from _f_i_l_e_n_a_m_e.  If
  3885.               _f_i_l_e_n_a_m_e does not contain a slash,  file  names  in
  3886.               PPAATTHH  are  used  to  find  the directory containing
  3887.               _f_i_l_e_n_a_m_e.  The file searched for in PPAATTHH  need  not
  3888.               be  executable.   The current directory is searched
  3889.  
  3890.  
  3891.  
  3892. GNU                         1998 Apr 1                         59
  3893.  
  3894.  
  3895.  
  3896.  
  3897.  
  3898. BASH(1)                                                   BASH(1)
  3899.  
  3900.  
  3901.               if no file is found in  PPAATTHH.   If  the  ssoouurrcceeppaatthh
  3902.               option  to the sshhoopptt builtin command is turned off,
  3903.               the PPAATTHH is not searched.   If  any  _a_r_g_u_m_e_n_t_s  are
  3904.               supplied,  they  become  the  positional parameters
  3905.               when _f_i_l_e_n_a_m_e is  executed.   Otherwise  the  posi-
  3906.               tional parameters are unchanged.  The return status
  3907.               is the status of the last command exited within the
  3908.               script  (0  if no commands are executed), and false
  3909.               if _f_i_l_e_n_a_m_e is not found or cannot be read.
  3910.  
  3911.        aalliiaass [--pp] [_n_a_m_e[=_v_a_l_u_e] ...]
  3912.               AAlliiaass with no  arguments  or  with  the  --pp  option
  3913.               prints  the  list  of  aliases  in  the  form aalliiaass
  3914.               _n_a_m_e=_v_a_l_u_e on standard output.  When arguments  are
  3915.               supplied,  an  alias is defined for each _n_a_m_e whose
  3916.               _v_a_l_u_e is given.  A trailing space in  _v_a_l_u_e  causes
  3917.               the  next word to be checked for alias substitution
  3918.               when the alias is expanded.  For each _n_a_m_e  in  the
  3919.               argument  list  for which no _v_a_l_u_e is supplied, the
  3920.               name and value of  the  alias  is  printed.   AAlliiaass
  3921.               returns  true  unless  a _n_a_m_e is given for which no
  3922.               alias has been defined.
  3923.  
  3924.        bbgg [_j_o_b_s_p_e_c]
  3925.               Resume the suspended job _j_o_b_s_p_e_c in the background,
  3926.               as  if  it  had been started with &&.  If _j_o_b_s_p_e_c is
  3927.               not present, the shell's notion of the _c_u_r_r_e_n_t  _j_o_b
  3928.               is  used.  bbgg _j_o_b_s_p_e_c returns 0 unless run when job
  3929.               control is disabled or, when run with  job  control
  3930.               enabled,  if _j_o_b_s_p_e_c was not found or started with-
  3931.               out job control.
  3932.  
  3933.        bbiinndd [--mm _k_e_y_m_a_p] [--llppssvvPPSSVV]
  3934.        bbiinndd [--mm _k_e_y_m_a_p] [--qq _f_u_n_c_t_i_o_n] [--uu _f_u_n_c_t_i_o_n] [--rr _k_e_y_s_e_q]
  3935.        bbiinndd [--mm _k_e_y_m_a_p] --ff _f_i_l_e_n_a_m_e
  3936.        bbiinndd [--mm _k_e_y_m_a_p] _k_e_y_s_e_q:_f_u_n_c_t_i_o_n_-_n_a_m_e
  3937.               Display current rreeaaddlliinnee key and function bindings,
  3938.               or  bind  a  key sequence to a rreeaaddlliinnee function or
  3939.               macro.  The binding syntax accepted is identical to
  3940.               that  of  _._i_n_p_u_t_r_c, but each binding must be passed
  3941.               as  a   separate   argument;   e.g.,   '"\C-x\C-r":
  3942.               re-read-init-file'.  Options, if supplied, have the
  3943.               following meanings:
  3944.               --mm _k_e_y_m_a_p
  3945.                      Use _k_e_y_m_a_p as the keymap to be  affected  by
  3946.                      the  subsequent bindings.  Acceptable _k_e_y_m_a_p
  3947.                      names are _e_m_a_c_s_, _e_m_a_c_s_-_s_t_a_n_d_a_r_d_, _e_m_a_c_s_-_m_e_t_a_,
  3948.                      _e_m_a_c_s_-_c_t_l_x_,  _v_i_,  _v_i_-_c_o_m_m_a_n_d, and _v_i_-_i_n_s_e_r_t.
  3949.                      _v_i is equivalent  to  _v_i_-_c_o_m_m_a_n_d;  _e_m_a_c_s  is
  3950.                      equivalent to _e_m_a_c_s_-_s_t_a_n_d_a_r_d.
  3951.               --ll     List the names of all rreeaaddlliinnee functions.
  3952.               --pp     Display rreeaaddlliinnee function names and bindings
  3953.                      in such a way that they can be re-read.
  3954.               --PP     List current  rreeaaddlliinnee  function  names  and
  3955.  
  3956.  
  3957.  
  3958. GNU                         1998 Apr 1                         60
  3959.  
  3960.  
  3961.  
  3962.  
  3963.  
  3964. BASH(1)                                                   BASH(1)
  3965.  
  3966.  
  3967.                      bindings.
  3968.               --vv     Display  rreeaaddlliinnee  variable names and values
  3969.                      in such a way that they can be re-read.
  3970.               --VV     List current  rreeaaddlliinnee  variable  names  and
  3971.                      values.
  3972.               --ss     Display  rreeaaddlliinnee  key  sequences  bound  to
  3973.                      macros and the strings they output in such a
  3974.                      way that they can be re-read.
  3975.               --SS     Display  rreeaaddlliinnee  key  sequences  bound  to
  3976.                      macros and the strings they output.
  3977.               --ff _f_i_l_e_n_a_m_e
  3978.                      Read key bindings from _f_i_l_e_n_a_m_e.
  3979.               --qq _f_u_n_c_t_i_o_n
  3980.                      Query about  which  keys  invoke  the  named
  3981.                      _f_u_n_c_t_i_o_n.
  3982.               --uu _f_u_n_c_t_i_o_n
  3983.                      Unbind all keys bound to the named _f_u_n_c_t_i_o_n.
  3984.               --rr _k_e_y_s_e_q
  3985.                      Remove any current binding for _k_e_y_s_e_q.
  3986.  
  3987.               The return value is 0 unless an unrecognized option
  3988.               is given or an error occurred.
  3989.  
  3990.        bbrreeaakk [_n]
  3991.               Exit  from  within  a  ffoorr, wwhhiillee, uunnttiill, or sseelleecctt
  3992.               loop.  If _n is specified, break _n levels.   _n  must
  3993.               be  >=  1.   If  _n  is  greater  than the number of
  3994.               enclosing loops, all enclosing  loops  are  exited.
  3995.               The  return value is 0 unless the shell is not exe-
  3996.               cuting a loop when bbrreeaakk is executed.
  3997.  
  3998.        bbuuiillttiinn _s_h_e_l_l_-_b_u_i_l_t_i_n [_a_r_g_u_m_e_n_t_s]
  3999.               Execute the specified  shell  builtin,  passing  it
  4000.               _a_r_g_u_m_e_n_t_s,  and  return  its  exit status.  This is
  4001.               useful when defining a function whose name  is  the
  4002.               same  as a shell builtin, retaining the functional-
  4003.               ity of the builtin within  the  function.   The  ccdd
  4004.               builtin is commonly redefined this way.  The return
  4005.               status is false if _s_h_e_l_l_-_b_u_i_l_t_i_n  is  not  a  shell
  4006.               builtin command.
  4007.  
  4008.        ccdd [--LLPP] [_d_i_r]
  4009.               Change  the current directory to _d_i_r.  The variable
  4010.               HHOOMMEE is  the  default  _d_i_r.   The  variable  CCDDPPAATTHH
  4011.               defines  the search path for the directory contain-
  4012.               ing _d_i_r.  Alternative directory names in CCDDPPAATTHH are
  4013.               separated by a colon (:).  A null directory name in
  4014.               CCDDPPAATTHH is the same as the current directory,  i.e.,
  4015.               ``..''.  If _d_i_r begins with a slash (/), then CCDDPPAATTHH
  4016.               is not used. The --PP option says to use the physical
  4017.               directory  structure  instead of following symbolic
  4018.               links (see also the --PP option to  the  sseett  builtin
  4019.               command); the --LL option forces symbolic links to be
  4020.               followed.   An  argument  of  --  is  equivalent  to
  4021.  
  4022.  
  4023.  
  4024. GNU                         1998 Apr 1                         61
  4025.  
  4026.  
  4027.  
  4028.  
  4029.  
  4030. BASH(1)                                                   BASH(1)
  4031.  
  4032.  
  4033.               $$OOLLDDPPWWDD.  The return value is true if the directory
  4034.               was successfully changed; false otherwise.
  4035.  
  4036.        ccoommmmaanndd [--ppVVvv] _c_o_m_m_a_n_d [_a_r_g ...]
  4037.               Run _c_o_m_m_a_n_d with _a_r_g_s suppressing the normal  shell
  4038.               function  lookup. Only builtin commands or commands
  4039.               found in the PPAATTHH are executed.  If the  --pp  option
  4040.               is given, the search for _c_o_m_m_a_n_d is performed using
  4041.               a default value for PPAATTHH that is guaranteed to find
  4042.               all of the standard utilities.  If either the --VV or
  4043.               --vv option is supplied, a description of _c_o_m_m_a_n_d  is
  4044.               printed.   The --vv option causes a single word indi-
  4045.               cating the command or file name used to invoke _c_o_m_-
  4046.               _m_a_n_d to be displayed; the --VV option produces a more
  4047.               verbose description.  If the --VV  or  --vv  option  is
  4048.               supplied,  the  exit  status  is  0  if _c_o_m_m_a_n_d was
  4049.               found, and 1 if not.  If neither option is supplied
  4050.               and  an  error occurred or _c_o_m_m_a_n_d cannot be found,
  4051.               the exit status is 127.  Otherwise, the exit status
  4052.               of  the  ccoommmmaanndd builtin is the exit status of _c_o_m_-
  4053.               _m_a_n_d.
  4054.  
  4055.        ccoonnttiinnuuee [_n]
  4056.               Resume the next iteration  of  the  enclosing  ffoorr,
  4057.               wwhhiillee,  uunnttiill,  or sseelleecctt loop.  If _n is specified,
  4058.               resume at the _nth enclosing loop.  _n must be >=  1.
  4059.               If _n is greater than the number of enclosing loops,
  4060.               the last enclosing loop (the ``top-level'' loop) is
  4061.               resumed.  The return value is 0 unless the shell is
  4062.               not executing a loop when ccoonnttiinnuuee is executed.
  4063.  
  4064.        ddeeccllaarree [--aaffFFiirrxx] [--pp] [_n_a_m_e[=_v_a_l_u_e]]
  4065.        ttyyppeesseett [--aaffFFiirrxx] [--pp] [_n_a_m_e[=_v_a_l_u_e]]
  4066.               Declare variables and/or give them attributes.   If
  4067.               no _n_a_m_es are given then display the values of vari-
  4068.               ables.  The --pp option will display  the  attributes
  4069.               and  values  of  each _n_a_m_e.  When --pp is used, addi-
  4070.               tional options are ignored.  The --FF option inhibits
  4071.               the display of function definitions; only the func-
  4072.               tion name  and  attributes  are  printed.   The  --FF
  4073.               option  implies  --ff.   The following options can be
  4074.               used to restrict output to variables with the spec-
  4075.               ified attribute or to give variables attributes:
  4076.               --aa     Each  _n_a_m_e  is an array variable (see AArrrraayyss
  4077.                      above).
  4078.               --ff     Use function names only.
  4079.               --ii     The  variable  is  treated  as  an  integer;
  4080.                      arithmetic evaluation (see AARRIITTHHMMEETTIICC EEVVAALLUU--
  4081.                      AATTIIOONN )) is performed when  the  variable  is
  4082.                      assigned a value.
  4083.               --rr     Make  _n_a_m_es  readonly.   These  names cannot
  4084.                      then  be  assigned  values   by   subsequent
  4085.                      assignment statements or unset.
  4086.               --xx     Mark _n_a_m_es for export to subsequent commands
  4087.  
  4088.  
  4089.  
  4090. GNU                         1998 Apr 1                         62
  4091.  
  4092.  
  4093.  
  4094.  
  4095.  
  4096. BASH(1)                                                   BASH(1)
  4097.  
  4098.  
  4099.                      via the environment.
  4100.  
  4101.               Using `+' instead of `-' turns  off  the  attribute
  4102.               instead, with the exception that ++aa may not be used
  4103.               to destroy an array variable.  When used in a func-
  4104.               tion, makes each _n_a_m_e local, as with the llooccaall com-
  4105.               mand.  The return value  is  0  unless  an  invalid
  4106.               option is encountered, an attempt is made to define
  4107.               a function using "-f foo=bar", an attempt  is  made
  4108.               to  assign  a  value  to  a  readonly  variable, an
  4109.               attempt is made to assign a value to an array vari-
  4110.               able  without  using the compound assignment syntax
  4111.               (see AArrrraayyss above), one of the _n_a_m_e_s is not a valid
  4112.               shell variable name, an attempt is made to turn off
  4113.               readonly status for a readonly variable, an attempt
  4114.               is made to turn off array status for an array vari-
  4115.               able, or an attempt is made to display a  non-exis-
  4116.               tent function with -f.
  4117.  
  4118.        ddiirrss [[--ccllppvv]] [[++_n]] [[--_n]]
  4119.               Without  options,  displays  the  list of currently
  4120.               remembered directories.  The default display is  on
  4121.               a  single  line  with  directory names separated by
  4122.               spaces.  Directories are added to the list with the
  4123.               ppuusshhdd  command;  the  ppooppdd  command removes entries
  4124.               from the list.
  4125.               ++_n     Displays the _nth  entry  counting  from  the
  4126.                      left  of the list shown by ddiirrss when invoked
  4127.                      without options, starting with zero.
  4128.               --_n     Displays the _nth  entry  counting  from  the
  4129.                      right of the list shown by ddiirrss when invoked
  4130.                      without options, starting with zero.
  4131.               --cc     Clears the directory stack by  deleting  all
  4132.                      of the entries.
  4133.               --ll     Produces a longer listing; the default list-
  4134.                      ing format uses a tilde to denote  the  home
  4135.                      directory.
  4136.               --pp     Print the directory stack with one entry per
  4137.                      line.
  4138.               --vv     Print the directory stack with one entry per
  4139.                      line, prefixing each entry with its index in
  4140.                      the stack.
  4141.  
  4142.               The return value is 0 unless an invalid  option  is
  4143.               supplied  or _n indexes beyond the end of the direc-
  4144.               tory stack.
  4145.  
  4146.        ddiissoowwnn [--aarr] [--hh] [_j_o_b_s_p_e_c ...]
  4147.               Without options, each _j_o_b_s_p_e_c is removed  from  the
  4148.               table  of  active jobs.  If the --hh option is given,
  4149.               each _j_o_b_s_p_e_c is not removed from the table, but  is
  4150.               marked so that SSIIGGHHUUPP is not sent to the job if the
  4151.               shell receives a SSIIGGHHUUPP.  If no _j_o_b_s_p_e_c is present,
  4152.               and  neither  the --aa nor the --rr option is supplied,
  4153.  
  4154.  
  4155.  
  4156. GNU                         1998 Apr 1                         63
  4157.  
  4158.  
  4159.  
  4160.  
  4161.  
  4162. BASH(1)                                                   BASH(1)
  4163.  
  4164.  
  4165.               the _c_u_r_r_e_n_t _j_o_b is used.  If  no  _j_o_b_s_p_e_c  is  sup-
  4166.               plied,  the  --aa  option means to remove or mark all
  4167.               jobs; the --rr  option  without  a  _j_o_b_s_p_e_c  argument
  4168.               restricts  operation  to  running jobs.  The return
  4169.               value is 0 unless a  _j_o_b_s_p_e_c  does  not  specify  a
  4170.               valid job.
  4171.  
  4172.        eecchhoo [--nneeEE] [_a_r_g ...]
  4173.               Output the _a_r_gs, separated by spaces, followed by a
  4174.               newline.  The return status is always 0.  If --nn  is
  4175.               specified,  the trailing newline is suppressed.  If
  4176.               the --ee option is given, interpretation of the  fol-
  4177.               lowing  backslash-escaped  characters  is  enabled.
  4178.               The --EE option disables the interpretation of  these
  4179.               escape  characters,  even on systems where they are
  4180.               interpreted by default.  eecchhoo does not interpret ----
  4181.               to  mean  the  end of options.  eecchhoo interprets the
  4182.               following escape sequences:
  4183.               \\aa     alert (bell)
  4184.               \\bb     backspace
  4185.               \\cc     suppress trailing newline
  4186.               \\ee     an escape character
  4187.               \\ff     form feed
  4188.               \\nn     new line
  4189.               \\rr     carriage return
  4190.               \\tt     horizontal tab
  4191.               \\vv     vertical tab
  4192.               \\\\     backslash
  4193.               \\_n_n_n   the character whose ASCII code is the  octal
  4194.                      value _n_n_n (one to three digits)
  4195.               \\xx_n_n_n  the  character  whose ASCII code is the hex-
  4196.                      adecimal value _n_n_n (one to three digits)
  4197.  
  4198.        eennaabbllee [--aaddnnppss] [--ff _f_i_l_e_n_a_m_e] [_n_a_m_e ...]
  4199.               Enable and disable builtin  shell  commands.   Dis-
  4200.               abling  a  builtin  allows a disk command which has
  4201.               the same name as a shell  builtin  to  be  executed
  4202.               with  specifying  a  full pathname, even though the
  4203.               shell normally searches for  builtins  before  disk
  4204.               commands.   If  --nn  is used, each _n_a_m_e is disabled;
  4205.               otherwise, _n_a_m_e_s are enabled.  For example, to  use
  4206.               the  tteesstt  binary found via the PPAATTHH instead of the
  4207.               shell builtin version, run enable -n test..  TThhee  --ff
  4208.               option  means  to load the new builtin command _n_a_m_e
  4209.               from shared object _f_i_l_e_n_a_m_e, on systems  that  sup-
  4210.               port  dynamic loading.  The --dd option will delete a
  4211.               builtin previously loaded  with  --ff.   If  no  _n_a_m_e
  4212.               arguments  are  given,  or if the --pp option is sup-
  4213.               plied, a list of shell builtins is  printed.   With
  4214.               no other option arguments, the list consists of all
  4215.               enabled shell builtins.  If --nn  is  supplied,  only
  4216.               disabled  builtins are printed.  If --aa is supplied,
  4217.               the list printed includes  all  builtins,  with  an
  4218.               indication  of  whether or not each is enabled.  If
  4219.  
  4220.  
  4221.  
  4222. GNU                         1998 Apr 1                         64
  4223.  
  4224.  
  4225.  
  4226.  
  4227.  
  4228. BASH(1)                                                   BASH(1)
  4229.  
  4230.  
  4231.               --ss is supplied, the output  is  restricted  to  the
  4232.               POSIX  _s_p_e_c_i_a_l  builtins.   The  return  value is 0
  4233.               unless a _n_a_m_e is not a shell builtin or there is  a
  4234.               problem loading a new builtin from a shared object.
  4235.  
  4236.        eevvaall [_a_r_g ...]
  4237.               The _a_r_gs are read and concatenated together into  a
  4238.               single command.  This command is then read and exe-
  4239.               cuted by the shell, and its exit status is returned
  4240.               as  the  value  of  eevvaall.  If there are no _a_r_g_s, or
  4241.               only null arguments, eevvaall returns 0.
  4242.  
  4243.        eexxeecc [--ccll] [--aa _n_a_m_e] [_c_o_m_m_a_n_d [_a_r_g_u_m_e_n_t_s]]
  4244.               If _c_o_m_m_a_n_d is specified, it replaces the shell.  No
  4245.               new  process  is created.  The _a_r_g_u_m_e_n_t_s become the
  4246.               arguments to _c_o_m_m_a_n_d.  If the  --ll  option  is  sup-
  4247.               plied,  the  shell  places a dash in the zeroth arg
  4248.               passed to _c_o_m_m_a_n_d.  This  is  what  _l_o_g_i_n(1)  does.
  4249.               The --cc option causes _c_o_m_m_a_n_d to be executed with an
  4250.               empty environment.  If --aa is  supplied,  the  shell
  4251.               passes  _n_a_m_e as the zeroth argument to the executed
  4252.               command.  If _c_o_m_m_a_n_d cannot be  executed  for  some
  4253.               reason,  a  non-interactive shell exits, unless the
  4254.               shell option eexxeeccffaaiill is enabled, in which case  it
  4255.               returns  failure.   An  interactive  shell  returns
  4256.               failure if the file cannot be executed.  If _c_o_m_m_a_n_d
  4257.               is  not  specified, any redirections take effect in
  4258.               the current shell, and the return status is 0.   If
  4259.               there  is a redirection error, the return status is
  4260.               1.
  4261.  
  4262.        eexxiitt [_n]
  4263.               Cause the shell to exit with a status of _n.   If  _n
  4264.               is  omitted,  the  exit  status is that of the last
  4265.               command executed.   A  trap  on  EEXXIITT  is  executed
  4266.               before the shell terminates.
  4267.  
  4268.        eexxppoorrtt [--ffnn] [_n_a_m_e[=_w_o_r_d]] ...
  4269.        eexxppoorrtt --pp
  4270.               The  supplied _n_a_m_e_s are marked for automatic export
  4271.               to the environment of  subsequently  executed  com-
  4272.               mands.   If the --ff option is given, the _n_a_m_e_s refer
  4273.               to functions.  If no _n_a_m_e_s are given, or if the  --pp
  4274.               option  is  supplied,  a list of all names that are
  4275.               exported in this shell is printed.  The  --nn  option
  4276.               causes  the  export property to be removed from the
  4277.               named variables.  eexxppoorrtt returns an exit status  of
  4278.               0  unless  an invalid option is encountered, one of
  4279.               the _n_a_m_e_s is not a valid shell variable name, or --ff
  4280.               is supplied with a _n_a_m_e that is not a function.
  4281.  
  4282.        ffcc [--ee _e_n_a_m_e] [--nnllrr] [_f_i_r_s_t] [_l_a_s_t]
  4283.        ffcc --ss [_p_a_t=_r_e_p] [_c_m_d]
  4284.               Fix  Command.   In  the  first  form,  a  range  of
  4285.  
  4286.  
  4287.  
  4288. GNU                         1998 Apr 1                         65
  4289.  
  4290.  
  4291.  
  4292.  
  4293.  
  4294. BASH(1)                                                   BASH(1)
  4295.  
  4296.  
  4297.               commands from _f_i_r_s_t to _l_a_s_t is  selected  from  the
  4298.               history list.  _F_i_r_s_t and _l_a_s_t may be specified as a
  4299.               string (to locate the last command  beginning  with
  4300.               that string) or as a number (an index into the his-
  4301.               tory list, where a negative number is  used  as  an
  4302.               offset  from  the current command number).  If _l_a_s_t
  4303.               is not specified it is set to the  current  command
  4304.               for  listing  (so that ffcc --ll --1100 prints the last 10
  4305.               commands) and to _f_i_r_s_t otherwise.  If _f_i_r_s_t is  not
  4306.               specified  it  is  set  to the previous command for
  4307.               editing and -16 for listing.
  4308.  
  4309.               The --nn option suppresses the command  numbers  when
  4310.               listing.   The  --rr option reverses the order of the
  4311.               commands.  If the --ll option is given, the  commands
  4312.               are listed on standard output.  Otherwise, the edi-
  4313.               tor given by _e_n_a_m_e is invoked on a file  containing
  4314.               those  commands.   If _e_n_a_m_e is not given, the value
  4315.               of the FFCCEEDDIITT variable is used, and  the  value  of
  4316.               EEDDIITTOORR  if  FFCCEEDDIITT is not set.  If neither variable
  4317.               is set, _v_i is used.  When editing is complete,  the
  4318.               edited commands are echoed and executed.
  4319.  
  4320.               In  the  second  form, _c_o_m_m_a_n_d is re-executed after
  4321.               each instance of _p_a_t is replaced by _r_e_p.  A  useful
  4322.               alias to use with this is ``r=fc -s'', so that typ-
  4323.               ing ``r cc'' runs the last command  beginning  with
  4324.               ``cc''  and  typing ``r'' re-executes the last com-
  4325.               mand.
  4326.  
  4327.               If the first form is used, the return  value  is  0
  4328.               unless an invalid option is encountered or _f_i_r_s_t or
  4329.               _l_a_s_t specify history lines out of range.  If the --ee
  4330.               option  is  supplied, the return value is the value
  4331.               of the last command executed or failure if an error
  4332.               occurs with the temporary file of commands.  If the
  4333.               second form is used, the return status is  that  of
  4334.               the  command re-executed, unless _c_m_d does not spec-
  4335.               ify a valid history line, in which case ffcc  returns
  4336.               failure.
  4337.  
  4338.        ffgg [_j_o_b_s_p_e_c]
  4339.               Resume  _j_o_b_s_p_e_c  in the foreground, and make it the
  4340.               current  job.   If  _j_o_b_s_p_e_c  is  not  present,  the
  4341.               shell's  notion  of  the  _c_u_r_r_e_n_t _j_o_b is used.  The
  4342.               return value is that of the command placed into the
  4343.               foreground,  or  failure if run when job control is
  4344.               disabled or, when run with job control enabled,  if
  4345.               _j_o_b_s_p_e_c  does  not  specify  a valid job or _j_o_b_s_p_e_c
  4346.               specifies a job that was started without  job  con-
  4347.               trol.
  4348.  
  4349.        ggeettooppttss _o_p_t_s_t_r_i_n_g _n_a_m_e [_a_r_g_s]
  4350.               ggeettooppttss  is  used  by  shell  procedures  to  parse
  4351.  
  4352.  
  4353.  
  4354. GNU                         1998 Apr 1                         66
  4355.  
  4356.  
  4357.  
  4358.  
  4359.  
  4360. BASH(1)                                                   BASH(1)
  4361.  
  4362.  
  4363.               positional  parameters.   _o_p_t_s_t_r_i_n_g  contains   the
  4364.               option  letters  to  be  recognized; if a letter is
  4365.               followed by a colon, the option is expected to have
  4366.               an  argument,  which should be separated from it by
  4367.               white space.  Each  time  it  is  invoked,  ggeettooppttss
  4368.               places  the next option in the shell variable _n_a_m_e,
  4369.               initializing _n_a_m_e if it does  not  exist,  and  the
  4370.               index of the next argument to be processed into the
  4371.               variable OOPPTTIINNDD.  OOPPTTIINNDD is initialized to  1  each
  4372.               time  the shell or a shell script is invoked.  When
  4373.               an option requires an argument, ggeettooppttss places that
  4374.               argument  into the variable OOPPTTAARRGG.  The shell does
  4375.               not reset OOPPTTIINNDD automatically; it must be manually
  4376.               reset  between multiple calls to ggeettooppttss within the
  4377.               same shell invocation if a new set of parameters is
  4378.               to be used.
  4379.  
  4380.               When  the  end  of  options is encountered, ggeettooppttss
  4381.               exits  with  a  return  value  greater  than  zero.
  4382.               OOPPTTIINNDD  is set to the index of the first non-option
  4383.               argument, and nnaammee is set to ?.
  4384.  
  4385.               ggeettooppttss normally parses the positional  parameters,
  4386.               but  if  more  arguments are given in _a_r_g_s, ggeettooppttss
  4387.               parses those instead.
  4388.  
  4389.               ggeettooppttss can report errors  in  two  ways.   If  the
  4390.               first  character  of  _o_p_t_s_t_r_i_n_g  is a colon, _s_i_l_e_n_t
  4391.               error reporting is used.  In normal operation diag-
  4392.               nostic messages are printed when invalid options or
  4393.               missing option arguments are encountered.   If  the
  4394.               variable OOPPTTEERRRR is set to 0, no error messages will
  4395.               be displayed, even if the first character  of  _o_p_t_-
  4396.               _s_t_r_i_n_g is not a colon.
  4397.  
  4398.               If an invalid option is seen, ggeettooppttss places ? into
  4399.               _n_a_m_e and, if not silent, prints  an  error  message
  4400.               and  unsets  OOPPTTAARRGG.   If  ggeettooppttss  is  silent, the
  4401.               option character found is placed in OOPPTTAARRGG  and  no
  4402.               diagnostic message is printed.
  4403.  
  4404.               If a required argument is not found, and ggeettooppttss is
  4405.               not silent, a question mark (??) is placed in  _n_a_m_e,
  4406.               OOPPTTAARRGG  is  unset,  and  a  diagnostic  message  is
  4407.               printed.  If ggeettooppttss is silent, then a colon (::) is
  4408.               placed  in  _n_a_m_e  and  OOPPTTAARRGG  is set to the option
  4409.               character found.
  4410.  
  4411.               ggeettooppttss returns true if  an  option,  specified  or
  4412.               unspecified, is found.  It returns false if the end
  4413.               of options is encountered or an error occurs.
  4414.  
  4415.        hhaasshh [--rr] [--pp _f_i_l_e_n_a_m_e] [_n_a_m_e]
  4416.               For each _n_a_m_e, the full file name of the command is
  4417.  
  4418.  
  4419.  
  4420. GNU                         1998 Apr 1                         67
  4421.  
  4422.  
  4423.  
  4424.  
  4425.  
  4426. BASH(1)                                                   BASH(1)
  4427.  
  4428.  
  4429.               determined  by  searching  the directories in $$PPAATTHH
  4430.               and remembered.  If the --pp option is  supplied,  no
  4431.               path  search  is performed, and _f_i_l_e_n_a_m_e is used as
  4432.               the full file name of the command.  The  --rr  option
  4433.               causes  the  shell  to  forget all remembered loca-
  4434.               tions.  If  no  arguments  are  given,  information
  4435.               about  remembered  commands is printed.  The return
  4436.               status is true unless a _n_a_m_e is  not  found  or  an
  4437.               invalid option is supplied.
  4438.  
  4439.        hheellpp [_p_a_t_t_e_r_n]
  4440.               Display helpful information about builtin commands.
  4441.               If _p_a_t_t_e_r_n is specified, hheellpp gives  detailed  help
  4442.               on  all  commands  matching _p_a_t_t_e_r_n; otherwise help
  4443.               for all the builtins and shell  control  structures
  4444.               is  printed.  The return status is 0 unless no com-
  4445.               mand matches _p_a_t_t_e_r_n.
  4446.  
  4447.        hhiissttoorryy [--cc] [_n]
  4448.        hhiissttoorryy --aannrrww [_f_i_l_e_n_a_m_e]
  4449.        hhiissttoorryy --pp _a_r_g [_a_r_g _._._.]
  4450.        hhiissttoorryy --ss _a_r_g [_a_r_g _._._.]
  4451.               With no options, display the command  history  list
  4452.               with line numbers.  Lines listed with a ** have been
  4453.               modified.  An argument of _n lists only the  last  _n
  4454.               lines.   If _f_i_l_e_n_a_m_e is supplied, it is used as the
  4455.               name of the history file;  if  not,  the  value  of
  4456.               HHIISSTTFFIILLEE  is  used.  Options, if supplied, have the
  4457.               following meanings:
  4458.               --aa     Append the ``new''  history  lines  (history
  4459.                      lines  entered  since  the  beginning of the
  4460.                      current bbaasshh session) to the history file.
  4461.               --nn     Read the history lines not already read from
  4462.                      the  history  file  into the current history
  4463.                      list.  These are lines appended to the  his-
  4464.                      tory file since the beginning of the current
  4465.                      bbaasshh session.
  4466.               --rr     Read the contents of the  history  file  and
  4467.                      use them as the current history.
  4468.               --ww     Write  the  current  history  to the history
  4469.                      file, overwriting the  history  file's  con-
  4470.                      tents.
  4471.               --cc     Clear  the  history list by deleting all the
  4472.                      entries.
  4473.               --pp     Perform history substitution on the  follow-
  4474.                      ing _a_r_g_s and display the result on the stan-
  4475.                      dard output.  Does not store the results  in
  4476.                      the  history  list.  Each _a_r_g must be quoted
  4477.                      to disable normal history expansion.
  4478.               --ss     Store the _a_r_g_s in the history list as a sin-
  4479.                      gle  entry.  The last command in the history
  4480.                      list is removed before the _a_r_g_s are added.
  4481.  
  4482.               The return value is 0 unless an invalid  option  is
  4483.  
  4484.  
  4485.  
  4486. GNU                         1998 Apr 1                         68
  4487.  
  4488.  
  4489.  
  4490.  
  4491.  
  4492. BASH(1)                                                   BASH(1)
  4493.  
  4494.  
  4495.               encountered  or  an  error  occurs while reading or
  4496.               writing the history file.
  4497.  
  4498.        jjoobbss [--llnnpprrss] [ _j_o_b_s_p_e_c ... ]
  4499.        jjoobbss --xx _c_o_m_m_a_n_d [ _a_r_g_s ... ]
  4500.               The first form lists the active jobs.  The  options
  4501.               have the following meanings:
  4502.               --ll     List  process  IDs in addition to the normal
  4503.                      information.
  4504.               --pp     List only the process ID of the  job's  pro-
  4505.                      cess group leader.
  4506.               --nn     Display  information  only  about  jobs that
  4507.                      have changed status since the user was  last
  4508.                      notified of their status.
  4509.               --rr     Restrict output to running jobs.
  4510.               --ss     Restrict output to stopped jobs.
  4511.  
  4512.               If _j_o_b_s_p_e_c is given, output is restricted to infor-
  4513.               mation about that job.   The  return  status  is  0
  4514.               unless  an  invalid  option  is  encountered  or an
  4515.               invalid _j_o_b_s_p_e_c is supplied.
  4516.  
  4517.               If the --xx option is  supplied,  jjoobbss  replaces  any
  4518.               _j_o_b_s_p_e_c  found  in  _c_o_m_m_a_n_d or _a_r_g_s with the corre-
  4519.               sponding process group  ID,  and  executes  _c_o_m_m_a_n_d
  4520.               passing it _a_r_g_s, returning its exit status.
  4521.  
  4522.        kkiillll [--ss _s_i_g_s_p_e_c | --nn _s_i_g_n_u_m | --_s_i_g_s_p_e_c] [_p_i_d | _j_o_b_s_p_e_c]
  4523.               ...
  4524.        kkiillll --ll [_s_i_g_s_p_e_c | _e_x_i_t___s_t_a_t_u_s]
  4525.               Send the signal named by _s_i_g_s_p_e_c or _s_i_g_n_u_m  to  the
  4526.               processes  named  by  _p_i_d  or  _j_o_b_s_p_e_c.  _s_i_g_s_p_e_c is
  4527.               either a signal name such as SSIIGGKKIILLLL  or  a  signal
  4528.               number; _s_i_g_n_u_m is a signal number.  If _s_i_g_s_p_e_c is a
  4529.               signal name, the name may be given with or  without
  4530.               the  SSIIGG  prefix.   If _s_i_g_s_p_e_c is not present, then
  4531.               SSIIGGTTEERRMM is assumed.  An argument of  --ll  lists  the
  4532.               signal  names.   If any arguments are supplied when
  4533.               --ll is given, the names of the signals corresponding
  4534.               to  the arguments are listed, and the return status
  4535.               is 0.  The _e_x_i_t___s_t_a_t_u_s argument to --ll is  a  number
  4536.               specifying  either a signal number or the exit sta-
  4537.               tus of a process  terminated  by  a  signal.   kkiillll
  4538.               returns  true  if  at least one signal was success-
  4539.               fully sent, or false  if  an  error  occurs  or  an
  4540.               invalid option is encountered.
  4541.  
  4542.        lleett _a_r_g [_a_r_g ...]
  4543.               Each  _a_r_g  is an arithmetic expression to be evalu-
  4544.               ated (see AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN).  If the last  _a_r_g
  4545.               evaluates to 0, lleett returns 1; 0 is returned other-
  4546.               wise.
  4547.  
  4548.  
  4549.  
  4550.  
  4551.  
  4552. GNU                         1998 Apr 1                         69
  4553.  
  4554.  
  4555.  
  4556.  
  4557.  
  4558. BASH(1)                                                   BASH(1)
  4559.  
  4560.  
  4561.        llooccaall [_n_a_m_e[=_v_a_l_u_e] ...]
  4562.               For each argument, a local variable named  _n_a_m_e  is
  4563.               created,  and  assigned  _v_a_l_u_e.  When llooccaall is used
  4564.               within a function, it causes the variable  _n_a_m_e  to
  4565.               have  a  visible  scope restricted to that function
  4566.               and its children.  With no operands, llooccaall writes a
  4567.               list of local variables to the standard output.  It
  4568.               is an error to use llooccaall when not  within  a  func-
  4569.               tion.   The return status is 0 unless llooccaall is used
  4570.               outside a function, or an invalid _n_a_m_e is supplied.
  4571.  
  4572.        llooggoouutt Exit a login shell.
  4573.  
  4574.        ppooppdd [-nn] [+_n] [-_n]
  4575.               Removes  entries from the directory stack.  With no
  4576.               arguments,  removes  the  top  directory  from  the
  4577.               stack,  and performs a ccdd to the new top directory.
  4578.               Arguments, if supplied, have  the  following  mean-
  4579.               ings:
  4580.               ++_n     Removes the _nth entry counting from the left
  4581.                      of the list shown  by  ddiirrss,  starting  with
  4582.                      zero.   For example: ``popd +0'' removes the
  4583.                      first directory, ``popd +1'' the second.
  4584.               --_n     Removes the  _nth  entry  counting  from  the
  4585.                      right  of  the  list shown by ddiirrss, starting
  4586.                      with zero.  For example: ``popd -0'' removes
  4587.                      the  last directory, ``popd -1'' the next to
  4588.                      last.
  4589.               --nn     Suppresses the normal  change  of  directory
  4590.                      when removing directories from the stack, so
  4591.                      that only the stack is manipulated.
  4592.  
  4593.               If the ppooppdd command is successful, a ddiirrss  is  per-
  4594.               formed  as  well, and the return status is 0.  ppooppdd
  4595.               returns false if an invalid option is  encountered,
  4596.               the directory stack is empty, a non-existent direc-
  4597.               tory stack entry is  specified,  or  the  directory
  4598.               change fails.
  4599.  
  4600.        pprriinnttff _f_o_r_m_a_t [_a_r_g_u_m_e_n_t_s]
  4601.               Write  the formatted _a_r_g_u_m_e_n_t_s to the standard out-
  4602.               put under the control of the _f_o_r_m_a_t.  The _f_o_r_m_a_t is
  4603.               a  character  string  which contains three types of
  4604.               objects: plain characters, which are simply  copied
  4605.               to  standard  output,  character  escape sequences,
  4606.               which are converted and copied to the standard out-
  4607.               put,  and  format  specifications,  each  of  which
  4608.               causes printing of the  next  successive  _a_r_g_u_m_e_n_t.
  4609.               In  addition  to the standard _p_r_i_n_t_f(1) formats, %b
  4610.               causes pprriinnttff to expand backslash escape  sequences
  4611.               in the corresponding _a_r_g_u_m_e_n_t, and %q causes pprriinnttff
  4612.               to output the corresponding _a_r_g_u_m_e_n_t  in  a  format
  4613.               that can be reused as shell input.
  4614.  
  4615.  
  4616.  
  4617.  
  4618. GNU                         1998 Apr 1                         70
  4619.  
  4620.  
  4621.  
  4622.  
  4623.  
  4624. BASH(1)                                                   BASH(1)
  4625.  
  4626.  
  4627.               The _f_o_r_m_a_t is reused as necessary to consume all of
  4628.               the _a_r_g_u_m_e_n_t_s.  If the _f_o_r_m_a_t requires  more  _a_r_g_u_-
  4629.               _m_e_n_t_s  than are supplied, the extra format specifi-
  4630.               cations behave as if a zero value or  null  string,
  4631.               as appropriate, had been supplied.
  4632.  
  4633.        ppuusshhdd [--nn] [_d_i_r]
  4634.        ppuusshhdd [--nn] [+_n] [-_n]
  4635.               Adds a directory to the top of the directory stack,
  4636.               or rotates the stack, making the  new  top  of  the
  4637.               stack the current working directory.  With no argu-
  4638.               ments,  exchanges  the  top  two  directories   and
  4639.               returns  0,  unless  the  directory stack is empty.
  4640.               Arguments, if supplied, have  the  following  mean-
  4641.               ings:
  4642.               ++_n     Rotates  the stack so that the _nth directory
  4643.                      (counting from the left of the list shown by
  4644.                      ddiirrss, starting with zero) is at the top.
  4645.               --_n     Rotates  the stack so that the _nth directory
  4646.                      (counting from the right of the  list  shown
  4647.                      by  ddiirrss, starting with zero) is at the top.
  4648.               --nn     Suppresses the normal  change  of  directory
  4649.                      when  adding  directories  to  the stack, so
  4650.                      that only the stack is manipulated.
  4651.               ddiirr    Adds _d_i_r to the directory stack at the  top,
  4652.                      making it the new current working directory.
  4653.  
  4654.               If the ppuusshhdd command is successful, a ddiirrss is  per-
  4655.               formed  as  well.  If the first form is used, ppuusshhdd
  4656.               returns 0 unless the cd to  _d_i_r  fails.   With  the
  4657.               second  form,  ppuusshhdd returns 0 unless the directory
  4658.               stack is empty, a non-existent directory stack ele-
  4659.               ment  is  specified, or the directory change to the
  4660.               specified new current directory fails.
  4661.  
  4662.        ppwwdd [--LLPP]
  4663.               Print the absolute file name of the current working
  4664.               directory.   The file name printed contains no sym-
  4665.               bolic links if the --PP option is supplied or the  --oo
  4666.               pphhyyssiiccaall  option  to  the  sseett  builtin  command is
  4667.               enabled.  If the --LL option is used, symbolic  links
  4668.               are  followed.   The  return  status is 0 unless an
  4669.               error occurs while reading the name of the  current
  4670.               directory or an invalid option is supplied.
  4671.  
  4672.        rreeaadd [--eerr] [--aa _a_n_a_m_e] [--pp _p_r_o_m_p_t] [_n_a_m_e ...]
  4673.               One  line  is read from the standard input, and the
  4674.               first word is assigned to the first _n_a_m_e, the  sec-
  4675.               ond  word to the second _n_a_m_e, and so on, with left-
  4676.               over  words  and   their   intervening   separators
  4677.               assigned  to  the  last  _n_a_m_e.   If there are fewer
  4678.               words read from the standard input than names,  the
  4679.               remaining  names  are  assigned  empty values.  The
  4680.               characters in IIFFSS are used to split the  line  into
  4681.  
  4682.  
  4683.  
  4684. GNU                         1998 Apr 1                         71
  4685.  
  4686.  
  4687.  
  4688.  
  4689.  
  4690. BASH(1)                                                   BASH(1)
  4691.  
  4692.  
  4693.               words.   Options,  if  supplied, have the following
  4694.               meanings:
  4695.               --rr     A backslash-newline pair is not ignored, and
  4696.                      the  backslash  is  considered to be part of
  4697.                      the line.
  4698.               --pp     Display _p_r_o_m_p_t, without a trailing  newline,
  4699.                      before  attempting  to  read any input.  The
  4700.                      prompt is displayed only if input is  coming
  4701.                      from a terminal.
  4702.               --aa     The words are assigned to sequential indices
  4703.                      of the array variable _a_n_a_m_e, starting at  0.
  4704.                      _a_n_a_m_e  is  unset  before  any new values are
  4705.                      assigned.  Other _n_a_m_e arguments are ignored.
  4706.               --ee     If  the standard input is coming from a ter-
  4707.                      minal, rreeaaddlliinnee (see RREEAADDLLIINNEE above) is used
  4708.                      to obtain the line.
  4709.  
  4710.               If no _n_a_m_e_s are supplied, the line read is assigned
  4711.               to the variable RREEPPLLYY.  The return  code  is  zero,
  4712.               unless end-of-file is encountered.
  4713.  
  4714.        rreeaaddoonnllyy [--aappff] [_n_a_m_e ...]
  4715.               The  given _n_a_m_e_s are marked readonly; the values of
  4716.               these  _n_a_m_e_s  may  not  be  changed  by  subsequent
  4717.               assignment.   If  the  --ff  option  is supplied, the
  4718.               functions corresponding to the _n_a_m_e_s are so marked.
  4719.               The  --aa  option  restricts the variables to arrays.
  4720.               If no _n_a_m_e arguments are given, or if the --pp option
  4721.               is  supplied,  a  list  of  all  readonly  names is
  4722.               printed.  The --pp option causes output  to  be  dis-
  4723.               played in a format thatmay be reused as input.  The
  4724.               return status is 0  unless  an  invalid  option  is
  4725.               encountered,  one of the _n_a_m_e_s is not a valid shell
  4726.               variable name, or --ff is supplied with a  _n_a_m_e  that
  4727.               is not a function.
  4728.  
  4729.        rreettuurrnn [_n]
  4730.               Causes  a  function  to  exit with the return value
  4731.               specified by _n.  If _n is omitted, the return status
  4732.               is  that  of the last command executed in the func-
  4733.               tion body.  If used outside a function, but  during
  4734.               execution  of  a script by the ..  (ssoouurrccee) command,
  4735.               it causes the shell to stop executing  that  script
  4736.               and  return either _n or the exit status of the last
  4737.               command executed within the script as the exit sta-
  4738.               tus  of the script.  If used outside a function and
  4739.               not during execution of a script by ..,  the  return
  4740.               status is false.
  4741.  
  4742.        sseett [----aabbeeffhhkkmmnnppttuuvvxxBBCCHHPP] [--oo _o_p_t_i_o_n] [_a_r_g ...]
  4743.               Without  options,  the name and value of each shell
  4744.               variable are displayed in  a  format  that  can  be
  4745.               reused as input.  The output is sorted according to
  4746.               the current locale.  When  options  are  specified,
  4747.  
  4748.  
  4749.  
  4750. GNU                         1998 Apr 1                         72
  4751.  
  4752.  
  4753.  
  4754.  
  4755.  
  4756. BASH(1)                                                   BASH(1)
  4757.  
  4758.  
  4759.               they  set or unset shell attributes.  Any arguments
  4760.               remaining  after  the  options  are  processed  are
  4761.               treated as values for the positional parameters and
  4762.               are  assigned,  in  order,  to  $$11,  $$22,  ......   $$_n.
  4763.               Options, if specified, have the following meanings:
  4764.               --aa      Automatically mark variables which are mod-
  4765.                       ified or created for export to the environ-
  4766.                       ment of subsequent commands.
  4767.               --bb      Report the status of terminated  background
  4768.                       jobs  immediately,  rather  than before the
  4769.                       next primary  prompt.   This  is  effective
  4770.                       only when job control is enabled.
  4771.               --ee      Exit  immediately  if a _s_i_m_p_l_e _c_o_m_m_a_n_d (see
  4772.                       SSHHEELLLL GGRRAAMMMMAARR above) exits with a  non-zero
  4773.                       status.   The  shell  does  not exit if the
  4774.                       command that fails is part of an  _u_n_t_i_l  or
  4775.                       _w_h_i_l_e  loop,  part of an _i_f statement, part
  4776.                       of a &&&& or |||| list,  or  if  the  command's
  4777.                       return value is being inverted via !!.
  4778.               --ff      Disable pathname expansion.
  4779.               --hh      Remember  the  location of commands as they
  4780.                       are  looked  up  for  execution.   This  is
  4781.                       enabled by default.
  4782.               --kk      All  arguments  in  the  form of assignment
  4783.                       statements are placed  in  the  environment
  4784.                       for  a command, not just those that precede
  4785.                       the command name.
  4786.               --mm      Monitor  mode.   Job  control  is  enabled.
  4787.                       This  option  is on by default for interac-
  4788.                       tive shells on systems that support it (see
  4789.                       JJOOBB  CCOONNTTRROOLL  above).  Background processes
  4790.                       run in a separate process group and a  line
  4791.                       containing  their  exit  status  is printed
  4792.                       upon their completion.
  4793.               --nn      Read commands  but  do  not  execute  them.
  4794.                       This  may  be  used to check a shell script
  4795.                       for syntax  errors.   This  is  ignored  by
  4796.                       interactive shells.
  4797.               --oo _o_p_t_i_o_n_-_n_a_m_e
  4798.                       The  _o_p_t_i_o_n_-_n_a_m_e  can be one of the follow-
  4799.                       ing:
  4800.                       aalllleexxppoorrtt
  4801.                               Same as --aa.
  4802.                       bbrraacceeeexxppaanndd
  4803.                               Same as --BB.
  4804.                       eemmaaccss   Use  an  emacs-style  command  line
  4805.                               editing interface.  This is enabled
  4806.                               by default when the shell is inter-
  4807.                               active, unless the shell is started
  4808.                               with the ----nnooeeddiittiinngg option.
  4809.                       eerrrreexxiitt Same as --ee.
  4810.                       hhaasshhaallll Same as --hh.
  4811.                       hhiisstteexxppaanndd
  4812.                               Same as --HH.
  4813.  
  4814.  
  4815.  
  4816. GNU                         1998 Apr 1                         73
  4817.  
  4818.  
  4819.  
  4820.  
  4821.  
  4822. BASH(1)                                                   BASH(1)
  4823.  
  4824.  
  4825.                       hhiissttoorryy Enable    command    history,    as
  4826.                               described   above   under  HHIISSTTOORRYY.
  4827.                               This option is  on  by  default  in
  4828.                               interactive shells.
  4829.                       iiggnnoorreeeeooff
  4830.                               The  effect is as if the shell com-
  4831.                               mand IGNOREEOF=10 hhaadd bbeeeenn eexxeeccuutteedd
  4832.                               ((sseeee SShheellll VVaarriiaabblleess above).
  4833.                       kkeeyywwoorrdd Same as --kk.
  4834.                       mmoonniittoorr Same as --mm.
  4835.                       nnoocclloobbbbeerr
  4836.                               Same as --CC.
  4837.                       nnooeexxeecc  Same as --nn.
  4838.                       nnoogglloobb  Same as --ff.
  4839.                       nnoottiiffyy  Same as --bb.
  4840.                       nnoouunnsseett Same as --uu.
  4841.                       oonneeccmmdd  Same as --tt.
  4842.                       pphhyyssiiccaall
  4843.                               Same as --PP.
  4844.                       ppoossiixx   Change  the  behavior of bbaasshh where
  4845.                               the default operation differs  from
  4846.                               the  POSIX 1003.2 standard to match
  4847.                               the standard.
  4848.                       pprriivviilleeggeedd
  4849.                               Same as --pp.
  4850.                       vveerrbboossee Same as --vv.
  4851.                       vvii      Use a vi-style command line editing
  4852.                               interface.
  4853.                       xxttrraaccee  Same as --xx.
  4854.                       If  --oo is supplied with no _o_p_t_i_o_n_-_n_a_m_e, the
  4855.                       values of the current options are  printed.
  4856.                       If  ++oo  is  supplied with no _o_p_t_i_o_n_-_n_a_m_e, a
  4857.                       series of sseett commands to recreate the cur-
  4858.                       rent  option  settings  is displayed on the
  4859.                       standard output.
  4860.               --pp      Turn on _p_r_i_v_i_l_e_g_e_d mode.  In this mode, the
  4861.                       $$EENNVV file is not processed, shell functions
  4862.                       are not inherited from the environment, and
  4863.                       the  variable The SSHHEELLLLOOPPTTSS variable, if it
  4864.                       appears in  the  environment,  is  ignored.
  4865.                       This is enabled automatically on startup if
  4866.                       the effective user (group) id is not  equal
  4867.                       to  the real user (group) id.  Turning this
  4868.                       option off causes the  effective  user  and
  4869.                       group  ids  to  be set to the real user and
  4870.                       group ids.
  4871.               --tt      Exit after reading and executing  one  com-
  4872.                       mand.
  4873.               --uu      Treat unset variables as an error when per-
  4874.                       forming parameter expansion.  If  expansion
  4875.                       is  attempted  on  an  unset  variable, the
  4876.                       shell prints an error message, and, if  not
  4877.                       interactive,  exits with a non-zero status.
  4878.               --vv      Print shell input lines as they are read.
  4879.  
  4880.  
  4881.  
  4882. GNU                         1998 Apr 1                         74
  4883.  
  4884.  
  4885.  
  4886.  
  4887.  
  4888. BASH(1)                                                   BASH(1)
  4889.  
  4890.  
  4891.               --xx      After expanding each _s_i_m_p_l_e  _c_o_m_m_a_n_d,  dis-
  4892.                       play the expanded value of PPSS44, followed by
  4893.                       the command and its expanded arguments.
  4894.               --BB      The shell  performs  brace  expansion  (see
  4895.                       BBrraaccee  EExxppaannssiioonn  above).   This  is  on by
  4896.                       default.
  4897.               --CC      If set, bbaasshh does not overwrite an existing
  4898.                       file  with  the  >>,  >>&&, and <<>> redirection
  4899.                       operators.  This  may  be  overridden  when
  4900.                       creating output files by using the redirec-
  4901.                       tion operator >>|| instead of >>.
  4902.               --HH      Enable !!  style history substitution.  This
  4903.                       option  is  on by default when the shell is
  4904.                       interactive.
  4905.               --PP      If set, the shell does not follow  symbolic
  4906.                       links  when  executing  commands such as ccdd
  4907.                       that change the current working  directory.
  4908.                       It  uses  the  physical directory structure
  4909.                       instead.  By default, bbaasshh follows the log-
  4910.                       ical  chain  of directories when performing
  4911.                       commands which change  the  current  direc-
  4912.                       tory.
  4913.               ----      If  no  arguments  follow this option, then
  4914.                       the positional parameters are unset.   Oth-
  4915.                       erwise,  the  positional parameters are set
  4916.                       to the _a_r_gs, even if  some  of  them  begin
  4917.                       with a --.
  4918.               --       Signal   the  end  of  options,  cause  all
  4919.                       remaining _a_r_gs to be assigned to the  posi-
  4920.                       tional  parameters.   The --xx and --vv options
  4921.                       are turned off.  If there are no _a_r_gs,  the
  4922.                       positional parameters remain unchanged.
  4923.  
  4924.               The  options  are  off  by default unless otherwise
  4925.               noted.  Using + rather than - causes these  options
  4926.               to  be  turned off.  The options can also be speci-
  4927.               fied as arguments to an invocation  of  the  shell.
  4928.               The current set of options may be found in $$--.  The
  4929.               return status is  always  true  unless  an  invalid
  4930.               option is encountered.
  4931.  
  4932.        sshhiifftt [_n]
  4933.               The  positional parameters from _n+1 ... are renamed
  4934.               to $$11 ........  Parameters represented by  the  numbers
  4935.               $$## down to $$##-_n+1 are unset.  _n must be a non-nega-
  4936.               tive number less than or equal to $$##.  If _n  is  0,
  4937.               no  parameters  are changed.  If _n is not given, it
  4938.               is assumed to be 1.  If _n is greater than  $$##,  the
  4939.               positional  parameters are not changed.  The return
  4940.               status is greater than zero if _n is greater than $$##
  4941.               or less than zero; otherwise 0.
  4942.  
  4943.        sshhoopptt [--ppqqssuu] [--oo] [_o_p_t_n_a_m_e ...]
  4944.               Toggle the values of variables controlling optional
  4945.  
  4946.  
  4947.  
  4948. GNU                         1998 Apr 1                         75
  4949.  
  4950.  
  4951.  
  4952.  
  4953.  
  4954. BASH(1)                                                   BASH(1)
  4955.  
  4956.  
  4957.               shell behavior.  With no options, or  with  the  --pp
  4958.               option,  a  list  of  all  settable options is dis-
  4959.               played, with an indication of whether or  not  each
  4960.               is  set.   The  --pp  option causes output to be dis-
  4961.               played in a form  that  may  be  reused  as  input.
  4962.               Other options have the following meanings:
  4963.               --ss     Enable (set) each _o_p_t_n_a_m_e.
  4964.               --uu     Disable (unset) each _o_p_t_n_a_m_e.
  4965.               --qq     Suppresses  normal  output (quiet mode); the
  4966.                      return status indicates whether the  _o_p_t_n_a_m_e
  4967.                      is  set or unset.  If multiple _o_p_t_n_a_m_e argu-
  4968.                      ments are given with --qq, the  return  status
  4969.                      is  zero  if  all _o_p_t_n_a_m_e_s are enabled; non-
  4970.                      zero otherwise.
  4971.               --oo     Restricts the values of _o_p_t_n_a_m_e to be  those
  4972.                      defined   for  the  --oo  option  to  the  sseett
  4973.                      builtin.
  4974.  
  4975.               If either --ss or --uu is used with  no  _o_p_t_n_a_m_e  argu-
  4976.               ments,  the  display  is  limited  to those options
  4977.               which are set or unset, respectively.  Unless  oth-
  4978.               erwise   noted,  the  sshhoopptt  options  are  disabled
  4979.               (unset) by default.
  4980.  
  4981.               The return status when listing options is  zero  if
  4982.               all _o_p_t_n_a_m_e_s are enabled, non-zero otherwise.  When
  4983.               setting or unsetting options, the return status  is
  4984.               zero unless an _o_p_t_n_a_m_e is not a valid shell option.
  4985.  
  4986.               The list of sshhoopptt options is:
  4987.  
  4988.               ccddaabbllee__vvaarrss
  4989.                       If set, an argument to the ccdd builtin  com-
  4990.                       mand  that is not a directory is assumed to
  4991.                       be the name of a variable  whose  value  is
  4992.                       the directory to change to.
  4993.               ccddssppeellll If  set,  minor errors in the spelling of a
  4994.                       directory component in a ccdd command will be
  4995.                       corrected.   The  errors  checked  for  are
  4996.                       transposed characters, a missing character,
  4997.                       and  one  character too many.  If a correc-
  4998.                       tion is found, the corrected file  name  is
  4999.                       printed,  and  the  command proceeds.  This
  5000.                       option is only used by interactive  shells.
  5001.               cchheecckkhhaasshh
  5002.                       If set, bbaasshh checks that a command found in
  5003.                       the hash table exists before trying to exe-
  5004.                       cute  it.   If  a  hashed command no longer
  5005.                       exists, a normal path search is  performed.
  5006.               cchheecckkwwiinnssiizzee
  5007.                       If  set,  bbaasshh checks the window size after
  5008.                       each command and, if necessary, updates the
  5009.                       values of LLIINNEESS and CCOOLLUUMMNNSS.
  5010.               ccmmddhhiisstt If  set, bbaasshh attempts to save all lines of
  5011.  
  5012.  
  5013.  
  5014. GNU                         1998 Apr 1                         76
  5015.  
  5016.  
  5017.  
  5018.  
  5019.  
  5020. BASH(1)                                                   BASH(1)
  5021.  
  5022.  
  5023.                       a multiple-line command in the same history
  5024.                       entry.   This  allows  easy  re-editing  of
  5025.                       multi-line commands.
  5026.               ddoottgglloobb If set, bbaasshh includes  filenames  beginning
  5027.                       with  a  `.'  in  the  results  of pathname
  5028.                       expansion.
  5029.               eexxeeccffaaiill
  5030.                       If set, a non-interactive  shell  will  not
  5031.                       exit  if  it cannot execute the file speci-
  5032.                       fied as an argument  to  the  eexxeecc  builtin
  5033.                       command.   An  interactive  shell  does not
  5034.                       exit if eexxeecc fails.
  5035.               eexxppaanndd__aalliiaasseess
  5036.                       If set, aliases are expanded  as  described
  5037.                       above   under   AALLIIAASSEESS.   This  option  is
  5038.                       enabled by default for interactive  shells.
  5039.               eexxttgglloobb If  set, the extended pattern matching fea-
  5040.                       tures described above under PPaatthhnnaammee EExxppaann--
  5041.                       ssiioonn are enabled.
  5042.               hhiissttaappppeenndd
  5043.                       If set, the history list is appended to the
  5044.                       file named by the  value  of  the  HHIISSTTFFIILLEE
  5045.                       variable  when the shell exits, rather than
  5046.                       overwriting the file.
  5047.               hhiissttrreeeeddiitt
  5048.                       If set, and rreeaaddlliinnee is being used, a  user
  5049.                       is  given  the  opportunity  to  re-edit  a
  5050.                       failed history substitution.
  5051.               hhiissttvveerriiffyy
  5052.                       If set, and rreeaaddlliinnee  is  being  used,  the
  5053.                       results  of  history  substitution  are not
  5054.                       immediately passed  to  the  shell  parser.
  5055.                       Instead,  the resulting line is loaded into
  5056.                       the rreeaaddlliinnee editing buffer, allowing  fur-
  5057.                       ther modification.
  5058.               hhoossttccoommpplleettee
  5059.                       If  set,  and  rreeaaddlliinnee is being used, bbaasshh
  5060.                       will attempt to perform hostname completion
  5061.                       when  a  word  containing a @@ is being com-
  5062.                       pleted  (see  CCoommpplleettiinngg   under   RREEAADDLLIINNEE
  5063.                       above).  This is enabled by default.
  5064.               hhuuppoonneexxiitt
  5065.                       If  set,  bbaasshh will send SSIIGGHHUUPP to all jobs
  5066.                       when an interactive login shell exits.
  5067.               iinntteerraaccttiivvee__ccoommmmeennttss
  5068.                       If set, allow a word beginning  with  ##  to
  5069.                       cause  that  word and all remaining charac-
  5070.                       ters on that  line  to  be  ignored  in  an
  5071.                       interactive  shell  (see  CCOOMMMMEENNTTSS  above).
  5072.                       This option is enabled by default.
  5073.               lliitthhiisstt If set, and the ccmmddhhiisstt option is  enabled,
  5074.                       multi-line  commands  are saved to the his-
  5075.                       tory with  embedded  newlines  rather  than
  5076.                       using  semicolon separators where possible.
  5077.  
  5078.  
  5079.  
  5080. GNU                         1998 Apr 1                         77
  5081.  
  5082.  
  5083.  
  5084.  
  5085.  
  5086. BASH(1)                                                   BASH(1)
  5087.  
  5088.  
  5089.               mmaaiillwwaarrnn
  5090.                       If set, and a file that  bbaasshh  is  checking
  5091.                       for  mail  has been accessed since the last
  5092.                       time it was checked, the message ``The mail
  5093.                       in _m_a_i_l_f_i_l_e has been read'' is displayed.
  5094.               nnooccaasseegglloobb
  5095.                       If   set,   bbaasshh  matches  filenames  in  a
  5096.                       case-insensitive  fashion  when  performing
  5097.                       pathname  expansion (see PPaatthhnnaammee EExxppaannssiioonn
  5098.                       above).
  5099.               nnuullllgglloobb
  5100.                       If set, bbaasshh allows patterns which match no
  5101.                       files  (see  PPaatthhnnaammee  EExxppaannssiioonn  above) to
  5102.                       expand to a null string, rather than  them-
  5103.                       selves.
  5104.               pprroommppttvvaarrss
  5105.                       If set, prompt strings undergo variable and
  5106.                       parameter expansion after being expanded as
  5107.                       described  in PPRROOMMPPTTIINNGG above.  This option
  5108.                       is enabled by default.
  5109.               sshhiifftt__vveerrbboossee
  5110.                       If set, the sshhiifftt builtin prints  an  error
  5111.                       message  when  the  shift count exceeds the
  5112.                       number of positional parameters.
  5113.               ssoouurrcceeppaatthh
  5114.                       If set, the ssoouurrccee  (..)  builtin  uses  the
  5115.                       value  of  PPAATTHH  to find the directory con-
  5116.                       taining the file supplied as  an  argument.
  5117.                       This option is enabled by default.
  5118.        ssuussppeenndd [--ff]
  5119.               Suspend  the  execution  of  this  shell  until  it
  5120.               receives a SSIIGGCCOONNTT signal.  The --ff option says  not
  5121.               to  complain if this is a login shell; just suspend
  5122.               anyway.  The return status is 0 unless the shell is
  5123.               a  login  shell  and  --ff is not supplied, or if job
  5124.               control is not enabled.
  5125.        tteesstt _e_x_p_r
  5126.        [[ _e_x_p_r ]]
  5127.               Return a status of 0 or 1 depending on the  evalua-
  5128.               tion  of  the  conditional  expression  _e_x_p_r.  Each
  5129.               operator and operand must be a  separate  argument.
  5130.               Expressions are composed of the primaries described
  5131.               above under CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS.
  5132.  
  5133.               Expressions may be  combined  using  the  following
  5134.               operators,  listed  in  decreasing  order of prece-
  5135.               dence.
  5136.               !! _e_x_p_r True if _e_x_p_r is false.
  5137.               (( _e_x_p_r ))
  5138.                      Returns the value of _e_x_p_r.  This may be used
  5139.                      to  override the normal precedence of opera-
  5140.                      tors.
  5141.               _e_x_p_r_1 -aa _e_x_p_r_2
  5142.                      True if both _e_x_p_r_1 and _e_x_p_r_2 are true.
  5143.  
  5144.  
  5145.  
  5146. GNU                         1998 Apr 1                         78
  5147.  
  5148.  
  5149.  
  5150.  
  5151.  
  5152. BASH(1)                                                   BASH(1)
  5153.  
  5154.  
  5155.               _e_x_p_r_1 -oo _e_x_p_r_2
  5156.                      True if either _e_x_p_r_1 or _e_x_p_r_2 is true.
  5157.  
  5158.               tteesstt and [[ evaluate conditional expressions using a
  5159.               set of rules based on the number of arguments.
  5160.  
  5161.               0 arguments
  5162.                      The expression is false.
  5163.               1 argument
  5164.                      The  expression  is  true if and only if the
  5165.                      argument is not null.
  5166.               2 arguments
  5167.                      If the first argument is !!,  the  expression
  5168.                      is  true  if and only if the second argument
  5169.                      is null.  If the first argument  is  one  of
  5170.                      the unary conditional operators listed above
  5171.                      under CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS,  the  expres-
  5172.                      sion  is true if the unary test is true.  If
  5173.                      the first argument is not a valid unary con-
  5174.                      ditional  operator, the expression is false.
  5175.               3 arguments
  5176.                      If the second argument is one of the  binary
  5177.                      conditional  operators  listed  above  under
  5178.                      CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS, the result  of  the
  5179.                      expression  is the result of the binary test
  5180.                      using  the  first  and  third  arguments  as
  5181.                      operands.   If  the first argument is !!, the
  5182.                      value is the negation  of  the  two-argument
  5183.                      test  using  the second and third arguments.
  5184.                      If the first argument is exactly ((  and  the
  5185.                      third  argument  is exactly )), the result is
  5186.                      the one-argument test of  the  second  argu-
  5187.                      ment.   Otherwise,  the expression is false.
  5188.                      The  --aa  and  --oo  operators  are  considered
  5189.                      binary operators in this case.
  5190.               4 arguments
  5191.                      If  the  first  argument is !!, the result is
  5192.                      the negation of the  three-argument  expres-
  5193.                      sion  composed  of  the remaining arguments.
  5194.                      Otherwise,  the  expression  is  parsed  and
  5195.                      evaluated  according to precedence using the
  5196.                      rules listed above.
  5197.               5 or more arguments
  5198.                      The  expression  is  parsed  and   evaluated
  5199.                      according  to  precedence  using  the  rules
  5200.                      listed above.
  5201.  
  5202.        ttiimmeess  Print the accumulated user and system times for the
  5203.               shell  and  for  processes run from the shell.  The
  5204.               return status is 0.
  5205.  
  5206.        ttrraapp [--llpp] [_a_r_g] [_s_i_g_s_p_e_c ...]
  5207.               The command _a_r_g is to be read and executed when the
  5208.               shell receives signal(s) _s_i_g_s_p_e_c.  If _a_r_g is absent
  5209.  
  5210.  
  5211.  
  5212. GNU                         1998 Apr 1                         79
  5213.  
  5214.  
  5215.  
  5216.  
  5217.  
  5218. BASH(1)                                                   BASH(1)
  5219.  
  5220.  
  5221.               or --, all specified  signals  are  reset  to  their
  5222.               original  values (the values they had upon entrance
  5223.               to the shell).  If _a_r_g is the null string the  sig-
  5224.               nal  specified  by  each  _s_i_g_s_p_e_c is ignored by the
  5225.               shell and by the commands it invokes.  If _a_r_g is --pp
  5226.               then the trap commands associated with each _s_i_g_s_p_e_c
  5227.               are displayed.  If no arguments are supplied or  if
  5228.               only  --pp is given, ttrraapp prints the list of commands
  5229.               associated with each signal number.   Each  _s_i_g_s_p_e_c
  5230.               is either a signal name defined in <_s_i_g_n_a_l_._h>, or a
  5231.               signal number.  If a _s_i_g_s_p_e_c is EEXXIITT (0)  the  com-
  5232.               mand  _a_r_g is executed on exit from the shell.  If a
  5233.               _s_i_g_s_p_e_c is DDEEBBUUGG, the command _a_r_g is executed after
  5234.               every  _s_i_m_p_l_e  _c_o_m_m_a_n_d  (see  SSHHEELLLL GGRRAAMMMMAARR above).
  5235.               The --ll option causes the shell to print a  list  of
  5236.               signal names and their corresponding numbers.  Sig-
  5237.               nals ignored upon entry  to  the  shell  cannot  be
  5238.               trapped  or  reset.   Trapped  signals are reset to
  5239.               their original values in a child process when it is
  5240.               created.  The return status is false if any _s_i_g_s_p_e_c
  5241.               is invalid; otherwise ttrraapp returns true.
  5242.  
  5243.        ttyyppee [--aattpp] _n_a_m_e [_n_a_m_e ...]
  5244.               With no options, indicate how each  _n_a_m_e  would  be
  5245.               interpreted  if  used as a command name.  If the --tt
  5246.               option is used, ttyyppee prints a string which  is  one
  5247.               of  _a_l_i_a_s,  _k_e_y_w_o_r_d,  _f_u_n_c_t_i_o_n, _b_u_i_l_t_i_n, or _f_i_l_e if
  5248.               _n_a_m_e is an alias, shell  reserved  word,  function,
  5249.               builtin,  or  disk file, respectively.  If the _n_a_m_e
  5250.               is not found, then nothing is printed, and an  exit
  5251.               status  of  false is returned.  If the --pp option is
  5252.               used, ttyyppee either returns the name of the disk file
  5253.               that  would be executed if _n_a_m_e were specified as a
  5254.               command name, or nothing if type -t name _w_o_u_l_d  _n_o_t
  5255.               _r_e_t_u_r_n _f_i_l_e.  If a command is hashed, --pp prints the
  5256.               hashed value, not necessarily the file that appears
  5257.               first  in  PPAATTHH.   If  the  --aa option is used, ttyyppee
  5258.               prints all of the places that contain an executable
  5259.               named  _n_a_m_e.   This includes aliases and functions,
  5260.               if and only if the --pp option is not also used.  The
  5261.               table  of  hashed  commands  is  not consulted when
  5262.               using --aa.  ttyyppee returns true if any  of  the  argu-
  5263.               ments are found, false if none are found.
  5264.  
  5265.        uulliimmiitt [--SSHHaaccddffllmmnnppssttuuvv [_l_i_m_i_t]]
  5266.               Provides  control  over  the resources available to
  5267.               the shell and to processes started by it,  on  sys-
  5268.               tems  that  allow such control.  The value of _l_i_m_i_t
  5269.               can be a number  in  the  unit  specified  for  the
  5270.               resource,  or  the  value uunnlliimmiitteedd.  The --HH and --SS
  5271.               options specify that the hard or soft limit is  set
  5272.               for  the  given  resource.   A hard limit cannot be
  5273.               increased once it is  set;  a  soft  limit  may  be
  5274.               increased  up  to  the value of the hard limit.  If
  5275.  
  5276.  
  5277.  
  5278. GNU                         1998 Apr 1                         80
  5279.  
  5280.  
  5281.  
  5282.  
  5283.  
  5284. BASH(1)                                                   BASH(1)
  5285.  
  5286.  
  5287.               neither --HH nor --SS is specified, both the  soft  and
  5288.               hard limits are set.  If _l_i_m_i_t is omitted, the cur-
  5289.               rent value of the soft limit  of  the  resource  is
  5290.               printed,  unless the --HH option is given.  When more
  5291.               than one resource is specified, the limit name  and
  5292.               unit  are  printed before the value.  Other options
  5293.               are interpreted as follows:
  5294.               --aa     All current limits are reported
  5295.               --cc     The maximum size of core files created
  5296.               --dd     The maximum size of a process's data segment
  5297.               --ff     The  maximum  size  of  files created by the
  5298.                      shell
  5299.               --ll     The maximum size that  may  be  locked  into
  5300.                      memory
  5301.               --mm     The maximum resident set size
  5302.               --nn     The  maximum number of open file descriptors
  5303.                      (most systems do not allow this value to  be
  5304.                      set)
  5305.               --pp     The  pipe  size in 512-byte blocks (this may
  5306.                      not be set)
  5307.               --ss     The maximum stack size
  5308.               --tt     The maximum amount of cpu time in seconds
  5309.               --uu     The maximum number of processes available to
  5310.                      a single user
  5311.               --vv     The  maximum amount of virtual memory avail-
  5312.                      able to the shell
  5313.  
  5314.               If _l_i_m_i_t is given, it is the new value of the spec-
  5315.               ified resource (the --aa option is display only).  If
  5316.               no option is given, then --ff is assumed.  Values are
  5317.               in 1024-byte increments, except for --tt, which is in
  5318.               seconds, --pp, which is in units of 512-byte  blocks,
  5319.               and  --nn  and  --uu,  which  are unscaled values.  The
  5320.               return status is 0  unless  an  invalid  option  is
  5321.               encountered,  a  non-numeric  argument  other  than
  5322.               uunnlliimmiitteedd is supplied as _l_i_m_i_t, or an error  occurs
  5323.               while setting a new limit.
  5324.  
  5325.        uummaasskk [--pp] [--SS] [_m_o_d_e]
  5326.               The  user  file-creation  mask  is set to _m_o_d_e.  If
  5327.               _m_o_d_e begins with a digit, it is interpreted  as  an
  5328.               octal number; otherwise it is interpreted as a sym-
  5329.               bolic  mode  mask  similar  to  that  accepted   by
  5330.               _c_h_m_o_d(1).   If _m_o_d_e is omitted, or if the --SS option
  5331.               is supplied, the  current  value  of  the  mask  is
  5332.               printed.   The  --SS  option  causes  the  mask to be
  5333.               printed in symbolic form; the default output is  an
  5334.               octal  number.   If  the --pp option is supplied, and
  5335.               _m_o_d_e is omitted, the output is in a form  that  may
  5336.               be  reused as input.  The return status is 0 if the
  5337.               mode was successfully changed or if no  _m_o_d_e  argu-
  5338.               ment was supplied, and false otherwise.
  5339.  
  5340.  
  5341.  
  5342.  
  5343.  
  5344. GNU                         1998 Apr 1                         81
  5345.  
  5346.  
  5347.  
  5348.  
  5349.  
  5350. BASH(1)                                                   BASH(1)
  5351.  
  5352.  
  5353.        uunnaalliiaass [-aa] [_n_a_m_e ...]
  5354.               Remove  _n_a_m_es from the list of defined aliases.  If
  5355.               --aa is supplied, all alias definitions are  removed.
  5356.               The  return value is true unless a supplied _n_a_m_e is
  5357.               not a defined alias.
  5358.  
  5359.        uunnsseett [-ffvv] [_n_a_m_e ...]
  5360.               For each _n_a_m_e, remove the corresponding variable or
  5361.               function.   If  no  options are supplied, or the --vv
  5362.               option is given, each _n_a_m_e refers to a shell  vari-
  5363.               able.  Read-only variables may not be unset.  If --ff
  5364.               is specifed, each _n_a_m_e refers to a shell  function,
  5365.               and the function definition is removed.  Each unset
  5366.               variable or function is removed from  the  environ-
  5367.               ment passed to subsequent commands.  If any of RRAANN--
  5368.               DDOOMM, SSEECCOONNDDSS,  LLIINNEENNOO,  HHIISSTTCCMMDD,  or  DDIIRRSSTTAACCKK  are
  5369.               unset,  they lose their special properties, even if
  5370.               they are subsequently reset.  The  exit  status  is
  5371.               true unless a _n_a_m_e does not exist or is readonly.
  5372.  
  5373.        wwaaiitt [_n]
  5374.               Wait  for the specified process and return its ter-
  5375.               mination status.  _n may be a process ID  or  a  job
  5376.               specification;  if  a  job  spec is given, all pro-
  5377.               cesses in that job's pipeline are waited for.  If _n
  5378.               is  not given, all currently active child processes
  5379.               are waited for, and the return status is zero.   If
  5380.               _n  specifies  a  non-existent  process  or job, the
  5381.               return status is 127.  Otherwise, the return status
  5382.               is  the  exit  status  of  the  last process or job
  5383.               waited for.
  5384.  
  5385. RREESSTTRRIICCTTEEDD SSHHEELLLL
  5386.        If bbaasshh is started with the name rrbbaasshh, or the  --rr  option
  5387.        is  supplied  at invocation, the shell becomes restricted.
  5388.        A restricted shell is used to set up an  environment  more
  5389.        controlled  than  the  standard shell.  It behaves identi-
  5390.        cally to bbaasshh with the exception that  the  following  are
  5391.        disallowed or not performed:
  5392.  
  5393.        +o      changing directories with ccdd
  5394.  
  5395.        +o      setting or unsetting the values of SSHHEELLLL or PPAATTHH
  5396.  
  5397.        +o      specifying command names containing //
  5398.  
  5399.        +o      specifying  a  file name containing a // as an argu-
  5400.               ment to the ..  builtin command
  5401.  
  5402.        +o      importing function definitions from the shell envi-
  5403.               ronment at startup
  5404.  
  5405.        +o      parsing the value of SSHHEELLLLOOPPTTSS from the shell envi-
  5406.               ronment at startup
  5407.  
  5408.  
  5409.  
  5410. GNU                         1998 Apr 1                         82
  5411.  
  5412.  
  5413.  
  5414.  
  5415.  
  5416. BASH(1)                                                   BASH(1)
  5417.  
  5418.  
  5419.        +o      redirecting output using the >, >|, <>, >&, &>, and
  5420.               >> redirection operators
  5421.  
  5422.        +o      using the eexxeecc builtin command to replace the shell
  5423.               with another command
  5424.  
  5425.        +o      adding or deleting builtin commands with the --ff and
  5426.               --dd options to the eennaabbllee builtin command
  5427.  
  5428.        +o      specifying  the  --pp  option  to the ccoommmmaanndd builtin
  5429.               command
  5430.  
  5431.        +o      turning off restricted mode with sseett ++rr or  sseett  ++oo
  5432.               rreessttrriicctteedd.
  5433.  
  5434.        These  restrictions  are  enforced after any startup files
  5435.        are read.
  5436.  
  5437.        When a command that is found to be a shell script is  exe-
  5438.        cuted  (see  CCOOMMMMAANNDD EEXXEECCUUTTIIOONN above), rrbbaasshh turns off any
  5439.        restrictions in the shell spawned to execute the script.
  5440.  
  5441. SSEEEE AALLSSOO
  5442.        _B_a_s_h _F_e_a_t_u_r_e_s, Brian Fox and Chet Ramey
  5443.        _T_h_e _G_n_u _R_e_a_d_l_i_n_e _L_i_b_r_a_r_y, Brian Fox and Chet Ramey
  5444.        _T_h_e _G_n_u _H_i_s_t_o_r_y _L_i_b_r_a_r_y, Brian Fox and Chet Ramey
  5445.        _P_o_r_t_a_b_l_e _O_p_e_r_a_t_i_n_g _S_y_s_t_e_m _I_n_t_e_r_f_a_c_e _(_P_O_S_I_X_)  _P_a_r_t  _2_:
  5446.               _S_h_e_l_l  _a_n_d _U_t_i_l_i_t_i_e_s, IEEE
  5447.        _s_h(1), _k_s_h(1), _c_s_h(1)
  5448.        _e_m_a_c_s(1), _v_i(1)
  5449.        _r_e_a_d_l_i_n_e(3)
  5450.  
  5451. FFIILLEESS
  5452.        _/_b_i_n_/_b_a_s_h
  5453.               The bbaasshh executable
  5454.        _/_e_t_c_/_p_r_o_f_i_l_e
  5455.               The systemwide initialization  file,  executed  for
  5456.               login shells
  5457.        _~_/_._b_a_s_h___p_r_o_f_i_l_e
  5458.               The  personal  initialization  file,  executed  for
  5459.               login shells
  5460.        _~_/_._b_a_s_h_r_c
  5461.               The individual per-interactive-shell startup file
  5462.        _~_/_._i_n_p_u_t_r_c
  5463.               Individual _r_e_a_d_l_i_n_e initialization file
  5464.  
  5465. AAUUTTHHOORRSS
  5466.        Brian Fox, Free Software Foundation
  5467.        bfox@gnu.ai.MIT.Edu
  5468.  
  5469.        Chet Ramey, Case Western Reserve University
  5470.        chet@ins.CWRU.Edu
  5471.  
  5472.  
  5473.  
  5474.  
  5475.  
  5476. GNU                         1998 Apr 1                         83
  5477.  
  5478.  
  5479.  
  5480.  
  5481.  
  5482. BASH(1)                                                   BASH(1)
  5483.  
  5484.  
  5485. BBUUGG RREEPPOORRTTSS
  5486.        If you find a bug in bbaasshh,,  you  should  report  it.   But
  5487.        first,  you  should make sure that it really is a bug, and
  5488.        that it appears in the latest version  of  bbaasshh  that  you
  5489.        have.
  5490.  
  5491.        Once  you  have determined that a bug actually exists, use
  5492.        the _b_a_s_h_b_u_g command to submit a bug report.  If you have a
  5493.        fix, you are encouraged to mail that as well!  Suggestions
  5494.        and `philosophical' bug reports  may  be  mailed  to  _b_u_g_-
  5495.        _b_a_s_h_@_g_n_u_._o_r_g   or   posted   to   the   Usenet   newsgroup
  5496.        ggnnuu..bbaasshh..bbuugg.
  5497.  
  5498.        ALL bug reports should include:
  5499.  
  5500.        The version number of bbaasshh
  5501.        The hardware and operating system
  5502.        The compiler used to compile
  5503.        A description of the bug behaviour
  5504.        A short script or `recipe' which exercises the bug
  5505.  
  5506.        _b_a_s_h_b_u_g inserts the first three items  automatically  into
  5507.        the template it provides for filing a bug report.
  5508.  
  5509.        Comments  and  bug  reports  concerning  this  manual page
  5510.        should be directed to _c_h_e_t_@_i_n_s_._C_W_R_U_._E_d_u.
  5511.  
  5512. BBUUGGSS
  5513.        It's too big and too slow.
  5514.  
  5515.        There are some subtle differences between bbaasshh and  tradi-
  5516.        tional  versions of sshh, mostly because of the PPOOSSIIXX speci-
  5517.        fication.
  5518.  
  5519.        Aliases are confusing in some uses.
  5520.  
  5521.        Shell  builtin  commands  and  functions  are  not   stop-
  5522.        pable/restartable.
  5523.  
  5524.        Compound commands and command sequences of the form `a ; b
  5525.        ; c' are not handled gracefully when process suspension is
  5526.        attempted.   When  a process is stopped, the shell immedi-
  5527.        ately executes the next command in the sequence.  It  suf-
  5528.        fices  to place the sequence of commands between parenthe-
  5529.        ses to force it into a subshell, which may be stopped as a
  5530.        unit.
  5531.  
  5532.        Commands  inside  of  $$((...))  command substitution are not
  5533.        parsed until substitution is attempted.  This  will  delay
  5534.        error  reporting  until  some  time  after  the command is
  5535.        entered.
  5536.  
  5537.        Array variables may not (yet) be exported.
  5538.  
  5539.  
  5540.  
  5541.  
  5542. GNU                         1998 Apr 1                         84
  5543.  
  5544.  
  5545.