Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Inconsistent history expansion of characters adjacent to histchar



On Tue, 08 Oct 2013 07:31:25 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> I'm wondering if backslash ought to be treated specially in more of the
> history code.  In particular:
>
> torch% print !\!; print foo       
> zsh: event not found: \!
> torch% 
> 
> One might think one could use that form to search for a command line
> that begins with a literal exclamation point, but no.

Hmm... the documentation does indeed imply backslash is some sort of a
quote for history.  Actually, I think it's just talking about escaping
the initial ! and then goes into its usual "it sort of vaguely works
like this but nobody ever really thought it through from beginning to
end" mode.  However, you might think you were morally entitled to have a
backslash at that point either isolate the backslashed expression from
what went before (so it behaves just like a single !), or to be treated
as a string argument, and I would think the second, the one you
mentioned, is rather more useful.

pws



Messages sorted by: Reverse Date, Date, Thread, Author