Linux/Unix 手册页语法约定 [英] Linux/Unix man page syntax conventions

查看:43
本文介绍了Linux/Unix 手册页语法约定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

In man pages I come across various syntaxes to write Linux/Unix commands, which include square brackets, angular brackets, hyphens (-) and double hyphens (--) in various combinations. Does anyone know the meaning of these syntax conventions?

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

推荐答案

方括号 [ ]

方括号 ( [ ] ) 表示所包含的元素(参数、值或信息)是可选的.您可以选择一个或多个项目或不选择项目.不要在命令行中输入方括号本身.

The square brackets ( [ ] ) indicate that the enclosed element (parameter, value, or information) is optional. You can choose one or more items or no items. Do not type the square brackets themselves in the command line.

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

角括号<>

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

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 [设置文件名变量]、-printer <打印机名称>、-repeat ;<天><小时><分钟>,日期访问

在类 Unix 系统中,ASCII 连字符-减号通常用于指定选项.该字符通常后跟一个或多个字母.一个单独的连字符减号本身没有任何字母的参数通常指定程序应该处理来自标准输入的数据或将数据发送到标准输出.在某些程序中使用两个连字符减号 ( -- ) 来指定使用更具描述性的选项名称的长选项".这是 GNU 软件的一个共同特点.

In Unix-like systems, the ASCII hyphen–minus is commonly used to specify options. The character is usually followed by one or more letters. An argument that is a single hyphen–minus by itself without any letters usually specifies that a program should handle data coming from the standard input or send data to the standard output. Two hyphen–minus characters ( -- ) are used on some programs to specify "long options" where more descriptive option names are used. This is a common feature of GNU software.

只需执行 'ls --help' 并查看选项,这对您来说应该很明显.

Just do 'ls --help' and look at the options, it should be obvious to you.

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

这篇关于Linux/Unix 手册页语法约定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆