如何在屏幕会话中编写gnu屏幕脚本以打开新窗口并在其中运行命令? [英] how do you script gnu screen from within a screen session to open new windows and run commands in them?

查看:80
本文介绍了如何在屏幕会话中编写gnu屏幕脚本以打开新窗口并在其中运行命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个屏幕会话中,我想运行一个打开的shell脚本 在同一会话中有几个新的屏幕窗口,并开始运行一些 其中的程序.

From within a screen session, I'd like to run a shell script that opens a few new screen windows in the same session and start running some programs in them.

我需要这样的脚本:

screen -t newWindow
[switch to newWindow and execute a command]
screen -t newWindow2
[switch to newWindow2 and execute a command]

我不知道如何实现括号中描述的效果. 有什么线索吗?请注意,这不是我将用来开始屏幕会话的脚本.我需要此脚本在现有的屏幕会话中可运行,以便向该会话添加新窗口.

I don't know how to accomplish the effect I describe in the brackets. Any clues? Please note that this is not a script I'll be running to start a screen session. I need this script to be runnable within an existing screen session, in order to add new windows to the session.

推荐答案

在屏幕内运行此脚本可以实现我认为想要的功能:

Running this script inside screen does what I think you want:

#!/bin/bash

screen vi
screen top

这篇关于如何在屏幕会话中编写gnu屏幕脚本以打开新窗口并在其中运行命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆