bug-bash
[Top][All Lists]
Advanced

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

Re: parameter expansion with `:` does not work


From: Greg Wooledge
Subject: Re: parameter expansion with `:` does not work
Date: Wed, 7 Jul 2021 17:54:21 -0400

On Wed, Jul 07, 2021 at 11:50:01PM +0200, lisa-asket@perso.be wrote:
> Have noticed that parameter expansion with `:` does not work
> 
> : ${fltype:-"texi,org"}  # alternative to `fltype=`

What did it do?  What did you *expect* it to do?

This looks like it's related to your ongoing project to make your
simple script as complex as possible.  As such, it appears you're
digging into the bowels of the Bourne shell and trying to dig up
every obscure piece of syntax you can find, so that you can use
them all, to be completely sure you can't possibly read the script
a week from now.

I advise you to stop doing this.

In this particular instance, you're assigning a LIST of two values
to a STRING variable, using a comma as a delimiter between them.
Presumably you're going to split this list apart later on.

Wouldn't it be a whole lot simpler to store the list in an ARRAY
variable in the first place, and avoid the need to split it?



reply via email to

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