[英]Remote SSH : no such file or directory
When trying to run this cmd: 尝试运行此cmd时:
ssh user@host " cp -f /path1/`cat /path2/file.txt | awk -F : '{printf $4}' `* ../ "
got this: 收到:
cat: /path2/file.txt: no such file or directory
cat:/path2/file.txt:没有这样的文件或目录
Notice that when execute it directly in the server it works 请注意,直接在服务器中执行它时,它可以工作
Thanks for any advice 谢谢你的建议
Try this: 尝试这个:
ssh user@host 'cp -f /path1/$(awk -F : '\''{printf $4}'\'' /path2/file.txt)* ..'
This might be also interesting: Useless Use of Cat Award . 这可能也很有趣: 无用的猫奖 。
Or this: 或这个:
ssh user@host 'cp -f '\'"$path1"\''/$(awk -F : '\''{printf $4}'\'' /path2/file.txt)* ..'
Keep in mind: 记住:
'a'\\''b'
becomes a'b
'a'\\''b'
成为a'b
'a'"$x"'b'
becomes a${x}b
'a'"$x"'b'
变为a${x}b
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.