Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: wait for the next process to finish
- X-seq: zsh-users 16625
- From: Martin Richter <mrichter@xxxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: wait for the next process to finish
- Date: Tue, 13 Dec 2011 08:15:20 +0100
- In-reply-to: <CAHSx_Sv8g+tQQnytijXd=HOSHkyu-vwcmjCaDWoHhp2ba+whHw@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- Organization: TU Dresden
- References: <20111212154601.GA5198@cosy.cit.nih.gov> <CAHSx_Sv8g+tQQnytijXd=HOSHkyu-vwcmjCaDWoHhp2ba+whHw@mail.gmail.com>
- Reply-to: mrichter@xxxxxxxxxxxxxxxxxxxxxxxx
On Monday December 12 2011, Wayne Davison wrote:
> On Mon, Dec 12, 2011 at 7:46 AM, Anthony R Fletcher <arif@xxxxxxxxxxxx>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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author