theyfightcrime: double quote third party input - annna - Annna the nice friendl… | |
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
commit 289cc398a0f12633630239246ed6c134372ce8a1 | |
parent 6efa888944e0adbee4ef0142c3120d766e4c8174 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Thu, 11 Feb 2021 22:03:00 +0100 | |
theyfightcrime: double quote third party input | |
Signed-off-by: Annna Robert-Houdin <[email protected]> | |
Diffstat: | |
M theyfightcrime | 12 ++++++------ | |
1 file changed, 6 insertions(+), 6 deletions(-) | |
--- | |
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" |