increment an integer

hi

I want to echo the variable $i while it auto-increments till 21

I set initially i to 1

any idea how to do that?

thank you

hi melanie,
try the following. hope it will work...
put the code in a script and then excute the script..

count=21
i=1
while [ $i -le $count ]
do
echo $i
i=`expr $i + 1`
done

This is untested, but should work..

count=21
while [ $count -gt 0 ] 
do
  $i=$(( $lsv + 1 ))
  count=$(( $count - 1 ))
done

Following works for bash and ksh93

i=0
while (( ++i <= 21 ))
do
     echo $i
done
bc <<EOF
 for(i=1;i<21;i++){
   print i
   print "\n"
 }
EOF