:
# ge - translate english words into german
# Heiner Steven (heiner.steven@odn.de)

: ${DICT:=$HOME/lib/words}
: ${EGREP:=egrep}

if [ $# -gt 1 ]
then
    # Convert "a b c" to "(a|b|c)" for egrep
    P=
    for i
    do	P="${P:+$P|}$i"
    done
    P="($P)"
    set -- "$P"
fi

if [ -r "$DICT" ]
then
    for i
    do
	look "$i" ${DICT:=$HOME/lib/words}
    done
else				# Dictionary may be compressed - use egrep
    if [ $# -gt 1 ]
    then
	# Convert "a b c" to "(a|b|c)" for egrep
	P=
	for i
	do	P="${P:+$P|}$i"
	done
	P="($P)"
	set -- "$P"
    fi
    icat "$DICT" 2>/dev/null | $EGREP -i "^$1"
fi
