我知道有很多人问过如何在scp中转义空格的问题,但是我试图使用“&”符号却失败了,如果这个符号是目录名称的一部分。
[sorunome@sorunome-desktop tmp]$ scp test.txt "bpi:/home/sorunome/test & stuff"
zsh:1: command not found: stuff
lost connection
&符号似乎会混淆很多东西,使用\&无法解决问题,因为远程目录找不到:
[sorunome@sorunome-desktop tmp]$ scp test.txt "bpi:/home/sorunome/test \& stuff"
scp: ambiguous target
即使省略引号并在各处添加 \ ,这也无法正常工作:
[sorunome@sorunome-desktop tmp]$ scp test.txt bpi:/home/sorunome/test\ \&\ stuff
zsh:1: command not found: stuff
lost connection
那么,有什么想法吗?
scp test.txt "bpi:/home/sorunome/test & touch test.tmp"
, 它实际上会在我的远程主目录中创建test.tmp文件! - Sorunome