summaryrefslogtreecommitdiff
path: root/devdocs/bash/modifiers.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/bash/modifiers.html
new repository
Diffstat (limited to 'devdocs/bash/modifiers.html')
-rw-r--r--devdocs/bash/modifiers.html17
1 files changed, 17 insertions, 0 deletions
diff --git a/devdocs/bash/modifiers.html b/devdocs/bash/modifiers.html
new file mode 100644
index 00000000..c2b9dbc9
--- /dev/null
+++ b/devdocs/bash/modifiers.html
@@ -0,0 +1,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>&amp;</samp>’ appears in <var>new</var>, it is replaced by <var>old</var>. A single backslash will quote the ‘<samp>&amp;</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>&amp;</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>&amp;</samp>’. </p> </dd> <dt><span><code>G</code></span></dt> <dd>
+<p>Apply the following ‘<samp>s</samp>’ or ‘<samp>&amp;</samp>’ modifier once to each word in the event. </p> </dd> </dl><div class="_attribution">
+ <p class="_attribution-p">
+ Copyright &copy; 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>