Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 41213

Summary: bash profile (skel) should export more things by default like COLUMNS and LINES
Product: Gentoo Linux Reporter: Aaron Peterson <alpeterson>
Component: [OLD] Core systemAssignee: Gentoo Linux bug wranglers <bug-wranglers>
Status: RESOLVED WONTFIX    
Severity: enhancement    
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 41166    

Description Aaron Peterson 2004-02-11 01:16:58 UTC
I've been trying to figure out how to make this simple shell script work:
#!/bin/bash
echo $COLUMNS

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:
1.
2.
3.
Comment 1 SpanKY gentoo-dev 2004-02-11 18:29:19 UTC
i dont have COLUMNS defined anywhere in my files yet that var works when i start a new bash

what shell do you use ?
Comment 2 Aaron Peterson 2004-02-11 21:44:10 UTC
bash-2.05b$ whoami
aaron
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
#!/bin/bash
#shopt -s checkwinsize
#kill -n 28 $$
echo $COLUMNS
bash-2.05b$ ./cow2.sh

bash-2.05b$ . cow2.sh
71
bash-2.05b$ COLUMNS=$COLUMNS ./cow2.sh
71
bash-2.05b$
Comment 3 SpanKY gentoo-dev 2004-02-11 21:54:40 UTC
from bash(1):
       COLUMNS
              Used by the select builtin command  to  determine  the  terminal
              width  when  printing  selection  lists.  Automatically set upon
              receipt of a SIGWINCH.
from signals(7):
       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`