help-bash
[Top][All Lists]
Advanced

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

Local variables for nested function calls


From: eduardo-chibas
Subject: Local variables for nested function calls
Date: Wed, 28 Jul 2021 21:10:49 +0200


Are there other things to be unsatisfied with in addition to
`: "${fdir:="${@:$#}"}"}` and `fdir=${fdir:-default}`.

You are satisfied with

`bar="${foo:-default}`

Would you also be satisfied with

: ${ctx:=8}

Was the problem mostly related to using a list such as `$@` together with the 
other
complications?

Have only started looking about these things a few days ago, so most of my 
analysis
on what to use in specific situations is likely wrong.  That's why I am asking
for some illumination on this list.


> Sent: Thursday, July 29, 2021 at 5:05 AM
> From: "Greg Wooledge" <greg@wooledge.org>
> To: help-bash@gnu.org
> Subject: Re: Local variables for nested function calls
>
> On Wed, Jul 28, 2021 at 06:55:19PM +0200, eduardo-chibas@caramail.com wrote:
> > Some object to this one,
> >
> > local foo=${foo:-default}
>
> Well, yeah, you can see why.  What was 'foo' set to previously?  Why are
> you only declaring it local *now*, after it possibly already had some
> value?
>
> I don't understand the intent of this command, at least not without
> some context, so it's difficult for me to approve of it.
>
> What are you actually trying to do?
>
>



reply via email to

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