Paolo Bonzini <bonzini <at> gnu.org> writes:

> 
> 
> > In the meanwhile I thought about
> > 
> >   as_lineno=${as_lineno-$LINENO} func
> > 
> > which is a slick trick, as it supports nesting and does not require
> > unset.  
> 
> ... and fails in bash 2.x, of course.

How?  I built 2.05a just for this occasion, and I couldn't reproduce a failure.

$ func_var(){ var=$var${a-B}; }
$ func_var
$ a=b func_var
$ func_var
$ b=c      
$ a=${a-$b} func_var
$ func_var
$ echo $var
BbBcB
$ echo $BASH_VERSION
2.05a.0(1)-release

-- 
Eric Blake






Reply via email to