当我在 gnome-terminal -e 中打开 php 时,只看到空的终端窗口

当我在 gnome-terminal -e 中打开 php 时,只看到空的终端窗口

我要执行,gnome-terminal -e php /var/scripts/script.php但我什么也没得到,只有没有用户名的空终端窗口,当我执行时,php /var/scripts/script.php终端运行正常,如何在新启动的终端中显示脚本的输出?我想 cron 一些东西,最终终端在这里等我检查它们的进展情况,因为它会在我不在工作站时发生,我已经检查过了……如果我想记录它,我需要重写 140 个输出,因为我没有使用包装器……无论如何,我只需要终端来查看这些东西。

答案1

这应该对你有用:

gnome-terminal -e "/bin/bash -c 'php \var\scripts\script.php; exec /bin/bash -i'"  

您可能需要将“php”替换为程序的完整路径,但即使没有它也可以工作。
您还可以使用“--tab”参数在选项卡而不是窗口中打开新实例:

gnome-terminal --tab -e "/bin/bash -c 'php \var\scripts\script.php; exec /bin/bash -i'"    

编辑:这假设反斜杠的使用不是拼写错误,否则就会像这样:

gnome-terminal --tab -e "/bin/bash -c 'php /var/scripts/script.php; exec /bin/bash -i'"    

相关内容