for(int i=0; i<10; i++) type of loop in bash 

Newsgroups: comp.unix.shell
> typeset -i i=0
> while [ "$i" -lt 10 ]; do
>    <command>
>    let i=i+1
> done
>
> "((i=i+1))" or "let i+=1" are alternative syntaxes for the 4th line that may
> also work in bash.

in bash you do it like this

#!/bin/bash
i=0
while [ "$i" -lt 10 ]
do
        <command block>
        i=`expr $i + 1`
done

joeri

for(int i=0; i<10; i++) type of loop in bash 

integer i
for ((i=0; i<10; i++))
do     ...
done

You need version 2.04. And you will need to:

alias integer='typeset -i'

Dan Mercer

documented on: 2001.03.19 Mon 00:28:33