Advertisement
sheffield

case-fruit.sh

Mar 14th, 2013
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.37 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. echo "Which fruit do you like most?"
  4. read fruit
  5.  
  6. case $fruit in
  7.     apple)
  8.         echo 'Mmmmh... I like those!'
  9.         ;;
  10.     banana)
  11.         echo 'Hm, a bit awry, no?'
  12.         ;;
  13.     orange|tangerine)
  14.         echo $'Eeeks! I don\'t like those!\nGo away!'
  15.        exit 1
  16.        ;;
  17.    *)
  18.        echo "Unknown fruit - sure it isn't toxic?"
  19. esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement