Advertisement
Guest User

Untitled

a guest
May 27th, 2014
487
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. usr=$RANDOM
  4. num=$RANDOM
  5.  
  6. clear
  7.  
  8. compare()
  9. {
  10.     if [[ "$usr" -ne "$num" ]]; then
  11.  
  12.         if [[ "$usr" -lt "$num" ]]; then
  13.             echo "Больше"
  14.             echo
  15.             return 1
  16.         else
  17.             echo "Меньше"
  18.             echo
  19.             return 1
  20.         fi
  21.  
  22.         return 0
  23.     fi
  24. }
  25.  
  26. echo "Первая догадка:"
  27. while [ "$usr" -ne "$num" ]; do
  28.     read usr
  29.     compare && echo "Правильно!"
  30. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement