When I run sqlite3 interactively with the -echo option, every command I type gets echoed before its output, as expected:
$ sqlite3 -echo database.db
SQLite version 3.45.1 2024-01-30 16:01:20
Enter ".help" for usage hints.
sqlite> SELECT * FROM stuff;
SELECT * FROM stuff;
apples|67
tissues|10
sqlite> .tables
.tables
stuff
sqlite> .exit
However, when the commands are specified in the commandline arguments, SQL queries get echoed but dot commands do not:
$ sqlite3 -echo database.db "SELECT * FROM stuff;" ".tables"
SELECT * FROM stuff;
apples|67
tissues|10
stuff
Notice that .tables did not get echoed.
- Why is this?
- Is there a way to make dot commands supplied in the command line get echoed as well?
echo ".tables" | sqlite3 -echo database.dbbut while this is acceptable, it doesn't answer my first question (why is this?) and it's a bit ugly.