chiark / gitweb /
check-bkp-status.in: Force `sqlite3' output options to be correct.
authorMark Wooding <mdw@distorted.org.uk>
Fri, 7 Jul 2017 10:01:40 +0000 (11:01 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 7 Jul 2017 10:01:40 +0000 (11:01 +0100)
If the user has a `.sqlite3' file which overrides the default output
options (quite likely, because the default format is rather ugly) then
`check-bkp-status' gets very confused.  So add a bunch of options:

  * `-batch' suppresses the annoying `Loading resources from
    HOME/.sqliterc' banner;

  * `-list' forces thing-separated items rather than tabulated output;

  * `-separator |' sets the thing which separates items; and

  * `-noheader' suppresses the column headings.

Honestly there ought to be a `-norc' option, but there isn't.

check-bkp-status.in

index d45c06b94da342b4c0f2ef1fdd072aae8eb2f6d6..75ddf600523b0f8b15a26edada7bba2a1e56a388 100644 (file)
@@ -407,7 +407,7 @@ backup () {
       case $host:$fs in $p) matchp=t; break ;; esac
     done
     case $matchp in nil) return ;; esac
-    when=$(sqlite3 $INDEXDB \
+    when=$(sqlite3 -batch -list -separator \| -noheader $INDEXDB \
       "SELECT MAX(date) FROM idx WHERE host = '$host' AND fs = '$fs';")
     case $when in
       "")