#!/bin/bash COM_BASE="/home/miekg/miek.nl/blog/comments" # a clone of listadmin, but then for acking comments in my site for art in $COM_BASE/*.txt; do com=$art/new/* set -- $com # turn $com in $@ while (($# > 0)); do if [ "$(basename $1)" = "*" ]; then # empty dir shift continue fi echo "> Article: $art" echo " >> Comment found: $(basename $1)" cat $1 | sed 's/^/ /' echo read -p "(A)approve (D)discard (N)skip [E]edit: [A] " reply [[ -z $reply ]] && reply="A" case $reply in A*|a*) echo "new/$(basename $1) -> ok/$(basename $1)" if ! mv $1 $art/ok ; then echo "$0: mv failed!" >&2 fi shift ;; D*|d*) echo rm "new/$(basename $1)" if ! rm -f $1; then echo "$0: rm failed!" >&2 fi shift ;; K*|k*) echo "Skipping" shift ;; E*|e*) ${EDITOR} $1 # no shift ;; esac echo done done