简体   繁体   English

多个终端,多个命令,lxterminal

[英]Multiple terminals, multiple commands, lxterminal

I am working with Python.我正在使用 Python。 Writing a script, I am attempting to use os.system() to open a new terminal, create new tabs and run different commands in each respective tab (which appear to run simultaneously).编写脚本,我试图使用os.system()打开一个新终端,创建新选项卡并在每个相应选项卡中运行不同的命令(似乎同时运行)。

I am familiar with gnome-terminal as it is what I have used in the past, however the system I am working with at the moment, a Raspberry Pi (Raspbian), uses lxterminal .我熟悉gnome-terminal因为它是我过去使用过的,但是我目前使用的系统是 Raspberry Pi(Raspbian),使用lxterminal

I have always used我一直用

    os.system("gnome-terminal --tab -e 'command1' --tab -e 'command2' ")

with success, but I don't know how to reproduce these results with lxterminal .成功了,但我不知道如何用lxterminal重现这些结果。 So, basically I'm asking if and how lxterminal can do this.所以,基本上我是在问lxterminal是否以及如何做到这一点。

I can create the tabs, no problem, with我可以创建标签,没问题,

    lxterminal --tabs=1,2,3

and

    lxterminal --tabs=1,2,3 --command="command1"

does create the tabs and execute the first command in the first tab... but that's as close as I can get, and obviously that doesn't do the trick of multiple commands in tabs 2 and 3.确实创建了选项卡并在第一个选项卡中执行了第一个命令......但这是我所能得到的最接近的,显然这并没有完成选项卡 ​​2 和 3 中的多个命令的技巧。

If the lxterminal man gives any clues I'm just missing them... I thought maybe the brackets under -t , --title , and --tabs section might point to details for those, so I tried something like如果lxterminal人提供了任何线索,我只是想念它们......我想也许-t--title--tabs部分下的括号可能指向这些细节,所以我尝试了类似的方法

    lxterminal --tabs=1[--command="command1"],2[--command="command2"]

But that only titled the tabs.... as expected.但这只是标题标签......正如预期的那样。

All of my searches point me back to gnome-terminal but if there's a way to make lxterminal do this, I'd love to know.我所有的搜索都将我指向gnome-terminal但如果有办法让lxterminal这样做,我很想知道。

Try run the command like this:尝试像这样运行命令:

lxterminal --command 'command1 & command2'

Anyway there are old bug reports regarding the issue无论如何,有关该问题的旧错误报告

I know this is so late and I'm not an expert just sharing, but I hope anyone who has a similar problem can be helped.我知道这太晚了,我不是专家只是分享,但我希望任何有类似问题的人都可以得到帮助。

to do that you need to make a new bash file example.bash then insert command you want, like;为此,您需要创建一个新的 bash 文件example.bash,然后插入您想要的命令,例如;

#!/bin/bash

lxterminal --command 'cd /Apath/Bpath/Cpath/ &&  sudo example.bash/py/sh/bash'
lxterminal --command 'cd /Dpath/Epath/Fpath/ &&  sudo example.bash/py/sh/bash'
lxterminal --command 'cd /Gpath/Hpath/Ipath/ &&  sudo example.bash/py/sh/bash'

it will open 3 of the script in the new terminal ༼ つ ◕_◕ ༽つ它将在新终端中打开 3 个脚本 ༼ つ ◕_◕ ༽つ

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM