dimanche 30 août 2015

Submitting several commands to sqlite3 in a single command at cli

On Mac OS Yosemite I use the following version of SQLite:

# sqlite3 --version
3.8.5 2014-08-15 22:37:57 c8ade949d4a2eb3bba4702a4a0e17b405e9b6ace

And I have 2 commands which run fine at sqlite3 prompt:

.read android.sql
.import words.txt dict

The first command above creates 3 tables I need in my Android app.

The second command above fills the dict table from a text file.

How can I run both commands at the cli?

I have tried following separators: semicolon, slash and \\n but this does not work:

echo ".read android.sql / .import words.txt dict" | sqlite3 my.db 
Usage: .read FILE

Aucun commentaire:

Enregistrer un commentaire