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: Eli Schwartz
Subject: Re: Allowing dash in variable and function names
Date: Tue, 6 Apr 2021 01:31:23 -0400

On 4/6/21 1:15 AM, konsolebox wrote:
> 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.


While neat, this really doesn't answer the OP's interest in particularly
dashes.

-- 
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

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