"Taking a LiveFire Labs' course is an excellent way to learn
Linux/Unix. The lessons are well thought out, the material is
explained thoroughly, and you get to perform exercises on a real
Linux/Unix box. It was money well spent."
LiveFire Labs' UNIX and Linux Operating System Fundamentals
course was very enjoyable. Although I regularly used UNIX systems
for 16 years, I haven't done so since 2000. This course was a
great refresher. The exercises were fun and helped me gain a real
feel for working with UNIX/Linux OS. Thanks very much!"
$ print $SECONDS; sleep 30; print $SECONDS
8
38
$
$ SECONDS=10; print $SECONDS; sleep 30; print $SECONDS
10
40
$
#!/bin/ksh
FILELIST="file1 file2 file3"
sleeptime=5
for i in ${FILELIST}
do
# record the value of SECONDS before processing begins
start=$SECONDS
print "Processing $i..."
# Normally, processing statements would replace
# the following sleep statement
sleep ${sleeptime}
# record the value of SECONDS after processing ends
stop=$SECONDS
# calculate processing time
(( runtime=stop-start ))
print "Processing time for $i was $runtime seconds.\n"
# increase the sleep time for next iteration of the loop
(( sleeptime=sleeptime*2 ))
done
exit 0
$ ./seconds
Processing file1...
Processing time for file1 was 5 seconds.
Processing file2...
Processing time for file2 was 10 seconds.
Processing file3...
Processing time for file3 was 20 seconds.
$