Open chnkd opened 1 year ago
foo[foo]
and bar[bar]
are just func names there, right? Out of curiosity, why would you use names that look like array indexing expressions? :)
I've personally never come across this in practice. If Bash supports it, we probably should support it as well, although it's worth noting that POSIX shell defines names (like function names) as simply:
In the shell command language, a word consisting solely of underscores, digits, and alphabetics from the portable character set. The first character of a name is not a digit.
Meaning that such func names are not valid POSIX Shell.
man bash
, instead, says:
When in posix mode, fname must be a valid shell name and may not be the name of one of the POSIX special builtins. In default mode, a function name can be any unquoted shell word that does not contain $.
Pretty bonkers design decision from Bash if you ask me!