bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Gettings LINES and COLUMNS from stderr instead of /dev/tty


From: Martin Schulte
Subject: Re: Gettings LINES and COLUMNS from stderr instead of /dev/tty
Date: Sun, 17 Jul 2022 09:15:03 +0200

Hello Dale!

> Martin Schulte <gnu@schrader-schulte.de> writes:
> > I'm just wondering that bash (reproduced with 5.2-rc1 under Debian 11)
> > seems to determine LINES and COLUMNS from stderr.
> 
> It's not clear to me that the manual page says where the LINES and
> COLUMNS values are obtained from.

Sorry, maybe my mail was somewhat too short...

I didn't find anything in the man pages that states where these variables are 
obtained from.

To show the behaviour do the following:
- Open a (resizable) terminal window (with a bash in it), say it is /dev/pts/5
- In a second terminal window start the script
#!/bin/bash

shopt -s checkwinsize
trap 'echo $LINES $COLUMNS' SIGWINCH
while true; do sleep 0.1; done

with ./winsize 2> /dev/pts/5

Whenn you now resize this window, the script will show you the size of the 
other one.

The sources (get_new_windows_size in lib/sh/winsize.c) seem to explain well why 
this happens.

Hope this helps to understand the problem!

Best regards

Martin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]