bug-bash
[Top][All Lists]
Advanced

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

parameter expansion with `:` does not work


From: lisa-asket
Subject: parameter expansion with `:` does not work
Date: Thu, 8 Jul 2021 02:54:06 +0200 (CEST)

From: Chet Ramey <chet.ramey@case.edu>
To: lisa-asket@perso.be;
   Greg Wooledge <greg@wooledge.org>;
   bug-bash@gnu.org
Subject: Re: parameter expansion with `:` does not work
Date: 08/07/2021 00:59:52 Europe/Paris
Cc: chet.ramey@case.edu

On 7/7/21 6:53 PM, lisa-asket@perso.be wrote:

> > Yes I can see one has :- and the other has  :=
> > 
> > But I also noticed : at the front, with someone saying that the command 
> > does not
> > exist in Gnu Bash.

> No one implied that `the command' is not present in bash.



Things are clearer now.  



> Seriously, just replace the :- expansion with := and go on with your code.
> It's the least intrusive change, and won't disturb your logic.



 I executed 



echo "${parameter:-word}"; echo "${parameter}" 



and then 



echo "${parameter:=word}"; echo "${parameter}" 



It was to make the distinction clear.



As I was in it, have also changed  



fdir=${fdir:-$PWD} 



to 



fdir=${fdir:=$PWD} 



-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/




reply via email to

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