On 2015-03-14 10:51 AM, Mikael wrote: > I have a file DBDEFINITION.TXT that I want to use to initialize [execute > on] the database DB.SQLITE. > > How do I do something like > > $ sqlite3 -exec DBDEFINITION.TXT DB.SQLITE > $
A piped file is always the answer - for anything really. If a piped file is not specified then the console becomes the standard input to the program and you end up in the console input cycle (which is what happens for you). # sqlite3 mydb.db < somefile.sql - will execute with mydb.db all the SQL statements (if no errors occur) inside somefile.sql - Note that this doesn't wrap the file in an implicit transaction, if the file fails halfway through and you did not start an explicit transaction, it won't be rolled back. Good luck! Ryan