安装 Tor 浏览器时,可以在 ~/.local/share/applications/ 中创建一个 .desktop 条目,以便能够使用应用程序的启动器打开 tor。这对我来说是个问题。这是 .desktop 条目中的重要参数:
Exec=sh -c '"/opt/tor-browser_en-US/Browser/start-tor-browser" --detach || ([ ! -x "/opt/tor-browser_en-US/Browser/start-tor-browser" ] && "$(dirname "$*")"/Browser/start-tor-browser --detach)' dummy %k
现在执行时desktop-file-validate start-tor-browser.desktop
,我收到以下错误:
start-tor-browser.desktop: hint: value item "Security" in key "Categories" in group "Desktop Entry" can be extended with another category among the following categories: Settings, or System
start-tor-browser.desktop: error: value "sh -c '"/opt/tor-browser_en-US/Browser/start-tor-browser" --detach || ([ ! -x "/opt/tor-browser_en-US/Browser/start-tor-browser" ] && "$(dirname "$*")"/Browser/start-tor-browser --detach)' dummy %k" for key "Exec" in group "Desktop Entry" contains a reserved character ''' outside of a quote
start-tor-browser.desktop: error: value "sh -c '"/opt/tor-browser_en-US/Browser/start-tor-browser" --detach || ([ ! -x "/opt/tor-browser_en-US/Browser/start-tor-browser" ] && "$(dirname "$*")"/Browser/start-tor-browser --detach)' dummy %k" for key "Exec" in group "Desktop Entry" contains a reserved character '|' outside of a quote
start-tor-browser.desktop: error: value "sh -c '"/opt/tor-browser_en-US/Browser/start-tor-browser" --detach || ([ ! -x "/opt/tor-browser_en-US/Browser/start-tor-browser" ] && "$(dirname "$*")"/Browser/start-tor-browser --detach)' dummy %k" for key "Exec" in group "Desktop Entry" contains a reserved character '|' outside of a quote
start-tor-browser.desktop: error: value "sh -c '"/opt/tor-browser_en-US/Browser/start-tor-browser" --detach || ([ ! -x "/opt/tor-browser_en-US/Browser/start-tor-browser" ] && "$(dirname "$*")"/Browser/start-tor-browser --detach)' dummy %k" for key "Exec" in group "Desktop Entry" contains a reserved character '(' outside of a quote
start-tor-browser.desktop: error: value "sh -c '"/opt/tor-browser_en-US/Browser/start-tor-browser" --detach || ([ ! -x "/opt/tor-browser_en-US/Browser/start-tor-browser" ] && "$(dirname "$*")"/Browser/start-tor-browser --detach)' dummy %k" for key "Exec" in group "Desktop Entry" contains a reserved character '&' outside of a quote
start-tor-browser.desktop: error: value "sh -c '"/opt/tor-browser_en-US/Browser/start-tor-browser" --detach || ([ ! -x "/opt/tor-browser_en-US/Browser/start-tor-browser" ] && "$(dirname "$*")"/Browser/start-tor-browser --detach)' dummy %k" for key "Exec" in group "Desktop Entry" contains a reserved character '&' outside of a quote
start-tor-browser.desktop: error: value "sh -c '"/opt/tor-browser_en-US/Browser/start-tor-browser" --detach || ([ ! -x "/opt/tor-browser_en-US/Browser/start-tor-browser" ] && "$(dirname "$*")"/Browser/start-tor-browser --detach)' dummy %k" for key "Exec" in group "Desktop Entry" contains a non-escaped character '$' in a quote, but it should be escaped with two backslashes ("\\$")
start-tor-browser.desktop: error: value "sh -c '"/opt/tor-browser_en-US/Browser/start-tor-browser" --detach || ([ ! -x "/opt/tor-browser_en-US/Browser/start-tor-browser" ] && "$(dirname "$*")"/Browser/start-tor-browser --detach)' dummy %k" for key "Exec" in group "Desktop Entry" contains a reserved character '$' outside of a quote
start-tor-browser.desktop: error: value "sh -c '"/opt/tor-browser_en-US/Browser/start-tor-browser" --detach || ([ ! -x "/opt/tor-browser_en-US/Browser/start-tor-browser" ] && "$(dirname "$*")"/Browser/start-tor-browser --detach)' dummy %k" for key "Exec" in group "Desktop Entry" contains a reserved character '*' outside of a quote
start-tor-browser.desktop: error: value "sh -c '"/opt/tor-browser_en-US/Browser/start-tor-browser" --detach || ([ ! -x "/opt/tor-browser_en-US/Browser/start-tor-browser" ] && "$(dirname "$*")"/Browser/start-tor-browser --detach)' dummy %k" for key "Exec" in group "Desktop Entry" contains a reserved character ')' outside of a quote
start-tor-browser.desktop: error: value "sh -c '"/opt/tor-browser_en-US/Browser/start-tor-browser" --detach || ([ ! -x "/opt/tor-browser_en-US/Browser/start-tor-browser" ] && "$(dirname "$*")"/Browser/start-tor-browser --detach)' dummy %k" for key "Exec" in group "Desktop Entry" contains a reserved character ''' outside of a quote
即使使用“\””转义“”字符后,它仍变成:
Exec=sh -c '\\"/opt/tor-browser_en-US/Browser/start-tor-browser\\" --detach || ([ ! -x \\"/opt/tor-browser_en-US/Browser/start-tor-browser\\" ] && \\"$(dirname \\"$*\\")\\"/Browser/start-tor-browser --detach)' dummy %k
我仍然收到错误:
start-tor-browser.desktop: hint: value item "Security" in key "Categories" in group "Desktop Entry" can be extended with another category among the following categories: Settings, or System
start-tor-browser.desktop: error: value "sh -c '\\"/opt/tor-browser_en-US/Browser/start-tor-browser\\" --detach || ([ ! -x \\"/opt/tor-browser_en-US/Browser/start-tor-browser\\" ] && \\"$(dirname \\"$*\\")\\"/Browser/start-tor-browser --detach)' dummy %k" for key "Exec" in group "Desktop Entry" contains a reserved character ''' outside of a quote
start-tor-browser.desktop: error: value "sh -c '\\"/opt/tor-browser_en-US/Browser/start-tor-browser\\" --detach || ([ ! -x \\"/opt/tor-browser_en-US/Browser/start-tor-browser\\" ] && \\"$(dirname \\"$*\\")\\"/Browser/start-tor-browser --detach)' dummy %k" for key "Exec" in group "Desktop Entry" contains a reserved character ')' outside of a quote
start-tor-browser.desktop: error: value "sh -c '\\"/opt/tor-browser_en-US/Browser/start-tor-browser\\" --detach || ([ ! -x \\"/opt/tor-browser_en-US/Browser/start-tor-browser\\" ] && \\"$(dirname \\"$*\\")\\"/Browser/start-tor-browser --detach)' dummy %k" for key "Exec" in group "Desktop Entry" contains a reserved character ''' outside of a quote