On Thu, Jul 08, 2021 at 04:38:25AM +0200, lisa-as...@perso.be wrote:
> I'd rather understand what's going on, rather than simply never use it.
OK. Let's start from the beginning.
In sh and bash, anything that begins with a $ is potentially a
substitution, a.k.a. an expansion. The parser will
> On Jul 7, 2021, at 10:38 PM, lisa-as...@perso.be wrote:
>
> Correct. How do others customarily use `${fdir:=$PWD}` ?
The common idiom is
: "${fdir:=$PWD}"
The ':' utility is used because it does nothing, but its arguments
are expanded as usual.
> I'd rather understand what's going on,
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.
>
>
>
> to
>
>
>
> fdir=${fdir:=$PWD}
Here, you are using a form of parameter expansion that intrinsically performs
variable
> > fdir=${fdir:=$PWD}
>
> Ack!
I know. I simply gave up. At least this will "work", even if it's
completely silly.
On Wed, Jul 7, 2021, 7:55 PM wrote:
>
>
> 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}"
>
On 7/7/21 6:53 PM, lisa-as...@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.
Seriously, just replace the :- expansion
On Thu, Jul 08, 2021 at 12:33:04AM +0200, lisa-as...@perso.be wrote:
> Talking about neater design choices, you seem to imply you have some other
> way to take user options that are composed of lists, so that one does not use
> a delimited string. What is it?
I wrote a detailed message containing
On 7/7/21 6:48 PM, lisa-as...@perso.be wrote:
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.
Dennis Williamson succinctly summarized the differences.
${parameter:-word}
On Thu, Jul 08, 2021 at 12:37:07AM +0200, lisa-as...@perso.be wrote:
> >From: Dennis Williamson
> >$ : ${foo:-bar}
> >$ : ${foo:=bar}
> >The first form is a substitution and the second form is an assignment.
> So you used `:` at the beginning and it worked?
Are you incapable of seeing the
On Wed, Jul 7, 2021, at 6:37 PM, lisa-as...@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.
--
vq
On Wed, Jul 7, 2021, 4:50 PM wrote:
>
> Have noticed that parameter expansion with `:` does not work
>
>
>
> : ${fltype:-"texi,org"} # alternative to `fltype=`
>
>
$ unset foo
$ : ${foo:-bar}
$ echo "$foo"
$ : ${foo:=bar}
$ echo "$foo"
bar
The first form is a substitution and the second
On Thu, Jul 08, 2021 at 12:10:27AM +0200, lisa-as...@perso.be wrote:
> The line
> : ${fltype:-"texi,org"}
> should be an alternative to
> fltype=${fltype:-"texi,org"}
As Chet guessed earlier, you probably meant := instead of :- .
I started typing something to that effect in my first
On 7/7/21 6:12 PM, lisa-as...@perso.be wrote:
> : ${fltype:-"texi,org"} # alternative to `fltype=` >
I'm not sure why you think that's an alternative. Maybe you meant
${fltype:="texi,org"}?
It is supposed to be built into bash so a new process is not created.
Perhaps not in Gnu Bash?
What
On 7/7/21 6:10 PM, lisa-as...@perso.be wrote:
The line
: ${fltype:-"texi,org"}
should be an alternative to
fltype=${fltype:-"texi,org"}
It absolutely is not.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet
On 7/7/21 5:50 PM, lisa-as...@perso.be wrote:
Have noticed that parameter expansion with `:` does not work
: ${fltype:-"texi,org"} # alternative to `fltype=` >
I'm not sure why you think that's an alternative. Maybe you meant
${fltype:="texi,org"}?
--
``The lyf so short, the craft so
On Wed, Jul 07, 2021 at 11:50:01PM +0200, lisa-as...@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
16 matches
Mail list logo