Malcolm, I was thinking along the same lines. The equivalent in bash is
something like:-

$ timeout=10; docommand blah1 blah2 blah3  & sleep $timeout; kill %%

But there is a problem in that if docommand finishes before the timeout
expires then you still hang around sleeping. So you need to timeout the
sleep process - catch 22. (I think your zsh exhibits the same issue). If
docommand finishes early you need to figure out a way to kill the sleep
proces,



Martin Visser

Technology Consultant 
Consulting & Integration
Technology Solutions Group - HP Services

410 Concord Road
Rhodes NSW  2138
Australia 

Mobile: +61-411-254-513
Fax: +61-2-9022-1800     
E-mail: martin.visserAThp.com

This email (including any attachments) is intended only for the use of
the individual or entity named above and may contain information that is
confidential, proprietary or privileged. If you are not the intended
recipient, please notify HP immediately by return email and then delete
the email, destroy any printed copy and do not disclose or use the
information in it.


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Malcolm V
Sent: Monday, 8 May 2006 5:48 PM
To: SLUG
Subject: Re: [SLUG] timing out a process with timeout

On Monday 08 May 2006 15:48, Jeff Waugh allegedly wrote:
> Hey,
>
> I just asked a question on #slug and found my answer in an apt-cache 
> search mere moments later. Figured it would be handy for others (you 
> lot and anyone who finds this in the archives later)...

In zsh,

docommand blah blah1 blah2 &;sleep some_num;kill $\!
(or something close to that)

I'm sure most shells support something like the above. Note, sleep is
inaccurate.

I'm sure timeout is much nicer then the above, but it did make me wonder
about package management and how the various distributions deal with
merging small useful utilities into general utility packages rather then
bloating their package trees with mountains of tiny packages. (And the
problems of grouping unrelated utilities and the confusion the could
cause between distros).

Not sure why I wrote this now.
Cheers,
Malcolm V.

 --
BOFH Excuse #115:

your keyboard's space bar is generating spurious keycodes.
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to