1 |
On Sun, 2009-01-04 at 15:50 +0100, Martin Herrman wrote: |
2 |
|
3 |
> Note: ; is sequential, not optimized for multiple cores (I wonder if && is) |
4 |
> |
5 |
&& is a logic operator and operates sequential too. && only executes the |
6 |
command to the right of the operator if the command to the left returns |
7 |
success (0) for the return code. |
8 |
|
9 |
&& does not perform any job control. |
10 |
|
11 |
I have never looked into multi threading a shell script, though I |
12 |
suppose it could be possible but fairly complex. You could execute |
13 |
multiple jobs in the background using '&' and capture each process id |
14 |
into an array with the ${!} parameter, which "Expands to the process ID |
15 |
of the most recently executed background (asynchronous) command". Once |
16 |
you have launched the multiple jobs, you could enter a loop that sleeps |
17 |
a few seconds and then checks the status of each process id in the |
18 |
array, waiting for them to disappear. Once a process id disappears, you |
19 |
could remove the id from the array, launch another background process |
20 |
and add it's process id to the array. |
21 |
|
22 |
It may be simpler to use something like Perl, Python, Ruby or Java to |
23 |
handle threading, as those languages have threading APIs. |
24 |
|
25 |
-- |
26 |
Brett Johnson <brett@××××.com> |