fork download
  1. #!/bin/bash
  2. function lookup()
  3. {
  4. case "$1" in
  5. apple|banana|kiwi|melon)
  6. echo "FRUIT"
  7. ;;
  8.  
  9. radish|lettuce|potato)
  10. echo "VEGETABLE"
  11. ;;
  12.  
  13. blue|red|yellow|green|brown)
  14. echo "COLOR"
  15. ;;
  16. esac
  17. }
  18.  
  19. MY_CHOICE="kiwi"
  20. MY_CHOICE_GROUP=$(lookup "$MY_CHOICE")
  21.  
  22. echo $MY_CHOICE: $MY_CHOICE_GROUP
  23.  
Success #stdin #stdout 0.02s 5312KB
stdin
Standard input is empty
stdout
kiwi: FRUIT