你究竟如何解释命令“用法”输出的输出,例如在bash中。
例如,在我的OS X上, cp给了我
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file target_file cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file ... target_directory
我需要对我的一个程序实施一个telnet命令行,我想弄清楚这一点。
对于任何试图理解使用输出意味着什么的人来说,最好的方法就是man man 。
认真:-)花时间学习这些惯例,这真的有帮助。
The following conventions apply to the SYNOPSIS section and can be used as a guide in other sections. bold text type exactly as shown. italic text replace with appropriate argument. [-abc] any or all arguments within [ ] are optional. -a|-b options delimited by | cannot be used together. argument ... argument is repeatable. [expression] ... entire expression within [ ] is repeatable.
首先,虽然有一般惯例,但并不是统一适用的。
-R (表示“recursion”),则可以使用-H , -L或-P 。 如果你不使用-R ,那么这些选项是不相关的。 -h和-H做完全不同的事情。 其他值得注意的是:
[-fi | -n] [-fi | -n]表示可以使用-f和/或-i但不能与-n组合使用。 [-apvX]表示你可以使用这些选项的任意组合。 他们甚至不需要一起被粉碎。 所以-a -v -p将是一个有效的组合。