bug-gnulib
[Top][All Lists]
Advanced

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

Re: unset FOO


From: Peter Seebach
Subject: Re: unset FOO
Date: Tue, 14 Oct 2008 10:13:10 -0500

In message <address@hidden>, Eric Blake writes:
>Peter Seebach <seebs <at> seebs.net> writes:
>
>> 
>> In regards to worries about "unset FOO" not working if FOO is not set:
>> 
>> ${FOO+unset FOO}
>> 
>> Is this crazy or clever?  It works in Solaris sh.  (I know, in most cases,
>> it's sufficient to just empty the variable, but sometimes it'd be nice to
>> be able to distinguish between empty and unset.)
>
>No, it does NOT work in Solaris sh (tested on Solaris 8):
>
>$ /bin/sh -c 'foo=a;${foo+unset foo};echo ${foo+set}' ; echo $?
>/bin/sh: bad substitution
>1

I think it needs to be in quotes, as with other {x+a b} expansions.  I may
have tested it in double quotes or something.  Or I may just have been
confused.

-s




reply via email to

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