一、while语句

declare -i i=0
declare -i sum=0
while [ ${i} != 100 ]
do
        i=$((${i}+1))
#       echo "i=${i}"
        sum=$((${sum}+${i}))
done
echo "${sum}"



二、for语句

mypath=/etc/passwd

myusers=$(cat ${mypath} | awk -F":" '{print $1}')

for users in ${myusers}
do
        id ${users}
done
exit 0


三、for语句

for nethost in $(seq $2 $3)


四、for语句

sum=0
for (( i=1; i<=$1 ; i=i+1 ))
do
        sum=$((${sum}+${i}))
done
echo "the sum is:${sum}"
exit 0