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


Groups > gnu.bash.bug > #15612 > unrolled thread

Re: Issues with history substitution and its documentation

Started byChet Ramey <chet.ramey@case.edu>
First post2019-11-19 09:50 -0500
Last post2019-11-19 09:50 -0500
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Issues with history substitution and its documentation Chet Ramey <chet.ramey@case.edu> - 2019-11-19 09:50 -0500

#15612 — Re: Issues with history substitution and its documentation

FromChet Ramey <chet.ramey@case.edu>
Date2019-11-19 09:50 -0500
SubjectRe: Issues with history substitution and its documentation
Message-ID<mailman.1961.1574175026.13325.bug-bash@gnu.org>
On 11/18/19 12:40 PM, Jim Monte wrote:
> Thank you for looking into all of these reports. My issue here was that in 
> both cases there had not yet been any ?string? search, so they should 
> behave the same way -- an event is not required to not have a most recent 
> ?string? search. So if the default is to use an empty string as the 
> previous string when there is none, for consistency from the perspective of 
> the user, both instances of echo "!%" should output echo "" as the second 
> one does.

That's not the issue. The `%' isn't part of the event selector; it's a
word designator. The `real' event is `!!', though it's abbreviated as `!'.
This is essentially equivalent to "!!:%".

Since the event selector is `!!', you need a previous history entry to
make that a valid event, and you don't have one. The history code complains
when you specify an invalid event -- it's the same as if you had specified
"!578" when you only have 12 history entries.

> [root@localhost ~]# bash
> [root@localhost ~]# echo "!%"
> bash: !: event not found
> [root@localhost ~]# echo a >/dev/nul
> [root@localhost ~]# echo "!%"
> echo ""

I don't know if you're not reading the history file at startup or if it's
due to something else, but you have an empty history list when you attempt
the first history expansion.

-- 
``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/

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web