[Top][All Lists]

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

Re: bug: illegal function name?

From: Ilkka Virta
Subject: Re: bug: illegal function name?
Date: Sun, 20 Jan 2019 20:22:16 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:60.0) Gecko/20100101 Thunderbird/60.4.0

In POSIX mode, Bash disallows names like '1a':

 13. Function names must be valid shell names. That is, they may not
 contain characters other than letters, digits, and underscores, and may
 not start with a digit. Declaring a function with an invalid name
 causes a fatal syntax error in non-interactive shells.

 14. Function names may not be the same as one of the POSIX special


The rules are more lax if POSIX mode is not set, but there's nothing that requires using nonstandard function names even in that case.

The manual could of course mention something about the accepted function names, e.g. "Function names can contain the characters [...], except in POSIX mode, where they must be valid shell /names/." I'm not exactly sure what the accepted characters are, though, so I can't really suggest anything concrete.

On 20.1. 17:26, Andrey Butirsky wrote:
Andreas, I know it will work with the '-f' flag.
But for others function names, the '-f' unset flag is not required.
Moreover, it seem confronts with Open Group Base Specification.
So I consider it as a bug still.

On 20.01.2019 18:18, Andreas Schwab wrote:
On Jan 20 2019, Andrey Butirsky <address@hidden> wrote:

|$ unset 1a             ||
||bash: unset: `1a': not a valid identifier
Use `unset -f'.


Ilkka Virta / address@hidden

reply via email to

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