[olug] Bash or CygWin quirk waiting for process...

David Gilman davidgilman1 at gmail.com
Thu Jun 29 18:19:39 CDT 2017


If you use wait without an argument it'll block until all child
shells/processes finish.  So I think you can take out the for loop and your
use of jobs entirely, and your script becomes:

mintty foo &
mintty bar &

wait


On Thu, Jun 29, 2017 at 7:01 PM, Boian Berberov (Public) <
bberberov at gmail.com> wrote:

> You might have to trim the output of jobs -p.  Mine gives extra info.
>
> Respectfully,
>
> Boian Berberov
> _________________________
> https://boian.berberov.eu
>
> On 29/06/17 17:25, Dan Linder wrote:
> > I'm using CygWin in Windows 10 to automate a process.  I have two child
> > shell scripts I want to kick off from my main script, but I want the main
> > script to hang around until both of the child scripts are done.
> >
> > The two child scripts are called as processes of "mintty" so the output
> of
> > each is in separate windows.
> >
> > Here's my script:
> >
> > #!/bin/bash
> > mintty -t Type-A --exec ./build.sh typeA &
> > mintty -t Type-B --exec ./build.sh typeB &
> >
> > for job in `jobs -p` ; do
> >   echo Waiting for child $job of jobs: `jobs -p` to exit.
> >   wait $job
> > done
> >
> > ./process_both.sh
> >
> >
> > Both of the MinTTY consoles open and run the script, but the wait
> for-loop
> > doesn't wait and the "process_both.sh" script fires right away.
> >
> > Any ideas?
> >
> > Dan
> >
> >
> _______________________________________________
> OLUG mailing list
> OLUG at olug.org
> https://lists.olug.org/mailman/listinfo/olug
>



-- 
David Gilman
:DG<


More information about the OLUG mailing list