1

When we execute the command echo $COLUMNS, where is COLUMNS located? I thought it was just an environment variable, but it is not displayed in env.

1 Answer 1

3

COLUMNS is a shell variable, not an environment variable. Therefore, you will not find it when you use env. If you are not sure what the differences between a shell variable and an environment variable are, take a look at Environment variable vs Shell variable, what's the difference?.

According to https://askubuntu.com/a/275972/15003, you can find COLUMNS if you run

( set -o posix; set ) | grep COLUMNS

which, on my machine, gives

COLUMNS=206
1
  • 1
    With the fish shell, set | grep COLUMNS provide me the answer. Nov 20, 2016 at 11:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.