[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unexpected Quick Substitution in string literals
From: |
Chet Ramey |
Subject: |
Re: Unexpected Quick Substitution in string literals |
Date: |
Thu, 14 Dec 2023 11:47:16 -0500 |
User-agent: |
Mozilla Thunderbird |
On 12/13/23 12:20 AM, Sundeep Agarwal wrote:
Bash Version: 5.0
Patch Level: 17
Release Status: release
Description:
While declaring a string literal across multiple lines, a line starting
with the ^ character is resulting in some sort of quick substitution
processing.
This is a standard form of history expansion, described in the man page.
I do not have the latest Bash on my machine, but somebody else got the same
result on the 5.2.21 version.
For a long time, history expansion was stateless: it worked on a line at
a time, and didn't know anything about the calling application's quoting
state. Bash simply didn't call history expansion if it was parsing a
single-quoted string.
That generated complaints, since people wanted history expansion after
the closing quote on a line that started out single-quoted, so I moved
this functionality into the history library itself, and there became a
way to tell the history library the current quoting state of a line.
The quick substitution feature didn't pay attention to the quoting state,
however, and just translated the line into a standard history expansion,
which was then skipped. The fix is to have it inhibit quick substitution
the same way as other history expansions.
--
``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/
OpenPGP_signature.asc
Description: OpenPGP digital signature