gum/examples/filter-key-value.sh

14 lines
207 B
Bash
Raw Normal View History

2022-07-30 22:47:49 +02:00
#!/bin/bash
export LIST=$(cat <<END
2022-07-30 22:47:49 +02:00
Cow:Moo
Cat:Meow
Dog:Woof
END
)
ANIMAL=$(echo "$LIST" | cut -d':' -f1 | gum filter)
SOUND=$(echo "$LIST" | grep $ANIMAL | cut -d':' -f2)
echo "The $ANIMAL goes $SOUND"