I see plenty of examples showing how to use the sqlite3 interactive shell, e.g.:
$ sqlite3
$ sqlite3> SELECT * from x;
but I am looking for a way to create a table in a SQLite3 database with a bash script, aka, non-interactively.
For example, the following doesn't seem to work (compare last 2 characters with accepted answer), it remains interactive:
#!/bin/bash
sqlite3 test.db "create table n (id INTEGER PRIMARY KEY,f TEXT,l TEXT);"
sqlite3 test.db "insert into n (f,l) values ('john','smith');"
sqlite3 test.db "select * from n";