0 seq命令:产生序列的命令
seq 1 10 :输出1到10seq 10 1 : 输出10到1seq 1 +2 10 : 输出13579seq 10 -2 1 : 输出108642
1 shell脚本中的for循环
语法结构: for 变量名 in 条件; do … done
#!/bin/bash##for循环 数字的##17-1-20 严龙sum=0for i in {1..10}#或者 for i in `seq 1 10`doecho "$i"sum=$(($sum+$i))doneecho "$sum"------------------------------------------------------------------------------#!/bin/bash##以文件为条件for 自动查看tmp目录下文件的行数##17-1-20 ylfor tmp in `ls /tmp`do#echo "$tmp"if [ -f "/tmp/""$tmp" ]thenwc -l "/tmp/""$tmp"elseecho "this is not file"fidone
