Date: Tue, 9 Jul 2002 15:50:38 -0400 From: "Matthew Emmerton" <matt@gsicomp.on.ca> To: <freebsd-questions@FreeBSD.ORG>, "Kirk Strauser" <kirk@strauser.com> Subject: Re: How do I repeat a command N times? Message-ID: <006101c22781$e66c8010$1200a8c0@gsicomp.on.ca> References: <003101c22768$80ddb250$0801a8c0@customfilmeffects.com><20020709200449.3fcf1ba7.fxn@retemail.es> <8765zowwmo.fsf@pooh.int>
next in thread | previous in thread | raw e-mail | index | archive | help
> > At 2002-07-09T18:04:49Z, "F.Xavier Noria" <fxn@retemail.es> 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 <insert command to run here> done -- Matt Emmerton 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?006101c22781$e66c8010$1200a8c0>