简体   繁体   English

如何打开一个gnome终端来执行gnome-terminal命令,不断?

[英]how to open a gnome terminal to execute a command with gnome-terminal, constantly?

I have a sh file which includes those lines: 我有一个包含这些行的sh文件:

gnome-terminal\
  --tab\
    --title="ElasticSearch"\
    --working-directory="/home/username/program/bin"\
    -e "bash -c './somecommand'"\

when I run it, a gnome terminal will open and run a command for me. 当我运行它时,一个gnome终端将打开并为我运行命令。 The problem is, when I press ctrl+c to stop the running command, the terminal closed. 问题是,当我按ctrl + c停止运行命令时,终端关闭。 Is there a way to stop the running command and keep the terminal alive? 有没有办法停止运行命令并使终端保持活动状态? Thanks in advance. 提前致谢。

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. 你的命令工作正常,但是在somecommand终止后gnome-terminal关闭,原因是gnome-terminal没有运行bash因为它是默认的shell。

To get the bash prompt( $ ) after the command command completes, you need to trigger it back. 要在命令命令完成后获取bash提示符( $ ),您需要将其触发。

-e "bash -c ./somecommand;bash"\

-e has since been deprecated. -e已被弃用。 Use gnome-terminal -- somecommand now. 现在使用gnome-terminal -- somecommand

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM