bug-bash
[Top][All Lists]
Advanced

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

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


From: Chet Ramey
Subject: Re: `printf -v foo ""` does not set foo=
Date: Tue, 25 Jun 2013 09:53:59 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130509 Thunderbird/17.0.6

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 6/24/13 6:52 PM, Mike Frysinger wrote:
> On Monday 24 June 2013 16:13:01 Chet Ramey wrote:
>> On 6/17/13 1:27 AM, 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.
>>
>> printf returns immediately if the format string is null.  It has always
>> been implemented this way.
> 
> seems like when the -v arg is in use, that [otherwise reasonable] shortcut 
> should be not taken ?

Maybe.  I'll take a look.  I suspect that the amount of code that depends
on the current behavior is pretty small.

Chet
- -- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (Darwin)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlHJoPcACgkQu1hp8GTqdKskTQCfatq1LQuEh6oPEl55Ljqarf1T
HGsAnA6fPLj+bP8LIqeSbayFne6HOkR4
=9mwl
-----END PGP SIGNATURE-----



reply via email to

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