帮酷LOGO
0 0 评论
  • 显示原文与译文双语对照的内容
文章标签:工具  UTI  Comma  帮助文档  UTIL  COM  BASH  Builtin  

问题:

我正在运行Bash脚本,但是有时我会混淆我使用哪些命令属于谁。 有时 man xxx 工作,有时不会,所以我使用 --help 或者 info,大多数是用来显示命令的描述。 谁能告诉我怎么知道什么命令属于什么? Bash内置,GNU实用程序等。


回答 1:

你可以使用 type 来查找:


$ type echo


echo is a shell builtin


$ type sudo


sudo is/usr/bin/sudo



对于 bash,使用 help,如 help echo


回答 2:

为了提高效率,一些内置命令被包含,并作为外部命令存在。 例如:


$ type -a echo


echo is a shell builtin


echo is/bin/echo



$ type -a printf


printf is a shell builtin


printf is/usr/bin/printf



可以在 &中找到内置和外部命令的详细分析。

至于获得双重内置/外部命令( 比如 echo )的帮助,你有两种选择。 一种方法是使用 man echo:


ECHO(1) User Commands ECHO(1)



NAME


 echo - display a line of text



SYNOPSIS


 echo [SHORT-OPTION]... [STRING]...


 echo LONG-OPTION



DESCRIPTION


 Echo the STRING(s) to standard output.



 -n do not output the trailing newline



 -e enable interpretation of backslash escapes



 -E disable interpretation of backslash escapes (default)



 --help display this help and exit



 --version


 output version information and exit



 If -e is in effect, the following sequences are recognized:



 backslash



 a alert (BEL)



 Manual page echo(1) line 1 (press h for help or q to quit)



你可以键入:


$ help echo


echo: echo [-neE] [arg.. .]


 Write arguments to the standard output.



 Display the ARGs, separated by a single space character and followed by a


 newline, on the standard output.



 Options:


 -n do not append a newline


 -e enable interpretation of the following backslash escapes


 -E explicitly suppress interpretation of backslash escapes



 `echo' interprets the following backslash-escaped characters:


 a alert (bell)


 b backspace


 c suppress further output


 e escape character


 E escape character


 f form feed


 n new line


 r carriage return


 t horizontal tab


 v vertical tab


 backslash


 nnn the character whose ASCII code is NNN (octal). NNN can be


 0 to 3 octal digits


 xHH the eight-bit character whose value is HH (hexadecimal). HH


 can be one or two hex digits



 Exit Status:


 Returns success unless a write error occurs.






文章标签:COM  MAN  COMM  Comma  UTIL  UTI  工具  BASH  

Copyright © 2011 HelpLib All rights reserved.    知识分享协议 京ICP备05059198号-3  |  如果智培  |  酷兔英语