Friday, October 12, 2007

Writing tests in Linux


#!/bin/sh
# $SENT1 is a variable meaning "Sentence 1"
# Not sure what PS3 means.
# Could be a good start for a program that would make tests for Annika.

PS3="Choose the number of the correct word to fill in the blank: "
echo "The emergency brake let go and car rolled ______ the hill"

select SENT1 in up down along beside

do

if [ "$SENT1" == "" ]; then
echo -e "You need to enter something\n"
continue


elif [ "$SENT1" != down ]; then
echo -e "Sorry. Incorrect\n"
echo "1. Incorrect" >> eoiexam.dat

elif [ "$SENT1" == down ]; then
echo -e "Great!\n"
echo "No. 1 - Correct" >> eoiexam.dat
break

fi

done

No comments: