SQLite Forum

Shell command parsing bugs with .open
Login
It's good to see there is a way to do such one-liners.

When I went to try something similar (after seeing Warren's post), I ran<code>
  sqlite3 -help
</code>which produced some tips beginning with:<code>
  Usage: sqlite3 [OPTIONS] FILENAME [SQL]
  FILENAME is the name of an SQLite database.
</code>. This led me to try a few things which did not work. For example:<code>
  sqlite3 -cmd ".once stupid.sql" -cmd .dump -cmd .quit stupid.sdb
  sqlite3 -cmd ".once stupid.sql ; .dump ; .quit" stupid.sdb
  sqlite3 stupid.sdb -cmd ".once stupid.sql ; .dump ; .quit"
</code>, all of which told me what commands can be used.

Prior to seeing the above tip, I did not realize that 'sqlite3 -help' might have said:<code>
  sqlite3 FILENAME [options] [SQL]
</code>. Is semicolon a meta-command separator as Warren hoped? (I see no evidence of it.) Is there a way to specify multiple successive meta-commands on the invocation command tail?  Why does "sqlite3 database.db -cmd '.once foo.sql' .dump" work?  Is it because [SQL] is really [meta-command or SQL]?