[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: |
felix |
Subject: |
Re: is it normal that set -x unset commands dont display special chars in the content |
Date: |
Mon, 1 Mar 2021 11:21:39 +0100 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Sun, Feb 28, 2021 at 10:32:13PM +0000, kfm@plushkava.net wrote:
> 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. Presumably,
> this led to the conclusion that bash doesn't "display em".
I agree:
$ declare -A map; key=$'foo\34bar'; map[$key]=
$ exec {BASH_XTRACEFD}> >(sed -ue 's/\o34/<<\\34>>/')
$ set -x
$ : "$key"
+ : $'foo\034bar'
$ unset map["$key"]
+ unset 'map[foo<<\34>>bar]'
--
FĂ©lix Hauri - <felix@f-hauri.ch> - http://www.f-hauri.ch