如何了解linux命令的用法信息?

时间:2018-08-27 07:50:19

标签: command-line-arguments

示例:“ []”和“ [[]]”选项是什么意思?

usage: scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
           [-l limit] [-o ssh_option] [-P port] [-S program]
           [[user@]host1:]file1 ... [[user@]host2:]file2

1 个答案:

答案 0 :(得分:0)

方括号之间的东西通常是可选的。因此,例如,您不需要提供 -B 选项。

嵌套括号用于可选内容可选内容,您可以看到-c和文件规范的区别:

  • [-c cipher] 是可选的,但如果您提供 -c,您必须提供 cipher 位。括号内的整个事物是一个原子单元,要么存在,要么不存在。

  • 对于[[user@]host1:]file1file1 位是绝对需要的,因为它周围没有括号。您可以选择使用远程位置说明符作为前缀。如果这样做,则 host1: 位是必需的,但 user@ 位是可选的。因此,允许使用 file1host1:file1user@host1:file1 中的任何一个。