Hi, I'm wondering how to write a BASH script that will capture my SQLite
output.

I can do it for a single line with something like this:

somevar=`sqlite3 dbfilename "SELECT name FROM tablename WHERE name='smith'
LIMIT 1;"`

However, if I want to do anything with multiple lines, I haven't figured out
a good way.  So far, I'm using a workaround by outputting to a file, then
reading it after I exit the SQLite commandline, but that slows down the
script significantly.

e.g.

sqlite3 dbfilename << EOF

.output temp1
select id from tablename where name = "bush";
.output temp2
select id from tablename where name = "osama";

.quit
EOF

read id1 < temp1
read id2 < temp2

What's the better way to do this without actually writing to a file?

Thanks!
-- 
View this message in context: 
http://www.nabble.com/Capturing-output-from-SQLlite-with-variables-in-a-BASH-script-tf3966729.html#a11259171
Sent from the SQLite mailing list archive at Nabble.com.


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to