Well, after some time on your question there is some observations:
line 2: commands should all be arranged in the bash window, preferably tiled is not possible, as when detached, there is no windows.
So when you re-attach, you will always see only one pseudo-tty.
But to do approximatively what asked for, try the following:
First create a RCfile as typing:
cat >screenRcTest whith the following:
setenv MyVariable Test
screen -t Top top
screen -t VMStat vmstat -n 1
screen -t OpenPorts watch -n 2 'netstat -tan | grep LISTEN'
screen -t IF-Configs watch -n2 'ip -s link show | grep -v "^ *[RT]X: bytes"'
screen -t "Bourne Again Shell" /bin/bash -i
Than prepare a
run wrapper as:
screen -ls | grep -q screenTest || screen -dmS screenTest -c ./screenRcTest
this will run a new screen session in background if not already exist.
For building tiled presentation, prepare another shell script as
while read line ;do
screen -X $line
and don't forget
chmod +x screenSplitTest.
Finally run the display command as:
xterm -fn 9x15 -geom 160x60 -exec screen -DrS screenTest
This will open a new window with only a
In this inner bash, hit simply:
This will split your window and let you ready again, in your bash session.
So you will see how Environment variable as passed to child bash.
After doing all, you could hit the following in your inner bash:
trap '[ $(tput lines) == 60 ] && [ $(tput cols) == 160 ] && ./screenSplitTest' WINCH
So you could disconnect by typing:
Ctrl-A d than next time you run
xterm whith same arguments and geometry, the script screenSplitTest will be initiated automatically.
And now, you could even install this
trap in your
MyVariable for ensuring that bash is a child of screenRcTest screen (after moving
screenSplitTest to a hidden file in
$HOME/.screenSplitTest for constance):
[ "$TERM.$MyVariable" == "screen.Test" ] && \
trap '[ $(tput lines) == 60 ] && [ $(tput cols) == 160 ] && $HOME/.screenSplitTest' WINCH