Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15601

Re: Issues with history substitution and its documentation

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: Issues with history substitution and its documentation
Date 2019-11-18 10:34 -0500
Message-ID <mailman.1845.1574091294.13325.bug-bash@gnu.org> (permalink)
References <CA+VKLw-WX8zUz06MZ9ThuMhUuW97aJ5ted8oSfJSvrVJBLW3hA@mail.gmail.com> <aafb3106-1401-47b7-ced3-92af6ea3acd4@case.edu>

Show all headers | View raw


On 10/3/19 6:19 PM, Jim Monte wrote:

> Description:
> =============================================================================
> Documentation of quick substitution is incorrect (or does not match
> behavior).
> 
> I believe this issue is an error with the documentation of history
> "Quick Substitution" that has existed since the first snapshot available at
> web.archive.org in 2007 at
> 
> https://web.archive.org/web/20071223174140/http://www.gnu.org/software/bash/manual/html_node/Event-Designators.html
> 
> At the least it is true that bash does not behave as the documentation
> states,
> but it does act in a way that is more reasonable (to me) than what is
> written.
> 
> The documentation states that ^string1^string2^ is equivalent to
> !!:s/string1/string2/. However, bash treats it as equivalent to
> !!:s^string1^string2^.

This is correct, and I changed the documentation.

> =============================================================================
> Behavior of empty "old" string in a substitution is undefined.
> 
> The earlier example also shows a related but different issue with the
> !!:s//a/b/ command, where the string to locate is empty.
> It causes /a to be replaced by a and the b/ is appended.

It's not, actually. It's documented in the man page, but due to an
oversight the text doesn't appear in the texinfo manual.


> =============================================================================
> BUG
> If an event designator has a leading - character, it is ignored.

It's treated as an offset with value 0, and otherwise ignored. If it's not
followed by a digit string, it should be treated as part of a search
string.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: Issues with history substitution and its documentation Chet Ramey <chet.ramey@case.edu> - 2019-11-18 10:34 -0500

csiph-web