SQLite Forum

.read with parameters... or alternative?
Login
How 'sqlite3 -batch ...' differs from 'sqlite3 ...' invoked with redirected input is not a simple subject. (Anybody who doubts this should study shell.c, paying attention to sets/uses of the variable stdin_is_interactive and various tests such as 'isatty(0)', 'in!=0' and 'in==stdin'.)  The final, simplified answer is: On many platforms, not much difference.

My answer is: To be sure the interactive features are disabled, use -batch. It is clear from the code that there has been a series adjustments made to how and how well the shell "does the right thing" without being explicitly told what that is.

Not using -batch, where that forces the shell to do the right thing, is a fine bet for typed one-liners. For scripted use of sqlite3, I still consider it a bad bet.