【发布时间】:2021-01-22 15:58:00
【问题描述】:
我正在尝试启动一个新的 gnome 终端并执行一个命令
当我执行gnome-terminal时,一个新的终端顺利打开。
现在当我运行它时
gnome-terminal -- "zsh; echo hello"
我希望打开一个带有 zsh 的新终端,并打印 hello。
但我得到的是一个新的终端:
There was an error creating the child process for this terminal
Failed to execute child process “zsh; echo hello” (No such file or directory)
一些重要的结果
请看一下
❯ gnome-terminal -e "echo hello"
# Option “-e” is deprecated and might be removed in a later version of gnome-terminal.
# Use “-- ” to terminate the options and put the command line to execute after it.
❯ gnome-terminal --command "echo hello"
# Option “--command” is deprecated and might be removed in a later version of gnome-terminal.
# Use “-- ” to terminate the options and put the command line to execute after it.
执行以下几行,会在屏幕上执行一些幽灵动作,但不会产生可见的输出
❯ gnome-terminal --window -- echo hello
❯ gnome-terminal --tab -- echo hello
❯ gnome-terminal --tab -- echo hello
❯ gnome-terminal --tab --wait -- echo hello
我在哪里犯错了?如何完成我的预期工作,即启动一个印有 hello 的新 zsh 终端,并等待下一个命令
【问题讨论】:
标签: linux shell terminal zsh gnome-terminal