Mike Frysinger wrote:
simple test code:
unset foo
printf -v foo ""
echo ${foo+set}
that does not display "set". seems to have been this way since the feature
was added in bash-3.1.
-mike
----
Indeed:
set -u
unset foo
printf -v foo ""
echo $foo
bash: foo: unbound variable
foo=""
echo $foo
----
I have a feeling this would be hard to fix, since how can printf
tell the difference between
printf -v foo ""
and
printf -v foo
??
(with nothing after it?) it seems the semantic parser would have already
removed the quotes by the time the args are passed to printf, even this:
set -u
printf -v foo "$(echo "$'\000'")"
echo $foo
still leaves foo gutless: without content (even if were null)