编写GNU屏幕会话脚本

我有一些在FreeBSD 9.0文件服务器上定期运行的虚拟机镜像。

我有写入的脚本,启动他们与我所需的设置( startUbuntuVMstartWindowsVM )。

我想编写一个脚本,执行以下操作:

 1) Start a screen session named 'virtualbox' 2) Add one window named 'Ubuntu' that runs the 'startUbuntuVM' command. 3) Add a second window named 'Windows' that runs the 'startWindowsVM' command. 

我已经看到了屏幕的-X标志,但据我所知它只能在另一个正在运行的屏幕进程中运行。

有什么办法可以做我想要的吗? 我不想在.screenrc中编写脚本,因为我只希望在需要时完成此操作,而不是在每个屏幕会话开始的时候完成。

像下面这个脚本的东西?

 #!/bin/bash [ -z "$STY" ] && exec screen -S virtualbox "$0" "$@" screen -t Ubuntu ./startUbuntuVM screen -t Windows ./startWindowsVM # uncomment following line to detach from screen #screen -d