4 ms·
I recommend adding a little trick to ignore existing ~/.sqliterc files, which makes the script more portable: cat <<EOF | sqlite3 -init <(echo "") "$DBFIL
by manx 5y ago
I recommend adding a little trick to ignore existing ~/.sqliterc files, which makes the script more portable:
cat <<EOF | sqlite3 -init <(echo "") "$DBFILE"
...your sql...
EOF
For one-line queries I use:
q() { echo "$@" | sqlite3 -init <(echo "") "$DBFILE"; }
- tyingq 5y agoInteresting. I noticed that "-init" doesn't error out if you give it a filename that can't be a file, like . or /. Using /dev/null seems to work also.
- t0astbread 5y agoThe cat in the first script can be omitted I think (by using the heredoc on sqlite directly).