Skip site navigation (1)Skip section navigation (2)
Date:      09 Jul 2002 14:04:47 -0500
From:      Kirk Strauser <kirk@strauser.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: How do I repeat a command N times?
Message-ID:  <8765zowwmo.fsf@pooh.int>
In-Reply-To: <20020709200449.3fcf1ba7.fxn@retemail.es>
References:  <003101c22768$80ddb250$0801a8c0@customfilmeffects.com> <20020709200449.3fcf1ba7.fxn@retemail.es>

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).
-- 
Kirk Strauser
The Strauser Group - http://www.strausergroup.com/

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?8765zowwmo.fsf>