Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: wait for the next process to finish



On Mon, Dec 12, 2011 at 10:46 AM, Anthony R Fletcher <arif@xxxxxxxxxxxx>wrote:

> I just realised that the 'wait' command will either wait for specified
> jobs or all jobs and nothing in between. The manual says "If job is not
> given then all currently active child processes are waited for.".
>
> So
>        sleep 30 &
>        sleep 10 &
>        sleep 30 &
>        sleep 30 &
>        wait
> waits for all the sleeps to finish.
>
> How can I wait for just the next job to finish?
>

Just don't run it in the background.

or do it like this:

(job1 ; job2)

or, if you want to make sure that job2 only runs if job1 succeeds:

(job1 && job2)

TjL

ps - my apologies if I am misunderstanding the question




>


Messages sorted by: Reverse Date, Date, Thread, Author