> From: Kerin Millar <[email protected]>
> To: Dennis Williamson <[email protected]>
> Subject: Re: parameter expansion with `:` does not work
> Date: 08/07/2021 03:51:15 Europe/Paris
> Cc: [email protected];
>    Greg Wooledge <[email protected]>;
>    bug-bash <[email protected]>;
>    Chester Ramey <[email protected]>

> On Thu, 8 Jul 2021 02:54:06 +0200 (CEST)
> [email protected] wrote:

> > As I was in it, have also changed  
> > 
> > fdir=${fdir:-$PWD}

> This makes sense.



> It makes sense, although one is using substitution and then setting it to the 
> same parameter. 



> > to 
> > 
> > fdir=${fdir:=$PWD} 

> Here, you are using a form of parameter expansion that intrinsically performs 
> variable 

> assignment, only to redundantly assign the result of the expansion to the 
> same variable once 

> again. 



Correct.  How do others customarily use `${fdir:=$PWD}` ?



> In a roundabout fashion, it ends up proving Greg's point. I'd suggest 
> temporarily disavowing 

> yourself of the ${parameter:=word} form, for the time being.



I'd rather understand what's going on, rather than simply never use it.




Reply via email to