#! /bin/sh QUERY=$1 TABLE=$2 echo -e "Here is your statement:\n" CMD="BEGIN;\n" CMD=$CMD`echo '.tables' | sqlite3 $TABLE | tr ' ' '\n' | grep $QUERY | sed 's/^/DROP TABLE /g' | sed 's/$/;/g'` CMD=$CMD"\nCOMMIT;" echo -e "$CMD\n" echo -n "Do you want to commit this statement? (Y/N) " read -e ANSWER if test "$ANSWER" = "Y"; then echo -e "$CMD" | sqlite3 $TABLE echo "Done!" else echo "Nothing changed, have a good day." fi exit