ubuntu14 for 循环


#!/bin/bash


a=2
v2=`expr $a - 1`
echo $v2

echo "============================================="

for i in `seq 1 10`;
do
  echo $i
done

echo "============================================="
for i in `seq 1 5 20`; do echo $i; done


echo "============================================="

COUNTER=0
while [  $COUNTER -lt 10 ]; do
echo The counter is $COUNTER
   COUNTER=`expr $COUNTER + 1`
done


echo "============================================="

for i in $(echo "for (i=0;i<=10;i=i+2) i"|bc)
do
  echo "$i"
done

你可能感兴趣的:(ubuntu)