Sor*_*ome 4 shell scp escaping
是的,我确实已经意识到已经被问过一千次如何在scp中转义空格,但是我没有用& -sign 来做,所以如果那个符号是目录名的一部分.
[sorunome@sorunome-desktop tmp]$ scp test.txt "bpi:/home/sorunome/test & stuff"
zsh:1: command not found: stuff
lost connection
Run Code Online (Sandbox Code Playgroud)
&符号似乎搞乱了很多东西,使用\&将无法解决问题,因为找不到远程目录:
[sorunome@sorunome-desktop tmp]$ scp test.txt "bpi:/home/sorunome/test \& stuff"
scp: ambiguous target
Run Code Online (Sandbox Code Playgroud)
甚至没有通过省略引号并在整个地方添加\这是有效的:
[sorunome@sorunome-desktop tmp]$ scp test.txt bpi:/home/sorunome/test\ \&\ stuff
zsh:1: command not found: stuff
lost connection
Run Code Online (Sandbox Code Playgroud)
那么,任何想法?
逃离空间和&符号对我来说是个窍门:
scp source_file "user@host:/dir\ with\ spaces\ \&\ ampersand"
Run Code Online (Sandbox Code Playgroud)
出于某种原因,仍然需要报价.