On Friday, Oct 22, 2004, at 11:01 US/Central, Robert Citek wrote:
However, I somehow have to wait at the end of the loop for the last job to finish before starting the cat. How can I do that? In pseudocode:

for i in 1 2 3 4 5;
  wget http://foo.com/path/to/file/file$i &
done
wait-for-last-job-to-finish
cat file{1,2,3,4,5} > one big.file.txt

Here's some sample code which I got to do exactly what I wanted:

for i in $(seq 5 -1 1) ; do
  { echo $i ; sleep $i ; echo $i; } &
done
wait
echo done

Now to think of a way to do the same when not using native bash, e.g. using a queueing system like Sun Grid Engine. I imagine each job within the for loop would set a semaphore, do something, and remove the semaphore while some "wait" process keeps polling until all the semaphores are gone.

Just thinking aloud to the list.

Regards,
- Robert
http://www.cwelug.org/downloads
Help others get OpenSource.  Distribute FLOSS for
Windows, Linux, *BSD, and MacOS X with BitTorrent

_______________________________________________
CWE-LUG mailing list
http://www.cwelug.org/ [EMAIL PROTECTED]
http://lists.firepipe.net/listinfo/cwe-lug

Reply via email to