Bash Looping a JSON List

· 31 words · 1 minute read
#!/usr/bin/env sh
#
# Loop a JSON list and perform some action

fakelist='["foo", "bar", "baz"]'

echo $fakelist | jq -rc '.[]' | while read item; do
    echo $item
done

Handy dandy.