> 2011-04-11, 09:51(-04), Chet Ramey: > >> 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. > [...] > > Why would you put any restriction on the allowed name of a function?
(Wow, this message took a long time getting here.) Because Posix does, and because unset without -f has to enforce the variable name restrictions. (Though the language has been relaxed in the latest standard.) Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/