bug-bash
[Top][All Lists]
Advanced

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

checkwinsize only works in interactive shells


From: Greg Wooledge
Subject: checkwinsize only works in interactive shells
Date: Fri, 11 Jan 2013 16:13:07 -0500
User-agent: Mutt/1.4.2.3i

shopt -s checkwinsize only works in interactive shells.  However, this
is not mentioned in the manual.

Tested in Bash 4.2.37.

#!/bin/bash
trap 'echo "COLUMNS is now <$COLUMNS>"' WINCH
test -z "$COLUMNS" && COLUMNS=$(tput cols)
shopt -s checkwinsize
while sleep 1; do :; done

Run in a terminal, resize the terminal repeatedly.  COLUMNS is never
updated after its initial setting.

Set the same trap in an interactive shell, and resize the terminal
repeatedly.  COLUMNS will be updated each time.



reply via email to

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