之前一直对shell编程不是很了解,现在想要对这块内容慢慢开始我的研究。
授人与鱼不如授人以鱼,用对方法很重要。看网上的资料shell哪个命令参数怎么用怎么记不住,现在自己通过man XX来查看手册进行作用和参数选项的解读
1.对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 #enable 开启 interpretation 解释 backslash 转义字符 escapes 逃脱
#总的解释就是让转义字符逃脱(或者这里的逃脱的意思就是从字符串中逃脱出来不让转义字符显示出来而是让他转义作用开启)的解释作用开启
#echo -e '\n test'和echo '\n test'作用是不一样的
-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: #如果-e有效的话,那么接下来的转义队列都会被认识
\\ backslash #转义字符
\a alert (BEL)
\b backspace #实现退格作用
\c produce no further output #产生不了后面更多的输入,只能输入前面的
\e escape
\f form feed #换页
\n new line #新行 换行
\r carriage return #回车 把字符串插入到前面带有空格的字符串中并将空格前的字符串删掉
\t horizontal tab #
\v vertical tab
\0NNN byte with octal value NNN (1 to 3 digits) #八进制转换byte
\xHH byte with hexadecimal value HH (1 to 2 digits)#十六进制转为byte
#你的shell有自己的版本,实际作用要参照自己系统上的shell手册细节
NOTE: your shell may have its own version of echo, which usually super‐
sedes the version described here. Please refer to your shell's docu‐
mentation for details about the options it supports.
#作用
AUTHOR
Written by Brian Fox and Chet Ramey.
#额外的bug
REPORTING BUGS
GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
Report echo translation bugs to <http://translationproject.org/team/>
#版权
COPYRIGHT
Copyright © 2014 Free Software Foundation, Inc. License GPLv3+: GNU
GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
SEE ALSO
Full documentation at: <http://www.gnu.org/software/coreutils/echo>
or available locally via: info '(coreutils) echo invocation'
GNU coreutils 8.23 October 2015 ECHO(1)