[svlug] Running a command n times simutaneously
Andrew Stitt
a at t.armory.com
Tue Apr 25 10:58:13 PDT 2006
On Tue, Apr 25, 2006 at 09:23:22AM -0700, Rufoo wrote:
> For a performance measurement task I need to run a
> command n>1 times simultaneously. Is there any tool
> that can help me do this?
>
You can use the '&' shell operator to run a command in the background
and use it in a loop to run the command in the background n times.
in bash it looks like this:
for ((i=0;i<n;i++)); do
cmd &
done
Once that finishes you'll get your prompt back but there will be n cmd
processes running. You can use the jobs builtin, top or ps to see which
processes are still running.
-Andrew
More information about the svlug
mailing list