> 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.
_______________________________________________
screen-users mailing list
screen-users@gnu.org
https://lists.gnu.org/mailman/listinfo/screen-users