help-bash
[Top][All Lists]
Advanced

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

Re: Allowing dash in variable and function names


From: konsolebox
Subject: Re: Allowing dash in variable and function names
Date: Tue, 6 Apr 2021 13:15:04 +0800

On Tue, Apr 6, 2021 at 1:01 PM Eli Schwartz <eschwartz@archlinux.org> wrote:
> echo ${var-suffix} would not work either, even though ${} is the usual
> approach to disambiguating variable names, because that too has a
> pre-existing meaning:
>
>     When not performing substring expansion, using the forms documented
>     below (e.g., :-), bash tests for a parameter that is unset or null.
>     Omitting the colon results in a test only for a parameter that is
>     unset.
>
>     ${parameter:-word}
>         Use Default Values. If parameter is unset or null, the expansion
>         of word is substituted. Otherwise, the value of parameter is
>         substituted.

Dots however don't conflict. Ksh also already had them as readonly variables.

-- 
konsolebox



reply via email to

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