retitle 628638 bash.1: "shopt -s checkwinsize" has no effect in non-interactive
shells
severity 628638 minor
tags 628638 + upstream
quit
Hi Leslie,
Leslie A Rhorer wrote:
> The $COLUMNS variable seems to work properly in a terminal window
> (with shopt -s checkwinsize), but in a child script, the $COLUMNS
> variable is null no matter what I try, even if the windows is
> resized while running the script.
I tried to reproduce this like so:
cat >$HOME/bin/echocolumns <<\EOF
#!/bin/bash
shopt -s checkwinsize
read tmp
echo $COLUMNS
EOF
chmod +x $HOME/bin/echocolumns
echocolumns
[resize the terminal, then hit enter]
Indeed, it printed a blank line instead of a number of columns. But
I can't really fault bash for this behavior when
#!/bin/sh
tput cols
works reliably.
Do you agree? If so, could you suggest a patch for the manpage? If
not, what would be a better behavior?
Thanks for reporting,
Jonathan
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]