Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Jul 2016 18:34:40 +0300
From:      Nikos Vassiliadis <nvass@gmx.com>
To:        freebsd-questions@FreeBSD.org
Subject:   jobs control in a /bin/sh script
Message-ID:  <930cbcd1-2345-8a55-1b87-1691f5aa09a1@gmx.com>

next in thread | raw e-mail | index | archive | help
Hi,

Is there a way to redirect "jobs" output?
While this works on other bourne-like shells like zsh
or bash, it doesn't on /bin/sh.

> $ sleep 100 &
> $ sleep 100 &
> $ jobs -p
> 1760
> 1761
> $ jobs -p | cat
> $

My code looks like this:
> for j in $jobs
> do
>   (
> 	blah; blah; blah;
>   ) &
> done

and I'd like to limit the number of jobs my script could create.

Thanks,
Nikos



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?930cbcd1-2345-8a55-1b87-1691f5aa09a1>