shell技巧

shell的数字循环、字母循环、指定顺序循环

花括号
for i in {1..3};do
echo “$i What to do”
done

循环字母:

for i in {a..z};do
echo “Letters is $i”
done

seq产生
for i in seq 1 3;do
echo “num is $i”
done

条件循环小括号
for((i=1;i<=3;i++));do
echo “Cycle number is $i”
done

While循环
i=1
while(($i<=3));do
echo “while run num is $i”
i=$(($i+1))
done