こうやって書ける
#!/bin/bash
for((i=0;i<5;i++)){
echo $i
}
スペース入れてもOK
#!/bin/bash
for (( i = 0 ; i < 5 ; i ++ )) {
echo $i
}
出典
http://qiita.com/b4b4r07/items/e56a8e3471fb45df2f59
man bash 抜粋
for (( expr1 ; expr2 ; expr3 )) ; do list ; done
First, the arithmetic expression expr1 is evaluated according to the rules
described below under ARITHMETIC EVALUATION. The arithmetic expression expr2 is
then evaluated repeatedly until it evaluates to zero. Each time expr2 evaluates
to a non-zero value, list is executed and the arithmetic expression expr3 is
evaluated. If any expression is omitted, it behaves as if it evaluates to 1.
The return value is the exit status of the last command in list that is exe-
cuted, or false if any of the expressions is invalid.
; do list ; done の部分がなんで { list } でいいのか謎。