Author: R A Montante, Ph.D. Date: To: dng Subject: Re: [DNG] Some minor annoyances
>> ...at the commandline works, but the script >> #!/bin/bash
>> echo ${LINES} ${COLUMNS}
>> ...returns nothing.
> It's a bit odd, but it's consistent with the behaviour described in the
> man page. The man page for bash 5.3 says that if the checkwinsize option
> is enabled (the default since bash 5.0), "bash checks the window size
> after each external (non-builtin) command and, if necessary, updates the
> values of LINES and COLUMNS".
This all led me to the realization that bash distinguishes between
"environment variables" and "shell variables" --- the former being those
which a shell invocation inherits and the latter being those it
determines for itself.
This makes some sense to me --- for example, $LINES and $COLUMNS should
change any time your shell window is resized (presuming you're in a GUI
:-) while $LS_COLORS should be an intrinsic property of (the current
invocation of) the shell. On the other hand, the bash man page lists
$PWD as a shell variable but also subsequently refers to it as an
"environment variable", although it clearly needs to change every time
you change your working directory. So the distinction isn't rigorous.
...so I've generated more heat than light on this topic. Just my little
contribution to climate change --- or is that part of the environment? :-}