zsh-users
 help / color / mirror / code / Atom feed
From: Martin Richter <mrichter@theory.phy.tu-dresden.de>
To: zsh-users@zsh.org
Subject: Re: wait for the next process to finish
Date: Tue, 13 Dec 2011 08:15:20 +0100	[thread overview]
Message-ID: <201112130815.21779.mrichter@theory.phy.tu-dresden.de> (raw)
In-Reply-To: <CAHSx_Sv8g+tQQnytijXd=HOSHkyu-vwcmjCaDWoHhp2ba+whHw@mail.gmail.com>

On Monday December 12 2011, Wayne Davison wrote:
> On Mon, Dec 12, 2011 at 7:46 AM, Anthony R Fletcher <arif@mail.nih.gov>wrote:
> 
> > How can I wait for just the next job to finish?

This is probably not exactly what you want and it isn't pretty either. But you could use `make' for this and use the -j flag for telling it to process stuff in parallel:


#---------------------------

make -j 4 -f =( cat <<EOF
default: task1 task2 task3 task4 task_finally

task1:
        @echo task1
        sleep 2
        @echo task1 finished

task2:
        @echo task2
        sleep 7
        @echo task2 finished

task3:
        @echo task3
        sleep 4
        @echo task3 finished

task4:
        @echo task4
        sleep 10
        @echo task4 finished

task_finally:
        @echo finally
EOF)

#---------------------------

However it is not really customizable and I think it is not really meant to be used that way. If this solution does not already make you shudder, you might also be able to construct something likewise using xargs and the --max-procs switch.

Martin


  reply	other threads:[~2011-12-13  7:39 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-12 15:46 Anthony R Fletcher
2011-12-12 16:37 ` TJ Luoma
2011-12-12 19:41 ` Wayne Davison
2011-12-13  7:15   ` Martin Richter [this message]
2011-12-13 16:07   ` Rory Mulvaney
2011-12-13 16:45     ` Jérémie Roquet
2011-12-13 16:59       ` Anthony R Fletcher
2011-12-13 18:08         ` Daniel Shahaf
2011-12-13 16:49     ` Christoph (Stucki) von Stuckrad
2011-12-13 17:31       ` Bart Schaefer
2011-12-13 17:04     ` Rory Mulvaney
2011-12-13 17:32       ` Anthony R Fletcher
2011-12-13 18:04         ` Jérémie Roquet
2011-12-13 18:20           ` Stephane Chazelas
2011-12-13 19:19             ` Anthony R Fletcher
2011-12-13 10:01 ` Peter Stephenson
2011-12-13 17:10   ` Bart Schaefer
2011-12-13 20:42     ` Rory Mulvaney
2011-12-13 17:45 ` Stephane Chazelas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201112130815.21779.mrichter@theory.phy.tu-dresden.de \
    --to=mrichter@theory.phy.tu-dresden.de \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).