Ubuntu: The nature of echo $COLUMNS


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.


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


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »