You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
459B

  1. #!/bin/sh
  2. i=0
  3. while read command
  4. do
  5. i=$((i+1))
  6. if test ${i} -ge 12345; then
  7. echo "quit"
  8. elif test "${command}" = 'bye'; then
  9. exit
  10. elif test "${command}" = 'bet?'; then
  11. echo 1
  12. elif test "${command}" = 'insurance?'; then
  13. echo "no"
  14. elif test "$(echo ${command} | cut -c-5)" = 'play?'; then
  15. count=$(echo ${command} | cut -f2 -d" ")
  16. if test ${count} -lt 12; then
  17. echo "hit"
  18. else
  19. echo "stand"
  20. fi
  21. fi
  22. done