Cleaner:<br><br>for pid in `jobs -p`;<br>do<br> JOBNAME=`ps aux | grep $pid | grep -v grep | awk ' { print $11 }'`;<br> echo "${JOBNAME}: $pid";<br>done<br><br><br clear="all">--<br>
Stephen Benjamin<br><a href="mailto:skbenja@gmail.com" target="_blank">skbenja@gmail.com</a><br><br><a href="http://www.linkedin.com/in/skbenja" target="_blank">http://www.linkedin.com/in/skbenja</a><br>
<br>
<br><br><div class="gmail_quote">On Wed, Nov 11, 2009 at 2:25 PM, John Mills <span dir="ltr"><<a href="mailto:johnmills@speakeasy.net" target="_blank">johnmills@speakeasy.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Tim -<br>
<br>
Clean. Thanks.<br>
<div><br>
On Wed, 11 Nov 2009, Tim Watts wrote:<br>
<br>
> #/bin/bash<br>
<br>
> CAPTURE=output.log<br>
<br>
> for c in "$@"; do<br>
> $c >>"$CAPTURE" 2>&1 &<br>
> PIDS="$PIDS $!"<br>
> done<br>
<br>
> echo "$PIDS"<br>
<br>
> Then call it like this:<br>
<br>
> <script-name> "echo test1" "echo test2" "echo test3"<br>
<br>
> On Wed, 2009-11-11 at 11:12 -0500, John Mills wrote:<br>
<br>
</div><div>>> I want to write a bash script to launch several processes into background<br>
>> without waiting for them to exit, and return a list of their PIDs.<br>
</div><div><div></div><div>_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org" target="_blank">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
</div></div></blockquote></div><br>