bash script question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
I have a question about bash scripting.
Can someone point me in the right direction?
I want the script to loop until the correct response is given, but I cant get it to work. see code below.

#!/bin/bash

quiz() {
  echo "Starting quiz..."
  echo "What is 2+2?"
  read response
  if [ "$response" == 4 ]
  then
    echo "You got it."
   else 
    echo "That is incorrect."
    until [ "$response" == 4 ]; do
  fi
  echo "Begin math quiz? (y/n)"
read response
if [ "$response" == "y" ] || [ "$response" == "Y" ]
then 
  SECONDS=0
  quiz
  echo "The quiz took you $SECONDS seconds to complete."
else 
  echo "Exiting..."
fi


_______________________________________________
Blinux-list mailing list
Blinux-list@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/blinux-list




[Index of Archives]     [Linux Speakup]     [Fedora]     [Linux Kernel]     [Yosemite News]     [Big List of Linux Books]