bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Issues with history substitution and its documentation


From: Jim Monte
Subject: Re: Issues with history substitution and its documentation
Date: Mon, 18 Nov 2019 12:40:13 -0500

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.
[root@localhost ~]# bash
[root@localhost ~]# echo "!%"
bash: !: event not found
[root@localhost ~]# echo a >/dev/nul
[root@localhost ~]# echo "!%"
echo ""

Jim

On Mon, Nov 18, 2019 at 11:20 AM Chet Ramey <chet.ramey@case.edu> wrote:

> On 11/5/19 11:44 AM, Jim Monte wrote:
> > The availability of the % string only after a command unrelated to it
> (not
> > using !??) is executed as shown below is not documented, but it probably
> > falls under the category of a bug. That is, it seems reasonable that both
> > echo "!%" commands should behave as the second one does.
> > [root@localhost ~]# bash
> > [root@localhost ~]# echo "!%"
> > bash: !: event not found
>
> If there is no history list, and hence no history entries, there are no
> events to find. Hence the error message.
>
> --
> ``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/
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]