bash-Shell脚本打开多个终端并执行不同的命令 [英] bash - Shell script opening multiple terminals and executing distinct commands
本文介绍了bash-Shell脚本打开多个终端并执行不同的命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图编写自己的shell脚本.到目前为止,由于'hold'选项,我已经设法打开了只能执行一个命令的4个xterminal.
I've tried to write my own shell script. So far I've managed to open 4 xterminals that can only execute ONE command because of the 'hold' option.
如果我不使用此选项,则终端将消失.
If i don't use this option, the terminals just disappear.
这是我的代码:
#!/bin/sh
xterm -title "App 1" -hold -e mycommand | mysecondcommand &
xterm -title "App 2" -hold -e mycommand | mysecondcommand &
xterm -title "App 3" -hold -e mycommand | mysecondcommand &
xterm -title "App 4" -hold -e mycommand | mysecondcommand
不确定我是否应该在同一终端上执行第二条命令.
Not so sure if I'm supposed to execute the second command in the same terminal that way.
有什么想法吗?
谢谢
推荐答案
如果没有 -hold
,则xterm将在命令完成后立即关闭.您可以使用双引号和命令分隔符(例如;
,&
)执行多个命令:
Without -hold
, the xterm will close as soon as the command is completed. You can execute multiple commands by using double quotes and command separators (eg ;
, &
):
xterm -title "App 1" -e "mycommand; mysecondcommand"
这篇关于bash-Shell脚本打开多个终端并执行不同的命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文