bash - 在 gnome 终端的新选项卡中运行脚本

标签 bash shell ubuntu gnome-terminal

这个问题在这里已经有了答案:





Open a terminal via gnome-terminal then execute command, error : "failed to execute child process"" [closed]

(1 个回答)


2年前关闭。




到目前为止,我有这个有效的命令

gnome-terminal --tab -e '/bin/bash -c "ls";bash'

但有一个警告
# 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 --tab -- '/bin/bash -c "ls";bash'

新标签失败
There was an error creating the child process for this terminal
Failed to execute child process “/bin/bash -c "ls";bash” (No such file or directory)

最佳答案

原因是:

gnome-terminal --tab -- '/bin/bash -c "ls";bash'

失败是它正在寻找一个以它为名称的程序。这是链加载的一个实例,其中其余参数按原样传递给 exec。第一个参数是程序的名称。通过此引用,它接收整个命令和选项作为单个程序名称。

将引用更改为:
gnome-terminal --tab -- /bin/bash -c "ls;bash"

关于bash - 在 gnome 终端的新选项卡中运行脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58143512/

相关文章:

bash - 运行 kubectl exec 时禁用 Kubernetes 上的网络日志

linux - 在 Bash 中处理目录名称中的空格

bash - 如何在管道中获取应用程序的错误代码?

Bash:控制 SSH

linux - sh 文件无法正常工作,但 sh 中的命令可以

shell - OS X 10.9.2 : Error: SHA256 mismatch 中的 Homebrew 软件

linux - 使用 SSH 的调用命令失败?

python - 菜单栏在 wxPython 中错误对齐

java - Ubuntu 11.04 Eclipse Java 未运行

ubuntu - 准备 VPS 以使用 Kubespray 安装 Kubernetes