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