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.
>
> Why can't you use this instead of unset -e which has the side effect
> of unsetting the variable?
I think Roland has the better solution. I can fix our existing scripts
with alias unset='unset -e ' while your solution requires to edit
whole scripts.
Chris
--
^---^
(@)v(@) Chris Pickett
| / IT consultant
===m==m=== pkchris at users.sourceforge.net