会话屏幕 - 如何获取会话列表

时间:2013-11-19 11:51:31

标签: linux session debian

嘿我需要获取循环的所有会话名称

root@xxx:/home/manager/scripts# screen -ls
There are screens on:
        5472.session1   (19.11.2013 11:36:48)   (Detached)
        5409.session2   (19.11.2013 11:36:38)   (Detached)
        5386.session3   (19.11.2013 11:36:27)   (Detached)
3 Sockets in /var/run/screen/S-root.

任何想法我怎么能得到这个名字?

1 个答案:

答案 0 :(得分:0)

使用grep

screen -ls | grep $'^\t' | while read name _rest ; do
    # Process $name
done