The first chapter, shell of special variables
$0 : 当前shell的脚本名字,执行脚本包含路径,那么就包含脚本路径
$n : 获取脚本执行的时候接的参数,n大于9就用大括号括起来
$# : shell脚本后面接的参数总个数
$* : 获取当前shell脚本所有传参的参数,加引号“$*”表示将所有的参数视为单个字符串
$@ : 不加引号和$*输出结果相同,加引号“$@”表示将所有参数视为不同的独立字符串
$? : 判断上一个命令是否执行成功
$$ : 获取当前执行shell脚本的进程号(PID)
$! : 获取上一个脚本进程号
$_ : 获取在此之前执行的命令或脚本的最后一个参数
The second chapter, shell variable string
2.1, delete
2.2, the output content to be replaced, replace the equivalent sed
2.3, the content acquisition variable length method
The third chapter, shell special variable expansion
The fourth chapter, the common arithmetic operators
Chapter V, shell common operational command
5.1, numerical operations (integer arithmetic)
the first method,(())
The second method, let
The third method, expr
The fourth method, $ []
The fifth method, declare -i
5.2, integer or fractional arithmetic
The first, awk algorithm
The second, bc calculator
5.3、a++、a--
5.4, (()) is determined
5.5, expr function
5.6, the essence is to read read variable assignment
变量赋值的三种方式:
1)定义式 a=1
2) read读入式
3)脚本传参 $1=100
Chapter VI, grammar test conditions (now determine whether there is)
文件测试表达式:对文件的属性进行判断,然后根据结果进行处理
6.1, [] brackets
6.2, condition parameter expressions
6.3, a string expression