在man
页中,我遇到了编写Linux/Unix命令的各种语法,包括方括号、尖括号、连字符(-
)和双连字符(--
)的各种组合.有人知道这些语法约定的含义吗?
[ ]
< >
[< >]
[--]
-
--
[< >...]
在man
页中,我遇到了编写Linux/Unix命令的各种语法,包括方括号、尖括号、连字符(-
)和双连字符(--
)的各种组合.有人知道这些语法约定的含义吗?
[ ]
< >
[< >]
[--]
-
--
[< >...]
Square Brackets [ ]
方括号([])表示封闭的元素(参数、值或信息)是可选的.您可以 Select 一个或多个项目,也可以不 Select 任何项目.不要在命令行中键入方括号.
示例:[global options], [source arguments], [destination arguments]
Angle Brackets < >
The angle brackets ( < > ) indicate that the enclosed element (parameter, value, or information) is mandatory. You are required to replace the text within the angle brackets with the appropriate information. Do not type the angle brackets themselves in the command line.
示例:-f [set the File Name variable], -printer <printer name>, -repeat <months> <days> <hours> <minutes>, date access <mm/dd/yyyy>
在类Unix系统中,ASCII连字符–减号通常用于指定选项.字符后面通常有一个或多个字母.参数本身是一个连字符-负号,没有任何字母,通常指定程序应该处理来自标准输入的数据或将数据发送到标准输出.有些程序使用两个连字符(-)来指定"长选项",其中使用了更具描述性的选项名称.这是GNU软件的一个常见功能.
只要做"ls--help",看看选项,你就会明白这一点.
-A, --almost-all do not list implied . and ..
--author with -l, print the author of each file
-b, --escape print octal escapes for nongraphic characters
--block-size=SIZE use SIZE-byte blocks
-B, --ignore-backups do not list implied entries ending with ~
-c with -lt: sort by, and show, ctime (time of last
modification of file status information)
with -l: show ctime and sort by name
otherwise: sort by ctime'
-C list entries by columns
--color[=WHEN]