theyfightcrime: double quote third party input - annna - Annna the nice friendly bot.
(HTM) git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) README
---
(DIR) commit 289cc398a0f12633630239246ed6c134372ce8a1
(DIR) parent 6efa888944e0adbee4ef0142c3120d766e4c8174
(HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Thu, 11 Feb 2021 22:03:00 +0100
theyfightcrime: double quote third party input
Signed-off-by: Annna Robert-Houdin <annna@bitreich.org>
Diffstat:
M theyfightcrime | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
---
(DIR) diff --git a/theyfightcrime b/theyfightcrime
@@ -1,13 +1,13 @@
#!/bin/sh
-duo=$(curl -s https://theyfightcrime.org/ | grep -Eo '[^>]+They fight crime!')
+duo="$(curl -s https://theyfightcrime.org/ | grep -Eo '[^>]+They fight crime!')"
-if [ $(echo $1 | wc -m) -gt 1 ]; then
- duo=$(echo $duo | sed "s/He's/$1 is/g")
+if test "$1"; then
+ duo="$(printf '%s\n' "$duo" | sed "s/He's/$1 is/g")"
fi
-if [ $(echo $2 | wc -m) -gt 1 ]; then
- duo=$(echo $duo | sed "s/She's/$2 is/g")
+if test "$2"; then
+ duo="$(printf '%s\n' "$duo" | sed "s/She's/$2 is/g")"
fi
-echo $duo
+printf '%s\n' "$duo"