From owner-freebsd-questions Tue Jul 9 12:50:58 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 61D6637B400 for ; Tue, 9 Jul 2002 12:50:56 -0700 (PDT) Received: from tomts20-srv.bellnexxia.net (tomts20.bellnexxia.net [209.226.175.74]) by mx1.FreeBSD.org (Postfix) with ESMTP id EEE8643E97 for ; Tue, 9 Jul 2002 12:50:41 -0700 (PDT) (envelope-from matt@gsicomp.on.ca) Received: from xena.gsicomp.on.ca ([65.95.182.142]) by tomts20-srv.bellnexxia.net (InterMail vM.5.01.04.19 201-253-122-122-119-20020516) with ESMTP id <20020709195039.LAPA11295.tomts20-srv.bellnexxia.net@xena.gsicomp.on.ca>; Tue, 9 Jul 2002 15:50:39 -0400 Received: from hermes (hermes.gsicomp.on.ca [192.168.0.18]) by xena.gsicomp.on.ca (8.11.3/8.11.3) with SMTP id g69Ianw80687; Tue, 9 Jul 2002 14:36:49 -0400 (EDT) (envelope-from matt@gsicomp.on.ca) Message-ID: <006101c22781$e66c8010$1200a8c0@gsicomp.on.ca> From: "Matthew Emmerton" To: , "Kirk Strauser" References: <003101c22768$80ddb250$0801a8c0@customfilmeffects.com><20020709200449.3fcf1ba7.fxn@retemail.es> <8765zowwmo.fsf@pooh.int> Subject: Re: How do I repeat a command N times? Date: Tue, 9 Jul 2002 15:50:38 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 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 > > At 2002-07-09T18:04:49Z, "F.Xavier Noria" writes: > > > With a Perl one-liner: > > > > $ perl -e '$n = 607; system "cmd" while $n--' > > Mix and match! If you know Bash or sh much better than Perl, just use Perl > to feed the counter: > > for i in `perl -e 'print ".\n"x10;'`; do > echo 'foo'; > done > > Replace 'x10' with 'x607' and "echo 'foo'" with whatever complicated shell > command you've strung together and you'll have the best of both worlds (or > worst, depending on your POV). I've found that sh + jot works best in my experience, and doesn't involve any counter math and comparisons: for i in `jot 1000` do done -- Matt Emmerton To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message