1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
<h1 class="subsection">Modifiers</h1> <p>After the optional word designator, you can add a sequence of one or more of the following modifiers, each preceded by a ‘<samp>:</samp>’. These modify, or edit, the word or words selected from the history event. </p> <dl compact> <dt><span><code>h</code></span></dt> <dd>
<p>Remove a trailing pathname component, leaving only the head. </p> </dd> <dt><span><code>t</code></span></dt> <dd>
<p>Remove all leading pathname components, leaving the tail. </p> </dd> <dt><span><code>r</code></span></dt> <dd>
<p>Remove a trailing suffix of the form ‘<samp>.<var>suffix</var></samp>’, leaving the basename. </p> </dd> <dt><span><code>e</code></span></dt> <dd>
<p>Remove all but the trailing suffix. </p> </dd> <dt><span><code>p</code></span></dt> <dd>
<p>Print the new command but do not execute it. </p> </dd> <dt><span><code>q</code></span></dt> <dd>
<p>Quote the substituted words, escaping further substitutions. </p> </dd> <dt><span><code>x</code></span></dt> <dd>
<p>Quote the substituted words as with ‘<samp>q</samp>’, but break into words at spaces, tabs, and newlines. The ‘<samp>q</samp>’ and ‘<samp>x</samp>’ modifiers are mutually exclusive; the last one supplied is used. </p> </dd> <dt><span><code>s/<var>old</var>/<var>new</var>/</code></span></dt> <dd>
<p>Substitute <var>new</var> for the first occurrence of <var>old</var> in the event line. Any character may be used as the delimiter in place of ‘<samp>/</samp>’. The delimiter may be quoted in <var>old</var> and <var>new</var> with a single backslash. If ‘<samp>&</samp>’ appears in <var>new</var>, it is replaced by <var>old</var>. A single backslash will quote the ‘<samp>&</samp>’. If <var>old</var> is null, it is set to the last <var>old</var> substituted, or, if no previous history substitutions took place, the last <var>string</var> in a !?<var>string</var><code>[?]</code> search. If <var>new</var> is null, each matching <var>old</var> is deleted. The final delimiter is optional if it is the last character on the input line. </p> </dd> <dt><span><code>&</code></span></dt> <dd>
<p>Repeat the previous substitution. </p> </dd> <dt><span><code>g</code></span></dt> <dt><span><code>a</code></span></dt> <dd>
<p>Cause changes to be applied over the entire event line. Used in conjunction with ‘<samp>s</samp>’, as in <code>gs/<var>old</var>/<var>new</var>/</code>, or with ‘<samp>&</samp>’. </p> </dd> <dt><span><code>G</code></span></dt> <dd>
<p>Apply the following ‘<samp>s</samp>’ or ‘<samp>&</samp>’ modifier once to each word in the event. </p> </dd> </dl><div class="_attribution">
<p class="_attribution-p">
Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.<br>Licensed under the GNU Free Documentation License.<br>
<a href="https://www.gnu.org/software/bash/manual/html_node/Modifiers.html" class="_attribution-link">https://www.gnu.org/software/bash/manual/html_node/Modifiers.html</a>
</p>
</div>
|