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    c...@case.edu    http://tiswww.cwru.edu/~chet/


Reply via email to