Perhaps something like the following? This doesn't include the doing
the find(1), instead it's designed to get the text to search on
STDIN. It also doesn't use the $wwild or $ccase variables, which I
didn't see defined anywhere. But that would be easy to add.
No use of eval here. Besides being safer, that also tends to be more
readable; although the use of recursion here cuts down on that
improvement.
Despite having zsh on the #! line, this would work with bash as well.
#!/bin/zsh -u
# Multi-color grep
__mcgrep() {
local color=$1; shift
local pattern="$1"; shift
if [[ $# = 0 ]]; then
# No more patterns, just pass through the input
cat
else
__mcgrep $((color + 1)) "$@"
fi |
GREP_COLOR="01;$color" grep --color=always "$pattern"
}
# Start with yellow, then blue, magenta, cyan.
__mcgrep 33 "$@"