I've been trying to figure out how to make this simple shell script work:
apperantly, the way to do this is to say COLUMNS=$COLUMNS cow.sh
or export $COLUMNS cow.sh
but the other way is it have these imporant enviorment variables exported by default
Reproducible: Didn't try
Steps to Reproduce:
i dont have COLUMNS defined anywhere in my files yet that var works when i start a new bash
what shell do you use ?
bash-2.05b$ bash --version
GNU bash, version 2.05b.0(1)-release (i686-pc-linux-gnu)
Copyright (C) 2002 Free Software Foundation, Inc.
bash-2.05b$ cat cow2.sh
#shopt -s checkwinsize
#kill -n 28 $$
bash-2.05b$ . cow2.sh
bash-2.05b$ COLUMNS=$COLUMNS ./cow2.sh
Used by the select builtin command to determine the terminal
width when printing selection lists. Automatically set upon
receipt of a SIGWINCH.
SIGWINCH 28,28,20 Ign Window resize signal (4.3 BSD, Sun)
if you want access to that kind of information in scripts i'd suggest you utilize `stty size`