summaryrefslogtreecommitdiff
path: root/hangman-helper.sh
blob: 3d14a7e16ebe26f73153566f5266934b41ae9772 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash
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"