bug-bash
[Top][All Lists]
Advanced

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

Re: ${parameter/pattern/string} behaviour changed


From: L A Walsh
Subject: Re: ${parameter/pattern/string} behaviour changed
Date: Fri, 16 Mar 2018 18:02:38 -0700
User-agent: Thunderbird



dc@ftb-esv.de wrote:
Description:
        Command: x="a b c"; echo "'${x// /','}'"
        On old systems the output is:  'a','b','c'
        In this version the output is: 'a,b,c'
        This new behavior breaks some scripts.
---
The way I'd see it is that the ',' in the replacement text
field needs to have its quotes quoted.  I.e. this works:

 echo "'${x// /"','"}'"
'a','b','c'

----
So it's really just a matter of quote removal occurring in
the replacement text.  In that respect, it is consistent
with:

 echo "$(echo 'hi')"
hi

where you get hi w/no quotes, vs.:

 echo "$(echo "'hi'")"
'hi'

If quotes didn't function in the 2nd part, I'd think it a bug, since
it would be using the literal value in the 2nd part and one wouldn't be
able to use a variable (like Greg did, though I didn't see
the need to put the quotes in a variable).




reply via email to

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