summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hangman-helper.sh6
1 files changed, 3 insertions, 3 deletions
diff --git a/hangman-helper.sh b/hangman-helper.sh
index 3ed1c17..c46bb1e 100644
--- a/hangman-helper.sh
+++ b/hangman-helper.sh
@@ -7,7 +7,7 @@
#
# Without the `-l` flag, it produces a list of possible completions.
#
-# With the `-l` flag, it produces a list of letters,
+# With the `-l` flag, it produces a list of letters not in <word>,
# sorted by the number of times they appear in the normal list
word=$1
@@ -16,8 +16,8 @@ flag=$3
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
+ tr 'A-Z' 'a-z' | sed 's/\(.\)/\1\n/'g | grep -v -e "[$word]" -e '^$' | sort | uniq -c | sort -n
else
- cat
+ sort
fi
}