bug-bash
[Top][All Lists]
Advanced

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

Re: bug with multiline strings parsing and single-quoted !


From: Chet Ramey
Subject: Re: bug with multiline strings parsing and single-quoted !
Date: Wed, 03 Dec 2014 08:47:29 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

On 12/3/14, 4:19 AM, Eduardo A. Bustamante López wrote:
> On Wed, Dec 03, 2014 at 08:57:26AM +0100, Piotr Grzybowski wrote:
>> Hey,
>>
>>  I think in this case, history_expand lib/readline/histexpand.c:905 is
>> invoked with hstring="b\" | echo '!'", and goes wrongly into history
>> expansion.
>>  Not that I know how to fix it ;-)
> Yes, the issue is tricky, because you don't have access to the whole buffer
> there (shell_getc), just to the current line (shell_input_line), but the
> current line is a fragment of the whole command.
> 
> What I don't understand is why bash does history expansion inside shell_getc,
> shouldn't it be easier to do it once you have the whole thing?

Bash has always performed history expansion a line at a time, as soon as
the line is read from the current input source.  One consequence of this,
as you noted, is that it doesn't have access to the current quoting state.
This is a limitation of the implementation.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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