在shell脚本中,在新终端中运行进程,然后再次在原始终端中运行某些进程

时间:2015-02-07 11:22:28

标签: bash shell

这是我的代码:

gnome-terminal -x bash -c "some-debug-tool-here"
echo "HELLO"

我希望调试工具在新终端中运行并保持打开状态。这很好。但我希望下一行的命令能够在我的终端中运行,而且它永远不会。我尝试在&命令之后使用gnome-terminal,但这似乎没有帮助。有什么想法吗?

2 个答案:

答案 0 :(得分:0)

你可以使用的是nohup

nohup test_sample &

记得在最后使用“& ”,您可以运行任何您想要的命令,而无需在终端中

如果您想要终止进程,只需搜索PID并将其终止

ps aux | grep nohup kill 'PID'

答案 1 :(得分:0)

&应该够了。它适用于我使用xterm和sh。

xterm -e sh -c yes &; echo HELLO

- Raphael Santos