|
|
Subscribe / Log in / New account

Go fish! (developerWorks)

Go fish! (developerWorks)

Posted Dec 4, 2008 16:49 UTC (Thu) by sitaram (guest, #5959)
In reply to: Go fish! (developerWorks) by nix
Parent article: Go fish! (developerWorks)

I'll admit exception handling is a little over the top for a shell, but bash has a few tricks up its sleeve too.

What would you say to a job-queuing program whose main "loop" is essentially the single statement "wait", and which did everything else by trapping SIGCHLD? Take a look at http://sitaramc.googlepages.com/queue.sh (but note: I wrote it for a lark and it seemed to work fine in testing but I never actually used it "in production")


to post comments

Go fish! (developerWorks)

Posted Dec 5, 2008 0:41 UTC (Fri) by nix (subscriber, #2304) [Link]

Oh, that's very neat. I can think of half a dozen times I've done things
in deeply ugly ways that could have been done like that.

The code's not even contorted to fit: the 'one line at the end where
control sits forever' just falls out of it.

Go fish! (developerWorks)

Posted Dec 5, 2008 3:11 UTC (Fri) by sitaram (guest, #5959) [Link]

thanks!

I'm a perl guy normally, but I wrote this to show (show off?) a bunch of perl/python/java type kids what plain bash could do...

Go fish! (developerWorks)

Posted Dec 5, 2008 9:42 UTC (Fri) by njs (subscriber, #40338) [Link]

Very slick indeed, thanks for sharing!


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds