home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / prgramer / unix / emx / gnu / doc / inc_hist.tex < prev    next >
Encoding:
Text File  |  1992-02-27  |  4.8 KB  |  156 lines

  1. @ignore
  2. This file is completely identical to hsuser.texinfo, except that it has the
  3. reference to the programming manual removed.  There are definately better ways
  4. to do this!
  5.  
  6. This file documents the user interface to the GNU History library.
  7.  
  8. Copyright (C) 1988, 1991 Free Software Foundation, Inc.
  9. Authored by Brian Fox.
  10.  
  11. Permission is granted to make and distribute verbatim copies of this manual
  12. provided the copyright notice and this permission notice are preserved on
  13. all copies.
  14.  
  15. Permission is granted to process this file through Tex and print the
  16. results, provided the printed document carries copying permission notice
  17. identical to this one except for the removal of this paragraph (this
  18. paragraph not being relevant to the printed manual).
  19.  
  20. Permission is granted to copy and distribute modified versions of this
  21. manual under the conditions for verbatim copying, provided also that the
  22. GNU Copyright statement is available to the distributee, and provided that
  23. the entire resulting derived work is distributed under the terms of a
  24. permission notice identical to this one.
  25.  
  26. Permission is granted to copy and distribute translations of this manual
  27. into another language, under the above conditions for modified versions.
  28. @end ignore
  29.  
  30. @node Using History Interactively
  31. @appendix Using History Interactively
  32.  
  33. This chapter describes how to use the GNU History Library interactively,
  34. from a user's standpoint.
  35.  
  36. @menu
  37. * History Interaction::        What it feels like using History as a user.
  38. @end menu
  39.  
  40. @node History Interaction
  41. @section History Interaction
  42. @cindex expansion
  43.  
  44. The History library provides a history expansion feature that is similar
  45. to the history expansion in Csh.  The following text describes the sytax
  46. that you use to manipulate the history information.
  47.  
  48. History expansion takes place in two parts.  The first is to determine
  49. which line from the previous history should be used during substitution.
  50. The second is to select portions of that line for inclusion into the
  51. current one.  The line selected from the previous history is called the
  52. @dfn{event}, and the portions of that line that are acted upon are
  53. called @dfn{words}.  The line is broken into words in the same fashion
  54. that the Bash shell does, so that several English (or Unix) words
  55. surrounded by quotes are considered as one word.
  56.  
  57. @menu
  58. * Event Designators::    How to specify which history line to use.
  59. * Word Designators::    Specifying which words are of interest.
  60. * Modifiers::        Modifying the results of susbstitution.
  61. @end menu
  62.  
  63. @node Event Designators
  64. @subsection Event Designators
  65. @cindex event designators
  66.  
  67. An event designator is a reference to a command line entry in the
  68. history list.
  69.  
  70. @table @asis
  71.  
  72. @item @code{!}
  73. Start a history subsititution, except when followed by a space, tab, or
  74. the end of the line... @key{=} or @key{(}.
  75.  
  76. @item @code{!!}
  77. Refer to the previous command.  This is a synonym for @code{!-1}.
  78.  
  79. @item @code{!n}
  80. Refer to command line @var{n}.
  81.  
  82. @item @code{!-n}
  83. Refer to the command line @var{n} lines back.
  84.  
  85. @item @code{!string}
  86. Refer to the most recent command starting with @var{string}.
  87.  
  88. @item @code{!?string}[@code{?}]
  89. Refer to the most recent command containing @var{string}.
  90.  
  91. @end table
  92.  
  93. @node Word Designators
  94. @subsection Word Designators
  95.  
  96. A @key{:} separates the event specification from the word designator.  It
  97. can be omitted if the word designator begins with a @key{^}, @key{$},
  98. @key{*} or @key{%}.  Words are numbered from the beginning of the line,
  99. with the first word being denoted by a 0 (zero).
  100.  
  101. @table @code
  102.  
  103. @item 0 (zero)
  104. The zero'th word.  For many applications, this is the command word.
  105.  
  106. @item n
  107. The @var{n}'th word.
  108.  
  109. @item ^
  110. The first argument.  that is, word 1.
  111.  
  112. @item $
  113. The last argument.
  114.  
  115. @item %
  116. The word matched by the most recent @code{?string?} search.
  117.  
  118. @item x-y
  119. A range of words; @code{-@var{y}} Abbreviates @code{0-@var{y}}.
  120.  
  121. @item *
  122. All of the words, excepting the zero'th.  This is a synonym for @code{1-$}.
  123. It is not an error to use @key{*} if there is just one word in the event.
  124. The empty string is returned in that case.
  125.  
  126. @end table
  127.  
  128. @node Modifiers
  129. @subsection Modifiers
  130.  
  131. After the optional word designator, you can add a sequence of one or more
  132. of the following modifiers, each preceded by a @key{:}.
  133.  
  134. @table @code
  135.  
  136. @item #
  137. The entire command line typed so far.  This means the current command,
  138. not the previous command, so it really isn't a word designator, and doesn't
  139. belong in this section.
  140.  
  141. @item h
  142. Remove a trailing pathname component, leaving only the head.
  143.  
  144. @item r
  145. Remove a trailing suffix of the form @samp{.}@var{suffix}, leaving the basename.
  146.  
  147. @item e
  148. Remove all but the suffix.
  149.  
  150. @item t
  151. Remove all leading  pathname  components, leaving the tail.
  152.  
  153. @item p
  154. Print the new command but do not execute it.
  155. @end table
  156.