SQLite Forum

Feature request: Dynamically execute SQL from shell
You can do the same thing when building the shell.  That is, the shell is merely an application which uses SQLite3, so you can extend builtin functionality the same way.

There is an additional caveat with the shell though.  There are (unfortunately) some extensions which are built into the shell which are not built into SQLite3 (that is, rather than adding them in the general case, they have been added only in the shell).  This causes all sorts of problem since you will end up with duplicate symbols and incompatibilities -- the best way I have found to fix these are to remove the extensions from the shell (where they do not belong) and add them to the SQLite3 core.

If you build your own amalgamation files (sqlite3.c/shell.c) this done rather easily by modifying the TCL scripts which "build" those files.  The primary caveat is that the hash returned by the -version will no longer match the "official versions" because it is the hash of the source, and you have changed the source.  It is, however, far easier to maintain than to keep track of changes to the amalgamation files -- it is merely a new fossil branch into which you merge changes from the trunk.