Mailinglist Archive: opensuse (1696 mails)

< Previous Next >
Re: [opensuse] BASH: has $COLUMNS gone nuts?
  • From: "David C. Rankin" <drankinatty@xxxxxxxxxxxxxxxxxx>
  • Date: Fri, 24 Jul 2009 10:17:09 -0500
  • Message-id: <200907241017.09739.drankinatty@xxxxxxxxxxxxxxxxxx>
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...

--
David C. Rankin, J.D.,P.E.
Rankin Law Firm, PLLC
510 Ochiltree Street
Nacogdoches, Texas 75961
Telephone: (936) 715-9333
Facsimile: (936) 715-9339
www.rankinlawfirm.com
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups