bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GROUPS


From: Štěpán Němec
Subject: Re: GROUPS
Date: Wed, 11 Aug 2021 12:10:21 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

On Tue, 10 Aug 2021 23:39:47 +0700
Robert Elz wrote:

>     Date:        Tue, 10 Aug 2021 10:22:29 -0400
>     From:        Chet Ramey <chet.ramey@case.edu>
>     Message-ID:  <731876fc-39c0-4388-0c9e-bf560921bb8c@case.edu>
>
>   | In this case, you are using features outside what POSIX specifies.
>
> Using a variable name that's outside what POSIX specifies is hardly
> using a feature that's outside POSIX - if it were then there would be
> no safe non-trivial scripts, since any variable name might be made magic
> by some shell or other (and no, there's nothing special about all upper
> case variable names).    Only those defined by POSIX to have some special
> meaning mean something, and even those can be re-used for another purpose
> as long as one doesn't expect the special behaviour to function correctly.

Quoting POSIX.1-2017 on environment variables [1]:

  Environment variable names used by the utilities in the Shell and
  Utilities volume of POSIX.1-2017 consist solely of uppercase letters,
  digits, and the <underscore> ( '_' ) from the characters defined in
  Portable Character Set and do not begin with a digit. Other characters
  may be permitted by an implementation; applications shall tolerate the
  presence of such names. Uppercase and lowercase letters shall retain
  their unique identities and shall not be folded together. 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.

So, no matter if "special" or not by your standards, there is definitely
a significant difference between "all upper case" variable names and the
rest, which IMO in itself constitutes a sufficient argument for sticking
to non-all-caps variable names for custom functionality (AKA
"applications" above or one's own shell scripts).

[1] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html

-- 
Štěpán



reply via email to

[Prev in Thread] Current Thread [Next in Thread]