On 6/13/13 3:58 PM, Linda Walsh wrote: > > I have a small function in my bashrc: > > function showsize () {\ > local s=$(stty size); local o="(${s% *}x${s#* })"; s="${#o}";\ > echo -n $o; while ((s-- > 0));do echo -ne "\b"; done; \ > } > export -f showsize > trap showsize SIGWINCH > --- > That has the effect of showing me my current window size > when I resize it. > > The odd thing is, if I use it while at a bash input prompt -- > any command I type has the first word ignored.
I haven't looked closely at this yet, but I bet that bash-4.2 running the trap immediately when the SIGWINCH is received is screwing up the parser state. A quick test shows me that running this on an empty line, then hitting return after resizing the terminal and before entering a new command, does not result in any errors. This won't work in bash-4.3, which runs traps at command boundaries to avoid just this kind of corruption. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/