[Top][All Lists]

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

Re: command line not saved after "event not found" error

From: Greg Wooledge
Subject: Re: command line not saved after "event not found" error
Date: Sun, 20 Feb 2022 12:29:16 -0500

On Sun, Feb 20, 2022 at 05:38:06PM +0100, Andrea Monaco wrote:
> on my bash 5.0.3, when I input
>   $ foo!\
> I get "bash: !\: event not found", which I think is appropriate, but the
> line doesn't get saved in history.  The same doesn't happen for other
> errors, for example "command not found".
> Is this behavior intended?

This is one of the reasons that I disable history expansion in my .bashrc.

In my particular experience, the trigger was repeated instances of this
sort of thing:

$ id3v2 -t "Ah! Leah!" -a "Donnie Iris" filename.mp3

This would fail with the infamous "event not found", and then to add
insult to injury, the command wasn't even editable with ESC k.  I would
have to highlight the command with the mouse, then copy/paste it, and
then edit it.

After that happened several times, I gave up on history expansion, and
put "set +o histexpand" in my .bashrc.

Later, bash was modified to make this particular failure condition less
prominent.  Something about changing the types of quoting that would
disable history expansion... I don't know the full details.  I've never
had any reason to turn histexpand back on.

reply via email to

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