[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Possible problem with ${var%%[...]*}
From: |
Chet Ramey |
Subject: |
Re: Possible problem with ${var%%[...]*} |
Date: |
Mon, 3 Apr 2023 09:29:40 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 |
On 4/2/23 1:28 PM, Robert Elz wrote:
Date: Sun, 2 Apr 2023 17:48:24 +0200
From: Martin Schulte <gnu@schrader-schulte.de>
Message-ID: <20230402174824.01db4d51fd4f0061fdba76cd@schrader-schulte.de>
| in the following lines I consider dash's behaviour as correct
| an bash's as wrong:
All other shells (even ksh93) not just dash.
I suspect the issue is that the string after %% is not regarded as
quoted, even when the expansion is
As POSIX specifies:
"Enclosing the full parameter expansion string in double-quotes shall not
cause the following four varieties of pattern characters to be quoted,
whereas quoting characters within the braces shall have this effect."
| $ bash -c 'option2="test{<().["; echo "${option2%%[<().[]*}"'
bash is parsing the <() as a process substitution, producing nothing.
Yes. No command, no child process, no pipe, no pathname.
--
``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/