From owner-freebsd-questions Fri Oct 26 13:37:53 2001 Delivered-To: freebsd-questions@freebsd.org Received: from webs1.accretive-networks.net (webs1.accretive-networks.net [207.246.154.13]) by hub.freebsd.org (Postfix) with ESMTP id BC3E837B403 for ; Fri, 26 Oct 2001 13:37:48 -0700 (PDT) Received: from localhost (davidk@localhost) by webs1.accretive-networks.net (8.11.1/8.11.3) with ESMTP id f9QKbcN28094; Fri, 26 Oct 2001 13:37:38 -0700 (PDT) Date: Fri, 26 Oct 2001 13:37:38 -0700 (PDT) From: David Kirchner X-X-Sender: To: The Almonds Cc: Subject: Re: Newbie-Simple C Shell programming help In-Reply-To: <20011026163145.N731-100000@shumai.marcuscom.com> Message-ID: <20011026133427.A25870-100000@localhost> 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 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