Northward Midget Pole to Pole

18Apr/110

Stuffing Text Into All Screen Windows

Posted by Quinn

Various pagers have been giving me question marks in boxes and hexadecimal codes.  This is probably because I didn't have the right font in the past and inserted various hacks into my ~/.bash tree to get around them, e.g. aliasing a LANG=C before every perldoc command.

Well, now I've just about got everything right and proper in UTF-8 mode using a uxterm, but those little nigglers still pop up.  Today I did a man less and found the LESSCHARSET environment variable.  Awesome!  But if it's not set, it's supposed to use the locale, and my locale is already properly set up to en_US.utf-8.  Not a problem.  I just export -n LESSCHARSET to un-export the variable.

But I'm in screen, with fourteen windows open.  How do I loop through all screen windows, stuffing a command into each?

Luckily, a quick reading of the screen man page led me to this:

at \# stuff "export -n LESSCHARSET\015source ~/.bash/aliases\015

And BAM that gets stuffed into every window I have open.  Unfortunately, some of those are SQL prompts, log tails, and maybe an open vim session or two, but such are the pitfalls of impatiently trying out a new command, and no harm was done.

The trick is to use the backslash-escaped octothorpe to specify all windows.  The rest is just a normal stuff, with that annoying octal \015 to specify a newline.

Oh, and I added a second command to source my bash aliases, because I'd added new ones recently.