1#!/bin/sh23cleanup()4{5 rm -f test.txt6 kill -KILL $pid 2>/dev/null7 if test $1 -ne 08 then9 kill -KILL $$10 fi11}1213rm -f file.txt14trap 'cleanup 0' EXIT15trap 'cleanup 1' INT TERM HUP1617$EXEC scc make -f - test.txt <<'EOF' &18.PRECIOUS: test.txt1920test.txt:21 @touch $@22 @while : ; do sleep 1 ; done23EOF24pid=$!2526sleep 10 && echo timeout >&2 && kill $$ 2>/dev/null &27timer=$!2829while :30do31 if test -f test.txt32 then33 kill $pid34 wait $pid35 kill $timer36 break37 fi38done3940test -f test.txt