Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

http://redd.it/pii6j

By: a guest on Feb 10th, 2012  |  syntax: Bash  |  size: 0.38 KB  |  views: 90  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/bin/bash
  2.  
  3. min=0 max=100
  4.  
  5. while true; do
  6.     guess=$((RANDOM%(max-min+1)+min))
  7.     echo Is your number $guess?
  8.     select choice in Yes Lower Higher; do
  9.         case $choice in
  10.         Yes)
  11.             echo Your number is $guess
  12.             exit 0;;
  13.         Lower)
  14.             max=$guess;;
  15.         Higher)
  16.             min=$guess;;
  17.         esac
  18.         break
  19.     done
  20. done