run sql/queries (postgres) within bash

e.g.

for things-to-buy in $(psql -d database-name -U username -c “select item from glossaries where priority = ‘urgent’ “;

do

blah, blah, blah …

done