|
|
@@ -0,0 +1,108 @@ |
|
|
|
#!/bin/bash |
|
|
|
# |
|
|
|
# Copyright 2020, Job Bautista |
|
|
|
# Licensed under the Eiffel Forum License 2. |
|
|
|
# See the COPYING file for the full license text. |
|
|
|
|
|
|
|
question=1 |
|
|
|
|
|
|
|
programdone () { |
|
|
|
echo "Program done. Exiting." |
|
|
|
exit |
|
|
|
} |
|
|
|
|
|
|
|
echo "Welcome to the" `cat config/testname`. |
|
|
|
echo "Read each statement carefully and answer honestly based on how well" |
|
|
|
echo "it describes you. There are five choices. Enter the number you selected." |
|
|
|
echo "---------------------------------------------------------------------------" |
|
|
|
|
|
|
|
echo "5="`cat config/5` |
|
|
|
echo "4="`cat config/4` |
|
|
|
echo "3="`cat config/3` |
|
|
|
echo "2="`cat config/2` |
|
|
|
echo "1="`cat config/1` |
|
|
|
|
|
|
|
|
|
|
|
read -p "Ready? (y/yes to proceed, anything else to exit): " ready |
|
|
|
case $ready in |
|
|
|
"yes" | "YES" | "Yes" | "y" | "Y") |
|
|
|
while [ $question -le 55 ] |
|
|
|
do |
|
|
|
echo "$question." `cat questions/$question` |
|
|
|
read -p "Answer: " num$question |
|
|
|
((question++)) |
|
|
|
done |
|
|
|
;; |
|
|
|
*) |
|
|
|
programdone |
|
|
|
;; |
|
|
|
esac |
|
|
|
|
|
|
|
score1pre=$((num1 + num12 + num23 - num34 + num45)) |
|
|
|
score2pre=$((num2 + num13 + num24 - num35 + num46)) |
|
|
|
score3pre=$((num3 + num14 + num25 + num36 - num47)) |
|
|
|
score4pre=$((num4 + num15 + num26 + num37 - num48)) |
|
|
|
score5pre=$((num5 - num16 + num27 + num38 + num49)) |
|
|
|
score6pre=$((num6 - num17 + num28 + num39 + num50)) |
|
|
|
score7pre=$((num7 + num18 - num29 + num40 + num51)) |
|
|
|
score8pre=$((num8 + num19 + num30 - num41 + num52)) |
|
|
|
score9pre=$((num9 - num20 + num31 + num42 + num53)) |
|
|
|
score10pre=$((num10 - num21 + num32 + num43 + num54)) |
|
|
|
correctionpre=$((num11 - num22 - num33 - num44 + num55)) |
|
|
|
correction=$((correctionpre+18)) |
|
|
|
score1=$((score1pre+6)) |
|
|
|
score2=$((score2pre+6)) |
|
|
|
score3=$((score3pre+6)) |
|
|
|
score4=$((score4pre+6)) |
|
|
|
score5=$((score5pre+6)) |
|
|
|
score6=$((score6pre+6)) |
|
|
|
score7=$((score7pre+6)) |
|
|
|
score8=$((score8pre+6)) |
|
|
|
score9=$((score9pre+6)) |
|
|
|
score10=$((score10pre+6)) |
|
|
|
echo "---------------------------------------------------------------------------" |
|
|
|
echo "Results (without correction):" |
|
|
|
echo `cat config/score1name` "= $score1" |
|
|
|
echo `cat config/score2name` "= $score2" |
|
|
|
echo `cat config/score3name` "= $score3" |
|
|
|
echo `cat config/score4name` "= $score4" |
|
|
|
echo `cat config/score5name` "= $score5" |
|
|
|
echo `cat config/score6name` "= $score6" |
|
|
|
echo `cat config/score7name` "= $score7" |
|
|
|
echo `cat config/score8name` "= $score8" |
|
|
|
echo `cat config/score9name` "= $score9" |
|
|
|
echo `cat config/score10name` "= $score10" |
|
|
|
echo "Correction Factor = $correction" |
|
|
|
|
|
|
|
if [ $correction -le 19 ] |
|
|
|
then |
|
|
|
programdone |
|
|
|
else |
|
|
|
case $correction in |
|
|
|
24 | 25) |
|
|
|
subtract=7 |
|
|
|
;; |
|
|
|
22 | 23) |
|
|
|
subtract=5 |
|
|
|
;; |
|
|
|
20 | 21) |
|
|
|
subtract=3 |
|
|
|
;; |
|
|
|
*) |
|
|
|
echo "This shouldn't happen. Either you inputted a number greater than 5, or this is a bug." |
|
|
|
programdone |
|
|
|
;; |
|
|
|
esac |
|
|
|
echo "---------------------------------------------------------------------------" |
|
|
|
echo "Results (with correction):" |
|
|
|
echo $((score1 - subtract)) |
|
|
|
echo $((score2 - subtract)) |
|
|
|
echo $((score3 - subtract)) |
|
|
|
echo $((score4 - subtract)) |
|
|
|
echo $((score5 - subtract)) |
|
|
|
echo $((score6 - subtract)) |
|
|
|
echo $((score7 - subtract)) |
|
|
|
echo $((score8 - subtract)) |
|
|
|
echo $((score9 - subtract)) |
|
|
|
echo $((score10 - subtract)) |
|
|
|
fi |