Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Jul 2002 12:04:24 -0500 (CDT)
From:      Lee J Carmichael <lcarmich@wamnet.com>
To:        David Smithson <david@customfilmeffects.com>
Cc:        FreeBSD-Questions <freebsd-questions@FreeBSD.ORG>
Subject:   Re: How do I repeat a command N times?
Message-ID:  <Pine.SGI.3.96.1020709115845.295966F-100000@y.dev.wamnet.com>
In-Reply-To: <004201c22769$8468df70$0801a8c0@customfilmeffects.com>

next in thread | previous in thread | raw e-mail | index | archive | help
The 'for' loops in bash, ksh, sh don't do the c-style for processing,
these are more perl like loops (iterate through a list of thingys like (a
b c). 

BTW, the loop below needs to be changed slightly for bash, here is the
bash version:

let x=0
let stop=607

while [ $x -le $stop ]
do
   echo $x
   let x=$x+1
done


Damn bash... 

--------
Lee Carmichael		
Service Architect - WorkSpace

WAM!NET Inc.
655 Lone Oak Rd Building A
Eagan, MN 55121

ph# 651-256-5292 
email: lcarmich@wamnet.com

On Tue, 9 Jul 2002, David Smithson wrote:

> Aha.  A FOR loop?
> 
> > For ksh:
> >
> > let x=0
> > let stop=607
> >
> > while [[ $x -le $stop ]]
> > do
> >   # whatever you'd like
> >   echo $x
> >   let x=$x+1
> > done
> >
> > I guess you could make 'x' to 'n'... ;)
> >
> > Take Care,
> >
> > > Hello friends.  I want to repeat a command 607 times and stop.  How do I
> > > accomplish this besides writing a script that's 607 lines long?


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SGI.3.96.1020709115845.295966F-100000>