[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: History expansion quoting problem
From: |
Chet Ramey |
Subject: |
Re: History expansion quoting problem |
Date: |
Sun, 10 Sep 2017 15:01:00 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 |
On 9/8/17 4:18 AM, Philipp Sasse wrote:
> Executing something like
> echo "foo
> bar" | sed '/foo/!d'
> results in an error. Apparently the history expansion considers only
> quoting characters on the same input line, so the closing double quote is
> taken as opening double quote, escaping the following single quotes, thus
> these don't escape the ! anymore.
History expansion is explicitly line-oriented, and always has been. There's
not a clean way to make it aware of the shell's current quoting state
(mostly since it's a library independent of the shell). Maybe there's a way
to use one of the existing callback functions to do it.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/