screen-users
[Top][All Lists]
Advanced

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

bash script for cycling through all screen -ls


From: Jon Bendtsen
Subject: bash script for cycling through all screen -ls
Date: Fri, 28 Jul 2006 14:25:53 +0200

Hi

I got tired of having to type alot or cut'n'paste all the screens listed using
        screen -ls
So i made a small bash script that does that semiautomaticaly.

It parses the output from screen -ls and attaches to each screen one
by one. To get to the next one just deatach using normal C-a d

Just before entering the screen session, it tells you which command that
screen session is running. 2 seconds later the script enters the screen
session. It is safe to press ctrl+c at this moment since i use a sleep 2.

After using it for some time i figured that i got rid of all the bugs and that others might like it. I call it allscreens and the script is naturaly under the
same GPL as screen is.

#!/bin/bash

for window in $(screen -list | grep "(.*)" | cut -d"." -f1 | sed -e "s/\t//g"); do childpid=$(pstree -p -A $window | sed -e "s/.*---//" | sed -e "s/.* (//" | sed "s/)$//")
  childtxt=$(ps $childpid | cut -b 28-)
  echo $childtxt
  sleep 2
  screen -r $window
done






reply via email to

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