这个标题有一个重复的问题,并确认为一个错误。但它在 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)
因为我没有得到错误代码。我不知道接下来要做什么。请告诉我如何修复它。谢谢。
按照@vidarlo 的建议,我已更改为 option flag --
。结果如下:
--
不适用于" "
引号内的命令。它返回失败执行错误:Fail to execute child process "df -h"
man
不在--help-all
。在我看来,这个标志还不是标准的。我寻找的是一个选项,允许我传递带有几个参数的命令。在 Lubuntu 中,它看起来像这样lxterminal -e "df -h -x devtmpfs -x tmpfs -x squashfs"
。
阅读错误信息:
Run Code Online (Sandbox Code Playgroud)# 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.
错误消息告诉您-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)