简体   繁体   English

我如何在新终端中开始bash?

[英]How i can start bash in a new terminal?

i want run bash in a new terminal. 我想在新的终端上运行bash。 Like this ( can be in any language) 这样(可以使用任何语言)

python 蟒蛇

#create terminal ( pts for example ) #创建终端(例如pts)

pid, term = os.openpty() PID,术语= os.openpty()

# call bash shell subprocess.Popen("bash"...) #调用bash shell subprocess.Popen(“ bash” ...)

If you guys know how to create this using shell script, would be better. 如果你们知道如何使用Shell脚本创建此脚本,那就更好了。

[for shell script] [用于shell脚本]

It depends on your system, but if you are using GNU/Linux: 这取决于您的系统,但是如果您使用的是GNU / Linux:

  • on Gnome: gnome-terminal 在Gnome上: gnome-terminal
  • on KDE: konsole 在KDE上: konsole
  • on any of them: xterm 在任何一个上: xterm

To turn the terminal on the background, you can use & . 要在后台打开终端,可以使用& For example gnome-terminal & . 例如gnome-terminal &

You can do this in Python using subproccess 您可以使用子过程在Python中执行此操作

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

相关问题 如何使用 Python 打开新的 bash 终端 - How to open new bash terminal using Python Bash-在另一个与当前终端分开的终端中启动命令的新实例 - Bash - Start a new instance of a command in another terminal seperate from your current terminal 如何在Ubuntu中启动,停止和重新启动bash脚本 - How can I make a bash script start, stop and restart in ubuntu 如何从bash脚本启动交互式ssh终端? - How to start interactive ssh terminal from bash script? 每次打开新的终端窗口时,如何自动记录终端会话? - How can I automatically record the terminal session every time a new terminal window is opened? 如何在新的终端窗口或标签中使用从终端外壳脚本设置的变量? (OSX) - How can I use variables set from a terminal shell script in a new terminal window or tab? (OSX) 无法启动[/bin/bash、--rcfile、/snap/pycharm-professional/127/plugins/terminal/jediterm-bash.in、-i] - Failed to start [/bin/bash, --rcfile, /snap/pycharm-professional/127/plugins/terminal/jediterm-bash.in, -i] 如何从终端启动命令,以便终端不是父节点? - How do I start a command from terminal so that terminal is not the parent? Mono:如何在新的控制台/终端窗口上运行 bash 命令? - Mono: how to run a bash command on a new console/terminal window? 在 Bash 中,如何在 read -es 后输出新行? - In Bash, how can I output a new line after read -es?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM