On Wed, May 07, 2008 at 05:50:59PM -0400, Chet Ramey wrote: > Poor Yorick wrote: >> ksh refuses to define functions which contain a dash ("-") in the name. >> The >> Bash manual also defines 'name' as consisting solely of letters, numbers, >> and >> underscores. So shouldn't bash refuse to create functions which contain a >> dash >> in the name? > > When in posix mode, bash does so refuse. In default (non-posix) mode, it > is more liberal. [...]
Note that bash didn't have to. POSIX allows a shell to accept any character in a function name, but it says one shouldn't use those in a POSIX script, which is different. IMO, given that they share the same namespace as other commands, I don't see why they should be more restricted than file paths (any character but NUL and must not be empty). Or even, given that they are an argument to a single command, they could be empty. zsh allows any character, even NUL and even the empty string: $ ''() echo $@ $ "" foo foo So do rc and es (not the NULs, though). -- Stéphane