-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Sat, Apr 07, 2007 at 02:08:35PM -0400, William L. Maltby wrote:
On Sat, 2007-04-07 at 14:03 -0400, William L. Maltby wrote:
On Sat, 2007-04-07 at 14:20 -0300, Rodrigo Barbosa wrote:
<snip>
If I've got your meaning write, you are proposing something like:
( sleep $TIMER; kill -WHATEVER $PID )&
Which is pretty interesting way to do it, which I haven't though about until now. I never tried (...)&, and after you said this, I decided to see if it worked. And it did. It is a pretty neat way to create alarms inside a shell script.
Almost forgot - you might enjoy looking at the "trap" command in bash (and other shells). Allows entry to arbitrary routines based on asynchronous events, similar to signal handling in "C". Receiving function has the choice of resetting the trap, issuing arbitrary actions and signals, setting other traps, etc. Fun stuff.
Yup, used it in the past.
Actually, my idea for using (...)& is because of the trap. This way, you can trap SIG_ALARM as you would with sigaction, and use (...)& as you would alarm().
[]s
- -- Rodrigo Barbosa "Quid quid Latine dictum sit, altum viditur" "Be excellent to each other ..." - Bill & Ted (Wyld Stallyns)