how to run sqlite3 in bash script? -


i'd run series of sqlite commands in bash script:

db="main.sqlite3" db2="sub.sqlite3"  sqlite3 ${db} <<eof attach ${db2} m; select count(*) m.details; .exit eof 

when attach string, works, when variable, won't, got

error: near line 1: near "/": syntax error 

how use variable(db2) inside eof? thanks

try putting db file attach double quotes:

attach "${db2}" m; 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -