Paul Eggert wrote:
> In addition to Pádraig's qualms, POSIX says[1] that if an environment 
> variable's name consists solely of uppercase ASCII letters, '_', and 
> non-initial digits, the variable might affect the behavior of standard 
> utilities like 'cat'. So if we document environment variable gotchas, we 
> should document that one too.
> 
> [1]: 
> https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap08.html#tag_08_01

I don't think we should document this anywhere, because it would have a
silly effect.

The current, widely used conventions in shell scripts are that
  - uppercase variables are often environment variables,
  - lowercase variables are shell variables (not inherited),
  - mixed-case variables don't exist.

These conventions make it easy to read and understand shell scripts.

[1] is saying "The name space of environment variable names containing
  lowercase letters is reserved for applications. Applications can define
  any environment variables with names from this name space without
  modifying the behavior of the standard utilities."
and anyone following this advice makes their shell scripts harder to
understand.

This is a case of the standards body wanting to reserve a convention
for themselves, that is widely used. (Similar to the ISO C body, which
reserves all types ending in '_t' for themselves.)

Bruno






Reply via email to