bash 命令在新的命令行窗口中运行程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4272984/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 22:59:05  来源:igfitidea点击:

bash command to run a program in a new command line window

bashscriptingcommand-lineterminal

提问by SkypeMeSM

I want to run a program from inside a bash script, such that it opens in a new command line window. How can I do this?

我想从 bash 脚本内部运行一个程序,以便它在新的命令行窗口中打开。我怎样才能做到这一点?

回答by icyrock.com

That really depends on the GUI you are using. Try some of the below for executing an lscommand.

这实际上取决于您使用的 GUI。尝试以下一些方法来执行ls命令。

With gnome-terminal:

gnome-terminal

gnome-terminal -x bash -c "ls; bash"

(taken from http://www.linuxquestions.org/questions/programming-9/is-command-line-invocation-of-gnome-terminal-to-run-more-than-one-command-possible-789599/)

(取自http://www.linuxquestions.org/questions/programming-9/is-command-line-invocation-of-gnome-terminal-to-run-more-than-one-command-possible-789599/

With xterm:

xterm

xterm -e "ls; bash"

(taken from http://ubuntuforums.org/showthread.php?t=760006).

(取自http://ubuntuforums.org/showthread.php?t=760006)。

For konsole, take a look here:

对于konsole,请看这里:

or here:

或在这里:

回答by robert

xterm -e 'program to be run'

xterm -e 'program to be run'

Your terminal may have a different switch than -e, but I don't know what your terminal is.

您的终端可能具有与 不同的开关-e,但我不知道您的终端是什么。