Reputation: 75686
#!/bin/sh
rows=$(sqlite3 db 'select * from subscriptions;')
for row in $rows; do
// curl $row['email']
done
I have a db that has email and keyword i want to make some curl requests for each row in the db.
Upvotes: 1
Views: 1400
Reputation: 639
If the output is delimited by newlines, you could do
while IFS= read -r row; do
echo "${row}"
done < <(sqlite3 db 'select * from subscriptions;')
Or you could read the rows into an array first, and iterate over it
mapfile -t rows < <(sqlite3 db 'select * from subscriptions;')
for row in "${rows}"; do
echo "${row}";
done
Upvotes: 2