[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 00:48:21 +0200 (CEST) |
>From: Lawrence Velázquez <vq@larryv.me>
>To: lisa-asket@perso.be
>Subject: Re: parameter expansion with `:` does not work
>Date: 08/07/2021 00:39:55 Europe/Paris
>Cc: bug-bash@gnu.org
>On Wed, Jul 7, 2021, at 6:37 PM, lisa-asket@perso.be wrote:
>> So you used `:` at the beginning and it worked?
>Chet and Greg already spelled out your mistake. It has nothing to
>do with the ':' command.
So the : command exists ?
I have some difficulty understanding the difference between ${parameter:-word}
and ${parameter:=word}, and when it is appropriate to use one as opposed to the
other.
${parameter:-word}
If parameter is unset or null, the expansion of word is substituted. Otherwise,
the value of parameter is substituted.
${parameter:=word}
If parameter is unset or null, the expansion of word is assigned to parameter.
The value of parameter is then substituted. Positional parameters and special
parameters may not be assigned to in this way.
Currently I have
dir=${dir:-$PWD}
fltype=${fltype:="texi,org"}
- Re: parameter expansion with `:` does not work, (continued)
Re: parameter expansion with `:` does not work, Chet Ramey, 2021/07/07
Re: parameter expansion with `:` does not work, Dennis Williamson, 2021/07/07
Re: parameter expansion with `:` does not work, Greg Wooledge, 2021/07/07
parameter expansion with `:` does not work, lisa-asket, 2021/07/07
Re: parameter expansion with `:` does not work, Chet Ramey, 2021/07/07
parameter expansion with `:` does not work, lisa-asket, 2021/07/07
Re: parameter expansion with `:` does not work, Dennis Williamson, 2021/07/07
Re: parameter expansion with `:` does not work, Greg Wooledge, 2021/07/07
Re: parameter expansion with `:` does not work, Kerin Millar, 2021/07/07
parameter expansion with `:` does not work, lisa-asket, 2021/07/07
Re: parameter expansion with `:` does not work, Lawrence Velázquez, 2021/07/07