minor updates
[iankelling.org] / set-comments
index 5694629e8afcd8bd0b9b53d99ddf62d29792ca93..8cb7029a2ec6e3914a64189134603f1b725eff7e 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/bash -l
 # Copyright (C) 2016 Ian Kelling
 
 # This program is free software: you can redistribute it and/or modify
@@ -20,10 +20,9 @@ trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
 cd "${BASH_SOURCE%/*}/proposed-comments"
 
 
-shell="ssh iankelling.org"
+shell="ssh -oStrictHostKeyChecking=no iankelling.org"
 while [[ $1 ]]; do
     case $1 in
-        -a) all=true; shift ;;
         -l) shell= ; shift ;; # -l  for local
     esac
 done
@@ -32,6 +31,10 @@ s="$shell sqlite3 $PWD/comments.sqlite"
 
 grep -Eo '^[^|]+\|[^|]+' /tmp/hcomments | while IFS='|' read -r id state; do
     #echo "$id -- $state" # debug print
-    sqlite3 comments.sqlite "update c set state='$state' where id = '$id'"
+    if [[ $state == delete ]]; then
+        $s <<<"delete from c where id = '$id';"
+    else
+        $s <<<"update c set state='$state' where id = '$id';"
+    fi
 done
 $shell $PWD/../build.rb