[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: splitting/whitespace in expansions of ${*} vs ${*/}
From: |
Grisha Levit |
Subject: |
Re: splitting/whitespace in expansions of ${*} vs ${*/} |
Date: |
Tue, 4 Apr 2017 15:29:03 -0400 |
There are a few small regressions in the latest devel relative to the
previous two commits but they're all rather exotic. Again, sorry if this
is still WIP/too minor:
CTLESC present in output (even with default IFS)
$ set -- 1; unset var; printf ${var-${*:1}} | xxd
00000000: 0131 .1
$ set -- 1; unset var; : ${var=${*:1}}; printf "$var" | xxd
00000000: 0131 .1
Not splitting (with default IFS):
$ set -- '1 1'; unset a b; printf '<%s>' ${a=$*} ${b=${*:1}}
<1><1><1 1>
A few more cases below:
# this worked correctly in the 20170324 push
$ set -- 1 2; IFS=; unset a b; printf '<%s>' $* ${a-$*} ${b-${*/}}
<1><2><1><2><12>
# this worked correctly in the 20170317 push
$ set -- 1 2; IFS=; unset a b; x=$*; printf '<%s>' $x ${a=$*} ${b=${*,}}
<12><12><1><2>
# as did this:
$ set -- 1 2; IFS=; a=$* b=${*@E}; printf '<%s>' "$a" "$b"
<12><1 2>
Another (rather unlikely-to-be-encountered) case of CTLESC showing up in
output (worked correctly in 20170317 but not in release):
# both indexed and assoc array have this:
$ A=(' '); IFS=; unset novar; var=${A[*]@E}
$ printf '%s' "$var" ${novar-${A[*]@E}} | xxd
00000000: 0120 0120 . .