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: Chet Ramey
Subject: Re: is it normal that set -x unset commands dont display special chars in the content
Date: Sun, 28 Feb 2021 17:47:16 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.8.0

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.



--
``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/



reply via email to

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