help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] parallel processing in bash (to replace for loop)


From: Greg Wooledge
Subject: Re: [Help-bash] parallel processing in bash (to replace for loop)
Date: Fri, 27 Jan 2012 12:32:05 -0500
User-agent: Mutt/1.4.2.3i

On Fri, Jan 27, 2012 at 11:13:37AM -0600, Peng Yu wrote:
> On Fri, Jan 27, 2012 at 7:28 AM, Greg Wooledge <address@hidden> wrote:
> >
> > for i in {1..5}; do
> >   foobar "$i" &
> > done
> > wait

> This won't work if you have many foobar to run.

Are you by chance trying to ask THIS question?

  I want to process a bunch of files in parallel, and when one finishes,
  I want to start the next. And I want to make sure there are exactly 5
  jobs running at a time.

> > See also http://mywiki.wooledge.org/ProcessManagement

Or more specifically,

http://mywiki.wooledge.org/ProcessManagement#I_want_to_process_a_bunch_of_files_in_parallel.2C_and_when_one_finishes.2C_I_want_to_start_the_next._And_I_want_to_make_sure_there_are_exactly_5_jobs_running_at_a_time.

will take you straight to it.

If that is NOT the question you are attempting to ask, then please ask
whatever it is you are trying to ask.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]