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

Bash 在shell脚本中,在新终端中运行一个进程,然后在原始终端中再次运行某个程序,bash,shell,Bash,Shell,这是我的密码: gnome-terminal -x bash -c "some-debug-tool-here" echo "HELLO" 我希望调试工具在新终端中运行并保持打开状态。那很好。但是我希望下一行的命令在我的终端中运行,但它从来没有运行过。我尝试过在gnome终端命令之后使用&但似乎没有帮助。有什么想法吗?你可以用nohup nohup test_sample & 记住使用&最后,您可以运行任何您想要的命令,而无需在终端中 如果要终止进程,只需搜索PID并终止它 ie p

这是我的密码:

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

我希望调试工具在新终端中运行并保持打开状态。那很好。但是我希望下一行的命令在我的终端中运行,但它从来没有运行过。我尝试过在gnome终端命令之后使用&但似乎没有帮助。有什么想法吗?

你可以用nohup

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

如果要终止进程,只需搜索PID并终止它


ie ps aux | grep nohup kill'PID'

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

xterm -e sh -c yes &; echo HELLO

–拉斐尔·桑托斯(Raphael Santos)

这一点就足够了。我使用xterm和sh.xterm-esh-csh-yes&;回声HELLOThe;为我工作,谢谢你。