bash 如何在 Ubuntu 的终端中自动运行应用程序?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35905/
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
How do I autorun an application in a terminal in Ubuntu?
提问by Tom
I've created a few autorunscript files on various USB devices that run bashscripts when they mount. These scripts run "in the background", how do I get them to run in a terminal window? (Like the "Application in Terminal" gnome Launcher type.)
我autorun在各种 USB 设备上创建了一些脚本文件,这些文件在bash挂载时运行脚本。这些脚本在“后台”运行,如何让它们在终端窗口中运行?(就像“终端中的应用程序”gnome Launcher 类型一样。)
回答by Vagnerr
Run them as a two stage process with your "autorun" script calling the second script in a new terminal eg
使用“自动运行”脚本在新终端中调用第二个脚本,将它们作为两阶段进程运行,例如
gnome-terminal -e top --title Testing
Would run the program "top" in a new gnome terminal window with the title "Testing" You can add additional arguments like setting the geometry to determine the size and location of the window checkout the man page for gnome-terminaland the "X" man page for more details
将在标题为“Testing”的新 gnome 终端窗口中运行程序“top”您可以添加其他参数,例如设置几何形状以确定窗口的大小和位置,请查看gnome-terminal的手册页和“X”手册页了解更多详情
回答by Steve Moon
xterm -e shellscript.sh
or (if xtermisn't installed)
或(如果xterm未安装)
gnome-terminal -e shellscript.sh
or (if you're using kubuntu / kde)
或者(如果您使用的是 kubuntu / kde)
konsole -e shellscript.sh

