[英]There was an error creating the child process for this terminal
我正在尝试使用执行的命令启动一个新的 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
我哪里出错了? 如何完成我的预期工作,即启动一个新的 zsh 终端并打印 hello,并等待下一个命令
发生的情况是您正在打开一个新终端,但在您的实际终端中运行这些命令。 如果您想在新终端中运行这些命令,您必须指定-x
选项,该选项表示它将在将打开的终端内执行命令行的其余部分。 现在,您可以编写命令,但是您需要为 zsh 指定-c
选项,以便 zsh 将第一个参数“逗号内的命令”作为命令。 现在终端将执行命令,并保持打开状态,它不会闪烁。 但它没有外壳,我猜你想继续写命令,所以你需要exec zsh
。 就是这样。
它会是这样的:
gnome-terminal --x zsh -c 'echo hello; exec zsh'
代码的第一行可能包含以下内容:
#!/usr/bin/expect -f
或者
#!/bin/bash
确保此目录存在。 例如,也许您正在运行该程序,但未安装该程序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.