From owner-freebsd-questions Fri Oct 26 13:42: 7 2001 Delivered-To: freebsd-questions@freebsd.org Received: from po4.wam.umd.edu (po4.wam.umd.edu [128.8.10.166]) by hub.freebsd.org (Postfix) with ESMTP id 5F12F37B403 for ; Fri, 26 Oct 2001 13:42:00 -0700 (PDT) Received: from rac2.wam.umd.edu (IDENT:root@rac2.wam.umd.edu [128.8.10.142]) by po4.wam.umd.edu (8.9.3/8.9.3) with ESMTP id QAA11956; Fri, 26 Oct 2001 16:41:55 -0400 (EDT) Received: from rac2.wam.umd.edu (IDENT:sendmail@localhost [127.0.0.1]) by rac2.wam.umd.edu (8.9.3/8.9.3) with SMTP id QAA26306; Fri, 26 Oct 2001 16:41:54 -0400 (EDT) Received: from localhost (gollucci@localhost) by rac2.wam.umd.edu (8.9.3/8.9.3) with ESMTP id QAA26302; Fri, 26 Oct 2001 16:41:54 -0400 (EDT) X-Authentication-Warning: rac2.wam.umd.edu: gollucci owned process doing -bs Date: Fri, 26 Oct 2001 16:41:54 -0400 (EDT) From: "Philip M. Gollucci" To: David Kirchner Cc: The Almonds , freebsd-questions@FreeBSD.ORG Subject: Re: Newbie-Simple C Shell programming help In-Reply-To: <20011026133427.A25870-100000@localhost> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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