On 22/10/2023 23:13, Greg Wooledge wrote:
2) All-caps variable name IFL. All-caps variable names are reserved, by
convention, for environment variables (e.g. PATH) and special shell
variables (e.g. IFS).
While I don't disagree with the suggestion of using lower case for
variables (and have even started doing so myself), it seems that this
"convention" is far from universal.
I did a quick search on the bash manual page and found no suggestion on
how to name user variables, or that uppercase names are reserved (but it
was a very quick search - I might have skipped something).
Even an internet search shows that people seem to be divided: this style
guide[0], for example, suggests lower case variable names (for the same
reason), but suggests that if the variable is actually a constant, it
should be upper case. (This seems to be influenced by Java conventions.)
[0]
https://google.github.io/styleguide/shellguide.html#s7-naming-conventions
This guy[1] even says that all variables should be uppercase.
[1] https://www.linkedin.com/pulse/bash-scripting-conventions-engin-polat
It's certainly very common (even if unfortunate) to use all uppercase
variables, as you certainly know.
So while I agree that it's a good idea to use lowercase variable names,
the way you put it seems a bit too strong. I'd call it a preference, or
even a matter of style, but convention to me implies something that's
more widely agreed upon or more widespread, which it's not (unfortunately).
--
Every word is like an unnecessary stain on silence and nothingness.
-- Beckett
Eduardo M KALINOWSKI
edua...@kalinowski.com.br