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