[Top][All Lists]

[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" <address@hidden>
   An: address@hidden
   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
   > was added in bash-3.1.
   > -mike
   > 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 ""
   printf -v foo
   (with nothing after it?) it seems the semantic parser would have
   removed the quotes by the time the args are passed to printf, even
   > 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]