> From: Kerin Millar <k...@plushkava.net>
> To: Dennis Williamson <dennistwilliam...@gmail.com>
> Subject: Re: parameter expansion with `:` does not work
> Date: 08/07/2021 03:51:15 Europe/Paris
> Cc: lisa-as...@perso.be;
>    Greg Wooledge <g...@wooledge.org>;
>    bug-bash <bug-bash@gnu.org>;
>    Chester Ramey <chet.ra...@case.edu>

> On Thu, 8 Jul 2021 02:54:06 +0200 (CEST)
> lisa-as...@perso.be 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