Cover V04, I01
Article
Figure 1
Figure 2
Figure 3
Figure 4
Figure 5
Table 1

jan95.tar


Figure 3: Bourne shell interrupt routine for Control-C

#!/bin/sh
#
N=30 # Wait N (1 - 59) seconds.
#
#  John Lees                        lees@cps.msu.edu
#  Pattern Recognition & Image Processing Laboratory
#  M i c h i g a n   S t a t e   U n i v e r s i t y
#
# Interrupt routine for Control-C. Be careful if you
# try this to have only spaces in the string echoed
# to the dc command. TABs will mess things up.
impatient() {
now=`date +%S`
# Figure it both ways and use the one that is
# correct.
togo=`echo \
"[ $N $now $start - 60 + - ] sa \
$N $now $start - - d $N <a p" \
| /usr/bin/dc`
echo "\nPatience! Still $togo seconds to go...."
sleep $togo
}

# Set a trap on Control-C.
trap "impatient" 2

# Sleep for N seconds.
start=`date +%S`
sleep $N

echo "There. That wasn't so long, was it now?"
exit