docs: add filter example with identification (key / value)

This commit is contained in:
Maas Lalani 2022-07-30 18:12:51 -04:00
commit 75a10561fa

View file

@ -1,7 +1,12 @@
#!/bin/bash
cat <<EOF | gum filter
export LIST=$(cat <<END
Cow:Moo
Cat:Meow
Dog:Woof
EOF
END)
ANIMAL=$(echo "$LIST" | cut -d':' -f1 | gum filter)
SOUND=$(echo "$LIST" | grep $ANIMAL | cut -d':' -f2)
echo "The $ANIMAL goes $SOUND"