问题描述
我有一个sh文件,其中包括以下几行:
I have a sh file which includes those lines:
gnome-terminal\
--tab\
--title="ElasticSearch"\
--working-directory="/home/username/program/bin"\
-e "bash -c './somecommand'"\
当我运行它时,gnome终端将打开并为我运行命令.问题是,当我按ctrl + c停止运行命令时,终端关闭.有没有办法停止正在运行的命令并使终端保持活动状态?提前致谢.
when I run it, a gnome terminal will open and run a command for me. The problem is, when I press ctrl+c to stop the running command, the terminal closed. Is there a way to stop the running command and keep the terminal alive? Thanks in advance.
推荐答案
您的命令运行正常,但是gnome-terminal
在somecommand
终止后关闭,原因是gnome-terminal
没有运行bash
作为默认外壳
Your command works fine but the gnome-terminal
closes after the somecommand
terminates, the reason being gnome-terminal
not running the bash
as it's default shell.
要在命令命令完成后获取bash提示($
),需要将其触发回去.
To get the bash prompt($
) after the command command completes, you need to trigger it back.
-e "bash -c ./somecommand;bash"\
这篇关于如何不断地打开gnome终端来执行带有gnome-terminal的命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!