DISPLAY=:0: 未找到命令

Pro*_*eak 1 tcsh centos display

user@domain:~ $ echo $DISPLAY
:0
user@domain:~ $ DISPLAY=:0
DISPLAY=:0: Command not found.
Run Code Online (Sandbox Code Playgroud)

只是尝试在这里运行命令: https: //stackoverflow.com/questions/46810043/notify-send-doesnt-work-over-ssh - 为什么它不被识别为命令?我使用的是 CentOS v7.7。

giu*_*sti 5

tcsh与 Bash 具有不同的语法。要在该 shell 中设置变量并使其可用于您将调用的程序,您必须使用以下命令:

setenv DISPLAY :0
ssh ....
Run Code Online (Sandbox Code Playgroud)

或者,如果您只想启动该变量ssh(如您链接的答案中所述),您可以env在命令之前使用:

env DISPLAY=:0 ssh ......
Run Code Online (Sandbox Code Playgroud)

  • `set` 命令不会将变量放入环境中。为此,您需要 `setenv DISPLAY :0` (三个单词,没有 `=`) (2认同)