bug-bash
[Top][All Lists]
Advanced

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

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


From: Andreas Kusalananda Kähäri
Subject: Re: command line not saved after "event not found" error
Date: Sun, 20 Feb 2022 22:26:58 +0100

On Sun, Feb 20, 2022 at 05:38:06PM +0100, Andrea Monaco wrote:
> 
> Hello,
> 
> 
> 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?
> 
> 
> 
> Let me know,
> 
> Andrea Monaco

It's not that it's the error that prevents the command from being saved
in the shell's history, it's the fact that it is a history expansion
(albeit a failed one).  History expansions are not saved in the history.

If history expansions, like !! to execute the most recent command in
history, was saved to the shell's command history, then what would the
shell execute if you entered !! for the secand time in a row?


-- 
Andreas (Kusalananda) Kähäri
SciLifeLab, NBIS, ICM
Uppsala University, Sweden

.



reply via email to

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