Reputation: 90776
If I run something like this:
sqlite3 mydb.sqlite -cmd 'UPDATE users SET update_time = 0;'
It's going to successfully run the command, however it's also going to open the sqlite command line interface. Is it possible to make it run the command and then close afterwards? I've tried adding .quit
at the end of my command:
sqlite3 mydb.sqlite -cmd 'UPDATE users SET update_time = 0; .quit'
but it says "command invalid" so I guess it's expecting actual SQL queries only.
Any idea if it can be done?
Upvotes: 1
Views: 964
Reputation: 180070
Keeping the CLI active is what the -cmd
option does.
To execute some command and quit, don't use this option:
sqlite3 mydb.sqlite 'UPDATE users SET update_time = 0;'
Upvotes: 2