bug-bash
[Top][All Lists]
Advanced

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

Aw: Re: `printf -v foo ""` does not set foo=


From: John Kearney
Subject: Aw: Re: `printf -v foo ""` does not set foo=
Date: Mon, 17 Jun 2013 12:09:26 +0200 (CEST)

   Thats one of the reasons I suggested the following syntax
   printf -v test "%s" ""
   It doesn't have this problem it also saves other problems as well.
   of if you want to expand back slashes etc.
   printf -v test "%b" ""
   Gesendet: Montag, 17. Juni 2013 um 08:33 Uhr
   Von: "Linda Walsh" <bash@tlinx.org>
   An: bug-bash@gnu.org
   Betreff: Re: `printf -v foo ""` does not set foo=
   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)


reply via email to

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