SQLite User Forum

SQLite shell config file path
Login

SQLite shell config file path

(1) By Lemuria (lemuria) on 2022-11-06 12:11:55 [source]

Is there a way to have SQLite read from ~/.config/sqlite/.sqliterc instead of ~/.sqliterc in accordance with the XDG Base Directory Specification?

(2) By Stephan Beal (stephan) on 2022-11-06 12:37:35 in reply to 1 [link] [source]

Is there a way to have SQLite read from ~/.config/sqlite/.sqliterc instead of ~/.sqliterc in accordance with the XDG Base Directory Specification?

Not currently automatically, no. The only workaround would be:

$ sqlite3 -init ~/.config/....

Which could be wrapped up in a script like ~/bin/sqlite3:

#!/bin/bash
exec ~/bin/sqlite3.bin -init ~/.config/... "$@"

That sounds like a good addition, though, and i have added that to my TODOs for the 3.41 release.

(4) By Lemuria (lemuria) on 2022-11-06 13:36:30 in reply to 2 [link] [source]

I actually prefer my user binaries to be in ~/.local/bin. That aside, I've went with the wrapper script.

(3) By Stephan Beal (stephan) on 2022-11-06 12:53:02 in reply to 1 [link] [source]

Is there a way to have SQLite read from ~/.config/sqlite/.sqliterc ... in accordance with the XDG Base Directory Specification?

Implementation question: are there any strong opinions as to whether it should be ~/.config/sqlite/sqliterc or ~/.config/sqlite3/sqliterc? My instinct is to use the latter. The dot in .sqliterc seems superfluous in this case. i.e. my proposal (and impl, barring objections) is ~/.config/sqlite3/sqliterc.

(5) By Adrian Ho (lexfiend) on 2022-11-08 05:15:37 in reply to 3 [link] [source]

~/.config/sqlite3/sqliterc is the more logical choice, since the CLI binary is named sqlite3 rather than sqlite.

(6) By jose isaias cabrera (jicman) on 2022-11-08 13:50:50 in reply to 5 [link] [source]

~/.config/sqlite3/sqliterc is the more logical choice, since the CLI binary is named sqlite3 rather than sqlite.

+1