David C. Rankin wrote:
On Friday 24 July 2009 08:19:24 am Randall R Schulz wrote:
#!/bin/bash --norc tmp=$(stty -a) tmp=${tmp##*rows\ } rows=${tmp%%;*} tmp=${tmp##*columns\ } cols=${tmp%%;*} echo "rows: $rows; cols: $cols"
Now it they just don't change the output format of stty -a....
There is a generalized substitution variant of the variable expansion syntax that is a that can strip content from around (from both sides) in a single expansion. That would clean up the foregoing code.
Hmm, I'll have to wade the frigid waters of man bash again...
I must have missed something. Why do you think these values are not exported? You do realize that lines & columns are dynamic values which at least some terminals and login daemons will continuously adjust right? de1:~ # echo $LINES $COLUMNS 25 80 de1:~ # echo $LINES $COLUMNS 29 86 de1:~ # sh de1:~> echo $LINES $COLUMNS 29 86 de1:~> cat /etc/SuSE-release openSUSE 11.1 (x86_64) VERSION = 11.1 de1:~> What the above shows is that I dragged the corner of my PuTTY window (which was connected to sshd, not every terminal client nor every server daemon does this) making the window a little larger and without issuing any commands, and no possibility that any bashrc or inclusions got executed, the values changed, because the terminal told the daemon and the daemon told it's child processes. Spawning a new shell creates a new seperate child process, and the values are still present, which proves that they were exported. I had not changed the window size so they weren't set anew, they had to have been exported to be present at all. Finally that this was an opensuse 11.1 box. -- bkw -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org