topical media & game development

talk show tell print

basic-unix-13.txt / txt



  Chapter 13
  
  #!/bin/bash
  echo “Guess the secret color”
  read COLOR
  if [ COLOR=”purple” ]
  then
          echo “You are correct.”
  else
          echo “Your guess was incorrect.”
  fi
  
  --------------------------------------
  
  read COLOR
  if [ COLOR=”purple” ]
  then
          echo “You are correct.”
  elif [ COLOR=”blue” ]
          echo “You’re close.”
  else
          echo “Your guess was incorrect.”
  fi
  
  --------------------------------------
  
  #!/bin/bash
  
  echo “Guess the secret color: red, blue, yellow, purple, or orange \n”
  read COLOR
  
  while [ COLOR != “purple” ]
  do
          echo “Incorrect. Guess again. \n”
          read COLOR
  done
  echo “Correct.”
  
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.