[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/
- Re: ! history expansion occurs within arithmetic substitutions, (continued)
- Re: ! history expansion occurs within arithmetic substitutions, Andreas Schwab, 2023/08/08
- Re: ! history expansion occurs within arithmetic substitutions, Dale R. Worley, 2023/08/11
- Re: ! history expansion occurs within arithmetic substitutions, Martin D Kealey, 2023/08/11
- Re: ! history expansion occurs within arithmetic substitutions, Chet Ramey, 2023/08/14
- Re: ! history expansion occurs within arithmetic substitutions, Martin D Kealey, 2023/08/15
- Re: ! history expansion occurs within arithmetic substitutions, Zachary Santer, 2023/08/08
- Re: ! history expansion occurs within arithmetic substitutions, Dale R. Worley, 2023/08/10
- Re: ! history expansion occurs within arithmetic substitutions, Lawrence Velázquez, 2023/08/10
- Re: !; is interpreted as an history expansion that can never match anything, Dale R. Worley, 2023/08/08
- Re: !; is interpreted as an history expansion that can never match anything,
Chet Ramey <=