Re: Re: yum.cron for testing & examination

"David L. Parsley" <[email protected]>
Newsgroups gmane.linux.tao.general
Message-ID <[email protected]>
On Mon, 2004-10-11 at 09:51, Ed L Cashin wrote:
> "David L. Parsley" <[email protected]> writes:
> >  If you know an easier way to
> > accomplish timeouts with bash in a clean way (not leaving cruft
> > processes hanging around) let me know.
> 
> David, to keep things simple you could use the timeout feature of
> bash's "read" built-in.
> 
>   ecashin@kokone tmp$ sh -c "sleep 2 && echo ok" | \
>     { read -t 3 a && echo $a || echo error; }
>   ok
>   ecashin@kokone tmp$ sh -c "sleep 4 && echo ok" | \
>     { read -t 3 a && echo $a || echo error; }
>   error

Yeah, I found out about the 'read' timeout a few hours later, but
decided not to rewrite.  The current version looks pretty readable to
me, and since I use 'sleep', the timeout value is anything sleep
understands (like 12h).  Do you find the script readable, or should I
sprinkle some comments?

David

_______________________________________________
Tao-discuss mailing list
[email protected]
http://mailman.taolinux.org/mailman/listinfo/tao-discuss
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQBBapYX4J4WoZuSf3URAtm0AJ470VtmDnNtSm2SkcArTL2hWt01mwCgjoNT
ZTRC5VAx9MMt2S+hVa1wkac=
=5Lt/
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.