summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hangman-helper.sh17
1 files changed, 7 insertions, 10 deletions
diff --git a/hangman-helper.sh b/hangman-helper.sh
index 1e65969..3ed1c17 100644
--- a/hangman-helper.sh
+++ b/hangman-helper.sh
@@ -14,13 +14,10 @@ word=$1
not=$2
flag=$3
-temp="$(mktemp --tmpdir "${0##*/}.XXXXXXXXXX")"
-trap "rm -f -- $(printf '%q' "$temp")" EXIT
-
-grep -ix "$word" /usr/share/dict/words | grep -iv "['$not]" > "$temp"
-
-if [[ "$flag" = '-l' ]]; then
- cat "$temp" | tr 'A-Z' 'a-z' | sed 's/\(.\)/\1\n/'g | sort | uniq -c | sort -n
-else
- cat "$temp"
-fi
+grep -ix "$word" /usr/share/dict/words | grep -iv "['$not]" | {
+ if [[ "$flag" = '-l' ]]; then
+ tr 'A-Z' 'a-z' | sed 's/\(.\)/\1\n/'g | sort | uniq -c | sort -n
+ else
+ cat
+ fi
+}