bug-bash
[Top][All Lists]
Advanced

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

Re: is it normal that set -x unset commands dont display special chars i


From:
Subject: Re: is it normal that set -x unset commands dont display special chars in the content
Date: Sun, 28 Feb 2021 23:19:09 +0000
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.8.0

On 28/02/2021 22:47, Chet Ramey wrote:
On 2/28/21 5:32 PM, kfm@plushkava.net wrote:
On 28/02/2021 22:13, Chet Ramey wrote:
On 2/27/21 6:14 AM, Alex fxmbsw7 Ratchev wrote:
but they get unset right, just doesnt display em

i have stuff with $'\34' separator and in set -x output the text is just
flat for the unset

+ unset 'dat[kwmetest]' 'dat[1kw1]' 'dat[1take]' 'dat[1code]'

code includes

minuskws_p1=$nspace$SUBSEP$minuskws_id$SUBSEP \
minuskws_p2=$nspace${SUBSEP}kw$SUBSEP

These code fragments have nothing to do with each other. Why not include
a self-contained example that includes relevant `stuff' in what you're
passing to `unset'?


Why not indeed. However, I think that I'm able to decipher this.

$ declare -A map; key=$'foo\34bar'; map[$key]=
$ set -x
$ : "$key"
+ : $'foo\034bar'
$ unset "map[$key]"
+ unset 'map[foobar]'

For the unset command, xtrace elects to emit the (non-printable) FS character verbatim rather than employ the ANSI-style notation.

The check for shell special characters, which results in single quoting,
comes before whether there are any characters that would require ANSI-C
quoting. This is not specific to unset.

In fairness, I don't think it's strictly incorrect to say that the outcome is different "for" one of two commands used in a trivial example. I was only attempting to clarify the circumstances that begat the original question.

--
Kerin Millar



reply via email to

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