我有这个简单的命令来检查文件是否存在:
if [ -f /tmp/file.txt ] ; then echo "yes" ; else echo "no" ; fi
如果我直接在终端上运行它,它可以工作(如果文件存在则显示“是”,如果不存在则显示“否”)。但我想在.desktop
文件中执行这个命令,使用它作为Exec
键的值:
[Desktop Entry]
Version=1.0
Type=Application
Exec=if [ -f /tmp/file.txt ] ; then echo "yes" ; else echo "no" ; fi
StartupNotify=true
Terminal=false
Categories=Utility;X-XFCE;X-Xfce-Toplevel;
MimeType=x-scheme-handler/custom
Name=Custom Test
Comment=Custom
如果我尝试执行xdg-open custom://
我得到custom://: error opening location: The specified location is not supported
,但如果我将Exec
值更改为echo "yes"
并执行xdg-open custom://
,它会显示yes
在终端上。
我在这里想念什么?