unixy scripts to help you solve that famous word puzzle game
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/sh

# $1: guessed word
# $2: .Abc. - A green, b, c yellow

n2="$(echo $2 | tr [:upper:] .)"
has="./has.sh '${n2:0:1}' 1 |./has.sh '${n2:1:1}' 2 |./has.sh '${n2:2:1}' 3 |./has.sh '${n2:3:1}' 4 |./has.sh '${n2:4:1}' 5"
alias lc="tr [:upper:] [:lower:]"
l2="$(echo "$2" | lc)"

cat - |
grep -v "[$(echo $1|tr -d "$l2")=]" |
grep -i "$(echo $2|tr [:lower:] .)" |
sh -c "$has"