scp: 非法选项 -- 0

waw*_*los -1 scp

我正在尝试通过 shh 连接将数据复制到远程服务器。

我收到以下错误:

[localhost]: scp: illegal option -- 0
[localhost]: usage: scp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
[localhost]: [-l limit] [-o ssh_option] [-P port] [-S program]
[localhost]: [[user@]host1:]file1 ... [[user@]host2:]file2
Run Code Online (Sandbox Code Playgroud)

我使用的脚本执行此请求:

 scp -p10012 /Users/trst/Docs/repositories/pro/.envoydeploy/tmp/servers/172.12.11.150 admin@172.12.11.150:/var/www/pro/tmp/service_owner
Run Code Online (Sandbox Code Playgroud)

ste*_*ver 8

scp中设置端口的开关是大写的 -P

 -P port
         Specifies the port to connect to on the remote host.  Note that
         this option is written with a capital ‘P’, because -p is already
         reserved for preserving the times and modes of the file in
         rcp(1).

 -p      Preserves modification times, access times, and modes from the
         original file.
Run Code Online (Sandbox Code Playgroud)

小写-p不带参数,因此10012被视为进一步的选项序列;options-1并且-2是有效的选项(控制 SSH 协议)但-0不是 - 因此错误。

  • 该脚本中似乎存在错误。提交拉取请求,将 `-p` 更改为 `-P`。 (2认同)