On Sep 29, 2011, at 10:42 PM, Robert Citek wrote:
> Given these two functions:
>
> $ foo () { for i in {1..10} ; do { sleep $i ; } & done ; wait ; }
> $ bar () { echo {1..10} | tr ' ' '\n' | while read i ; do { sleep $i ;
> } & done ; wait ; }
>
> Why does foo take 10 seconds and bar is instant? Apparently, foo is
> actually waiting for the background processes to finish, whereas bar
> is not. Why not? And how can I get bar to act like foo, i.e. wait
> for bg processes to finish)?
I'm even more interested in why foo only takes 10 seconds and not 55.
--
Central West End Linux Users Group (via Google Groups)
Main page: http://www.cwelug.org
To post: [email protected]
To subscribe: [email protected]
To unsubscribe: [email protected]
More options: http://groups.google.com/group/cwelug