automated COL and WCOL settings

Adrian Ho aho-lfs-discuss at 03s.net
Fri Jul 13 08:12:25 PDT 2001


On Fri, Jul 13, 2001 at 01:29:00PM +0200, Andre Wyrwa wrote:
> test -z "$CONSOLE" && CONSOLE=/dev/console
> COL=$[$(stty size < $CONSOLE | cut -f2 -d" ")-10]
> WCOL=$[$COL-20]
> [...]
> I have to admit that I don't know why the test-line is neccessary,
> cause a simple stty size (without input redirection) works for me. If
> somebody has an idea I would be glad to hear.

This looks like a code snippet that's normally used as part of a
application startup script.  I can think of two reasons why you'd want the
first line in this scenario:

[1] The app will not be started on the current console (eg. when run with
    the "open" command) -- you'd set CONSOLE to the appropriate device to
    be sure you capture the size of the correct console

[2] The user has redirected stdin from a file (COL=-10, WCOL=-20!)

- Adrian
-- 
Unsubscribe: send email to lfs-discuss-request at linuxfromscratch.org
and put unsubscribe in the subject header of the message



More information about the lfs-dev mailing list