![](/img/trans.png)
[英]Gcloud command not running on gitlab ci yml warning: here-document at line ted by end-of-file (wanted `EOF') /bin/bash: : EOF: command not found
[英]sudo heredoc: bash: warning: here-document at line 0 delimited by end-of-file (wanted `EOF…EOF')
我的目标是使用sudo
将内容写入另一个用户的xstartup
文件。
但是我的尝试
sudo -iu user1 bash -lic 'cat > ~/.vnc/xstartup <<\EOF
...
EOF'
...结果是...
bash: warning: here-document at line 0 delimited by end-of-file (wanted `EOF...EOF')
但是嵌套的heredocs有效...
sudo -iu user1 bash -s <<\OUTER
cat > ~/.vnc/xstartup <<\EOF
...
EOF
OUTER
有没有建议在不嵌套heredocs的情况下完成sudo重定向的建议?
您有很多不必要的图层。
sudo -u user1 tee ~user1/.vnc/xstartup > /dev/null <<\EOF
...
EOF
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.