On 9/4/26 7:10 AM, Zachary Santer wrote:
from the [email protected] email list

On Thu, Sep 3, 2026 at 8:37 AM <[email protected]> wrote:

From: Zachary Santer <[email protected]>

The information NSUB would convey doesn't have anything to do with the
kind of information held in PROCINFO. And all the other built-in
variables are just in the awk namespace.

PROCINFO["strftime"] is something of a counter-example.

Over time, Bash has moved away from adding variables to do things
and instead controlling features via the shopt command.

I'm not sure how true this is. I'd like some input from bug-bash people.

shopt options are good for binary toggles -- behavior is enabled or
disabled. One of the original motivations was to consolidate this kind
of toggling into one place, replacing the shell variables that bash used
previously.

I know that setting the shell compatibility level went from using a
shopt option to setting the BASH_COMPAT shell variable, at least.

BASH_COMPAT can hold more than one value; it's better to have that than a
bunch of `compatXX' shell options that would grow without bound.

And you obviously can't convey information to the user through shopt options.

Exactly.


How much concern is there that user scripts will already be using a
given variable name for something else, whenever a new shell variable
is added? Is the convention that only shell variables and environment
variables get the all-caps treatment enough?

Bash has adopted the BASH_ prefix for `private' shell variables that return
values (e.g., BASH_MONOSECONDS, BASH_NANOSECONDS). This is especially
useful for dynamic variables that generate their values upon reference.

This is a convention, of course, not a hard-and-fast rule.

This obviously won't fly with POSIX, so any variable whose semantics I
think POSIX might consider for standardization (e.g., GLOBSORT,
TIMEFORMAT) departs from this convention.

And what's the story on the -- now two -- shell variables that are lower-case?

History.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    [email protected]    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to