summaryrefslogtreecommitdiff
path: root/hangman-helper.sh
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2011-12-25 17:19:45 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2011-12-25 17:19:45 -0500
commite3f67d934025ba0c6853e8b8cdaddb97dbac1283 (patch)
tree0c10a0a59aaf25a6a15470208d9b1780e315a18e /hangman-helper.sh
parenta63b908b1f7fbc9560371c4a492759ed564a7e52 (diff)
rename `hangman' to `hangman-helper' to avoid conflict with bsd-games
Diffstat (limited to 'hangman-helper.sh')
-rw-r--r--hangman-helper.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/hangman-helper.sh b/hangman-helper.sh
new file mode 100644
index 0000000..5e0e138
--- /dev/null
+++ b/hangman-helper.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+word=$1
+not=$2
+flag=$3
+
+temp=`mktemp`
+
+grep -i '^'"$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
+rm "$temp"