Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Oct 2001 16:41:54 -0400 (EDT)
From:      "Philip M. Gollucci" <gollucci@wam.umd.edu>
To:        David Kirchner <davidk@accretivetg.com>
Cc:        The Almonds <cjalmond@yahoo.com>, freebsd-questions@FreeBSD.ORG
Subject:   Re: Newbie-Simple C Shell programming help
Message-ID:  <Pine.GSO.4.21.0110261641170.25270-100000@rac2.wam.umd.edu>
In-Reply-To: <20011026133427.A25870-100000@localhost>

next in thread | previous in thread | raw e-mail | index | archive | help
you could always use the shell command repeat

i.e.

repeat 100 w

which will run w 100 times... not a very useful example.

*****************************************************************************
Philip M. Gollucci (p6m7g8)
Web-site    : http://www.p6m7g8.com
E-mail      : gollucci@wam.umd.edu 
	      Philip@p6m7g8.com 
Phone       : 301.249.6261 (Home)
	      301.314.3118 (College)
Major       : Computer Science 
Minor	    : Classical & Jazz Performance
Current Job : Science, Discovery, & the Universe Webmaster
	      URL: http://www.sdu.umd.edu 
Resume	    : http://www.wam.umd.edu/~gollucci/resume.html
*****************************************************************************


On Fri, 26 Oct 2001, David Kirchner wrote:

> On Fri, 26 Oct 2001, The Almonds wrote:
> 
> > All,
> >
> > I am trying to run a program via a c shell 100 times
> > for a stress test.
> >
> > I have
> > #!/bin/sh
> >
> > for 1 in 1 2 3
> >
> > do
> >
> > x
> >
> > done
> >
> > as you can see this is painful if I want to do 100.
> > Anyone know of a quick way to do this for 100 loops.
> 
> Others have pointed out the sh and csh way to do this, but I just thought
> I'd also mention the "jot" program, which is pretty spiffy. You could then
> do, in sh:
> 
> for i in `jot 100`
> do
> 	whatever
> done
> 
> If you wanted to do every other number (ie 0 2 4 6 8) you'd do:
> 
> for i in `jot 100 0 100 2`
> do
> 	whatever
> done
> 
> Check out man jot for details.
> 
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message
> 


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.GSO.4.21.0110261641170.25270-100000>