简体   繁体   English

如何在Linux中的单独gnome终端中执行文件

[英]How to execute a file in separate gnome terminal in linux

I want to execute a C program in separate terminal, I've tried this command, 我想在单独的终端中执行C程序,我已经尝试过此命令,

gnome-terminal -x ./test

and

gnome-terminal -e test

But it opens a new terminal and before giving me output, it just vanish. 但是它打开了一个新的终端,在给我输出之前,它就消失了。

How could I solve this issue using gnome-terminal ? 我如何使用gnome-terminal解决此问题?

Thanks in advance 提前致谢

This might be what you search: 这可能是您搜索的内容:

gnome-terminal -e "bash -c \"!!; exec bash\""

or (shortly): 或(不久):

gnome-terminal -x sh -c "!!; bash"

It opens gnome-terminal with your last command (!!) executed and it stays open with the command output in the shell, even with an interactive command like top or less... 它会打开gnome-terminal并执行您的最后一条命令(!!),并且即使在诸如top或less之类的交互式命令中,它也会在shell中的命令输出中保持打开状态。

In your case its: 就您而言:

gnome-terminal -e "bash -c \"./test; exec bash\""

or 要么

gnome-terminal -x sh -c "./test; bash"

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

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