From b4ae142149f60150d583ec49876dfdef7dd3d259 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Fri, 26 Apr 2019 20:54:01 +0200 Subject: [PATCH] Remove printf escaping (we will realize it differently) and ensure we're using single quotes for strings (although double quotes are possible, too) Signed-off-by: DL6ER --- advanced/Scripts/list.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/advanced/Scripts/list.sh b/advanced/Scripts/list.sh index 053def02..374f888b 100755 --- a/advanced/Scripts/list.sh +++ b/advanced/Scripts/list.sh @@ -118,11 +118,11 @@ ProcessDomainList() { AddDomain() { local domain list num # Use printf to escape domain. %q prints the argument in a form that can be reused as shell input - domain="$(printf "%q" "$1")" + domain="$1" list="$2" # Is the domain in the list we want to add it to? - num="$(sqlite3 "${gravityDBfile}" "SELECT COUNT(*) FROM ${list} WHERE domain = \"${domain}\";")" + num="$(sqlite3 "${gravityDBfile}" "SELECT COUNT(*) FROM ${list} WHERE domain = '${domain}';")" if [[ "${num}" -ne 0 ]]; then if [[ "${verbose}" == true ]]; then @@ -138,17 +138,17 @@ AddDomain() { reload=true # Insert only the domain here. The enabled and date_added fields will be filled # with their default values (enabled = true, date_added = current timestamp) - sqlite3 "${gravityDBfile}" "INSERT INTO ${list} (domain) VALUES (\"${domain}\");" + sqlite3 "${gravityDBfile}" "INSERT INTO ${list} (domain) VALUES ('${domain}');" } RemoveDomain() { local domain list num # Use printf to escape domain. %q prints the argument in a form that can be reused as shell input - domain="$(printf "%q" "$1")" + domain="$1" list="$2" # Is the domain in the list we want to remove it from? - num="$(sqlite3 "${gravityDBfile}" "SELECT COUNT(*) FROM ${list} WHERE domain = \"${domain}\";")" + num="$(sqlite3 "${gravityDBfile}" "SELECT COUNT(*) FROM ${list} WHERE domain = '${domain}';")" if [[ "${num}" -eq 0 ]]; then if [[ "${verbose}" == true ]]; then @@ -163,7 +163,7 @@ RemoveDomain() { fi reload=true # Remove it from the current list - sqlite3 "${gravityDBfile}" "DELETE FROM ${list} WHERE domain = \"${domain}\";" + sqlite3 "${gravityDBfile}" "DELETE FROM ${list} WHERE domain = '${domain}';" } Displaylist() {