bug-bash
[Top][All Lists]
Advanced

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

Re: !; is interpreted as an history expansion that can never match anyth


From: Chet Ramey
Subject: Re: !; is interpreted as an history expansion that can never match anything
Date: Tue, 8 Aug 2023 15:35:10 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.13.0

On 8/8/23 1:43 AM, Emanuele Torre wrote:
! followed by a ; or another terminator  is interpreted as an history
expansion with no pattern that can never match anything.

   $ !; echo hi
   bash: !: event not found
   $ !&& echo hi
   bash: !: event not found

This is interesting. Bash documents the same characters that inhibit
history expansion as tcsh (my reference for csh-style history expansion),
but tcsh adds `;' and `&' to that set. Its behavior with `|' is a little
wierd: if the command on the rhs of the pipeline is an external command,
you get a command not found error, but if it's a builtin, you don't.

Anyway, there's a good reason to add ";&|" to the set of characters that
inhibit history expansion if they follow the history expansion character.

Chet

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