The problem is not grep, it is
CLASSPATH="/blah/libs/*:/blah/more/libs"
If you do
echo $CLASSPATH
You should see that your shell has expanded * all the files in this directory. To fix this, simply use single quotes to prevent freezes:
CLASSPATH='/blah/libs/*:/blah/more/libs'
source share