screen-users
[Top][All Lists]
Advanced

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

Re: need "windowlist" info externally, not interactively


From: Anonymous
Subject: Re: need "windowlist" info externally, not interactively
Date: Thu, 29 Oct 2015 12:11:17 +0100



> Which screen commandline parameters do you use for that? I'd expect
> something like "screen -X screen 63 somecommand". (Would run
> "somecommand" in a window with number 63 unless that number is
> already in use.)

Since writing the original post, I've improved the script.  Now it
does something like:

===8<----------
uid=a$(md5sum <<< "${RANDOM}")
screen -X screen -t "${uid%% *}"
screen -p "${uid%% *}" -X exec script -c env /tmp/window_env.txt
sleep 1; #needed to ensure the file is ready for awk to read
window_num="$(awk -F= '/^WINDOW=/{ print $2 }' /tmp/window_env.txt)"
rm /tmp/window_env.txt
screen -p "$window_num" -X title More-Meaningful-Title-Here
screen -p "$window_num" -X stuff command1$'\r'
screen -p "$window_num" -X stuff command2$'\r'
screen -p "$window_num" -X stuff command3$'\r'
..etc..
===8<----------

One tricky part was coming up with "script -c env
/tmp/window_env.txt", because redirection does not work (initially I
tried simply "env > /tmp/window_env.txt").

In the end, that seems to work.

> Have you tried "screen -Q windows"?

Thanks for that.  I didn't know about the -Q option.  It turns out
that the version of screen available is too old for that, so hacks
still needed.  I was pleased to find that my home machine has -Q
though.






reply via email to

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