I'd like to run series of sqlite commands in bash script:
db="main.sqlite3"
db2="sub.sqlite3"
sqlite3 ${db} <<EOF
attach ${db2} as m;
select count(*) from m.details;
.exit
EOF
when attach to a string, it works, but when it is a variable, it won't, got
Error: near line 1: near "/": syntax error
how to use a variable(db2) inside EOF? thanks