osx - Submitting several commands to sqlite3 in a single command at cli -
on mac os yosemite use following version of sqlite:
# sqlite3 --version 3.8.5 2014-08-15 22:37:57 c8ade949d4a2eb3bba4702a4a0e17b405e9b6ace and have 2 commands run fine @ sqlite3 prompt:
.read android.sql .import words.txt dict the first command above creates 3 tables need in android app (i use sqliteassethelper copy my.db apk-file).
the second command above fills dict table text file.
how can run both commands in single command @ cli?
i have tried following separators: semicolon, slash , \\n not work:
echo ".read android.sql / .import words.txt dict" | sqlite3 my.db usage: .read file update:
this work in mac os terminal (thanks, mark) -
# echo -e "command1\ncommand2" command1 command2 # echo -e ".read android.sql\n.import words.txt dict" | sqlite3 my.db usage: .read file
try this:
echo -e "command1\ncommand2" | sqlite3 my.db for example:
echo -e ".print hello\n.print goodbye" | sqlite3 hello goodbye see page echo using bash's built-in help:
help echo
Comments
Post a Comment