⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 history.html

📁 在非GUI环境下
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<HTML><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><!-- Created on July, 27  2004 by texi2html 1.64 --><!-- Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)            Karl Berry  <karl@freefriends.org>            Olaf Bachmann <obachman@mathematik.uni-kl.de>            and many others.Maintained by: Olaf Bachmann <obachman@mathematik.uni-kl.de>Send bugs and suggestions to <texi2html@mathematik.uni-kl.de> --><HEAD><TITLE>GNU History Library: </TITLE><META NAME="description" CONTENT="GNU History Library: "><META NAME="keywords" CONTENT="GNU History Library: "><META NAME="resource-type" CONTENT="document"><META NAME="distribution" CONTENT="global"><META NAME="Generator" CONTENT="texi2html 1.64"></HEAD><BODY LANG="" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000"><A NAME="SEC_Top"></A><TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0><TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC_Top">Top</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC_Contents">Contents</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC22">Index</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC_About"> ? </A>]</TD></TR></TABLE><H1>GNU History Library</H1></P><P>This document describes the GNU History library, a programming tool thatprovides a consistent user interface for recalling lines of previouslytyped input.</P><P><BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0> <TR><TD ALIGN="left" VALIGN="TOP"><A HREF="history.html#SEC1">1. Using History Interactively</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">GNU History User's Manual.</TD></TR><TR><TD ALIGN="left" VALIGN="TOP"><A HREF="history.html#SEC6">2. Programming with GNU History</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">GNU History Programmer's Manual.</TD></TR><TR><TD ALIGN="left" VALIGN="TOP"><A HREF="history.html#SEC19">A. Copying This Manual</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP"></TD></TR><TR><TD ALIGN="left" VALIGN="TOP"><A HREF="history.html#SEC22">B. Concept Index</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Index of concepts described in this manual.</TD></TR><TR><TD ALIGN="left" VALIGN="TOP"><A HREF="history.html#SEC23">C. Function and Variable Index</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Index of externally visible functions				  and variables.</TD></TR></TABLE></BLOCKQUOTE><P><HR SIZE=1><A NAME="SEC1"></A><TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0><TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC_Top"> &lt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC2"> &gt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[ &lt;&lt; ]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC_Top"> Up </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC6"> &gt;&gt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC_Top">Top</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC_Contents">Contents</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC22">Index</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC_About"> ? </A>]</TD></TR></TABLE><A NAME="Using History Interactively"></A><H1> 1. Using History Interactively </H1><!--docid::SEC1::--><P>This chapter describes how to use the GNU History Library interactively,from a user's standpoint.  It should be considered a user's guide.  Forinformation on using the GNU History Library in your own programs,see section <A HREF="history.html#SEC6">2. Programming with GNU History</A>.</P><P><BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0> <TR><TD ALIGN="left" VALIGN="TOP"><A HREF="history.html#SEC2">1.1 History Expansion</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">What it feels like using History as a user.</TD></TR></TABLE></BLOCKQUOTE><P><A NAME="History Interaction"></A><HR SIZE="6"><A NAME="SEC2"></A><TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0><TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC1"> &lt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC3"> &gt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[ &lt;&lt; ]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC1"> Up </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC6"> &gt;&gt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC_Top">Top</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC_Contents">Contents</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC22">Index</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC_About"> ? </A>]</TD></TR></TABLE><H2> 1.1 History Expansion </H2><!--docid::SEC2::--><P>The History library provides a history expansion feature that is similarto the history expansion provided by <CODE>csh</CODE>.  This sectiondescribes the syntax used to manipulate the history information.</P><P>History expansions introduce words from the history list intothe input stream, making it easy to repeat commands, insert thearguments to a previous command into the current input line, orfix errors in previous commands quickly.</P><P>History expansion takes place in two parts.  The first is to determinewhich line from the history list should be used during substitution.The second is to select portions of that line for inclusion into thecurrent one.  The line selected from the history is called the<EM>event</EM>, and the portions of that line that are acted upon arecalled <EM>words</EM>.  Various <EM>modifiers</EM> are available to manipulatethe selected words.  The line is broken into words in the same fashionthat Bash does, so that several wordssurrounded by quotes are considered one word.History expansions are introduced by the appearance of thehistory expansion character, which is <SAMP>`!'</SAMP> by default.</P><P><BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0> <TR><TD ALIGN="left" VALIGN="TOP"><A HREF="history.html#SEC3">1.1.1 Event Designators</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">How to specify which history line to use.</TD></TR><TR><TD ALIGN="left" VALIGN="TOP"><A HREF="history.html#SEC4">1.1.2 Word Designators</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Specifying which words are of interest.</TD></TR><TR><TD ALIGN="left" VALIGN="TOP"><A HREF="history.html#SEC5">1.1.3 Modifiers</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Modifying the results of substitution.</TD></TR></TABLE></BLOCKQUOTE><P><A NAME="Event Designators"></A><HR SIZE="6"><A NAME="SEC3"></A><TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0><TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC2"> &lt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC4"> &gt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[ &lt;&lt; ]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC2"> Up </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC6"> &gt;&gt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC_Top">Top</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC_Contents">Contents</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC22">Index</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC_About"> ? </A>]</TD></TR></TABLE><H3> 1.1.1 Event Designators </H3><!--docid::SEC3::--><P>An event designator is a reference to a command line entry in thehistory list.<A NAME="IDX1"></A></P><P><DL COMPACT><DT><CODE>!</CODE><DD>Start a history substitution, except when followed by a space, tab,the end of the line, or <SAMP>`='</SAMP>.<P><DT><CODE>!<VAR>n</VAR></CODE><DD>Refer to command line <VAR>n</VAR>.<P><DT><CODE>!-<VAR>n</VAR></CODE><DD>Refer to the command <VAR>n</VAR> lines back.<P><DT><CODE>!!</CODE><DD>Refer to the previous command.  This is a synonym for <SAMP>`!-1'</SAMP>.<P><DT><CODE>!<VAR>string</VAR></CODE><DD>Refer to the most recent command starting with <VAR>string</VAR>.<P><DT><CODE>!?<VAR>string</VAR>[?]</CODE><DD>Refer to the most recent command containing <VAR>string</VAR>.  The trailing<SAMP>`?'</SAMP> may be omitted if the <VAR>string</VAR> is followed immediately bya newline.<P><DT><CODE>^<VAR>string1</VAR>^<VAR>string2</VAR>^</CODE><DD>Quick Substitution.  Repeat the last command, replacing <VAR>string1</VAR>with <VAR>string2</VAR>.  Equivalent to<CODE>!!:s/<VAR>string1</VAR>/<VAR>string2</VAR>/</CODE>.<P><DT><CODE>!#</CODE><DD>The entire command line typed so far.<P></DL><P><A NAME="Word Designators"></A><HR SIZE="6"><A NAME="SEC4"></A><TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0><TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC3"> &lt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC5"> &gt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC5"> &lt;&lt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC2"> Up </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC6"> &gt;&gt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC_Top">Top</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC_Contents">Contents</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC22">Index</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC_About"> ? </A>]</TD></TR></TABLE><H3> 1.1.2 Word Designators </H3><!--docid::SEC4::--><P>Word designators are used to select desired words from the event.A <SAMP>`:'</SAMP> separates the event specification from the word designator.  Itmay be omitted if the word designator begins with a <SAMP>`^'</SAMP>, <SAMP>`$'</SAMP>,<SAMP>`*'</SAMP>, <SAMP>`-'</SAMP>, or <SAMP>`%'</SAMP>.  Words are numbered from the beginningof the line, with the first word being denoted by 0 (zero).  Words areinserted into the current line separated by single spaces.</P><P>For example,</P><P><DL COMPACT><DT><CODE>!!</CODE><DD>designates the preceding command.  When you type this, the precedingcommand is repeated in toto.<P><DT><CODE>!!:$</CODE><DD>designates the last argument of the preceding command.  This may beshortened to <CODE>!$</CODE>.<P><DT><CODE>!fi:2</CODE><DD>designates the second argument of the most recent command starting withthe letters <CODE>fi</CODE>.</DL><P>Here are the word designators: <DL COMPACT><DT><CODE>0 (zero)</CODE><DD>The <CODE>0</CODE>th word.  For many applications, this is the command word.<P><DT><CODE><VAR>n</VAR></CODE><DD>The <VAR>n</VAR>th word.<P><DT><CODE>^</CODE><DD>The first argument; that is, word 1.<P><DT><CODE>$</CODE><DD>The last argument.<P><DT><CODE>%</CODE><DD>The word matched by the most recent <SAMP>`?<VAR>string</VAR>?'</SAMP> search.<P><DT><CODE><VAR>x</VAR>-<VAR>y</VAR></CODE><DD>A range of words; <SAMP>`-<VAR>y</VAR>'</SAMP> abbreviates <SAMP>`0-<VAR>y</VAR>'</SAMP>.<P><DT><CODE>*</CODE><DD>All of the words, except the <CODE>0</CODE>th.  This is a synonym for <SAMP>`1-$'</SAMP>.It is not an error to use <SAMP>`*'</SAMP> if there is just one word in the event;the empty string is returned in that case.<P><DT><CODE><VAR>x</VAR>*</CODE><DD>Abbreviates <SAMP>`<VAR>x</VAR>-$'</SAMP><P><DT><CODE><VAR>x</VAR>-</CODE><DD>Abbreviates <SAMP>`<VAR>x</VAR>-$'</SAMP> like <SAMP>`<VAR>x</VAR>*'</SAMP>, but omits the last word.<P></DL><P>If a word designator is supplied without an event specification, theprevious command is used as the event.</P><P><A NAME="Modifiers"></A><HR SIZE="6"><A NAME="SEC5"></A><TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0><TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC4"> &lt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC6"> &gt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[ &lt;&lt; ]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC2"> Up </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC6"> &gt;&gt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC_Top">Top</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC_Contents">Contents</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="history.html#SEC22">Index</A>]</TD>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -