Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux/Unix手册页语法约定_Linux_Unix_Manpage - Fatal编程技术网

Linux/Unix手册页语法约定

Linux/Unix手册页语法约定,linux,unix,manpage,Linux,Unix,Manpage,在man页面中,我遇到了编写Linux/Unix命令的各种语法,包括方括号、尖括号、连字符(-)和双连字符(-)的各种组合。有人知道这些语法约定的含义吗 [ ] < > [< >] [--] - -- [< >...] [] < > [< >] [--] - -- [< >...] 方括号[] 方括号([])表示封闭的元素(参数、值或信息)是可选的。您可以选择一个或多个项目,也可以不选择任何项目。不要在命令行中键入方括号 示例:[全局选项],[源参数],[目

man
页面中,我遇到了编写Linux/Unix命令的各种语法,包括方括号、尖括号、连字符(
-
)和双连字符(
-
)的各种组合。有人知道这些语法约定的含义吗

[ ]
< >
[< >]
[--]
-
--
[< >...]
[]
< >
[< >]
[--]
-
--
[< >...]

方括号[]

方括号([])表示封闭的元素(参数、值或信息)是可选的。您可以选择一个或多个项目,也可以不选择任何项目。不要在命令行中键入方括号

示例:
[全局选项],[源参数],[目标参数]

尖括号<>

尖括号(<>)表示封闭的元素(参数、值或信息)是必需的。您需要用适当的信息替换尖括号内的文本。不要在命令行中键入尖括号本身

示例:
-f[设置文件名变量]、-printer、-repeat、日期访问

在类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] 

还有一些不常见的
{}
括号,从我的搜索中可以看出,这些括号是用于以互斥方式指定所需选项的,例如
{-a |--几乎所有}

 "{}" are used in conjunction with a vertical bar to
indicate cases where exactly one of the specified options may be used

我不确定我是否理解你的问题。你是在说shell命令(bash、tcsh等等)吗?我猜你是在说。这是一个程序设计language@tbsalling我在阅读linux命令时读到了它,甚至在为诸如[--options]、[--]、[…]等的bash工作时也读到了它。我想知道[]、<>、--或。。。在这些语法中,我认为问题是关于手册页约定的。另请参阅,特别是概要部分对约定的讨论。您能说出这些信息的来源吗?一个链接会很有帮助…这是doe的连字符-这是为/[]:Thanx A lot@Avi。。这些文档和您的回复真的很有帮助。有人知道是否有标记默认值/参数的约定吗?句子
“{}”与竖条一起使用,以指示可能使用指定选项中的一个的情况
是错误的。正确的句子是“{}”与竖条一起使用,表示必须使用指定选项中的一个时的情况。