转义字符在 scp 中不起作用

转义字符在 scp 中不起作用

我正在尝试通过 scp 传输一些文件。但是它不起作用,

scp "vogo_psql_db\:2017-08-30T18\:00\:01.762662" "[email protected]:db-dump"
ssh: Could not resolve hostname vogo_psql_db\\: Name or service not known

问题是,我认为由于冒号,vogo_psql_db 即使使用了转义字符,它仍被用作主机名。

应该怎么做才能解决这个问题?

答案1

根据手册页man scp

File names may contain a user and host specification to indicate that the
file is to be copied to/from that host.  Local file names can be made
explicit using absolute or relative pathnames to avoid scp treating file
names containing ‘:’ as host specifiers.  Copies between two remote hosts
are also permitted.

因此,您可以在本地文件名前面添加绝对路径,或者只添加简单的相对路径./,即

scp "./vogo_psql_db:2017-08-30T18:00:01.762662" "[email protected]:db-dump"

相关内容