I am trying to store a list of rows inside of a variable like in this example:
list=$(bash -c 'sqlite3 /home/ubuntu/myplace/mydb.db "SELECT row1 FROM table1"')
But when I want to add parameters like in this example:
list=$(bash -c 'sqlite3 /home/ubuntu/myplace/mydb.db "SELECT row2 FROM table2 WHERE row2='somevalue'"')
It does not work because the command given to bash inside the '' ends after the WHERE row2=
.
I tried some other variants where I first wrote the results of
sqlite3 /home/ubuntu/myplace/mydb.db "SELECT row2 FROM table2 WHERE row2='somevalue'"
to some txt, csv or json file just to read it out one line later but that just came out to be not practical.
Is there any other practical possibility?