如何不断地打开gnome终端来执行带有gnome-terminal的命令? [英] how to open a gnome terminal to execute a command with gnome-terminal, constantly?

查看:88
本文介绍了如何不断地打开gnome终端来执行带有gnome-terminal的命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个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-terminalsomecommand终止后关闭,原因是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的命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆