This question already has an answer here:
While playing around with bash and sh, I found out that the following is valid in bash:
system.out.println () { printf "$1"; }
but not in sh:
sh: `system.out.println': not a valid identifier
Why would this difference be there? Does the function defined above violate some convention (POSIX etc.) that causes this error?
Noctua
It's just the dots, you can't use dots in shell function names. Or any variable name, for that matter.
I'll link you to this question: Allowed characters in linux environment variable names
来源:https://stackoverflow.com/questions/20771743/function-name-valid-in-bash-but-not-in-sh