lundi, le 6 septembre, 2004, Ruben nous a dit ceci:
> When copying a file with an escaped character, scp removes the escaping
> character before
> sending to the host.
> Is there a way to circunvent this?
> Some examples follow (linux machines)
>
> A: touch file\(new\)
> B: scp user at A:file\(new\) .
> user at A password:
> bash: -c: line 1: syntax error near unexpected token `('
> bash: -c: line 1: `scp -f ('
>
> A: touch file\ 1
> B: scp user at A:file\ 1 .
> user at A password:
> scp: A: No such file or directory
> scp: B: No such file or directory
>
> B: scp user at A:file\\ 1 .
> user at A password:
> bash: -c: line 3: syntax error: unexpected end of file
> cp: cannot stat `B': No such file or directory
It's not scp removing the escaping character, it's the local shell that
processes that escaping character, so scp never sees it. You have to
protect the escaped characters from both the local and remote shells, and
protect the escaping characters from the local shell so SCP can see them
and pass them to the other side for the remote shell to process.
System A:
% touch file\(new\)
System B:
% scp A:file\\\(new\\\) .
file(new) 100% 0 0.0KB/s 00:00
% ls -l file*
-rw-r----- 1 clamat clamat 0 Sep 6 13:11 file(new)
B%
--
For a successful technology, reality must take precedence over public
relations, for nature cannot be fooled.
-- Richard P. Feynman