Select statement (if statement)
Greater than: -gt
determines whether a directory exists: -d
if [Condition judging]; the then
statement1
statement2
elif [Analyzing conditions]; the then
statement1
statement2
.......
the else
of statement3 in the
statement4
Fi
Determine whether there is a directory, if present, to delete, if you do not exist, create
Branch statement (case statement)
case 值 in
val1)
command1
command2
...
commandN ;;
val2)
command1
command2
...
commandN ;;
esac
for loop
Shell used in the mathematical expression: ((mathematical expression))
expr, evaluates an expression value, which is similar to the python eval
for var in list
do
commands
done
$ (Seq 1 10): generating a sequence of 1--10, shell where for i in $ (seq 1 10) and the python for i in range (1,11) as
for i in $(seq 1 10)
do
echo $(expr $i \* 3 + 1);
done
$@ 传递给脚本或函数的所有参数。
打印乘法口诀表
while循环
while argument;
do
statement ...
done
统计目录下所有文件的行数之和
find . -type f:选出当前目录下所有的文件类型,去除文件夹
xargs:把接收到的参数(默认根据换行符或者空格)分割成一个个的参数
用cat显示每一个文件的内容
用wc -l统计文件的行数
最后的指令为:find . -type f | xargs cat | wc -l