选项“-e”已弃用,可能会在 Ubuntu 18.04 的更高版本的 gnome-terminal 中删除

7 gnome-terminal

这个标题有一个重复的问题,并确认为一个错误。但它在 Ubuntu 17 中,我的是 Ubuntu 18.04 LTS。所以我想旧问题中的错误已修复。错误我仍然遇到它,所以这是我的问题:

文件磁盘.桌面 >>

[Desktop Entry]
Name=Disk Manager
Comment=Open df cmd in Terminal
Icon=harddisk
Type=Application
Categories=Utility;Management;
Keywords=disk; manager; terminal;
StartupNotify=true
Exec=gnome-terminal -t "Disk Manager" --hide-menubar -e "df -h --output=source,used,size,avail,target -x devtmpfs -x tmpfs -x squashfs"
Run Code Online (Sandbox Code Playgroud)

星星在最后一行:
gnome-terminal -t "Disk Manager" --hide-menubar -e "df -h --output=source,used,size,avail,target -x devtmpfs -x tmpfs -x squashfs"

我的命令是运行 gnome-terminal,df它使用它的几个参数执行应用程序。该.desktop文件有一个非常奇怪的行为。它什么都不做,甚至不触发错误代码。

如果我删除除 之外的所有参数-h,它有时会起作用。如果我df在正在运行的终端中运行app,它运行得非常好。所以我的钱是 gnome-terminal 的错。

我决定将我的整个命令复制到正在运行的终端。结果是半标题:

# 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.
Run Code Online (Sandbox Code Playgroud)

因为我没有得到错误代码。我不知道接下来要做什么。请告诉我如何修复它。谢谢。

2019 年 2 月 7 日更新 ::

按照@vidarlo 的建议,我已更改为 option flag --。结果如下:

  • --不适用于" "引号内的命令。它返回失败执行错误:Fail to execute child process "df -h"
  • 我找不到此选项的任何文档。不在man不在--help-all。在我看来,这个标志还不是标准的。

我寻找的是一个选项,允许我传递带有几个参数的命令。在 Lubuntu 中,它看起来像这样lxterminal -e "df -h -x devtmpfs -x tmpfs -x squashfs"

vid*_*rlo 5

阅读错误信息:

# 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.
Run Code Online (Sandbox Code Playgroud)

错误消息告诉您-e已弃用,可能会在未来版本中删除,以及-e.

您有以下命令行:

Exec=gnome-terminal -t "Disk Manager" --hide-menubar -e "df -h -- output=source,used,size,avail,target -x devtmpfs -x tmpfs -x squashfs"
Run Code Online (Sandbox Code Playgroud)

将此更改为

Exec=gnome-terminal -t "Disk Manager" --hide-menubar -- "df -h --output=source,used,size,avail,target -x devtmpfs -x tmpfs -x squashfs"
Run Code Online (Sandbox Code Playgroud)

  • `--` 只在没有 `"` 的情况下工作。这意味着我不能使用参数。如果我这样做:`gnome-terminal -- "df -h"`,它将打开一个新的终端,并显示错误: “无法执行子进程”......此外,我根本没有发现`gnome-terminal`的选项`--`的人。 (16认同)