[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Valid characters for function names
From: |
Reuti |
Subject: |
Re: Valid characters for function names |
Date: |
Mon, 25 Nov 2019 23:19:16 +0100 |
Thx for all the replies and links.
Nevertheless I wonder about the central place to read about the differences
between being POSIX compliant or allowing extensions for this particular issue.
As I noted in my original email from `man bash`:
a)
name A word consisting only of alphanumeric characters and underscores,
and beginning with an alphabetic character or
an underscore. Also referred to as an identifier.
b)
name () compound-command [redirection]
function name [()] compound-command [redirection]
There is no hint that Bash extends the valid character set to a broader range.
There is only a note about POSIX mode limiting the to be used names not to be
one of POSIX special builtins. In b) maybe "fname" should be used with a proper
definition of "fname" beforehand. Then it could be phrased: 'In POSIX mode
"fname" is limited to represent a "name".'
-- Reuti
> Am 25.11.2019 um 20:27 schrieb Chet Ramey <address@hidden>:
>
> On 11/25/19 12:02 PM, Eli Schwartz wrote:
>> On 11/25/19 9:41 AM, Reuti wrote:
>>> Hi,
>>>
>>> I got a script using foo++() as function name, and at first I was
>>> confused of a different behavior between bash 4.2, 4.4 and 5.0. After
>>> crawling some mailing lists whether this is allowed at all [...]
>> You can do some fun stuff with function names, which seems fair since
>> you can also do fun stuff with disk filenames in /usr/bin
>
> https://lists.gnu.org/archive/html/bug-bash/2019-01/msg00171.html
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
> ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU address@hidden http://tiswww.cwru.edu/~chet/
>