From 3f6c1435a4cbdf73a65639b05898a01c0dfc21ac Mon Sep 17 00:00:00 2001 From: Pete Travis Date: Wed, 1 Oct 2014 11:33:51 -0600 Subject: we might need this sles10 stuff later --- .../bash-3.1-postpatch/examples/scripts/timeout | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 scratch/bash-3.1-postpatch/examples/scripts/timeout (limited to 'scratch/bash-3.1-postpatch/examples/scripts/timeout') diff --git a/scratch/bash-3.1-postpatch/examples/scripts/timeout b/scratch/bash-3.1-postpatch/examples/scripts/timeout new file mode 100644 index 0000000..ac8d88f --- /dev/null +++ b/scratch/bash-3.1-postpatch/examples/scripts/timeout @@ -0,0 +1,53 @@ +#Newsgroups: comp.unix.admin,comp.unix.solaris,comp.unix.shell +#From: gwc@root.co.uk (Geoff Clare) +#Subject: Re: timeout -t (Re: How to give rsh a shorter timeout?) +#Message-ID: +#Date: Fri, 13 Feb 1998 18:23:52 GMT + +# +# Conversion to bash v2 syntax done by Chet Ramey &2 ; exit 2 ;; +esac + +( + for t in $timeout $delay + do + while (( $t > $interval )) + do + sleep $interval + kill -0 $$ || exit + t=$(( $t - $interval )) + done + sleep $t + kill $SIG $$ && kill -0 $$ || exit + SIG=-KILL + done +) 2> /dev/null & + +exec "$@" -- cgit