help-bash
[Top][All Lists]
Advanced

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

Re: Bash Shell Parameter Expansion


From: Greg Wooledge
Subject: Re: Bash Shell Parameter Expansion
Date: Sat, 9 Oct 2021 10:36:18 -0400

On Sat, Oct 09, 2021 at 09:05:19AM -0500, Dennis Williamson wrote:
> Your assignment is being executed as a command. Why don't you simply do
> 
> param="Hilbert Transform"

Don't bother asking this person why they do whatever it is that they do.
Just add their current email address-pattern to your ever-growing list
of killfile patterns for blocking them (again).

(My current email killfile consists of 8 patterns.  6 of them are for
this one person.  Seriously, this person is mentally ill and needs to
get help from somewhere other than help-bash.)

> Note the colon. You probably really want to do something else. Here's one
> example that comes in handy:
> 
> myfunc () {
> 
>     param=${$1:-"Hilbert Transform"}
>     echo "$param"
> }

The second $ is incorrect here.  You need ${1:-blah blah} instead.  Also,
you don't need the inner quotes there, but I guess they don't hurt.



reply via email to

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