[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Document what's allowed in function names
From: |
Chet Ramey |
Subject: |
Re: Document what's allowed in function names |
Date: |
Mon, 11 Apr 2011 09:51:32 -0400 |
> Machine Type: i686-pc-linux-gnu
>
> Bash Version: 4.2
> Patch Level: 8
> Release Status: release
>
> Description:
> man bash is currently lacking information on what is allowed for
> function
> names. It implies name with name () compound-command [redirection] and
> at the start of the manual there is:
>
> 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.
>
> In reality the rules for function names are much more loose. For example
> hyphen and forward slash are allowed. But there are still some
> restrictions:
> bash: `aa\'foo': not a valid identifier
It was a mistake to allow such characters in function names (`unset' doesn't
work to unset them without forcing -f, for instance). We're stuck with them
for backwards compatibility, but I don't have to encourage their use.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/