我怎么能启动多个xterm的窗口和运行上的每个命令,让每个窗口后开? [英] How can I launch multiple xterm windows and run a command on each, leaving each window open afterward?

查看:5358
本文介绍了我怎么能启动多个xterm的窗口和运行上的每个命令,让每个窗口后开?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很懒,我preFER的电脑做我的工作对我来说。我ssh到每天几台机器,所以我创建了一个简单的脚本,启动一些xterm的窗口和我想要的位置把它们(正如你所看到的,我使用bash):

I'm lazy, and I prefer that computers do my work for me. I ssh into several machines on a daily basis, so I created a simple script that launches some xterm windows and places them in positions I want (as you can see, I'm using bash):

#!/bin/bash
xterm -geometry 80x27+1930+0 &
xterm -geometry 80x27+2753+0 &
xterm -geometry 80x27+1930+626 &
xterm -geometry 80x27+2753+626 &

不过,我做的下一件事就是去的第一个窗口,输入

However, the next thing I do is go to the first window and type in

ssh server_a

然后在第二

ssh server_b

和等。我想要做的是有我的脚本做SSH命令中的每个xterm窗口,然后离开打开窗户,我做我的工作。我见过的xterm -e选项,但窗口关闭后,我执行我的命令。有没有办法做到这一点?

and so on. What I'd like to do is have my script do the ssh commands in each xterm window, and then leave the windows open for me to do my work. I've seen the -e option for xterm, but the window closes after I execute my command. Is there a way to do this?

我道歉,如果这是一个重复的问题。我已搜索周围,并没有任何与此运气。非常感谢!

I apologize if this is a duplicate question. I've searched around and haven't had any luck with this. Many thanks!

推荐答案

我喜欢看到一个更优雅的答案,但我想出了不工作:

I'd love to see a more elegant answer, but what I came up with does work:

xterm -e bash -c 'echo foo; exec bash'

替换回声富与您所选择的命令,你是好去。

Replace echo foo with the command of your choice, and you're good to go.

这篇关于我怎么能启动多个xterm的窗口和运行上的每个命令,让每个窗口后开?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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