先介绍两个非常好的查询网站:
sed-and-awk-101-hacks
BashPitfalls
shellscript
-e : exist
-f : file?
-r : readable?
-w : writable?
-x : executable?
-d : directory?
-z : zero, no value?
-L : symbol link?
-p : pipe?
-S : network socket?
-G : is it owned by group
-O : is it owned by the user
《Linux Shell Scripting Cookbook》
linux中shell变量$#,$@,$0,$1,$2
的含义解释:
变量说明:
$$
Shell本身的PID(ProcessID)
$!
Shell最后运行的后台Process的PID
$?
最后运行的命令的结束代码(返回值)
$-
使用Set命令设定的Flag一览
$*
所有参数列表。如"$*"用「"」括起来的情况、以"$1 $2 … $n"的形式输出所有参数。
$@
所有参数列表。如"$@"用「"」括起来的情况、以"$1" "$2" … "$n" 的形式输出所有参数。
$#
添加到Shell的参数个数
$0
Shell本身的文件名
$1~$n
添加到Shell的各参数值。$1是第1参数、$2是第2参数…。
tput:
tput : 改变终端显示特性,常见用法如下:
tput lines : 显示终端的行数
tput cols : 显示终端的列数
tput cup line_number collum_number : 定位光标到 line_number 行,collum_number 列的位置
tput setb n : 其中 n 为 0-7 的数字,设置终端的背景颜色
tput setf n : 其中 n 为 0-7 的数字,设置终端的前景色,即字体的颜色
tput sc : 保存光标的位置
tput rc : 恢复光标到上一次保存的位置
tput ed : 清空光标所在位置到屏幕结尾的所有内容
tput smul : 设置下划线
tput rmul : 移除下划线
tput bold : 设置文本样式为粗体
发现一个挺不错的linux 命令网站,说明清晰,检索方便
Linux命令大全
网友评论