Results 1 to 6 of 6
Tried using bash 3.1's "for" command and it keeps flagging my semicolons:
for (( m=0 ) ; ( $m<=20 ) ; ( m=$m+1 ))
do
...
done
It says it ...
- 09-24-2008 #1Linux User
- Join Date
- Mar 2008
- Posts
- 287
Using bash's for command
Tried using bash 3.1's "for" command and it keeps flagging my semicolons:
for (( m=0 ) ; ( $m<=20 ) ; ( m=$m+1 ))
do
...
done
It says it is a syntax error so I put spaces on either side of all of them to no avail.
Can someone help? I just do not see it.
- 09-24-2008 #2Linux User
- Join Date
- Aug 2006
- Posts
- 458
if you just want to go to 20
Code:for i in {0..19} do # do something done
- 09-24-2008 #3Linux Newbie
- Join Date
- Jul 2008
- Posts
- 181
Code:for (( m=0; $m < 10; m++ )); do echo $m; done
- 09-24-2008 #4Linux Engineer
- Join Date
- Apr 2006
- Location
- Saint Paul, MN, USA / CentOS, Debian, Solaris, SuSE
- Posts
- 1,117
Hi.
Minor comment: the remaining "$" can also be eliminated:
cheers, drlCode:for (( m=0; m < 10; m+=2 )); do echo $m; done 0 2 4 6 8
Welcome - get the most out of the forum by reading forum basics and guidelines: click here.
90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
We look forward to helping you with the challenge of the other 10%.
( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )
- 09-24-2008 #5Just Joined!
- Join Date
- Sep 2008
- Posts
- 20
- 09-24-2008 #6Linux User
- Join Date
- Mar 2008
- Posts
- 287
Using bash's for command
Thanks, burschik, you seen my too many parans. How I get my head so wired?? Appreciate all who helped.


Reply With Quote
