When I’m using for like
for i in 1 2 3 4 5
then my file contains #!/bin/sh
at the top.
But when I’m using
for(( i = 0; i<=5; i++))
then it is showing error
Syntax error: Bad for loop variable
and running properly when I remove shebang. Please tell me the reason behind this.
sh
mode? Thanks! – Ziyaddin Sadygly Feb 26 '14 at 18:48i=0; while [ $i -le 5 ]; do echo $i; i=$((i+1)); done
– Florian Diesch Feb 26 '14 at 19:32