Guest User

http://redd.it/pii6j

a guest
Feb 10th, 2012
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.38 KB | None | 0 0
  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
Add Comment
Please, Sign In to add comment