I have a loop in bash that sets some pathnames as variables.
Within that loop I want to perform some sqlite commands based on these variables.
for example:
sqlitedb="/Users/Documents/database.db"
for mm in 01 02 03; do
filename1="A:/data1-${mm}.csv"
filename2="D:/data2-${mm}.csv"
sqlite3 "$sqlitedb" #create new file, it is a temporary file. no problem with this command.
.mode csv
.import "$filename1" data_1 #try to import the first data file. This command doesn't work
.import "$filename2" data_2 #try to import the second data file. This command doesn't work
# now do some important sql stuff which joins these files.
.quit
rm -f "$sqlitedb" #remove old file, ready for the next loop
done
Clearly, SQLITE doesn't know about my BASH variables. What is the best way to set variables, loop through files, etc within sqlite3?
If it helps, I'm using WSL ubuntu 18.04