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: Lawrence Velázquez
Subject: Re: Allowing dash in variable and function names
Date: Tue, 06 Apr 2021 01:07:23 -0400
User-agent: Cyrus-JMAP/3.5.0-alpha0-273-g8500d2492d-fm-20210323.002-g8500d249

On Tue, Apr 6, 2021, at 12:59 AM, konsolebox wrote:
> On Tue, Apr 6, 2021 at 12:47 PM <pauline-galea@gmx.com> wrote:
> >
> >
> > Could gnu bash start allowing "-" in variable and function names
> > as with lisp?
> 
> That's possible with the function keyword and when POSIX mode is disabled.

The "function" keyword is not necessary.

bash-5.1$ this-works-fine() { echo hello world; }
bash-5.1$ declare -f this-works-fine
this-works-fine () 
{ 
    echo hello world
}
bash-5.1$ this-works-fine
hello world

-- 
vq



reply via email to

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