hubertf's NetBSD Blog
Send interesting links to hubert at feyrer dot de!
 
[20090502] Automatically cycling through screen(1) screens
NetBSD's systat(1) offers the -t option to switch to the display after a given number of cycles. I'd love to have something similar in screen(1), but couldn't find it from a brief RoTFM.

As a result, I came up with the following line, which -- when ran inside a screen(1) session -- skips through screens 0 to 4:

sh -c 'n=0; while true ; do  echo n=$n ; screen -x -X select $n ; \
       n=`expr $n + 1`; if [ $n = 4 ]; then n=0; fi ; sleep 5 ; done'
This assumes that there are four screen sessions running. Determining the number of screen sessions actually running as well as skipping the one running this code is left as an exercise to the reader.

If anyone has a better solution, I'd love to hear about it! :)

[Tags: , ]


Disclaimer: All opinion expressed here is purely my own. No responsibility is taken for anything.

Access count: 35082518
Copyright (c) Hubert Feyrer