scripts icon indicating copy to clipboard operation
scripts copied to clipboard

termsize: doesn't work

Open bam80 opened this issue 10 months ago • 0 comments

Hi, The script just doesn't work:

$ ./termsize 
Reset the terminal to 24 rows, 80 cols

Guest Fedora Linux 41.1.4 run in QEMU with console=ttyS0 kernel cmdline. The same system is on host.

Contrary, this function works (but it needs stty which Anaconda (Fedora installer ISO) doesn't have):

res() {

  old=$(stty -g)
  stty raw -echo min 0 time 5

  printf '\0337\033[r\033[999;999H\033[6n\0338' > /dev/tty
  IFS='[;R' read -r _ rows cols _ < /dev/tty

  stty "$old"

  # echo "cols:$cols"
  # echo "rows:$rows"
  stty cols "$cols" rows "$rows"
}

Any help?

bam80 avatar Mar 22 '25 22:03 bam80