removed examples with copyright issues at FSF request

This commit is contained in:
Chet Ramey
2013-03-05 17:19:48 -05:00
parent 899fe729a6
commit 8eb22ee966
118 changed files with 0 additions and 16706 deletions
-29
View File
@@ -1,29 +0,0 @@
#!/bin/sh
# Author: P@draigBrady.com
# V1.0 : Nov 3 2006
#
# Execute a command with a timeout.
# If the timeout occurs the exit status is 128
#
# Note there is an asynchronous equivalent of this
# script packaged with bash (under /usr/share/doc/ in my distro),
# which I only noticed after writing this.
if [ "$#" -lt "2" ]; then
echo "Usage: `basename $0` timeout_in_seconds command" >&2
echo "Example: `basename $0` 2 sleep 3 || echo timeout" >&2
exit 1
fi
cleanup()
{
kill %1 2>/dev/null #kill sleep $timeout if running
kill %2 2>/dev/null && exit 128 #kill monitored job if running
}
set -m #enable job control
trap "cleanup" 17 #cleanup after timeout or command
timeout=$1 && shift #first param is timeout in seconds
sleep $timeout& #start the timeout
"$@" #start the job