home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / info / bash.info next >
Encoding:
GNU Info File  |  1995-07-02  |  108.9 KB  |  3,012 lines

  1. This is Info file features.info, produced by Makeinfo-1.55 from the
  2. input file features.texi.
  3.  
  4. This text is a brief description of the features that are present in
  5. the Bash shell.
  6.  
  7. This is Edition 1.14, last updated 4 August 1994,
  8. of `The GNU Bash Features Guide',
  9. for `Bash', Version 1.14.
  10.  
  11. Copyright (C) 1991, 1993 Free Software Foundation, Inc.
  12.  
  13. This file is part of GNU Bash, the Bourne Again SHell.
  14.  
  15. Bash is free software; you can redistribute it and/or modify it
  16. under the terms of the GNU General Public License as published by
  17. the Free Software Foundation; either version 1, or (at your option)
  18. any later version.
  19.  
  20. Bash is distributed in the hope that it will be useful, but WITHOUT
  21. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  22. or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
  23. License for more details.
  24.  
  25. You should have received a copy of the GNU General Public License
  26. along with Bash; see the file COPYING.  If not, write to the Free
  27. Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  28.  
  29. 
  30. File: features.info,  Node: Top,  Next: Bourne Shell Features,  Prev: (DIR),  Up: (DIR)
  31.  
  32. Bash Features
  33. *************
  34.  
  35.    Bash contains features that appear in other popular shells, and some
  36. features that only appear in Bash.  Some of the shells that Bash has
  37. borrowed concepts from are the Bourne Shell (`sh'), the Korn Shell
  38. (`ksh'), and the C-shell (`csh' and its successor, `tcsh'). The
  39. following menu breaks the features up into categories based upon which
  40. one of these other shells inspired the feature.
  41.  
  42.    This manual is meant as a brief introduction to features found in
  43. Bash.  The Bash manual page should be used as the definitive reference
  44. on shell behavior.
  45.  
  46. * Menu:
  47.  
  48. * Bourne Shell Features::    Features originally found in the
  49.                 Bourne shell.
  50.  
  51. * Csh Features::        Features originally found in the
  52.                 Berkeley C-Shell.
  53.  
  54. * Korn Shell Features::        Features originally found in the Korn
  55.                 Shell.
  56.  
  57. * Bash Specific Features::    Features found only in Bash.
  58.  
  59. * Job Control::            A chapter describing what job control is
  60.                 and how bash allows you to use it.
  61.  
  62. * Using History Interactively::    Chapter dealing with history expansion
  63.                 rules.
  64.  
  65. * Command Line Editing::    Chapter describing the command line
  66.                 editing features.
  67.  
  68. * Variable Index::        Quick reference helps you find the
  69.                 variable you want.
  70.  
  71. * Concept Index::        General index for this manual.
  72.  
  73. 
  74. File: features.info,  Node: Bourne Shell Features,  Next: Csh Features,  Prev: Top,  Up: Top
  75.  
  76. Bourne Shell Style Features
  77. ***************************
  78.  
  79.    Bash is an acronym for Bourne Again SHell.  The Bourne shell is the
  80. traditional Unix shell originally written by Stephen Bourne.  All of
  81. the Bourne shell builtin commands are available in Bash, and the rules
  82. for evaluation and quoting are taken from the Posix 1003.2
  83. specification for the `standard' Unix shell.
  84.  
  85.    This section briefly summarizes things which Bash inherits from the
  86. Bourne shell: shell control structures, builtins, variables, and other
  87. features.  It also lists the significant differences between Bash and
  88. the Bourne Shell.
  89.  
  90. * Menu:
  91.  
  92. * Looping Constructs::        Shell commands for iterative action.
  93. * Conditional Constructs::    Shell commands for conditional execution.
  94. * Shell Functions::        Grouping commands by name.
  95. * Bourne Shell Builtins::    Builtin commands inherited from the Bourne
  96.                 Shell.
  97. * Bourne Shell Variables::    Variables which Bash uses in the same way
  98.                 as the Bourne Shell.
  99. * Other Bourne Shell Features::    Addtional aspects of Bash which behave in
  100.                 the same way as the Bourne Shell.
  101.  
  102. 
  103. File: features.info,  Node: Looping Constructs,  Next: Conditional Constructs,  Up: Bourne Shell Features
  104.  
  105. Looping Constructs
  106. ==================
  107.  
  108.    Note that wherever you see a `;' in the description of a command's
  109. syntax, it may be replaced indiscriminately with one or more newlines.
  110.  
  111.    Bash supports the following looping constructs.
  112.  
  113. `until'
  114.      The syntax of the `until' command is:
  115.           until TEST-COMMANDS; do CONSEQUENT-COMMANDS; done
  116.      Execute CONSEQUENT-COMMANDS as long as the final command in
  117.      TEST-COMMANDS has an exit status which is not zero.
  118.  
  119. `while'
  120.      The syntax of the `while' command is:
  121.           while TEST-COMMANDS; do CONSEQUENT-COMMANDS; done
  122.  
  123.      Execute CONSEQUENT-COMMANDS as long as the final command in
  124.      TEST-COMMANDS has an exit status of zero.
  125.  
  126. `for'
  127.      The syntax of the for command is:
  128.  
  129.           for NAME [in WORDS ...]; do COMMANDS; done
  130.      Execute COMMANDS for each member in WORDS, with NAME bound to the
  131.      current member.  If "`in WORDS'" is not present, "`in "$@"'" is
  132.      assumed.
  133.  
  134. 
  135. File: features.info,  Node: Conditional Constructs,  Next: Shell Functions,  Prev: Looping Constructs,  Up: Bourne Shell Features
  136.  
  137. Conditional Constructs
  138. ======================
  139.  
  140. `if'
  141.      The syntax of the `if' command is:
  142.  
  143.           if TEST-COMMANDS; then
  144.             CONSEQUENT-COMMANDS;
  145.           [elif MORE-TEST-COMMANDS; then
  146.             MORE-CONSEQUENTS;]
  147.           [else ALTERNATE-CONSEQUENTS;]
  148.           fi
  149.  
  150.      Execute CONSEQUENT-COMMANDS only if the final command in
  151.      TEST-COMMANDS has an exit status of zero.  Otherwise, each `elif'
  152.      list is executed in turn, and if its exit status is zero, the
  153.      corresponding MORE-CONSEQUENTS is executed and the command
  154.      completes.  If "`else ALTERNATE-CONSEQUENTS'" is present, and the
  155.      final command in the final `if' or `elif' clause has a non-zero
  156.      exit status, then execute ALTERNATE-CONSEQUENTS.
  157.  
  158. `case'
  159.      The syntax of the `case' command is:
  160.  
  161.           `case WORD in [PATTERN [| PATTERN]...) COMMANDS ;;]... esac'
  162.  
  163.      Selectively execute COMMANDS based upon WORD matching PATTERN.
  164.      The ``|'' is used to separate multiple patterns.
  165.  
  166.      Here is an example using `case' in a script that could be used to
  167.      describe an interesting feature of an animal:
  168.  
  169.           echo -n "Enter the name of an animal: "
  170.           read ANIMAL
  171.           echo -n "The $ANIMAL has "
  172.           case $ANIMAL in
  173.             horse | dog | cat) echo -n "four";;
  174.             man | kangaroo ) echo -n "two";;
  175.             *) echo -n "an unknown number of";;
  176.           esac
  177.           echo "legs."
  178.  
  179. 
  180. File: features.info,  Node: Shell Functions,  Next: Bourne Shell Builtins,  Prev: Conditional Constructs,  Up: Bourne Shell Features
  181.  
  182. Shell Functions
  183. ===============
  184.  
  185.    Shell functions are a way to group commands for later execution
  186. using a single name for the group.  They are executed just like a
  187. "regular" command.  Shell functions are executed in the current shell
  188. context; no new process is created to interpret them.
  189.  
  190.    Functions are declared using this syntax:
  191.  
  192.      [ `function' ] NAME () { COMMAND-LIST; }
  193.  
  194.    This defines a function named NAME.  The BODY of the function is the
  195. COMMAND-LIST between { and }.  This list is executed whenever NAME is
  196. specified as the name of a command.  The exit status of a function is
  197. the exit status of the last command executed in the body.
  198.  
  199.    When a function is executed, the arguments to the function become
  200. the positional parameters during its execution.  The special parameter
  201. `#' that gives the number of positional parameters is updated to
  202. reflect the change.  Positional parameter 0 is unchanged.
  203.  
  204.    If the builtin command `return' is executed in a function, the
  205. function completes and execution resumes with the next command after
  206. the function call.  When a function completes, the values of the
  207. positional parameters and the special parameter `#' are restored to the
  208. values they had prior to function execution.
  209.  
  210. 
  211. File: features.info,  Node: Bourne Shell Builtins,  Next: Bourne Shell Variables,  Prev: Shell Functions,  Up: Bourne Shell Features
  212.  
  213. Bourne Shell Builtins
  214. =====================
  215.  
  216.    The following shell builtin commands are inherited from the Bourne
  217. shell.  These commands are implemented as specified by the Posix 1003.2
  218. standard.
  219.  
  220. `:'
  221.      Do nothing beyond expanding any arguments and performing
  222.      redirections.
  223.  
  224. `.'
  225.      Read and execute commands from the FILENAME argument in the
  226.      current shell context.
  227.  
  228. `break'
  229.      Exit from a `for', `while', or `until' loop.
  230.  
  231. `cd'
  232.      Change the current working directory.
  233.  
  234. `continue'
  235.      Resume the next iteration of an enclosing `for', `while', or
  236.      `until' loop.
  237.  
  238. `echo'
  239.      Print the arguments, separated by spaces, to the standard output.
  240.  
  241. `eval'
  242.      The arguments are concatenated together into a single command,
  243.      which is then read and executed.
  244.  
  245. `exec'
  246.      If a COMMAND argument is supplied, it replaces the shell.  If no
  247.      COMMAND is specified, redirections may be used to affect the
  248.      current shell environment.
  249.  
  250. `exit'
  251.      Exit the shell.
  252.  
  253. `export'
  254.      Mark the arguments as variables to be passed to child processes in
  255.      the environment.
  256.  
  257. `getopts'
  258.      Parse options to shell scripts or functions.
  259.  
  260. `hash'
  261.      Remember the full pathnames of commands specified as arguments, so
  262.      they need not be searched for on subsequent invocations.
  263.  
  264. `kill'
  265.      Send a signal to a process.
  266.  
  267. `pwd'
  268.      Print the current working directory.
  269.  
  270. `read'
  271.      Read a line from the shell input and use it to set the values of
  272.      specified variables.
  273.  
  274. `readonly'
  275.      Mark variables as unchangable.
  276.  
  277. `return'
  278.      Cause a shell function to exit with a specified value.
  279.  
  280. `shift'
  281.      Shift positional parameters to the left.
  282.  
  283. `test'
  284. `['
  285.      Evaluate a conditional expression.
  286.  
  287. `times'
  288.      Print out the user and system times used by the shell and its
  289.      children.
  290.  
  291. `trap'
  292.      Specify commands to be executed when the shell receives signals.
  293.  
  294. `umask'
  295.      Set the shell process's file creation mask.
  296.  
  297. `unset'
  298.      Cause shell variables to disappear.
  299.  
  300. `wait'
  301.      Wait until child processes exit and report their exit status.
  302.  
  303. 
  304. File: features.info,  Node: Bourne Shell Variables,  Next: Other Bourne Shell Features,  Prev: Bourne Shell Builtins,  Up: Bourne Shell Features
  305.  
  306. Bourne Shell Variables
  307. ======================
  308.  
  309.    Bash uses certain shell variables in the same way as the Bourne
  310. shell.  In some cases, Bash assigns a default value to the variable.
  311.  
  312. `IFS'
  313.      A list of characters that separate fields; used when the shell
  314.      splits words as part of expansion.
  315.  
  316. `PATH'
  317.      A colon-separated list of directories in which the shell looks for
  318.      commands.
  319.  
  320. `HOME'
  321.      The current user's home directory.
  322.  
  323. `CDPATH'
  324.      A colon-separated list of directories used as a search path for
  325.      the `cd' command.
  326.  
  327. `MAILPATH'
  328.      A colon-separated list of files which the shell periodically checks
  329.      for new mail.    You can also specify what message is printed by
  330.      separating the file name from the message with a `?'.  When used
  331.      in the text of the message, `$_' stands for the name of the
  332.      current mailfile.
  333.  
  334. `PS1'
  335.      The primary prompt string.
  336.  
  337. `PS2'
  338.      The secondary prompt string.
  339.  
  340. `OPTIND'
  341.      The index of the last option processed by the `getopts' builtin.
  342.  
  343. `OPTARG'
  344.      The value of the last option argument processed by the `getopts'
  345.      builtin.
  346.  
  347. 
  348. File: features.info,  Node: Other Bourne Shell Features,  Prev: Bourne Shell Variables,  Up: Bourne Shell Features
  349.  
  350. Other Bourne Shell Features
  351. ===========================
  352.  
  353. * Menu:
  354.  
  355. * Major Differences from the Bourne Shell::    Major differences between
  356.                         Bash and the Bourne shell.
  357.  
  358.    Bash implements essentially the same grammar, parameter and variable
  359. expansion, redirection, and quoting as the Bourne Shell.  Bash uses the
  360. Posix 1003.2 standard as the specification of how these features are to
  361. be implemented.  There are some differences between the traditional
  362. Bourne shell and the Posix standard; this section quickly details the
  363. differences of significance.  A number of these differences are
  364. explained in greater depth in subsequent sections.
  365.  
  366. 
  367. File: features.info,  Node: Major Differences from the Bourne Shell,  Up: Other Bourne Shell Features
  368.  
  369. Major Differences from the Bourne Shell
  370. ---------------------------------------
  371.  
  372.    Bash implements the `!' keyword to negate the return value of a
  373. pipeline.  Very useful when an `if' statement needs to act only if a
  374. test fails.
  375.  
  376.    Bash includes brace expansion (*note Brace Expansion::.).
  377.  
  378.    Bash includes the Posix and `ksh'-style pattern removal `%%' and
  379. `##' constructs to remove leading or trailing substrings from variables.
  380.  
  381.    The Posix and `ksh'-style `$()' form of command substitution is
  382. implemented, and preferred to the Bourne shell's ```' (which is also
  383. implemented for backwards compatibility).
  384.  
  385.    Variables present in the shell's initial environment are
  386. automatically exported to child processes.  The Bourne shell does not
  387. normally do this unless the variables are explicitly marked using the
  388. `export' command.
  389.  
  390.    The expansion `${#xx}', which returns the length of `$xx', is
  391. supported.
  392.  
  393.    The `IFS' variable is used to split only the results of expansion,
  394. not all words.  This closes a longstanding shell security hole.
  395.  
  396.    It is possible to have a variable and a function with the same name;
  397. `sh' does not separate the two name spaces.
  398.  
  399.    Bash functions are permitted to have local variables, and thus useful
  400. recursive functions may be written.
  401.  
  402.    The `noclobber' option is available to avoid overwriting existing
  403. files with output redirection.
  404.  
  405.    Bash allows you to write a function to override a builtin, and
  406. provides access to that builtin's functionality within the function via
  407. the `builtin' and `command' builtins.
  408.  
  409.    The `command' builtin allows selective disabling of functions when
  410. command lookup is performed.
  411.  
  412.    Individual builtins may be enabled or disabled using the `enable'
  413. builtin.
  414.  
  415.    Functions may be exported to children via the environment.
  416.  
  417.    The Bash `read' builtin will read a line ending in \ with the `-r'
  418. option, and will use the `$REPLY' variable as a default if no arguments
  419. are supplied.
  420.  
  421.    The `return' builtin may be used to abort execution of scripts
  422. executed with the `.' or `source' builtins.
  423.  
  424.    The `umask' builtin allows symbolic mode arguments similar to those
  425. accepted by `chmod'.
  426.  
  427.    The `test' builtin is slightly different, as it implements the Posix
  428. 1003.2 algorithm, which specifies the behavior based on the number of
  429. arguments.
  430.  
  431. 
  432. File: features.info,  Node: Csh Features,  Next: Korn Shell Features,  Prev: Bourne Shell Features,  Up: Top
  433.  
  434. C-Shell Style Features
  435. **********************
  436.  
  437.    The C-Shell ("`csh'") was created by Bill Joy at UC Berkeley.  It is
  438. generally considered to have better features for interactive use than
  439. the original Bourne shell.  Some of the `csh' features present in Bash
  440. include job control, history expansion, `protected' redirection, and
  441. several variables for controlling the interactive behaviour of the shell
  442. (e.g. `IGNOREEOF').
  443.  
  444.    *Note Using History Interactively:: for details on history expansion.
  445.  
  446. * Menu:
  447.  
  448. * Tilde Expansion::        Expansion of the ~ character.
  449. * Brace Expansion::        Expansion of expressions within braces.
  450. * C Shell Builtins::        Builtin commands adopted from the C Shell.
  451. * C Shell Variables::        Variables which Bash uses in essentially
  452.                 the same way as the C Shell.
  453.  
  454. 
  455. File: features.info,  Node: Tilde Expansion,  Next: Brace Expansion,  Up: Csh Features
  456.  
  457. Tilde Expansion
  458. ===============
  459.  
  460.    Bash has tilde (~) expansion, similar, but not identical, to that of
  461. `csh'.  The following table shows what unquoted words beginning with a
  462. tilde expand to.
  463.  
  464. `~'
  465.      The current value of `$HOME'.
  466.  
  467. `~/foo'
  468.      `$HOME/foo'
  469.  
  470. `~fred/foo'
  471.      The subdirectory `foo' of the home directory of the user `fred'.
  472.  
  473. `~+/foo'
  474.      `$PWD/foo'
  475.  
  476. `~-'
  477.      `$OLDPWD/foo'
  478.  
  479.    Bash will also tilde expand words following redirection operators
  480. and words following `=' in assignment statements.
  481.  
  482. 
  483. File: features.info,  Node: Brace Expansion,  Next: C Shell Builtins,  Prev: Tilde Expansion,  Up: Csh Features
  484.  
  485. Brace Expansion
  486. ===============
  487.  
  488.    Brace expansion is a mechanism by which arbitrary strings may be
  489. generated.  This mechanism is similar to PATHNAME EXPANSION (see the
  490. Bash manual page for details), but the file names generated need not
  491. exist.  Patterns to be brace expanded take the form of an optional
  492. PREAMBLE, followed by a series of comma-separated strings between a
  493. pair of braces, followed by an optional POSTAMBLE.  The preamble is
  494. prepended to each string contained within the braces, and the postamble
  495. is then appended to each resulting string, expanding left to right.
  496.  
  497.    Brace expansions may be nested.  The results of each expanded string
  498. are not sorted; left to right order is preserved.  For example,
  499.      a{d,c,b}e
  500.    expands into ADE ACE ABE.
  501.  
  502.    Brace expansion is performed before any other expansions, and any
  503. characters special to other expansions are preserved in the result.  It
  504. is strictly textual.  Bash does not apply any syntactic interpretation
  505. to the context of the expansion or the text between the braces.
  506.  
  507.    A correctly-formed brace expansion must contain unquoted opening and
  508. closing braces, and at least one unquoted comma.  Any incorrectly
  509. formed brace expansion is left unchanged.
  510.  
  511.    This construct is typically used as shorthand when the common prefix
  512. of the strings to be generated is longer than in the above example:
  513.      mkdir /usr/local/src/bash/{old,new,dist,bugs}
  514.    or
  515.      chown root /usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}}
  516.  
  517. 
  518. File: features.info,  Node: C Shell Builtins,  Next: C Shell Variables,  Prev: Brace Expansion,  Up: Csh Features
  519.  
  520. C Shell Builtins
  521. ================
  522.  
  523.    Bash has several builtin commands whose definition is very similar
  524. to `csh'.
  525.  
  526. `pushd'
  527.           pushd [DIR | +N | -N]
  528.  
  529.      Save the current directory on a list and then `cd' to DIR.  With no
  530.      arguments, exchanges the top two directories.
  531.  
  532.     `+N'
  533.           Brings the Nth directory (counting from the left of the list
  534.           printed by `dirs') to the top of the list by rotating the
  535.           stack.
  536.  
  537.     `-N'
  538.           Brings the Nth directory (counting from the right of the list
  539.           printed by `dirs') to the top of the list by rotating the
  540.           stack.
  541.  
  542.     `DIR'
  543.           Makes the current working directory be the top of the stack,
  544.           and then CDs to DIR.  You can see the saved directory list
  545.           with the `dirs' command.
  546.  
  547. `popd'
  548.           popd [+N | -N]
  549.  
  550.      Pops the directory stack, and `cd's to the new top directory.  When
  551.      no arguments are given, removes the top directory from the stack
  552.      and `cd's to the new top directory.  The elements are numbered
  553.      from 0 starting at the first directory listed with `dirs'; i.e.
  554.      `popd' is equivalent to `popd +0'.
  555.     `+N'
  556.           Removes the Nth directory (counting from the left of the list
  557.           printed by `dirs'), starting with zero.
  558.  
  559.     `-N'
  560.           Removes the Nth directory (counting from the right of the
  561.           list printed by `dirs'), starting with zero.
  562.  
  563. `dirs'
  564.           dirs [+N | -N] [-L]
  565.      Display the list of currently remembered directories.  Directories
  566.      find their way onto the list with the `pushd' command; you can get
  567.      back up through the list with the `popd' command.
  568.     `+N'
  569.           Displays the Nth directory (counting from the left of the
  570.           list printed by `dirs' when invoked without options), starting
  571.           with zero.
  572.  
  573.     `-N'
  574.           Displays the Nth directory (counting from the right of the
  575.           list printed by `dirs' when invoked without options), starting
  576.           with zero.
  577.  
  578.     `-L'
  579.           Produces a longer listing; the default listing format uses a
  580.           tilde to denote the home directory.
  581.  
  582. `history'
  583.           history [N] [ [-w -r -a -n] [FILENAME]]
  584.  
  585.      Display the history list with line numbers.  Lines prefixed with
  586.      with a `*' have been modified.  An argument of N says to list only
  587.      the last N lines.  Option `-w' means write out the current history
  588.      to the history file; `-r' means to read the current history file
  589.      and make its contents the history list.  An argument of `-a' means
  590.      to append the new history lines (history lines entered since the
  591.      beginning of the current Bash session) to the history file.
  592.      Finally, the `-n' argument means to read the history lines not
  593.      already read from the history file into the current history list.
  594.      These are lines appended to the history file since the beginning
  595.      of the current Bash session.  If FILENAME is given, then it is used
  596.      as the history file, else if `$HISTFILE' has a value, that is
  597.      used, otherwise `~/.bash_history' is used.
  598.  
  599. `logout'
  600.      Exit a login shell.
  601.  
  602. `source'
  603.      A synonym for `.' (*note Bourne Shell Builtins::.)
  604.  
  605. 
  606. File: features.info,  Node: C Shell Variables,  Prev: C Shell Builtins,  Up: Csh Features
  607.  
  608. C Shell Variables
  609. =================
  610.  
  611. `IGNOREEOF'
  612.      If this variable is set, it represents the number of consecutive
  613.      `EOF's Bash will read before exiting.  By default, Bash will exit
  614.      upon reading a single `EOF'.
  615.  
  616. `cdable_vars'
  617.      If this variable is set, Bash treats arguments to the `cd' command
  618.      which are not directories as names of variables whose values are
  619.      the directories to change to.
  620.  
  621. 
  622. File: features.info,  Node: Korn Shell Features,  Next: Bash Specific Features,  Prev: Csh Features,  Up: Top
  623.  
  624. Korn Shell Style Features
  625. *************************
  626.  
  627.    This section describes features primarily inspired by the Korn Shell
  628. (`ksh').  In some cases, the Posix 1003.2 standard has adopted these
  629. commands and variables from the Korn Shell; Bash implements those
  630. features using the Posix standard as a guide.
  631.  
  632. * Menu:
  633.  
  634. * Korn Shell Constructs::    Shell grammar constructs adopted from the
  635.                 Korn Shell
  636. * Korn Shell Builtins::        Builtin commands adopted from the Korn Shell.
  637. * Korn Shell Variables::    Variables which bash uses in essentially
  638.                 the same way as the Korn Shell.
  639. * Aliases::            Substituting one command for another.
  640.  
  641. 
  642. File: features.info,  Node: Korn Shell Constructs,  Next: Korn Shell Builtins,  Up: Korn Shell Features
  643.  
  644. Korn Shell Constructs
  645. =====================
  646.  
  647.    Bash includes the Korn Shell `select' construct.  This construct
  648. allows the easy generation of menus.  It has almost the same syntax as
  649. the `for' command.
  650.  
  651.    The syntax of the `select' command is:
  652.      select NAME [in WORDS ...]; do COMMANDS; done
  653.  
  654.    The list of words following `in' is expanded, generating a list of
  655. items.  The set of expanded words is printed on the standard error,
  656. each preceded by a number.  If the "`in WORDS'" is omitted, the
  657. positional parameters are printed.  The `PS3' prompt is then displayed
  658. and a line is read from the standard input. If the line consists of the
  659. number corresponding to one of the displayed words, then the value of
  660. NAME is set to that word.  If the line is empty, the words and prompt
  661. are displayed again.  If `EOF' is read, the `select' command completes.
  662. Any other value read causes NAME to be set to null.  The line read is
  663. saved in the variable `REPLY'.
  664.  
  665.    The COMMANDS are executed after each selection until a `break' or
  666. `return' command is executed, at which point the `select' command
  667. completes.
  668.  
  669. 
  670. File: features.info,  Node: Korn Shell Builtins,  Next: Korn Shell Variables,  Prev: Korn Shell Constructs,  Up: Korn Shell Features
  671.  
  672. Korn Shell Builtins
  673. ===================
  674.  
  675.    This section describes Bash builtin commands taken from `ksh'.
  676.  
  677. `fc'
  678.           `fc [-e ENAME] [-nlr] [FIRST] [LAST]'
  679.           `fc -s [PAT=REP] [COMMAND]'
  680.  
  681.      Fix Command.  In the first form, a range of commands from FIRST to
  682.      LAST is selected from the history list.  Both FIRST and LAST may
  683.      be specified as a string (to locate the most recent command
  684.      beginning with that string) or as a number (an index into the
  685.      history list, where a negative number is used as an offset from the
  686.      current command number).  If LAST is not specified it is set to
  687.      FIRST.  If FIRST is not specified it is set to the previous
  688.      command for editing and -16 for listing.  If the `-l' flag is
  689.      given, the commands are listed on standard output.  The `-n' flag
  690.      suppresses the command numbers when listing.  The `-r' flag
  691.      reverses the order of the listing.  Otherwise, the editor given by
  692.      ENAME is invoked on a file containing those commands.  If ENAME is
  693.      not given, the value of the following variable expansion is used:
  694.      `${FCEDIT:-${EDITOR:-vi}}'.  This says to use the value of the
  695.      `FCEDIT' variable if set, or the value of the `EDITOR' variable if
  696.      that is set, or `vi' if neither is set.  When editing is complete,
  697.      the edited commands are echoed and executed.
  698.  
  699.      In the second form, COMMAND is re-executed after each instance of
  700.      PAT in the selected command is replaced by REP.
  701.  
  702.      A useful alias to use with the `fc' command is `r='fc -s'', so
  703.      that typing `r cc' runs the last command beginning with `cc' and
  704.      typing `r' re-executes the last command (*note Aliases::.).
  705.  
  706. `let'
  707.      The `let' builtin allows arithmetic to be performed on shell
  708.      variables.  For details, refer to *Note Arithmetic Builtins::.
  709.  
  710. `typeset'
  711.      The `typeset' command is supplied for compatibility with the Korn
  712.      shell; however, it has been made obsolete by the `declare' command
  713.      (*note Bash Builtins::.).
  714.  
  715. 
  716. File: features.info,  Node: Korn Shell Variables,  Next: Aliases,  Prev: Korn Shell Builtins,  Up: Korn Shell Features
  717.  
  718. Korn Shell Variables
  719. ====================
  720.  
  721. `REPLY'
  722.      The default variable for the `read' builtin.
  723.  
  724. `RANDOM'
  725.      Each time this parameter is referenced, a random integer is
  726.      generated.  Assigning a value to this variable seeds the random
  727.      number generator.
  728.  
  729. `SECONDS'
  730.      This variable expands to the number of seconds since the shell was
  731.      started.  Assignment to this variable resets the count to the
  732.      value assigned, and the expanded value becomes the value assigned
  733.      plus the number of seconds since the assignment.
  734.  
  735. `PS3'
  736.      The value of this variable is used as the prompt for the `select'
  737.      command.
  738.  
  739. `PS4'
  740.      This is the prompt printed before the command line is echoed when
  741.      the `-x' option is set (*note The Set Builtin::.).
  742.  
  743. `PWD'
  744.      The current working directory as set by the `cd' builtin.
  745.  
  746. `OLDPWD'
  747.      The previous working directory as set by the `cd' builtin.
  748.  
  749. `TMOUT'
  750.      If set to a value greater than zero, the value is interpreted as
  751.      the number of seconds to wait for input after issuing the primary
  752.      prompt.  Bash terminates after that number of seconds if input does
  753.      not arrive.
  754.  
  755. 
  756. File: features.info,  Node: Aliases,  Prev: Korn Shell Variables,  Up: Korn Shell Features
  757.  
  758. Aliases
  759. =======
  760.  
  761. * Menu:
  762.  
  763. * Alias Builtins::        Builtins commands to maniuplate aliases.
  764.  
  765.    The shell maintains a list of ALIASES that may be set and unset with
  766. the `alias' and `unalias' builtin commands.
  767.  
  768.    The first word of each command, if unquoted, is checked to see if it
  769. has an alias.  If so, that word is replaced by the text of the alias.
  770. The alias name and the replacement text may contain any valid shell
  771. input, including shell metacharacters, with the exception that the
  772. alias name may not contain =.  The first word of the replacement text
  773. is tested for aliases, but a word that is identical to an alias being
  774. expanded is not expanded a second time.  This means that one may alias
  775. `ls' to `"ls -F"', for instance, and Bash does not try to recursively
  776. expand the replacement text. If the last character of the alias value
  777. is a space or tab character, then the next command word following the
  778. alias is also checked for alias expansion.
  779.  
  780.    Aliases are created and listed with the `alias' command, and removed
  781. with the `unalias' command.
  782.  
  783.    There is no mechanism for using arguments in the replacement text,
  784. as in `csh'.  If arguments are needed, a shell function should be used.
  785.  
  786.    Aliases are not expanded when the shell is not interactive.
  787.  
  788.    The rules concerning the definition and use of aliases are somewhat
  789. confusing.  Bash always reads at least one complete line of input
  790. before executing any of the commands on that line.  Aliases are
  791. expanded when a command is read, not when it is executed.  Therefore, an
  792. alias definition appearing on the same line as another command does not
  793. take effect until the next line of input is read.  This means that the
  794. commands following the alias definition on that line are not affected
  795. by the new alias.  This behavior is also an issue when functions are
  796. executed.  Aliases are expanded when the function definition is read,
  797. not when the function is executed, because a function definition is
  798. itself a compound command.  As a consequence, aliases defined in a
  799. function are not available until after that function is executed.  To
  800. be safe, always put alias definitions on a separate line, and do not
  801. use `alias' in compound commands.
  802.  
  803.    Note that for almost every purpose, aliases are superseded by shell
  804. functions.
  805.  
  806. 
  807. File: features.info,  Node: Alias Builtins,  Up: Aliases
  808.  
  809. Alias Builtins
  810. --------------
  811.  
  812. `alias'
  813.           alias [NAME[=VALUE] ...]
  814.  
  815.      Without arguments, print the list of aliases on the standard
  816.      output.  If arguments are supplied, an alias is defined for each
  817.      NAME whose VALUE is given.  If no VALUE is given, the name and
  818.      value of the alias is printed.
  819.  
  820. `unalias'
  821.           unalias [-a] [NAME ... ]
  822.  
  823.      Remove each NAME from the list of aliases.  If `-a' is supplied,
  824.      all aliases are removed.
  825.  
  826. 
  827. File: features.info,  Node: Bash Specific Features,  Next: Job Control,  Prev: Korn Shell Features,  Up: Top
  828.  
  829. Bash Specific Features
  830. **********************
  831.  
  832.    This section describes the features unique to Bash.
  833.  
  834. * Menu:
  835.  
  836. * Invoking Bash::        Command line options that you can give
  837.                 to Bash.
  838. * Bash Startup Files::        When and how Bash executes scripts.
  839. * Is This Shell Interactive?::    Determining the state of a running Bash.
  840. * Bash Builtins::        Table of builtins specific to Bash.
  841. * The Set Builtin::        This builtin is so overloaded it
  842.                 deserves its own section.
  843. * Bash Variables::        List of variables that exist in Bash.
  844. * Shell Arithmetic::        Arithmetic on shell variables.
  845. * Printing a Prompt::        Controlling the PS1 string.
  846.  
  847. 
  848. File: features.info,  Node: Invoking Bash,  Next: Bash Startup Files,  Up: Bash Specific Features
  849.  
  850. Invoking Bash
  851. =============
  852.  
  853.    In addition to the single-character shell command-line options
  854. (*note The Set Builtin::.), there are several multi-character options
  855. that you can use.  These options must appear on the command line before
  856. the single-character options to be recognized.
  857.  
  858. `-norc'
  859.      Don't read the `~/.bashrc' initialization file in an interactive
  860.      shell.  This is on by default if the shell is invoked as `sh'.
  861.  
  862. `-rcfile FILENAME'
  863.      Execute commands from FILENAME (instead of `~/.bashrc') in an
  864.      interactive shell.
  865.  
  866. `-noprofile'
  867.      Don't load the system-wide startup file `/etc/profile' or any of
  868.      the personal initialization files `~/.bash_profile',
  869.      `~/.bash_login', or `~/.profile' when bash is invoked as a login
  870.      shell.
  871.  
  872. `-version'
  873.      Display the version number of this shell.
  874.  
  875. `-login'
  876.      Make this shell act as if it were directly invoked from login.
  877.      This is equivalent to `exec - bash' but can be issued from another
  878.      shell, such as `csh'.  If you wanted to replace your current login
  879.      shell with a Bash login shell, you would say `exec bash -login'.
  880.  
  881. `-nobraceexpansion'
  882.      Do not perform curly brace expansion (*note Brace Expansion::.).
  883.  
  884. `-nolineediting'
  885.      Do not use the GNU Readline library (*note Command Line Editing::.)
  886.      to read interactive command lines.
  887.  
  888. `-posix'
  889.      Change the behavior of Bash where the default operation differs
  890.      from the Posix 1003.2 standard to match the standard.  This is
  891.      intended to make Bash behave as a strict superset of that standard.
  892.  
  893.    There are several single-character options you can give which are
  894. not available with the `set' builtin.
  895.  
  896. `-c STRING'
  897.      Read and execute commands from STRING after processing the
  898.      options, then exit.
  899.  
  900. `-i'
  901.      Force the shell to run interactively.
  902.  
  903. `-s'
  904.      If this flag is present, or if no arguments remain after option
  905.      processing, then commands are read from the standard input.  This
  906.      option allows the positional parameters to be set when invoking an
  907.      interactive shell.
  908.  
  909.    An *interactive* shell is one whose input and output are both
  910. connected to terminals (as determined by `isatty()'), or one started
  911. with the `-i' option.
  912.  
  913. 
  914. File: features.info,  Node: Bash Startup Files,  Next: Is This Shell Interactive?,  Prev: Invoking Bash,  Up: Bash Specific Features
  915.  
  916. Bash Startup Files
  917. ==================
  918.  
  919.    When and how Bash executes startup files.
  920.  
  921.      For Login shells (subject to the -noprofile option):
  922.      
  923.          On logging in:
  924.             If `/etc/profile' exists, then source it.
  925.      
  926.             If `~/.bash_profile' exists, then source it,
  927.                else if `~/.bash_login' exists, then source it,
  928.                   else if `~/.profile' exists, then source it.
  929.      
  930.          On logging out:
  931.             If `~/.bash_logout' exists, source it.
  932.      
  933.      For non-login interactive shells (subject to the -norc and -rcfile options):
  934.          On starting up:
  935.             If `~/.bashrc' exists, then source it.
  936.      
  937.      For non-interactive shells:
  938.          On starting up:
  939.             If the environment variable `ENV' is non-null, expand the
  940.             variable and source the file named by the value.  If Bash is
  941.             not started in Posix mode, it looks for `BASH_ENV' before
  942.             `ENV'.
  943.  
  944.    So, typically, your `~/.bash_profile' contains the line
  945.      `if [ -f `~/.bashrc' ]; then source `~/.bashrc'; fi'
  946.  
  947. after (or before) any login specific initializations.
  948.  
  949.    If Bash is invoked as `sh', it tries to mimic the behavior of `sh'
  950. as closely as possible.  For a login shell, it attempts to source only
  951. `/etc/profile' and `~/.profile', in that order.  The `-noprofile'
  952. option may still be used to disable this behavior.  A shell invoked as
  953. `sh' does not attempt to source any other startup files.
  954.  
  955.    When Bash is started in POSIX mode, as with the `-posix' command
  956. line option, it follows the Posix 1003.2 standard for startup files.
  957. In this mode, the `ENV' variable is expanded and that file sourced; no
  958. other startup files are read.
  959.  
  960. 
  961. File: features.info,  Node: Is This Shell Interactive?,  Next: Bash Builtins,  Prev: Bash Startup Files,  Up: Bash Specific Features
  962.  
  963. Is This Shell Interactive?
  964. ==========================
  965.  
  966.    You may wish to determine within a startup script whether Bash is
  967. running interactively or not.  To do this, examine the variable `$PS1';
  968. it is unset in non-interactive shells, and set in interactive shells.
  969. Thus:
  970.  
  971.      if [ -z "$PS1" ]; then
  972.          echo This shell is not interactive
  973.      else
  974.          echo This shell is interactive
  975.      fi
  976.  
  977.    You can ask an interactive Bash to not run your `~/.bashrc' file
  978. with the `-norc' flag.  You can change the name of the `~/.bashrc' file
  979. to any other file name with `-rcfile FILENAME'.  You can ask Bash to
  980. not run your `~/.bash_profile' file with the `-noprofile' flag.
  981.  
  982. 
  983. File: features.info,  Node: Bash Builtins,  Next: The Set Builtin,  Prev: Is This Shell Interactive?,  Up: Bash Specific Features
  984.  
  985. Bash Builtin Commands
  986. =====================
  987.  
  988.    This section describes builtin commands which are unique to or have
  989. been extended in Bash.
  990.  
  991. `builtin'
  992.           builtin [SHELL-BUILTIN [ARGS]]
  993.      Run a shell builtin.  This is useful when you wish to rename a
  994.      shell builtin to be a function, but need the functionality of the
  995.      builtin within the function itself.
  996.  
  997. `bind'
  998.           bind [-m KEYMAP] [-lvd] [-q NAME]
  999.           bind [-m KEYMAP] -f FILENAME
  1000.           bind [-m KEYMAP] KEYSEQ:FUNCTION-NAME
  1001.  
  1002.      Display current Readline (*note Command Line Editing::.) key and
  1003.      function bindings, or bind a key sequence to a Readline function
  1004.      or macro.  The binding syntax accepted is identical to that of
  1005.      `.inputrc' (*note Readline Init File::.), but each binding must be
  1006.      passed as a separate argument: `"\C-x\C-r":re-read-init-file'.
  1007.      Options, if supplied, have the following meanings:
  1008.  
  1009.     `-m keymap'
  1010.           Use KEYMAP as the keymap to be affected by the subsequent
  1011.           bindings.  Acceptable KEYMAP names are `emacs',
  1012.           `emacs-standard', `emacs-meta', `emacs-ctlx', `vi', `vi-move',
  1013.           `vi-command', and `vi-insert'.  `vi' is equivalent to
  1014.           `vi-command'; `emacs' is equivalent to `emacs-standard'.
  1015.  
  1016.     `-l'
  1017.           List the names of all readline functions
  1018.  
  1019.     `-v'
  1020.           List current function names and bindings
  1021.  
  1022.     `-d'
  1023.           Dump function names and bindings in such a way that they can
  1024.           be re-read
  1025.  
  1026.     `-f filename'
  1027.           Read key bindings from FILENAME
  1028.  
  1029.     `-q'
  1030.           Query about which keys invoke the named FUNCTION
  1031.  
  1032. `command'
  1033.           command [-pVv] COMMAND [ARGS ...]
  1034.      Runs COMMAND with ARG ignoring shell functions.  If you have a
  1035.      shell function called `ls', and you wish to call the command `ls',
  1036.      you can say `command ls'.  The `-p' option means to use a default
  1037.      value for `$PATH' that is guaranteed to find all of the standard
  1038.      utilities.
  1039.  
  1040.      If either the `-V' or `-v' option is supplied, a description of
  1041.      COMMAND is printed.  The `-v' option causes a single word
  1042.      indicating the command or file name used to invoke COMMAND to be
  1043.      printed; the `-V' option produces a more verbose description.
  1044.  
  1045. `declare'
  1046.           declare [-frxi] [NAME[=VALUE]]
  1047.  
  1048.      Declare variables and/or give them attributes.  If no NAMEs are
  1049.      given, then display the values of variables instead.  `-f' means
  1050.      to use function names only.  `-r' says to make NAMEs readonly.
  1051.      `-x' says to mark NAMEs for export.  `-i' says that the variable
  1052.      is to be treated as an integer; arithmetic evaluation (*note Shell
  1053.      Arithmetic::.) is performed when the variable is assigned a value.
  1054.      Using `+' instead of `-' turns off the attribute instead.  When
  1055.      used in a function, `declare' makes NAMEs local, as with the
  1056.      `local' command.
  1057.  
  1058. `enable'
  1059.           enable [-n] [-a] [NAME ...]
  1060.      Enable and disable builtin shell commands.  This allows you to use
  1061.      a disk command which has the same name as a shell builtin.  If
  1062.      `-n' is used, the NAMEs become disabled.  Otherwise NAMEs are
  1063.      enabled.  For example, to use the `test' binary found via `$PATH'
  1064.      instead of the shell builtin version, type `enable -n test'.  The
  1065.      `-a' option means to list each builtin with an indication of
  1066.      whether or not it is enabled.
  1067.  
  1068. `help'
  1069.           help [PATTERN]
  1070.      Display helpful information about builtin commands.  If PATTERN is
  1071.      specified, `help' gives detailed help on all commands matching
  1072.      PATTERN, otherwise a list of the builtins is printed.
  1073.  
  1074. `local'
  1075.           local NAME[=VALUE]
  1076.      For each argument, create a local variable called NAME, and give
  1077.      it VALUE.  `local' can only be used within a function; it makes
  1078.      the variable NAME have a visible scope restricted to that function
  1079.      and its children.
  1080.  
  1081. `type'
  1082.           type [-all] [-type | -path] [NAME ...]
  1083.      For each NAME, indicate how it would be interpreted if used as a
  1084.      command name.
  1085.  
  1086.      If the `-type' flag is used, `type' returns a single word which is
  1087.      one of "alias", "function", "builtin", "file" or "keyword", if
  1088.      NAME is an alias, shell function, shell builtin, disk file, or
  1089.      shell reserved word, respectively.
  1090.  
  1091.      If the `-path' flag is used, `type' either returns the name of the
  1092.      disk file that would be executed, or nothing if `-type' would not
  1093.      return "file".
  1094.  
  1095.      If the `-all' flag is used, returns all of the places that contain
  1096.      an executable named FILE.  This includes aliases and functions, if
  1097.      and only if the `-path' flag is not also used.
  1098.  
  1099.      `Type' accepts `-a', `-t', and `-p' as equivalent to `-all',
  1100.      `-type', and `-path', respectively.
  1101.  
  1102. `ulimit'
  1103.           ulimit [-acdmstfpnuvSH] [LIMIT]
  1104.      `Ulimit' provides control over the resources available to processes
  1105.      started by the shell, on systems that allow such control.  If an
  1106.      option is given, it is interpreted as follows:
  1107.     `-S'
  1108.           change and report the soft limit associated with a resource
  1109.           (the default if the `-H' option is not given).
  1110.  
  1111.     `-H'
  1112.           change and report the hard limit associated with a resource.
  1113.  
  1114.     `-a'
  1115.           all current limits are reported.
  1116.  
  1117.     `-c'
  1118.           the maximum size of core files created.
  1119.  
  1120.     `-d'
  1121.           the maximum size of a process's data segment.
  1122.  
  1123.     `-m'
  1124.           the maximum resident set size.
  1125.  
  1126.     `-s'
  1127.           the maximum stack size.
  1128.  
  1129.     `-t'
  1130.           the maximum amount of cpu time in seconds.
  1131.  
  1132.     `-f'
  1133.           the maximum size of files created by the shell.
  1134.  
  1135.     `-p'
  1136.           the pipe buffer size.
  1137.  
  1138.     `-n'
  1139.           the maximum number of open file descriptors.
  1140.  
  1141.     `-u'
  1142.           the maximum number of processes available to a single user.
  1143.  
  1144.     `-v'
  1145.           the maximum amount of virtual memory available to the process.
  1146.  
  1147.      If LIMIT is given, it is the new value of the specified resource.
  1148.      Otherwise, the current value of the specified resource is printed.
  1149.      If no option is given, then `-f' is assumed.  Values are in
  1150.      1024-byte increments, except for `-t', which is in seconds, `-p',
  1151.      which is in units of 512-byte blocks, and `-n' and `-u', which are
  1152.      unscaled values.
  1153.  
  1154. 
  1155. File: features.info,  Node: The Set Builtin,  Next: Bash Variables,  Prev: Bash Builtins,  Up: Bash Specific Features
  1156.  
  1157. The Set Builtin
  1158. ===============
  1159.  
  1160.    This builtin is so overloaded that it deserves its own section.
  1161.  
  1162. `set'
  1163.           set [-abefhkmnptuvxldCHP] [-o OPTION] [ARGUMENT ...]
  1164.  
  1165.     `-a'
  1166.           Mark variables which are modified or created for export.
  1167.  
  1168.     `-b'
  1169.           Cause the status of terminated background jobs to be reported
  1170.           immediately, rather than before printing the next primary
  1171.           prompt.
  1172.  
  1173.     `-e'
  1174.           Exit immediately if a command exits with a non-zero status.
  1175.  
  1176.     `-f'
  1177.           Disable file name generation (globbing).
  1178.  
  1179.     `-h'
  1180.           Locate and remember (hash) commands as functions are defined,
  1181.           rather than when the function is executed.
  1182.  
  1183.     `-k'
  1184.           All keyword arguments are placed in the environment for a
  1185.           command, not just those that precede the command name.
  1186.  
  1187.     `-m'
  1188.           Job control is enabled (*note Job Control::.).
  1189.  
  1190.     `-n'
  1191.           Read commands but do not execute them.
  1192.  
  1193.     `-o OPTION-NAME'
  1194.           Set the flag corresponding to OPTION-NAME:
  1195.  
  1196.          `allexport'
  1197.                same as `-a'.
  1198.  
  1199.          `braceexpand'
  1200.                the shell will perform brace expansion (*note Brace
  1201.                Expansion::.).
  1202.  
  1203.          `emacs'
  1204.                use an emacs-style line editing interface (*note Command
  1205.                Line Editing::.).
  1206.  
  1207.          `errexit'
  1208.                same as `-e'.
  1209.  
  1210.          `histexpand'
  1211.                same as `-H'.
  1212.  
  1213.          `ignoreeof'
  1214.                the shell will not exit upon reading EOF.
  1215.  
  1216.          `interactive-comments'
  1217.                allow a word beginning with a `#' to cause that word and
  1218.                all remaining characters on that line to be ignored in an
  1219.                interactive shell.
  1220.  
  1221.          `monitor'
  1222.                same as `-m'.
  1223.  
  1224.          `noclobber'
  1225.                same as `-C'.
  1226.  
  1227.          `noexec'
  1228.                same as `-n'.
  1229.  
  1230.          `noglob'
  1231.                same as `-f'.
  1232.  
  1233.          `nohash'
  1234.                same as `-d'.
  1235.  
  1236.          `notify'
  1237.                same as `-b'.
  1238.  
  1239.          `nounset'
  1240.                same as `-u'.
  1241.  
  1242.          `physical'
  1243.                same as `-P'.
  1244.  
  1245.          `posix'
  1246.                change the behavior of Bash where the default operation
  1247.                differs from the Posix 1003.2 standard to match the
  1248.                standard.  This is intended to make Bash behave as a
  1249.                strict superset of that standard.
  1250.  
  1251.          `privileged'
  1252.                same as `-p'.
  1253.  
  1254.          `verbose'
  1255.                same as `-v'.
  1256.  
  1257.          `vi'
  1258.                use a `vi'-style line editing interface.
  1259.  
  1260.          `xtrace'
  1261.                same as `-x'.
  1262.  
  1263.     `-p'
  1264.           Turn on privileged mode.  In this mode, the `$ENV' file is
  1265.           not processed, and shell functions are not inherited from the
  1266.           environment.  This is enabled automatically on startup if the
  1267.           effective user (group) id is not equal to the real user
  1268.           (group) id.  Turning this option off causes the effective user
  1269.           and group ids to be set to the real user and group ids.
  1270.  
  1271.     `-t'
  1272.           Exit after reading and executing one command.
  1273.  
  1274.     `-u'
  1275.           Treat unset variables as an error when substituting.
  1276.  
  1277.     `-v'
  1278.           Print shell input lines as they are read.
  1279.  
  1280.     `-x'
  1281.           Print commands and their arguments as they are executed.
  1282.  
  1283.     `-l'
  1284.           Save and restore the binding of the NAME in a `for' command.
  1285.  
  1286.     `-d'
  1287.           Disable the hashing of commands that are looked up for
  1288.           execution.  Normally, commands are remembered in a hash
  1289.           table, and once found, do not have to be looked up again.
  1290.  
  1291.     `-C'
  1292.           Disallow output redirection to existing files.
  1293.  
  1294.     `-H'
  1295.           Enable ! style history substitution.  This flag is on by
  1296.           default.
  1297.  
  1298.     `-P'
  1299.           If set, do not follow symbolic links when performing commands
  1300.           such as `cd' which change the current directory.  The
  1301.           physical directory is used instead.
  1302.  
  1303.     `--'
  1304.           If no arguments follow this flag, then the positional
  1305.           parameters are unset.  Otherwise, the positional parameters
  1306.           are set to the ARGUMENTS, even if some of them begin with a
  1307.           `-'.
  1308.  
  1309.     `-'
  1310.           Signal the end of options, cause all remaining ARGUMENTS to
  1311.           be assigned to the positional parameters.  The `-x' and `-v'
  1312.           options are turned off.  If there are no arguments, the
  1313.           positional parameters remain unchanged.
  1314.  
  1315.      Using `+' rather than `-' causes these flags to be turned off.
  1316.      The flags can also be used upon invocation of the shell.  The
  1317.      current set of flags may be found in `$-'.  The remaining N
  1318.      ARGUMENTS are positional parameters and are assigned, in order, to
  1319.      `$1', `$2', ..  `$N'.  If no arguments are given, all shell
  1320.      variables are printed.
  1321.  
  1322. 
  1323. File: features.info,  Node: Bash Variables,  Next: Shell Arithmetic,  Prev: The Set Builtin,  Up: Bash Specific Features
  1324.  
  1325. Bash Variables
  1326. ==============
  1327.  
  1328.    These variables are set or used by bash, but other shells do not
  1329. normally treat them specially.
  1330.  
  1331. `HISTCONTROL'
  1332. `history_control'
  1333.      Set to a value of `ignorespace', it means don't enter lines which
  1334.      begin with a space or tab into the history list.  Set to a value
  1335.      of `ignoredups', it means don't enter lines which match the last
  1336.      entered line.  A value of `ignoreboth' combines the two options.
  1337.      Unset, or set to any other value than those above, means to save
  1338.      all lines on the history list.
  1339.  
  1340. `HISTFILE'
  1341.      The name of the file to which the command history is saved.
  1342.  
  1343. `HISTSIZE'
  1344.      If set, this is the maximum number of commands to remember in the
  1345.      history.
  1346.  
  1347. `histchars'
  1348.      Up to three characters which control history expansion, quick
  1349.      substitution, and tokenization (*note History Interaction::.).
  1350.      The first character is the "history-expansion-char", that is, the
  1351.      character which signifies the start of a history expansion,
  1352.      normally `!'.  The second character is the character which
  1353.      signifies `quick substitution' when seen as the first character on
  1354.      a line, normally `^'.  The optional third character is the
  1355.      character which signifies the remainder of the line is a comment,
  1356.      when found as the first character of a word, usually `#'.  The
  1357.      history comment character causes history substitution to be
  1358.      skipped for the remaining words on the line.  It does not
  1359.      necessarily cause the shell parser to treat the rest of the line
  1360.      as a comment.
  1361.  
  1362. `HISTCMD'
  1363.      The history number, or index in the history list, of the current
  1364.      command.  If `HISTCMD' is unset, it loses its special properties,
  1365.      even if it is subsequently reset.
  1366.  
  1367. `hostname_completion_file'
  1368. `HOSTFILE'
  1369.      Contains the name of a file in the same format as `/etc/hosts' that
  1370.      should be read when the shell needs to complete a hostname.  You
  1371.      can change the file interactively; the next time you attempt to
  1372.      complete a hostname, Bash will add the contents of the new file to
  1373.      the already existing database.
  1374.  
  1375. `MAILCHECK'
  1376.      How often (in seconds) that the shell should check for mail in the
  1377.      files specified in `MAILPATH'.
  1378.  
  1379. `PROMPT_COMMAND'
  1380.      If present, this contains a string which is a command to execute
  1381.      before the printing of each primary prompt (`$PS1').
  1382.  
  1383. `UID'
  1384.      The numeric real user id of the current user.
  1385.  
  1386. `EUID'
  1387.      The numeric effective user id of the current user.
  1388.  
  1389. `HOSTTYPE'
  1390.      A string describing the machine Bash is running on.
  1391.  
  1392. `OSTYPE'
  1393.      A string describing the operating system Bash is running on.
  1394.  
  1395. `FIGNORE'
  1396.      A colon-separated list of suffixes to ignore when performing
  1397.      filename completion A file name whose suffix matches one of the
  1398.      entries in `FIGNORE' is excluded from the list of matched file
  1399.      names.  A sample value is `.o:~'
  1400.  
  1401. `INPUTRC'
  1402.      The name of the Readline startup file, overriding the default of
  1403.      `~/.inputrc'.
  1404.  
  1405. `BASH_VERSION'
  1406.      The version number of the current instance of Bash.
  1407.  
  1408. `IGNOREEOF'
  1409.      Controls the action of the shell on receipt of an `EOF' character
  1410.      as the sole input.  If set, then the value of it is the number of
  1411.      consecutive `EOF' characters that can be read as the first
  1412.      characters on an input line before the shell will exit.  If the
  1413.      variable exists but does not have a numeric value (or has no
  1414.      value) then the default is 10.  If the variable does not exist,
  1415.      then `EOF' signifies the end of input to the shell.  This is only
  1416.      in effect for interactive shells.
  1417.  
  1418. `no_exit_on_failed_exec'
  1419.      If this variable exists, the shell will not exit in the case that
  1420.      it couldn't execute the file specified in the `exec' command.
  1421.  
  1422. `nolinks'
  1423.      If present, says not to follow symbolic links when doing commands
  1424.      that change the current working directory.  By default, bash
  1425.      follows the logical chain of directories when performing commands
  1426.      such as `cd' which change the current directory.
  1427.  
  1428.      For example, if `/usr/sys' is a link to `/usr/local/sys' then:
  1429.           $ cd /usr/sys; echo $PWD
  1430.           /usr/sys
  1431.           $ cd ..; pwd
  1432.           /usr
  1433.  
  1434.      If `nolinks' exists, then:
  1435.           $ cd /usr/sys; echo $PWD
  1436.           /usr/local/sys
  1437.           $ cd ..; pwd
  1438.           /usr/local
  1439.  
  1440.      See also the description of the `-P' option to the `set' builtin,
  1441.      *Note The Set Builtin::.
  1442.  
  1443. 
  1444. File: features.info,  Node: Shell Arithmetic,  Next: Printing a Prompt,  Prev: Bash Variables,  Up: Bash Specific Features
  1445.  
  1446. Shell Arithmetic
  1447. ================
  1448.  
  1449. * Menu:
  1450.  
  1451. * Arithmetic Evaluation::    How shell arithmetic works.
  1452. * Arithmetic Expansion::    How to use arithmetic in shell expansions.
  1453. * Arithmetic Builtins::        Builtin commands that use shell arithmetic.
  1454.  
  1455. 
  1456. File: features.info,  Node: Arithmetic Evaluation,  Next: Arithmetic Expansion,  Up: Shell Arithmetic
  1457.  
  1458. Arithmetic Evaluation
  1459. ---------------------
  1460.  
  1461.    The shell allows arithmetic expressions to be evaluated, as one of
  1462. the shell expansions or by the `let' builtin.
  1463.  
  1464.    Evaluation is done in long integers with no check for overflow,
  1465. though division by 0 is trapped and flagged as an error.  The following
  1466. list of operators is grouped into levels of equal-precedence operators.
  1467. The levels are listed in order of decreasing precedence.
  1468.  
  1469. `- +'
  1470.      unary minus and plus
  1471.  
  1472. `! ~'
  1473.      logical and bitwise negation
  1474.  
  1475. `* / %'
  1476.      multiplication, division, remainder
  1477.  
  1478. `+ -'
  1479.      addition, subtraction
  1480.  
  1481. `<< >>'
  1482.      left and right bitwise shifts
  1483.  
  1484. `<= >= < >'
  1485.      comparison
  1486.  
  1487. `== !='
  1488.      equality and inequality
  1489.  
  1490. `&'
  1491.      bitwise AND
  1492.  
  1493. `^'
  1494.      bitwise exclusive OR
  1495.  
  1496. `|'
  1497.      bitwise OR
  1498.  
  1499. `&&'
  1500.      logical AND
  1501.  
  1502. `||'
  1503.      logical OR
  1504.  
  1505. `= *= /= %= += -= <<= >>= &= ^= |='
  1506.      assignment
  1507.  
  1508.    Shell variables are allowed as operands; parameter expansion is
  1509. performed before the expression is evaluated.  The value of a parameter
  1510. is coerced to a long integer within an expression.  A shell variable
  1511. need not have its integer attribute turned on to be used in an
  1512. expression.
  1513.  
  1514.    Constants with a leading 0 are interpreted as octal numbers.  A
  1515. leading `0x' or `0X' denotes hexadecimal.  Otherwise, numbers take the
  1516. form [BASE#]n, where BASE is a decimal number between 2 and 36
  1517. representing the arithmetic base, and N is a number in that base.  If
  1518. BASE is omitted, then base 10 is used.
  1519.  
  1520.    Operators are evaluated in order of precedence.  Sub-expressions in
  1521. parentheses are evaluated first and may override the precedence rules
  1522. above.
  1523.  
  1524. 
  1525. File: features.info,  Node: Arithmetic Expansion,  Next: Arithmetic Builtins,  Prev: Arithmetic Evaluation,  Up: Shell Arithmetic
  1526.  
  1527. Arithmetic Expansion
  1528. --------------------
  1529.  
  1530.    Arithmetic expansion allows the evaluation of an arithmetic
  1531. expression and the substitution of the result.  There are two formats
  1532. for arithmetic expansion:
  1533.  
  1534.      $[ expression ]
  1535.      $(( expression ))
  1536.  
  1537.    The expression is treated as if it were within double quotes, but a
  1538. double quote inside the braces or parentheses is not treated specially.
  1539. All tokens in the expression undergo parameter expansion, command
  1540. substitution, and quote removal.  Arithmetic substitutions may be
  1541. nested.
  1542.  
  1543.    The evaluation is performed according to the rules listed above.  If
  1544. the expression is invalid, Bash prints a message indicating failure and
  1545. no substitution occurs.
  1546.  
  1547. 
  1548. File: features.info,  Node: Arithmetic Builtins,  Prev: Arithmetic Expansion,  Up: Shell Arithmetic
  1549.  
  1550. Arithmetic Builtins
  1551. -------------------
  1552.  
  1553. `let'
  1554.           let EXPRESSION [EXPRESSION]
  1555.      The `let' builtin allows arithmetic to be performed on shell
  1556.      variables.  Each EXPRESSION is evaluated according to the rules
  1557.      given previously (*note Arithmetic Evaluation::.).  If the last
  1558.      EXPRESSION evaluates to 0, `let' returns 1; otherwise 0 is
  1559.      returned.
  1560.  
  1561. 
  1562. File: features.info,  Node: Printing a Prompt,  Prev: Shell Arithmetic,  Up: Bash Specific Features
  1563.  
  1564. Controlling the Prompt
  1565. ======================
  1566.  
  1567.    The value of the variable `$PROMPT_COMMAND' is examined just before
  1568. Bash prints each primary prompt.  If it is set and non-null, then the
  1569. value is executed just as if you had typed it on the command line.
  1570.  
  1571.    In addition, the following table describes the special characters
  1572. which can appear in the `PS1' variable:
  1573.  
  1574. `\t'
  1575.      the time, in HH:MM:SS format.
  1576.  
  1577. `\d'
  1578.      the date, in "Weekday Month Date" format (e.g. "Tue May 26").
  1579.  
  1580. `\n'
  1581.      newline.
  1582.  
  1583. `\s'
  1584.      the name of the shell, the basename of `$0' (the portion following
  1585.      the final slash).
  1586.  
  1587. `\w'
  1588.      the current working directory.
  1589.  
  1590. `\W'
  1591.      the basename of `$PWD'.
  1592.  
  1593. `\u'
  1594.      your username.
  1595.  
  1596. `\h'
  1597.      the hostname.
  1598.  
  1599. `\#'
  1600.      the command number of this command.
  1601.  
  1602. `\!'
  1603.      the history number of this command.
  1604.  
  1605. `\nnn'
  1606.      the character corresponding to the octal number `nnn'.
  1607.  
  1608. `\$'
  1609.      if the effective uid is 0, `#', otherwise `$'.
  1610.  
  1611. `\\'
  1612.      a backslash.
  1613.  
  1614. `\['
  1615.      begin a sequence of non-printing characters.  This could be used to
  1616.      embed a terminal control sequence into the prompt.
  1617.  
  1618. `\]'
  1619.      end a sequence of non-printing characters.
  1620.  
  1621. 
  1622. File: features.info,  Node: Job Control,  Next: Using History Interactively,  Prev: Bash Specific Features,  Up: Top
  1623.  
  1624. Job Control
  1625. ***********
  1626.  
  1627.    This chapter disusses what job control is, how it works, and how
  1628. Bash allows you to access its facilities.
  1629.  
  1630. * Menu:
  1631.  
  1632. * Job Control Basics::        How job control works.
  1633. * Job Control Builtins::    Bash builtin commands used to interact
  1634.                 with job control.
  1635. * Job Control Variables::    Variables Bash uses to customize job
  1636.                 control.
  1637.  
  1638. 
  1639. File: features.info,  Node: Job Control Basics,  Next: Job Control Builtins,  Up: Job Control
  1640.  
  1641. Job Control Basics
  1642. ==================
  1643.  
  1644.    Job control refers to the ability to selectively stop (suspend) the
  1645. execution of processes and continue (resume) their execution at a later
  1646. point.  A user typically employs this facility via an interactive
  1647. interface supplied jointly by the system's terminal driver and Bash.
  1648.  
  1649.    The shell associates a JOB with each pipeline.  It keeps a table of
  1650. currently executing jobs, which may be listed with the `jobs' command.
  1651. When Bash starts a job asynchronously (in the background), it prints a
  1652. line that looks like:
  1653.      [1] 25647
  1654.    indicating that this job is job number 1 and that the process ID of
  1655. the last process in the pipeline associated with this job is 25647.
  1656. All of the processes in a single pipeline are members of the same job.
  1657. Bash uses the JOB abstraction as the basis for job control.
  1658.  
  1659.    To facilitate the implementation of the user interface to job
  1660. control, the system maintains the notion of a current terminal process
  1661. group ID.  Members of this process group (processes whose process group
  1662. ID is equal to the current terminal process group ID) receive
  1663. keyboard-generated signals such as `SIGINT'.  These processes are said
  1664. to be in the foreground.  Background processes are those whose process
  1665. group ID differs from the terminal's; such processes are immune to
  1666. keyboard-generated signals.  Only foreground processes are allowed to
  1667. read from or write to the terminal.  Background processes which attempt
  1668. to read from (write to) the terminal are sent a `SIGTTIN' (`SIGTTOU')
  1669. signal by the terminal driver, which, unless caught, suspends the
  1670. process.
  1671.  
  1672.    If the operating system on which Bash is running supports job
  1673. control, Bash allows you to use it.  Typing the SUSPEND character
  1674. (typically `^Z', Control-Z) while a process is running causes that
  1675. process to be stopped and returns you to Bash.  Typing the DELAYED
  1676. SUSPEND character (typically `^Y', Control-Y) causes the process to be
  1677. stopped when it attempts to read input from the terminal, and control to
  1678. be returned to Bash.  You may then manipulate the state of this job,
  1679. using the `bg' command to continue it in the background, the `fg'
  1680. command to continue it in the foreground, or the `kill' command to kill
  1681. it.  A `^Z' takes effect immediately, and has the additional side
  1682. effect of causing pending output and typeahead to be discarded.
  1683.  
  1684.    There are a number of ways to refer to a job in the shell.  The
  1685. character `%' introduces a job name.  Job number `n' may be referred to
  1686. as `%n'.  A job may also be referred to using a prefix of the name used
  1687. to start it, or using a substring that appears in its command line.
  1688. For example, `%ce' refers to a stopped `ce' job. Using `%?ce', on the
  1689. other hand, refers to any job containing the string `ce' in its command
  1690. line.  If the prefix or substring matches more than one job, Bash
  1691. reports an error.  The symbols `%%' and `%+' refer to the shell's
  1692. notion of the current job, which is the last job stopped while it was
  1693. in the foreground.  The previous job may be referenced using `%-'.  In
  1694. output pertaining to jobs (e.g., the output of the `jobs' command), the
  1695. current job is always flagged with a `+', and the previous job with a
  1696. `-'.
  1697.  
  1698.    Simply naming a job can be used to bring it into the foreground:
  1699. `%1' is a synonym for `fg %1' bringing job 1 from the background into
  1700. the foreground.  Similarly, `%1 &' resumes job 1 in the background,
  1701. equivalent to `bg %1'
  1702.  
  1703.    The shell learns immediately whenever a job changes state.
  1704. Normally, Bash waits until it is about to print a prompt before
  1705. reporting changes in a job's status so as to not interrupt any other
  1706. output.  If the the `-b' option to the `set' builtin is set, Bash
  1707. reports such changes immediately (*note The Set Builtin::.).  This
  1708. feature is also controlled by the variable `notify'.
  1709.  
  1710.    If you attempt to exit bash while jobs are stopped, the shell prints
  1711. a message warning you.  You may then use the `jobs' command to inspect
  1712. their status.  If you do this, or try to exit again immediately, you
  1713. are not warned again, and the stopped jobs are terminated.
  1714.  
  1715. 
  1716. File: features.info,  Node: Job Control Builtins,  Next: Job Control Variables,  Prev: Job Control Basics,  Up: Job Control
  1717.  
  1718. Job Control Builtins
  1719. ====================
  1720.  
  1721. `bg'
  1722.           bg [JOBSPEC]
  1723.      Place JOBSPEC into the background, as if it had been started with
  1724.      `&'.  If JOBSPEC is not supplied, the current job is used.
  1725.  
  1726. `fg'
  1727.           fg [JOBSPEC]
  1728.      Bring JOBSPEC into the foreground and make it the current job.  If
  1729.      JOBSPEC is not supplied, the current job is used.
  1730.  
  1731. `jobs'
  1732.           jobs [-lpn] [JOBSPEC]
  1733.           jobs -x COMMAND [JOBSPEC]
  1734.  
  1735.      The first form lists the active jobs.  The `-l' option lists
  1736.      process IDs in addition to the normal information; the `-p' option
  1737.      lists only the process ID of the job's process group leader.  The
  1738.      `-n' option displays only jobs that have changed status since last
  1739.      notfied.  If JOBSPEC is given, output is restricted to information
  1740.      about that job.  If JOBSPEC is not supplied, the status of all
  1741.      jobs is listed.
  1742.  
  1743.      If the `-x' option is supplied, `jobs' replaces any JOBSPEC found
  1744.      in COMMAND or ARGUMENTS with the corresponding process group ID,
  1745.      and executes COMMAND, passing it ARGUMENTs, returning its exit
  1746.      status.
  1747.  
  1748. `suspend'
  1749.           suspend [-f]
  1750.      Suspend the execution of this shell until it receives a `SIGCONT'
  1751.      signal.  The `-f' option means to suspend even if the shell is a
  1752.      login shell.
  1753.  
  1754.    When job control is active, the `kill' and `wait' builtins also
  1755. accept JOBSPEC arguments.
  1756.  
  1757. 
  1758. File: features.info,  Node: Job Control Variables,  Prev: Job Control Builtins,  Up: Job Control
  1759.  
  1760. Job Control Variables
  1761. =====================
  1762.  
  1763. `auto_resume'
  1764.      This variable controls how the shell interacts with the user and
  1765.      job control.  If this variable exists then single word simple
  1766.      commands without redirects are treated as candidates for resumption
  1767.      of an existing job.  There is no ambiguity allowed; if you have
  1768.      more than one job beginning with the string that you have typed,
  1769.      then the most recently accessed job will be selected.  The name of
  1770.      a stopped job, in this context, is the command line used to start
  1771.      it.  If this variable is set to the value `exact', the string
  1772.      supplied must match the name of a stopped job exactly; if set to
  1773.      `substring', the string supplied needs to match a substring of the
  1774.      name of a stopped job.  The `substring' value provides
  1775.      functionality analogous to the `%?' job id (*note Job Control
  1776.      Basics::.).  If set to any other value, the supplied string must
  1777.      be a prefix of a stopped job's name; this provides functionality
  1778.      analogous to the `%' job id.
  1779.  
  1780. `notify'
  1781.      Setting this variable to a value is equivalent to `set -b';
  1782.      unsetting it is equivalent to `set +b' (*note The Set Builtin::.).
  1783.  
  1784. 
  1785. File: features.info,  Node: Using History Interactively,  Next: Command Line Editing,  Prev: Job Control,  Up: Top
  1786.  
  1787. Using History Interactively
  1788. ***************************
  1789.  
  1790.    This chapter describes how to use the GNU History Library
  1791. interactively, from a user's standpoint.  It should be considered a
  1792. user's guide.  For information on using the GNU History Library in your
  1793. own programs, see the GNU Readline Library Manual.
  1794.  
  1795. * Menu:
  1796.  
  1797. * History Interaction::        What it feels like using History as a user.
  1798.  
  1799. 
  1800. File: features.info,  Node: History Interaction,  Up: Using History Interactively
  1801.  
  1802. History Interaction
  1803. ===================
  1804.  
  1805.    The History library provides a history expansion feature that is
  1806. similar to the history expansion provided by `csh'.  The following text
  1807. describes the syntax used to manipulate the history information.
  1808.  
  1809.    History expansion takes place in two parts.  The first is to
  1810. determine which line from the previous history should be used during
  1811. substitution.  The second is to select portions of that line for
  1812. inclusion into the current one.  The line selected from the previous
  1813. history is called the "event", and the portions of that line that are
  1814. acted upon are called "words".  The line is broken into words in the
  1815. same fashion that Bash does, so that several English (or Unix) words
  1816. surrounded by quotes are considered as one word.
  1817.  
  1818. * Menu:
  1819.  
  1820. * Event Designators::    How to specify which history line to use.
  1821. * Word Designators::    Specifying which words are of interest.
  1822. * Modifiers::        Modifying the results of substitution.
  1823.  
  1824. 
  1825. File: features.info,  Node: Event Designators,  Next: Word Designators,  Up: History Interaction
  1826.  
  1827. Event Designators
  1828. -----------------
  1829.  
  1830.    An event designator is a reference to a command line entry in the
  1831. history list.
  1832.  
  1833. `!'
  1834.      Start a history substitution, except when followed by a space, tab,
  1835.      the end of the line, = or (.
  1836.  
  1837. `!!'
  1838.      Refer to the previous command.  This is a synonym for `!-1'.
  1839.  
  1840. `!n'
  1841.      Refer to command line N.
  1842.  
  1843. `!-n'
  1844.      Refer to the command N lines back.
  1845.  
  1846. `!string'
  1847.      Refer to the most recent command starting with STRING.
  1848.  
  1849. `!?string'[`?']
  1850.      Refer to the most recent command containing STRING.
  1851.  
  1852. `!#'
  1853.      The entire command line typed so far.
  1854.  
  1855. `^string1^string2^'
  1856.      Quick Substitution.  Repeat the last command, replacing STRING1
  1857.      with STRING2.  Equivalent to `!!:s/string1/string2/'.
  1858.  
  1859. 
  1860. File: features.info,  Node: Word Designators,  Next: Modifiers,  Prev: Event Designators,  Up: History Interaction
  1861.  
  1862. Word Designators
  1863. ----------------
  1864.  
  1865.    A : separates the event specification from the word designator.  It
  1866. can be omitted if the word designator begins with a ^, $, * or %.
  1867. Words are numbered from the beginning of the line, with the first word
  1868. being denoted by a 0 (zero).
  1869.  
  1870. `0 (zero)'
  1871.      The `0'th word.  For many applications, this is the command word.
  1872.  
  1873. `n'
  1874.      The Nth word.
  1875.  
  1876. `^'
  1877.      The first argument;  that is, word 1.
  1878.  
  1879. `$'
  1880.      The last argument.
  1881.  
  1882. `%'
  1883.      The word matched by the most recent `?string?' search.
  1884.  
  1885. `x-y'
  1886.      A range of words; `-Y' abbreviates `0-Y'.
  1887.  
  1888. `*'
  1889.      All of the words, except the `0'th.  This is a synonym for `1-$'.
  1890.      It is not an error to use * if there is just one word in the event;
  1891.      the empty string is returned in that case.
  1892.  
  1893. `x*'
  1894.      Abbreviates `x-$'
  1895.  
  1896. `x-'
  1897.      Abbreviates `x-$' like `x*', but omits the last word.
  1898.  
  1899. 
  1900. File: features.info,  Node: Modifiers,  Prev: Word Designators,  Up: History Interaction
  1901.  
  1902. Modifiers
  1903. ---------
  1904.  
  1905.    After the optional word designator, you can add a sequence of one or
  1906. more of the following modifiers, each preceded by a :.
  1907.  
  1908. `h'
  1909.      Remove a trailing pathname component, leaving only the head.
  1910.  
  1911. `r'
  1912.      Remove a trailing suffix of the form `.'SUFFIX, leaving the
  1913.      basename.
  1914.  
  1915. `e'
  1916.      Remove all but the trailing suffix.
  1917.  
  1918. `t'
  1919.      Remove all leading  pathname  components, leaving the tail.
  1920.  
  1921. `p'
  1922.      Print the new command but do not execute it.
  1923.  
  1924. `q'
  1925.      Quote the substituted words, escaping further substitutions.
  1926.  
  1927. `x'
  1928.      Quote the substituted words as with `q', but break into words at
  1929.      spaces, tabs, and newlines.
  1930.  
  1931. `s/old/new/'
  1932.      Substitute NEW for the first occurrence of OLD in the event line.
  1933.      Any delimiter may be used in place of /.  The delimiter may be
  1934.      quoted in OLD and NEW with a single backslash.  If & appears in
  1935.      NEW, it is replaced by OLD.  A single backslash will quote the &.
  1936.      The final delimiter is optional if it is the last character on the
  1937.      input line.
  1938.  
  1939. `&'
  1940.      Repeat the previous substitution.
  1941.  
  1942. `g'
  1943.      Cause changes to be applied over the entire event line.  Used in
  1944.      conjunction with `s', as in `gs/old/new/', or with `&'.
  1945.  
  1946. 
  1947. File: features.info,  Node: Command Line Editing,  Next: Variable Index,  Prev: Using History Interactively,  Up: Top
  1948.  
  1949. Command Line Editing
  1950. ********************
  1951.  
  1952.    This chapter describes the basic features of the GNU command line
  1953. editing interface.
  1954.  
  1955. * Menu:
  1956.  
  1957. * Introduction and Notation::    Notation used in this text.
  1958. * Readline Interaction::    The minimum set of commands for editing a line.
  1959. * Readline Init File::        Customizing Readline from a user's view.
  1960. * Bindable Readline Commands::    A description of most of the Readline commands
  1961.                 available for binding
  1962. * Readline vi Mode::        A short description of how to make Readline
  1963.                 behave like the vi editor.
  1964.  
  1965. 
  1966. File: features.info,  Node: Introduction and Notation,  Next: Readline Interaction,  Up: Command Line Editing
  1967.  
  1968. Introduction to Line Editing
  1969. ============================
  1970.  
  1971.    The following paragraphs describe the notation used to represent
  1972. keystrokes.
  1973.  
  1974.    The text C-k is read as `Control-K' and describes the character
  1975. produced when the Control key is depressed and the k key is struck.
  1976.  
  1977.    The text M-k is read as `Meta-K' and describes the character
  1978. produced when the meta key (if you have one) is depressed, and the k
  1979. key is struck.  If you do not have a meta key, the identical keystroke
  1980. can be generated by typing ESC first, and then typing k.  Either
  1981. process is known as "metafying" the k key.
  1982.  
  1983.    The text M-C-k is read as `Meta-Control-k' and describes the
  1984. character produced by "metafying" C-k.
  1985.  
  1986.    In addition, several keys have their own names.  Specifically, DEL,
  1987. ESC, LFD, SPC, RET, and TAB all stand for themselves when seen in this
  1988. text, or in an init file (*note Readline Init File::., for more info).
  1989.  
  1990. 
  1991. File: features.info,  Node: Readline Interaction,  Next: Readline Init File,  Prev: Introduction and Notation,  Up: Command Line Editing
  1992.  
  1993. Readline Interaction
  1994. ====================
  1995.  
  1996.    Often during an interactive session you type in a long line of text,
  1997. only to notice that the first word on the line is misspelled.  The
  1998. Readline library gives you a set of commands for manipulating the text
  1999. as you type it in, allowing you to just fix your typo, and not forcing
  2000. you to retype the majority of the line.  Using these editing commands,
  2001. you move the cursor to the place that needs correction, and delete or
  2002. insert the text of the corrections.  Then, when you are satisfied with
  2003. the line, you simply press RETURN.  You do not have to be at the end of
  2004. the line to press RETURN; the entire line is accepted regardless of the
  2005. location of the cursor within the line.
  2006.  
  2007. * Menu:
  2008.  
  2009. * Readline Bare Essentials::    The least you need to know about Readline.
  2010. * Readline Movement Commands::    Moving about the input line.
  2011. * Readline Killing Commands::    How to delete text, and how to get it back!
  2012. * Readline Arguments::        Giving numeric arguments to commands.
  2013.  
  2014. 
  2015. File: features.info,  Node: Readline Bare Essentials,  Next: Readline Movement Commands,  Up: Readline Interaction
  2016.  
  2017. Readline Bare Essentials
  2018. ------------------------
  2019.  
  2020.    In order to enter characters into the line, simply type them.  The
  2021. typed character appears where the cursor was, and then the cursor moves
  2022. one space to the right.  If you mistype a character, you can use your
  2023. erase character to back up and delete the mistyped character.
  2024.  
  2025.    Sometimes you may miss typing a character that you wanted to type,
  2026. and not notice your error until you have typed several other
  2027. characters.  In that case, you can type C-b to move the cursor to the
  2028. left, and then correct your mistake.  Afterwards, you can move the
  2029. cursor to the right with C-f.
  2030.  
  2031.    When you add text in the middle of a line, you will notice that
  2032. characters to the right of the cursor are `pushed over' to make room
  2033. for the text that you have inserted.  Likewise, when you delete text
  2034. behind the cursor, characters to the right of the cursor are `pulled
  2035. back' to fill in the blank space created by the removal of the text.  A
  2036. list of the basic bare essentials for editing the text of an input line
  2037. follows.
  2038.  
  2039. C-b
  2040.      Move back one character.
  2041.  
  2042. C-f
  2043.      Move forward one character.
  2044.  
  2045. DEL
  2046.      Delete the character to the left of the cursor.
  2047.  
  2048. C-d
  2049.      Delete the character underneath the cursor.
  2050.  
  2051. Printing characters
  2052.      Insert the character into the line at the cursor.
  2053.  
  2054. C-_
  2055.      Undo the last thing that you did.  You can undo all the way back
  2056.      to an empty line.
  2057.  
  2058. 
  2059. File: features.info,  Node: Readline Movement Commands,  Next: Readline Killing Commands,  Prev: Readline Bare Essentials,  Up: Readline Interaction
  2060.  
  2061. Readline Movement Commands
  2062. --------------------------
  2063.  
  2064.    The above table describes the most basic possible keystrokes that
  2065. you need in order to do editing of the input line.  For your
  2066. convenience, many other commands have been added in addition to C-b,
  2067. C-f, C-d, and DEL.  Here are some commands for moving more rapidly
  2068. about the line.
  2069.  
  2070. C-a
  2071.      Move to the start of the line.
  2072.  
  2073. C-e
  2074.      Move to the end of the line.
  2075.  
  2076. M-f
  2077.      Move forward a word.
  2078.  
  2079. M-b
  2080.      Move backward a word.
  2081.  
  2082. C-l
  2083.      Clear the screen, reprinting the current line at the top.
  2084.  
  2085.    Notice how C-f moves forward a character, while M-f moves forward a
  2086. word.  It is a loose convention that control keystrokes operate on
  2087. characters while meta keystrokes operate on words.
  2088.  
  2089. 
  2090. File: features.info,  Node: Readline Killing Commands,  Next: Readline Arguments,  Prev: Readline Movement Commands,  Up: Readline Interaction
  2091.  
  2092. Readline Killing Commands
  2093. -------------------------
  2094.  
  2095.    "Killing" text means to delete the text from the line, but to save
  2096. it away for later use, usually by "yanking" (re-inserting) it back into
  2097. the line.  If the description for a command says that it `kills' text,
  2098. then you can be sure that you can get the text back in a different (or
  2099. the same) place later.
  2100.  
  2101.    When you use a kill command, the text is saved in a "kill-ring".
  2102. Any number of consecutive kills save all of the killed text together, so
  2103. that when you yank it back, you get it all.  The kill ring is not line
  2104. specific; the text that you killed on a previously typed line is
  2105. available to be yanked back later, when you are typing another line.
  2106.  
  2107.    Here is the list of commands for killing text.
  2108.  
  2109. C-k
  2110.      Kill the text from the current cursor position to the end of the
  2111.      line.
  2112.  
  2113. M-d
  2114.      Kill from the cursor to the end of the current word, or if between
  2115.      words, to the end of the next word.
  2116.  
  2117. M-DEL
  2118.      Kill from the cursor the start of the previous word, or if between
  2119.      words, to the start of the previous word.
  2120.  
  2121. C-w
  2122.      Kill from the cursor to the previous whitespace.  This is
  2123.      different than M-DEL because the word boundaries differ.
  2124.  
  2125.    And, here is how to "yank" the text back into the line.  Yanking
  2126. means to copy the most-recently-killed text from the kill buffer.
  2127.  
  2128. C-y
  2129.      Yank the most recently killed text back into the buffer at the
  2130.      cursor.
  2131.  
  2132. M-y
  2133.      Rotate the kill-ring, and yank the new top.  You can only do this
  2134.      if the prior command is C-y or M-y.
  2135.  
  2136. 
  2137. File: features.info,  Node: Readline Arguments,  Prev: Readline Killing Commands,  Up: Readline Interaction
  2138.  
  2139. Readline Arguments
  2140. ------------------
  2141.  
  2142.    You can pass numeric arguments to Readline commands.  Sometimes the
  2143. argument acts as a repeat count, other times it is the sign of the
  2144. argument that is significant.  If you pass a negative argument to a
  2145. command which normally acts in a forward direction, that command will
  2146. act in a backward direction.  For example, to kill text back to the
  2147. start of the line, you might type M- C-k.
  2148.  
  2149.    The general way to pass numeric arguments to a command is to type
  2150. meta digits before the command.  If the first `digit' you type is a
  2151. minus sign (-), then the sign of the argument will be negative.  Once
  2152. you have typed one meta digit to get the argument started, you can type
  2153. the remainder of the digits, and then the command.  For example, to give
  2154. the C-d command an argument of 10, you could type M-1 0 C-d.
  2155.  
  2156. 
  2157. File: features.info,  Node: Readline Init File,  Next: Bindable Readline Commands,  Prev: Readline Interaction,  Up: Command Line Editing
  2158.  
  2159. Readline Init File
  2160. ==================
  2161.  
  2162.    Although the Readline library comes with a set of Emacs-like
  2163. keybindings installed by default, it is possible that you would like to
  2164. use a different set of keybindings.  You can customize programs that
  2165. use Readline by putting commands in an "init" file in your home
  2166. directory.  The name of this file is taken from the value of the shell
  2167. variable `INPUTRC'.  If that variable is unset, the default is
  2168. `~/.inputrc'.
  2169.  
  2170.    When a program which uses the Readline library starts up, the init
  2171. file is read, and the key bindings are set.
  2172.  
  2173.    In addition, the `C-x C-r' command re-reads this init file, thus
  2174. incorporating any changes that you might have made to it.
  2175.  
  2176. * Menu:
  2177.  
  2178. * Readline Init Syntax::    Syntax for the commands in the inputrc file.
  2179. * Conditional Init Constructs::    Conditional key bindings in the inputrc file.
  2180.  
  2181. 
  2182. File: features.info,  Node: Readline Init Syntax,  Next: Conditional Init Constructs,  Up: Readline Init File
  2183.  
  2184. Readline Init Syntax
  2185. --------------------
  2186.  
  2187.    There are only a few basic constructs allowed in the Readline init
  2188. file.  Blank lines are ignored.  Lines beginning with a # are comments.
  2189. Lines beginning with a $ indicate conditional constructs (*note
  2190. Conditional Init Constructs::.).  Other lines denote variable settings
  2191. and key bindings.
  2192.  
  2193. Variable Settings
  2194.      You can change the state of a few variables in Readline by using
  2195.      the `set' command within the init file.  Here is how you would
  2196.      specify that you wish to use `vi' line editing commands:
  2197.  
  2198.           set editing-mode vi
  2199.  
  2200.      Right now, there are only a few variables which can be set; so
  2201.      few, in fact, that we just list them here:
  2202.  
  2203.     `editing-mode'
  2204.           The `editing-mode' variable controls which editing mode you
  2205.           are using.  By default, Readline starts up in Emacs editing
  2206.           mode, where the keystrokes are most similar to Emacs.  This
  2207.           variable can be set to either `emacs' or `vi'.
  2208.  
  2209.     `horizontal-scroll-mode'
  2210.           This variable can be set to either `On' or `Off'.  Setting it
  2211.           to `On' means that the text of the lines that you edit will
  2212.           scroll horizontally on a single screen line when they are
  2213.           longer than the width of the screen, instead of wrapping onto
  2214.           a new screen line.  By default, this variable is set to `Off'.
  2215.  
  2216.     `mark-modified-lines'
  2217.           This variable, when set to `On', says to display an asterisk
  2218.           (`*') at the start of history lines which have been modified.
  2219.           This variable is `off' by default.
  2220.  
  2221.     `bell-style'
  2222.           Controls what happens when Readline wants to ring the
  2223.           terminal bell.  If set to `none', Readline never rings the
  2224.           bell.  If set to `visible', Readline uses a visible bell if
  2225.           one is available.  If set to `audible' (the default),
  2226.           Readline attempts to ring the terminal's bell.
  2227.  
  2228.     `comment-begin'
  2229.           The string to insert at the beginning of the line when the
  2230.           `vi-comment' command is executed.  The default value is `"#"'.
  2231.  
  2232.     `meta-flag'
  2233.           If set to `on', Readline will enable eight-bit input (it will
  2234.           not strip the eighth bit from the characters it reads),
  2235.           regardless of what the terminal claims it can support.  The
  2236.           default value is `off'.
  2237.  
  2238.     `convert-meta'
  2239.           If set to `on', Readline will convert characters with the
  2240.           eigth bit set to an ASCII key sequence by stripping the eigth
  2241.           bit and prepending an ESC character, converting them to a
  2242.           meta-prefixed key sequence.  The default value is `on'.
  2243.  
  2244.     `output-meta'
  2245.           If set to `on', Readline will display characters with the
  2246.           eighth bit set directly rather than as a meta-prefixed escape
  2247.           sequence.  The default is `off'.
  2248.  
  2249.     `completion-query-items'
  2250.           The number of possible completions that determines when the
  2251.           user is asked whether he wants to see the list of
  2252.           possibilities.  If the number of possible completions is
  2253.           greater than this value, Readline will ask the user whether
  2254.           or not he wishes to view them; otherwise, they are simply
  2255.           listed.  The default limit is `100'.
  2256.  
  2257.     `keymap'
  2258.           Sets Readline's idea of the current keymap for key binding
  2259.           commands.  Acceptable `keymap' names are `emacs',
  2260.           `emacs-standard', `emacs-meta', `emacs-ctlx', `vi', `vi-move',
  2261.           `vi-command', and `vi-insert'.  `vi' is equivalent to
  2262.           `vi-command'; `emacs' is equivalent to `emacs-standard'.  The
  2263.           default value is `emacs'.  The value of the `editing-mode'
  2264.           variable also affects the default keymap.
  2265.  
  2266.     `show-all-if-ambiguous'
  2267.           This alters the default behavior of the completion functions.
  2268.           If set to `on', words which have more than one possible
  2269.           completion cause the matches to be listed immediately instead
  2270.           of ringing the bell.  The default value is `off'.
  2271.  
  2272.     `expand-tilde'
  2273.           If set to `on', tilde expansion is performed when Readline
  2274.           attempts word completion.  The default is `off'.
  2275.  
  2276. Key Bindings
  2277.      The syntax for controlling key bindings in the init file is
  2278.      simple.  First you have to know the name of the command that you
  2279.      want to change.  The following pages contain tables of the command
  2280.      name, the default keybinding, and a short description of what the
  2281.      command does.
  2282.  
  2283.      Once you know the name of the command, simply place the name of
  2284.      the key you wish to bind the command to, a colon, and then the
  2285.      name of the command on a line in the init file.  The name of the
  2286.      key can be expressed in different ways, depending on which is most
  2287.      comfortable for you.
  2288.  
  2289.     KEYNAME: FUNCTION-NAME or MACRO
  2290.           KEYNAME is the name of a key spelled out in English.  For
  2291.           example:
  2292.                Control-u: universal-argument
  2293.                Meta-Rubout: backward-kill-word
  2294.                Control-o: ">&output"
  2295.  
  2296.           In the above example, `C-u' is bound to the function
  2297.           `universal-argument', and `C-o' is bound to run the macro
  2298.           expressed on the right hand side (that is, to insert the text
  2299.           `>&output' into the line).
  2300.  
  2301.     "KEYSEQ": FUNCTION-NAME or MACRO
  2302.           KEYSEQ differs from KEYNAME above in that strings denoting an
  2303.           entire key sequence can be specified, by placing the key
  2304.           sequence in double quotes.  Some GNU Emacs style key escapes
  2305.           can be used, as in the following example, but the special
  2306.           character names are not recognized.
  2307.  
  2308.                "\C-u": universal-argument
  2309.                "\C-x\C-r": re-read-init-file
  2310.                "\e[11~": "Function Key 1"
  2311.  
  2312.           In the above example, `C-u' is bound to the function
  2313.           `universal-argument' (just as it was in the first example),
  2314.           `C-x C-r' is bound to the function `re-read-init-file', and
  2315.           `ESC [ 1 1 ~' is bound to insert the text `Function Key 1'.
  2316.           The following escape sequences are available when specifying
  2317.           key sequences:
  2318.  
  2319.          ``\C-''
  2320.                control prefix
  2321.  
  2322.          ``\M-''
  2323.                meta prefix
  2324.  
  2325.          ``\e''
  2326.                an escape character
  2327.  
  2328.          ``\\''
  2329.                backslash
  2330.  
  2331.          ``\"''
  2332.                "
  2333.  
  2334.          ``\'''
  2335.                '
  2336.  
  2337.           When entering the text of a macro, single or double quotes
  2338.           should be used to indicate a macro definition.  Unquoted text
  2339.           is assumed to be a function name.  Backslash will quote any
  2340.           character in the macro text, including " and '.  For example,
  2341.           the following binding will make `C-x \' insert a single \
  2342.           into the line:
  2343.                "\C-x\\": "\\"
  2344.  
  2345. 
  2346. File: features.info,  Node: Conditional Init Constructs,  Prev: Readline Init Syntax,  Up: Readline Init File
  2347.  
  2348. Conditional Init Constructs
  2349. ---------------------------
  2350.  
  2351.    Readline implements a facility similar in spirit to the conditional
  2352. compilation features of the C preprocessor which allows key bindings
  2353. and variable settings to be performed as the result of tests.  There
  2354. are three parser directives used.
  2355.  
  2356. `$if'
  2357.      The `$if' construct allows bindings to be made based on the
  2358.      editing mode, the terminal being used, or the application using
  2359.      Readline.  The text of the test extends to the end of the line; no
  2360.      characters are required to isolate it.
  2361.  
  2362.     `mode'
  2363.           The `mode=' form of the `$if' directive is used to test
  2364.           whether Readline is in `emacs' or `vi' mode.  This may be
  2365.           used in conjunction with the `set keymap' command, for
  2366.           instance, to set bindings in the `emacs-standard' and
  2367.           `emacs-ctlx' keymaps only if Readline is starting out in
  2368.           `emacs' mode.
  2369.  
  2370.     `term'
  2371.           The `term=' form may be used to include terminal-specific key
  2372.           bindings, perhaps to bind the key sequences output by the
  2373.           terminal's function keys.  The word on the right side of the
  2374.           `=' is tested against the full name of the terminal and the
  2375.           portion of the terminal name before the first `-'.  This
  2376.           allows SUN to match both SUN and SUN-CMD, for instance.
  2377.  
  2378.     `application'
  2379.           The APPLICATION construct is used to include
  2380.           application-specific settings.  Each program using the
  2381.           Readline library sets the APPLICATION NAME, and you can test
  2382.           for it.  This could be used to bind key sequences to
  2383.           functions useful for a specific program.  For instance, the
  2384.           following command adds a key sequence that quotes the current
  2385.           or previous word in Bash:
  2386.                $if bash
  2387.                # Quote the current or previous word
  2388.                "\C-xq": "\eb\"\ef\""
  2389.                $endif
  2390.  
  2391. `$endif'
  2392.      This command, as you saw in the previous example, terminates an
  2393.      `$if' command.
  2394.  
  2395. `$else'
  2396.      Commands in this branch of the `$if' directive are executed if the
  2397.      test fails.
  2398.  
  2399. 
  2400. File: features.info,  Node: Bindable Readline Commands,  Next: Readline vi Mode,  Prev: Readline Init File,  Up: Command Line Editing
  2401.  
  2402. Bindable Readline Commands
  2403. ==========================
  2404.  
  2405. * Menu:
  2406.  
  2407. * Commands For Moving::        Moving about the line.
  2408. * Commands For History::    Getting at previous lines.
  2409. * Commands For Text::        Commands for changing text.
  2410. * Commands For Killing::    Commands for killing and yanking.
  2411. * Numeric Arguments::        Specifying numeric arguments, repeat counts.
  2412. * Commands For Completion::    Getting Readline to do the typing for you.
  2413. * Keyboard Macros::        Saving and re-executing typed characters
  2414. * Miscellaneous Commands::    Other miscellaneous commands.
  2415.  
  2416. 
  2417. File: features.info,  Node: Commands For Moving,  Next: Commands For History,  Up: Bindable Readline Commands
  2418.  
  2419. Commands For Moving
  2420. -------------------
  2421.  
  2422. `beginning-of-line (C-a)'
  2423.      Move to the start of the current line.
  2424.  
  2425. `end-of-line (C-e)'
  2426.      Move to the end of the line.
  2427.  
  2428. `forward-char (C-f)'
  2429.      Move forward a character.
  2430.  
  2431. `backward-char (C-b)'
  2432.      Move back a character.
  2433.  
  2434. `forward-word (M-f)'
  2435.      Move forward to the end of the next word.  Words are composed of
  2436.      letters and digits.
  2437.  
  2438. `backward-word (M-b)'
  2439.      Move back to the start of this, or the previous, word.  Words are
  2440.      composed of letters and digits.
  2441.  
  2442. `clear-screen (C-l)'
  2443.      Clear the screen and redraw the current line, leaving the current
  2444.      line at the top of the screen.
  2445.  
  2446. `redraw-current-line ()'
  2447.      Refresh the current line.  By default, this is unbound.
  2448.  
  2449. 
  2450. File: features.info,  Node: Commands For History,  Next: Commands For Text,  Prev: Commands For Moving,  Up: Bindable Readline Commands
  2451.  
  2452. Commands For Manipulating The History
  2453. -------------------------------------
  2454.  
  2455. `accept-line (Newline, Return)'
  2456.      Accept the line regardless of where the cursor is.  If this line is
  2457.      non-empty, add it to the history list according to the setting of
  2458.      the `HISTCONTROL' variable.  If this line was a history line, then
  2459.      restore the history line to its original state.
  2460.  
  2461. `previous-history (C-p)'
  2462.      Move `up' through the history list.
  2463.  
  2464. `next-history (C-n)'
  2465.      Move `down' through the history list.
  2466.  
  2467. `beginning-of-history (M-<)'
  2468.      Move to the first line in the history.
  2469.  
  2470. `end-of-history (M->)'
  2471.      Move to the end of the input history, i.e., the line you are
  2472.      entering.
  2473.  
  2474. `reverse-search-history (C-r)'
  2475.      Search backward starting at the current line and moving `up'
  2476.      through the history as necessary.  This is an incremental search.
  2477.  
  2478. `forward-search-history (C-s)'
  2479.      Search forward starting at the current line and moving `down'
  2480.      through the the history as necessary.  This is an incremental
  2481.      search.
  2482.  
  2483. `non-incremental-reverse-search-history (M-p)'
  2484.      Search backward starting at the current line and moving `up'
  2485.      through the history as necessary using a non-incremental search
  2486.      for a string supplied by the user.
  2487.  
  2488. `non-incremental-forward-search-history (M-n)'
  2489.      Search forward starting at the current line and moving `down'
  2490.      through the the history as necessary using a non-incremental search
  2491.      for a string supplied by the user.
  2492.  
  2493. `history-search-forward ()'
  2494.      Search forward through the history for the string of characters
  2495.      between the start of the current line and the current point.  This
  2496.      is a non-incremental search.  By default, this command is unbound.
  2497.  
  2498. `history-search-backward ()'
  2499.      Search backward through the history for the string of characters
  2500.      between the start of the current line and the current point.  This
  2501.      is a non-incremental search.  By default, this command is unbound.
  2502.  
  2503. `yank-nth-arg (M-C-y)'
  2504.      Insert the first argument to the previous command (usually the
  2505.      second word on the previous line).  With an argument N, insert the
  2506.      Nth word from the previous command (the words in the previous
  2507.      command begin with word 0).  A negative argument inserts the Nth
  2508.      word from the end of the previous command.
  2509.  
  2510. `yank-last-arg (M-., M-_)'
  2511.      Insert last argument to the previous command (the last word on the
  2512.      previous line).  With an argument, behave exactly like
  2513.      `yank-nth-arg'.
  2514.  
  2515. 
  2516. File: features.info,  Node: Commands For Text,  Next: Commands For Killing,  Prev: Commands For History,  Up: Bindable Readline Commands
  2517.  
  2518. Commands For Changing Text
  2519. --------------------------
  2520.  
  2521. `delete-char (C-d)'
  2522.      Delete the character under the cursor.  If the cursor is at the
  2523.      beginning of the line, there are no characters in the line, and
  2524.      the last character typed was not C-d, then return EOF.
  2525.  
  2526. `backward-delete-char (Rubout)'
  2527.      Delete the character behind the cursor.  A numeric arg says to kill
  2528.      the characters instead of deleting them.
  2529.  
  2530. `quoted-insert (C-q, C-v)'
  2531.      Add the next character that you type to the line verbatim.  This is
  2532.      how to insert key sequences like C-q, for example.
  2533.  
  2534. `tab-insert (M-TAB)'
  2535.      Insert a tab character.
  2536.  
  2537. `self-insert (a, b, A, 1, !, ...)'
  2538.      Insert yourself.
  2539.  
  2540. `transpose-chars (C-t)'
  2541.      Drag the character before the cursor forward over the character at
  2542.      the cursor, moving the cursor forward as well.  If the insertion
  2543.      point is at the end of the line, then this transposes the last two
  2544.      characters of the line.  Negative argumentss don't work.
  2545.  
  2546. `transpose-words (M-t)'
  2547.      Drag the word behind the cursor past the word in front of the
  2548.      cursor moving the cursor over that word as well.
  2549.  
  2550. `upcase-word (M-u)'
  2551.      Uppercase the current (or following) word.  With a negative
  2552.      argument, do the previous word, but do not move the cursor.
  2553.  
  2554. `downcase-word (M-l)'
  2555.      Lowercase the current (or following) word.  With a negative
  2556.      argument, do the previous word, but do not move the cursor.
  2557.  
  2558. `capitalize-word (M-c)'
  2559.      Capitalize the current (or following) word.  With a negative
  2560.      argument, do the previous word, but do not move the cursor.
  2561.  
  2562. 
  2563. File: features.info,  Node: Commands For Killing,  Next: Numeric Arguments,  Prev: Commands For Text,  Up: Bindable Readline Commands
  2564.  
  2565. Killing And Yanking
  2566. -------------------
  2567.  
  2568. `kill-line (C-k)'
  2569.      Kill the text from the current cursor position to the end of the
  2570.      line.
  2571.  
  2572. `backward-kill-line (C-x Rubout)'
  2573.      Kill backward to the beginning of the line.
  2574.  
  2575. `unix-line-discard (C-u)'
  2576.      Kill backward from the cursor to the beginning of the current line.
  2577.      Save the killed text on the kill-ring.
  2578.  
  2579. `kill-whole-line ()'
  2580.      Kill all characters on the current line, no matter where the
  2581.      cursor is.  By default, this is unbound.
  2582.  
  2583. `kill-word (M-d)'
  2584.      Kill from the cursor to the end of the current word, or if between
  2585.      words, to the end of the next word.  Word boundaries are the same
  2586.      as `forward-word'.
  2587.  
  2588. `backward-kill-word (M-DEL)'
  2589.      Kill the word behind the cursor.  Word boundaries are the same as
  2590.      `backward-word'.
  2591.  
  2592. `unix-word-rubout (C-w)'
  2593.      Kill the word behind the cursor, using white space as a word
  2594.      boundary.  The killed text is saved on the kill-ring.
  2595.  
  2596. `delete-horizontal-space ()'
  2597.      Delete all spaces and tabs around point.  By default, this is
  2598.      unbound.
  2599.  
  2600. `yank (C-y)'
  2601.      Yank the top of the kill ring into the buffer at the current
  2602.      cursor position.
  2603.  
  2604. `yank-pop (M-y)'
  2605.      Rotate the kill-ring, and yank the new top.  You can only do this
  2606.      if the prior command is yank or yank-pop.
  2607.  
  2608. 
  2609. File: features.info,  Node: Numeric Arguments,  Next: Commands For Completion,  Prev: Commands For Killing,  Up: Bindable Readline Commands
  2610.  
  2611. Specifying Numeric Arguments
  2612. ----------------------------
  2613.  
  2614. `digit-argument (M-0, M-1, ... M--)'
  2615.      Add this digit to the argument already accumulating, or start a new
  2616.      argument.  M- starts a negative argument.
  2617.  
  2618. `universal-argument ()'
  2619.      Each time this is executed, the argument count is multiplied by
  2620.      four.  The argument count is initially one, so executing this
  2621.      function the first time makes the argument count four.  By
  2622.      default, this is not bound to a key.
  2623.  
  2624. 
  2625. File: features.info,  Node: Commands For Completion,  Next: Keyboard Macros,  Prev: Numeric Arguments,  Up: Bindable Readline Commands
  2626.  
  2627. Letting Readline Type For You
  2628. -----------------------------
  2629.  
  2630. `complete (TAB)'
  2631.      Attempt to do completion on the text before the cursor.  This is
  2632.      application-specific.  Generally, if you are typing a filename
  2633.      argument, you can do filename completion; if you are typing a
  2634.      command, you can do command completion, if you are typing in a
  2635.      symbol to GDB, you can do symbol name completion, if you are
  2636.      typing in a variable to Bash, you can do variable name completion,
  2637.      and so on.  See the Bash manual page for a complete list of
  2638.      available completion functions.
  2639.  
  2640. `possible-completions (M-?)'
  2641.      List the possible completions of the text before the cursor.
  2642.  
  2643. `insert-completions ()'
  2644.      Insert all completions of the text before point that would have
  2645.      been generated by `possible-completions'.  By default, this is not
  2646.      bound to a key.
  2647.  
  2648. 
  2649. File: features.info,  Node: Keyboard Macros,  Next: Miscellaneous Commands,  Prev: Commands For Completion,  Up: Bindable Readline Commands
  2650.  
  2651. Keyboard Macros
  2652. ---------------
  2653.  
  2654. `start-kbd-macro (C-x ()'
  2655.      Begin saving the characters typed into the current keyboard macro.
  2656.  
  2657. `end-kbd-macro (C-x ))'
  2658.      Stop saving the characters typed into the current keyboard macro
  2659.      and save the definition.
  2660.  
  2661. `call-last-kbd-macro (C-x e)'
  2662.      Re-execute the last keyboard macro defined, by making the
  2663.      characters in the macro appear as if typed at the keyboard.
  2664.  
  2665. 
  2666. File: features.info,  Node: Miscellaneous Commands,  Prev: Keyboard Macros,  Up: Bindable Readline Commands
  2667.  
  2668. Some Miscellaneous Commands
  2669. ---------------------------
  2670.  
  2671. `re-read-init-file (C-x C-r)'
  2672.      Read in the contents of your init file, and incorporate any
  2673.      bindings or variable assignments found there.
  2674.  
  2675. `abort (C-g)'
  2676.      Abort the current editing command and ring the terminal's bell
  2677.      (subject to the setting of `bell-style').
  2678.  
  2679. `do-uppercase-version (M-a, M-b, ...)'
  2680.      Run the command that is bound to the corresoponding uppercase
  2681.      character.
  2682.  
  2683. `prefix-meta (ESC)'
  2684.      Make the next character that you type be metafied.  This is for
  2685.      people without a meta key.  Typing `ESC f' is equivalent to typing
  2686.      `M-f'.
  2687.  
  2688. `undo (C-_, C-x C-u)'
  2689.      Incremental undo, separately remembered for each line.
  2690.  
  2691. `revert-line (M-r)'
  2692.      Undo all changes made to this line.  This is like typing the `undo'
  2693.      command enough times to get back to the beginning.
  2694.  
  2695. `tilde-expand (M-~)'
  2696.      Perform tilde expansion on the current word.
  2697.  
  2698. `dump-functions ()'
  2699.      Print all of the functions and their key bindings to the readline
  2700.      output stream.  If a numeric argument is supplied, the output is
  2701.      formatted in such a way that it can be made part of an INPUTRC
  2702.      file.
  2703.  
  2704. `display-shell-version (C-x C-v)'
  2705.      Display version information about the current instance of Bash.
  2706.  
  2707. `shell-expand-line (M-C-e)'
  2708.      Expand the line the way the shell does when it reads it.  This
  2709.      performs alias and history expansion as well as all of the shell
  2710.      word expansions.
  2711.  
  2712. `history-expand-line (M-^)'
  2713.      Perform history expansion on the current line.
  2714.  
  2715. `insert-last-argument (M-., M-_)'
  2716.      A synonym for `yank-last-arg'.
  2717.  
  2718. `operate-and-get-next (C-o)'
  2719.      Accept the current line for execution and fetch the next line
  2720.      relative to the current line from the history for editing.  Any
  2721.      argument is ignored.
  2722.  
  2723. `emacs-editing-mode (C-e)'
  2724.      When in `vi' editing mode, this causes a switch back to emacs
  2725.      editing mode, as if the command `set -o emacs' had been executed.
  2726.  
  2727. 
  2728. File: features.info,  Node: Readline vi Mode,  Prev: Bindable Readline Commands,  Up: Command Line Editing
  2729.  
  2730. Readline vi Mode
  2731. ================
  2732.  
  2733.    While the Readline library does not have a full set of `vi' editing
  2734. functions, it does contain enough to allow simple editing of the line.
  2735. The Readline `vi' mode behaves as specified in the Posix 1003.2
  2736. standard.
  2737.  
  2738.    In order to switch interactively between `Emacs' and `Vi' editing
  2739. modes, use the `set -o emacs' and `set -o vi' commands (*note The Set
  2740. Builtin::.).  The Readline default is `emacs' mode.
  2741.  
  2742.    When you enter a line in `vi' mode, you are already placed in
  2743. `insertion' mode, as if you had typed an `i'.  Pressing ESC switches
  2744. you into `command' mode, where you can edit the text of the line with
  2745. the standard `vi' movement keys, move to previous history lines with
  2746. `k', and following lines with `j', and so forth.
  2747.  
  2748. 
  2749. File: features.info,  Node: Variable Index,  Next: Concept Index,  Prev: Command Line Editing,  Up: Top
  2750.  
  2751. Variable Index
  2752. **************
  2753.  
  2754. * Menu:
  2755.  
  2756. * auto_resume:                          Job Control Variables.
  2757. * BASH_VERSION:                         Bash Variables.
  2758. * bell-style:                           Readline Init Syntax.
  2759. * cdable_vars:                          C Shell Variables.
  2760. * CDPATH:                               Bourne Shell Variables.
  2761. * comment-begin:                        Readline Init Syntax.
  2762. * completion-query-items:               Readline Init Syntax.
  2763. * convert-meta:                         Readline Init Syntax.
  2764. * editing-mode:                         Readline Init Syntax.
  2765. * EUID:                                 Bash Variables.
  2766. * expand-tilde:                         Readline Init Syntax.
  2767. * FIGNORE:                              Bash Variables.
  2768. * histchars:                            Bash Variables.
  2769. * HISTCMD:                              Bash Variables.
  2770. * HISTCONTROL:                          Bash Variables.
  2771. * HISTFILE:                             Bash Variables.
  2772. * history_control:                      Bash Variables.
  2773. * HISTSIZE:                             Bash Variables.
  2774. * HOME:                                 Bourne Shell Variables.
  2775. * horizontal-scroll-mode:               Readline Init Syntax.
  2776. * HOSTFILE:                             Bash Variables.
  2777. * hostname_completion_file:             Bash Variables.
  2778. * HOSTTYPE:                             Bash Variables.
  2779. * IFS:                                  Bourne Shell Variables.
  2780. * IGNOREEOF:                            Bash Variables.
  2781. * IGNOREEOF:                            C Shell Variables.
  2782. * INPUTRC:                              Bash Variables.
  2783. * keymap:                               Readline Init Syntax.
  2784. * MAILCHECK:                            Bash Variables.
  2785. * MAILPATH:                             Bourne Shell Variables.
  2786. * mark-modified-lines:                  Readline Init Syntax.
  2787. * meta-flag:                            Readline Init Syntax.
  2788. * nolinks:                              Bash Variables.
  2789. * notify:                               Job Control Variables.
  2790. * no_exit_on_failed_exec:               Bash Variables.
  2791. * OLDPWD:                               Korn Shell Variables.
  2792. * OPTARG:                               Bourne Shell Variables.
  2793. * OPTIND:                               Bourne Shell Variables.
  2794. * OSTYPE:                               Bash Variables.
  2795. * output-meta:                          Readline Init Syntax.
  2796. * PATH:                                 Bourne Shell Variables.
  2797. * PROMPT_COMMAND:                       Bash Variables.
  2798. * PS1:                                  Bourne Shell Variables.
  2799. * PS2:                                  Bourne Shell Variables.
  2800. * PS3:                                  Korn Shell Variables.
  2801. * PS4:                                  Korn Shell Variables.
  2802. * PWD:                                  Korn Shell Variables.
  2803. * RANDOM:                               Korn Shell Variables.
  2804. * REPLY:                                Korn Shell Variables.
  2805. * SECONDS:                              Korn Shell Variables.
  2806. * show-all-if-ambiguous:                Readline Init Syntax.
  2807. * TMOUT:                                Korn Shell Variables.
  2808. * UID:                                  Bash Variables.
  2809.  
  2810. 
  2811. File: features.info,  Node: Concept Index,  Prev: Variable Index,  Up: Top
  2812.  
  2813. Concept Index
  2814. *************
  2815.  
  2816. * Menu:
  2817.  
  2818. * $else:                                Conditional Init Constructs.
  2819. * $endif:                               Conditional Init Constructs.
  2820. * $if:                                  Conditional Init Constructs.
  2821. * .:                                    Bourne Shell Builtins.
  2822. * ::                                    Bourne Shell Builtins.
  2823. * abort (C-g):                          Miscellaneous Commands.
  2824. * accept-line (Newline, Return):        Commands For History.
  2825. * alias:                                Alias Builtins.
  2826. * backward-char (C-b):                  Commands For Moving.
  2827. * backward-delete-char (Rubout):        Commands For Text.
  2828. * backward-kill-line (C-x Rubout):      Commands For Killing.
  2829. * backward-kill-word (M-DEL):           Commands For Killing.
  2830. * backward-word (M-b):                  Commands For Moving.
  2831. * beginning-of-history (M-<):           Commands For History.
  2832. * beginning-of-line (C-a):              Commands For Moving.
  2833. * bg:                                   Job Control Builtins.
  2834. * bind:                                 Bash Builtins.
  2835. * break:                                Bourne Shell Builtins.
  2836. * builtin:                              Bash Builtins.
  2837. * call-last-kbd-macro (C-x e):          Keyboard Macros.
  2838. * capitalize-word (M-c):                Commands For Text.
  2839. * case:                                 Conditional Constructs.
  2840. * cd:                                   Bourne Shell Builtins.
  2841. * clear-screen (C-l):                   Commands For Moving.
  2842. * command:                              Bash Builtins.
  2843. * complete (TAB):                       Commands For Completion.
  2844. * continue:                             Bourne Shell Builtins.
  2845. * declare:                              Bash Builtins.
  2846. * delete-char (C-d):                    Commands For Text.
  2847. * delete-horizontal-space ():           Commands For Killing.
  2848. * digit-argument (M-0, M-1, ... M-):    Numeric Arguments.
  2849. * dirs:                                 C Shell Builtins.
  2850. * do-uppercase-version (M-a, M-b, ...): Miscellaneous Commands.
  2851. * downcase-word (M-l):                  Commands For Text.
  2852. * dump-functions ():                    Miscellaneous Commands.
  2853. * echo:                                 Bourne Shell Builtins.
  2854. * enable:                               Bash Builtins.
  2855. * end-kbd-macro (C-x )):                Keyboard Macros.
  2856. * end-of-history (M->):                 Commands For History.
  2857. * end-of-line (C-e):                    Commands For Moving.
  2858. * eval:                                 Bourne Shell Builtins.
  2859. * event designators:                    Event Designators.
  2860. * exec:                                 Bourne Shell Builtins.
  2861. * exit:                                 Bourne Shell Builtins.
  2862. * expansion:                            History Interaction.
  2863. * export:                               Bourne Shell Builtins.
  2864. * fc:                                   Korn Shell Builtins.
  2865. * fg:                                   Job Control Builtins.
  2866. * for:                                  Looping Constructs.
  2867. * forward-char (C-f):                   Commands For Moving.
  2868. * forward-search-history (C-s):         Commands For History.
  2869. * forward-word (M-f):                   Commands For Moving.
  2870. * getopts:                              Bourne Shell Builtins.
  2871. * hash:                                 Bourne Shell Builtins.
  2872. * help:                                 Bash Builtins.
  2873. * history:                              C Shell Builtins.
  2874. * history events:                       Event Designators.
  2875. * History, how to use:                  Job Control Variables.
  2876. * history-search-backward ():           Commands For History.
  2877. * history-search-forward ():            Commands For History.
  2878. * if:                                   Conditional Constructs.
  2879. * insert-completions ():                Commands For Completion.
  2880. * interaction, readline:                Readline Interaction.
  2881. * jobs:                                 Job Control Builtins.
  2882. * kill:                                 Bourne Shell Builtins.
  2883. * Kill ring:                            Readline Killing Commands.
  2884. * kill-line (C-k):                      Commands For Killing.
  2885. * kill-whole-line ():                   Commands For Killing.
  2886. * kill-word (M-d):                      Commands For Killing.
  2887. * Killing text:                         Readline Killing Commands.
  2888. * let:                                  Korn Shell Builtins.
  2889. * let:                                  Arithmetic Builtins.
  2890. * local:                                Bash Builtins.
  2891. * logout:                               C Shell Builtins.
  2892. * next-history (C-n):                   Commands For History.
  2893. * non-incremental-forward-search-history (M-n): Commands For History.
  2894. * non-incremental-reverse-search-history (M-p): Commands For History.
  2895. * popd:                                 C Shell Builtins.
  2896. * possible-completions (M-?):           Commands For Completion.
  2897. * prefix-meta (ESC):                    Miscellaneous Commands.
  2898. * previous-history (C-p):               Commands For History.
  2899. * pushd:                                C Shell Builtins.
  2900. * pwd:                                  Bourne Shell Builtins.
  2901. * quoted-insert (C-q, C-v):             Commands For Text.
  2902. * re-read-init-file (C-x C-r):          Miscellaneous Commands.
  2903. * read:                                 Bourne Shell Builtins.
  2904. * Readline, how to use:                 Modifiers.
  2905. * readonly:                             Bourne Shell Builtins.
  2906. * redraw-current-line ():               Commands For Moving.
  2907. * return:                               Bourne Shell Builtins.
  2908. * reverse-search-history (C-r):         Commands For History.
  2909. * revert-line (M-r):                    Miscellaneous Commands.
  2910. * self-insert (a, b, A, 1, !, ...):     Commands For Text.
  2911. * set:                                  The Set Builtin.
  2912. * shift:                                Bourne Shell Builtins.
  2913. * source:                               C Shell Builtins.
  2914. * start-kbd-macro (C-x ():              Keyboard Macros.
  2915. * suspend:                              Job Control Builtins.
  2916. * tab-insert (M-TAB):                   Commands For Text.
  2917. * test:                                 Bourne Shell Builtins.
  2918. * tilde-expand (M-~):                   Miscellaneous Commands.
  2919. * times:                                Bourne Shell Builtins.
  2920. * transpose-chars (C-t):                Commands For Text.
  2921. * transpose-words (M-t):                Commands For Text.
  2922. * trap:                                 Bourne Shell Builtins.
  2923. * type:                                 Bash Builtins.
  2924. * typeset:                              Korn Shell Builtins.
  2925. * ulimit:                               Bash Builtins.
  2926. * umask:                                Bourne Shell Builtins.
  2927. * unalias:                              Alias Builtins.
  2928. * undo (C-_, C-x C-u):                  Miscellaneous Commands.
  2929. * universal-argument ():                Numeric Arguments.
  2930. * unix-line-discard (C-u):              Commands For Killing.
  2931. * unix-word-rubout (C-w):               Commands For Killing.
  2932. * unset:                                Bourne Shell Builtins.
  2933. * until:                                Looping Constructs.
  2934. * upcase-word (M-u):                    Commands For Text.
  2935. * wait:                                 Bourne Shell Builtins.
  2936. * while:                                Looping Constructs.
  2937. * yank (C-y):                           Commands For Killing.
  2938. * yank-last-arg (M-., M-_):             Commands For History.
  2939. * yank-nth-arg (M-C-y):                 Commands For History.
  2940. * yank-pop (M-y):                       Commands For Killing.
  2941. * Yanking text:                         Readline Killing Commands.
  2942. * [:                                    Bourne Shell Builtins.
  2943.  
  2944.  
  2945. 
  2946. Tag Table:
  2947. Node: Top1044
  2948. Node: Bourne Shell Features2405
  2949. Node: Looping Constructs3579
  2950. Node: Conditional Constructs4634
  2951. Node: Shell Functions6194
  2952. Node: Bourne Shell Builtins7567
  2953. Node: Bourne Shell Variables9766
  2954. Node: Other Bourne Shell Features11025
  2955. Node: Major Differences from the Bourne Shell11783
  2956. Node: Csh Features14194
  2957. Node: Tilde Expansion15087
  2958. Node: Brace Expansion15691
  2959. Node: C Shell Builtins17283
  2960. Node: C Shell Variables20578
  2961. Node: Korn Shell Features21088
  2962. Node: Korn Shell Constructs21826
  2963. Node: Korn Shell Builtins23037
  2964. Node: Korn Shell Variables25190
  2965. Node: Aliases26466
  2966. Node: Alias Builtins28833
  2967. Node: Bash Specific Features29356
  2968. Node: Invoking Bash30085
  2969. Node: Bash Startup Files32404
  2970. Node: Is This Shell Interactive?34247
  2971. Node: Bash Builtins35055
  2972. Node: The Set Builtin41437
  2973. Node: Bash Variables46377
  2974. Node: Shell Arithmetic50945
  2975. Node: Arithmetic Evaluation51307
  2976. Node: Arithmetic Expansion53028
  2977. Node: Arithmetic Builtins53862
  2978. Node: Printing a Prompt54334
  2979. Node: Job Control55599
  2980. Node: Job Control Basics56074
  2981. Node: Job Control Builtins60249
  2982. Node: Job Control Variables61768
  2983. Node: Using History Interactively63077
  2984. Node: History Interaction63584
  2985. Node: Event Designators64630
  2986. Node: Word Designators65461
  2987. Node: Modifiers66446
  2988. Node: Command Line Editing67755
  2989. Node: Introduction and Notation68415
  2990. Node: Readline Interaction69435
  2991. Node: Readline Bare Essentials70574
  2992. Node: Readline Movement Commands72104
  2993. Node: Readline Killing Commands72995
  2994. Node: Readline Arguments74698
  2995. Node: Readline Init File75649
  2996. Node: Readline Init Syntax76647
  2997. Node: Conditional Init Constructs83580
  2998. Node: Bindable Readline Commands85826
  2999. Node: Commands For Moving86496
  3000. Node: Commands For History87344
  3001. Node: Commands For Text89988
  3002. Node: Commands For Killing91727
  3003. Node: Numeric Arguments93176
  3004. Node: Commands For Completion93803
  3005. Node: Keyboard Macros94816
  3006. Node: Miscellaneous Commands95375
  3007. Node: Readline vi Mode97466
  3008. Node: Variable Index98343
  3009. Node: Concept Index101671
  3010. 
  3011. End Tag Table
  3012.