1
#!/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.

1 Answer 1

2

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.