#!/bin/sh addr=$REMOTE_ADDR list=/dev/shm/test-var.$addr eval `./convert` echo -e "Content-type: text/html\n" cat header.txt if [ "$name" = "" ]; then echo "

Введите ваше имя!

" exit fi if [ "$file" = "" ]; then echo "

Выберите тест!

" exit fi [ "$num" = "" ] && num=1 total=`cat ../Tests/$file/total` maxvar=`cat ../Tests/$file/maxvar` if [ $num = 1 ]; then echo -e "\n\n\n" >> $list date >> $list echo -e "\n$name\t---\t$file\n" >> $list else LASST="не" echo -e "$[num-1]\t\c" >> $list fi [ "$last" != "" ] && last=$[$last % 11] if [ "$last" = "$a1" -a "$last" != "" ]; then echo "+" >> $list LASST="" right=$[right+1] else [ "$last" != "" ] && echo "-" >> $list fi if [ $maxvar -gt 1 ]; then rnd_num=-$[`./rand $maxvar` + 1] else rnd_num="" fi if [ "$num" -le "$total" ]; then echo -e "
" i=0 echo -e "

Вопрос $num из $total

" CHKD="checked" while read Qwest do if [ $i = 0 ]; then echo -e "

$Qwest

" elif [ $i -lt 5 ]; then echo -e "

$Qwest

" CHKD="" fi i=$[i+1] Answ=$Qwest done <../Tests/$file/$num$rnd_num num=$[num+1] val=$[`./rand` * 11 + $Answ] echo -e "\ \ \ " echo -e "
" # [ $num -ne 2 ] && echo -e "

На предыдущий вопрос ответ был" $LASST"верным

" else echo -e "

$name!

Вы дали $right правильных ответов

" BAL=`echo -e "scale=3\n oz=$right/$total\n if (oz<.5) 2 else if (oz<.7) 3 else if (oz<.9) 4 else 5"|bc` echo -e "

Ваша оценка: $BAL

\n" echo -e "

Вернуться

\n" echo -e "\n\n\t\tИтоговая оценка:\t$BAL\n\n\n\n\n" >> $list fi echo ""