I'm trying to dump the schema for test.db
only (i.e. no data) into a file called schema.sql
from the command line in OS X without launching sqlite3.
I know I can do:
sqlite3
.open test.db
.output schema.sql
.schema
.quit
But I don't want to launch sqlite 3. This...
echo '.output schema.sql' | sqlite3 test.db
creates the empty file but this...
echo '.schema' | sqlite3 test.db
only prints the schema. How can I write it to that file from Terminal?
Thanks!