On 1/13/09, David Korn <dgk at research.att.com> wrote:
> cc: don.cragun at sun.com April.Chin at eng.sun.com shell-discuss at
> opensolaris.org ksh93-integration-discuss at opensolaris.org
> Subject: Re: Re: CR 6791838 Created P3 shell/korn93 *ksh93* unset of a
> variablewhich is not set should return 0
> --------
>
>
> > Attached (as "ksh93_integration_unset_no_such_var_fix001.diff.txt") is a
> > prototype patch which fixes the problem (well, most of it, right now $
> > unset '1' # or $ unset '$' # do not return an error) and adds a new
> > option ("-e") to get the old behaviour for backwards-compatibilty.
> >
> >
>
>
> Why are you trying to merge the testing for whether a variable
> exists with unset? Aren't these orthogonal? Shouldn't they
> be done independently?
>
> Currently,
> [[ ${x+y} ]]
> will return true if x is set and 1 otherwise, where y can be any non-empty
> string.
Doesn't [[ ${x+y} ]] expand variable x?
x= ; x.get() { print "hello" ; } [[ ${x+y} ]] ; print $?
prints
hello
0
${x+y} will be a big performance regression if compared to if (unset -e x)
Chris
--
^---^
(@)v(@) Chris Pickett
| / IT consultant
===m==m=== pkchris at users.sourceforge.net