1

tl;dr where can I find a list of shell variables that are on-demand (not listed by env)

Variables like $OSTYPE or $COLUMNS (bash) or $RANDOM (bash) are not listed by env.

Where can I find the list of these seemingly hidden environment variables?

1 Answer 1

2

Using typeset keyword (in bash) will show all possible evaluations of $ variables.

From man bash

typeset [-aAfFgilnrtux] [-p] [name[=value] ...]

Declare variables and/or give them attributes. If no names are given then display the values of variables. The -p option will display the attributes and values of each name.


$ typeset
...
COLUMNS=169
...
OSTYPE=linux-gnu
...
RANDOM=23503
...

Also, declare keyword works similarly to typeset.

1
  • 2
    Aka. declare.
    – l0b0
    Jul 3, 2019 at 20:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .