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

查看:107
本文介绍了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.

示例:[global options], [source arguments], [destination arguments]

角括号< >

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

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软件的常见功能.

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天全站免登陆