1、shell的计算
#!/usr/bin/env bash
##计算##
result=`expr 2 - 100`
echo "$result"
result1=$((5+5))
echo "$result1"
result2=$[5+4]
echo $result2
let result3=2+4
echo $result3
2、for循环举例
for var in 1 2 3 4 5 6 7 8 9
do
echo "then is number is $var"
done
for var1 in {10..19}
do
echo "then is number is $var1"
done
for var2 in `seq 20 28`
do
echo "then is numver is $var2"
done
原文地址:http://blog.51cto.com/5920527/2348545
时间: 2024-11-08 21:31:31