grep: should report the bad regex

From:

Aharon Robbins

Subject:

grep: should report the bad regex

Date:

Tue, 20 Jul 2004 15:27:00 +0300

Greetings. Using GNU grep 2.5.1, if you give an invalid regex, all grep
does is tell you that it got a bad regex, but it doesn't print the
regex back at you. This is not a problem when you enter the grep command
straight at the command line, but is a problem if you build it on the fly
using a shell loop like this:
while read com
do if grep -q "<literal>$com</" file.xml
then echo $com
fi
done < bigcomlist > smallcomlist
Thanks,
Arnold Robbins