Philosophical question

From: Michael F. Stemper (michae...)

Why doesn't bash export $COLUMNS?

I wanted to add some code within a program to have its output
nicely formatted, no matter the width of the terminal in which
it was being run. Unfortunately, I wasn't able to do so, because
it didn't have access to $COLUMNS.

The following simple example shows that $COLUMNS is not exported:

[email protected]$ echo $COLUMNS
80
[email protected]$ cat > col
#!/bin/bash
echo $COLUMNS
[email protected]$ chmod +x col
[email protected]$ ./col

[email protected]$ export COLUMNS
[email protected]$ ./col
80
[email protected]$

Now that I've moved beyond denial, I'd like to understand *why*
this is so. Does anybody have a good reason why programs and
scripts shouldn't have automatic access to this particular
variable?

--
Michael F. Stemper
Life's too important to take seriously.

Share |