The reason why every single line of every single file was listed was due to variable substitution of your shell.
When you call
grep -ir "$featuredicon" *
bash
will evaluate that. It will look up the variable $featuredicon
and put it into your command. Guess what $featuredicon
most likely is?
Right, nothing. So what you're actually doing is:
grep -ir "" *
And that matches every line of every file.
Old Answer
The dollar sign ($
) is a placeholder for end-of-line
in regular expression (I assume the same is true for grep).
If you want to search for a dollar sign, use '\$'
.
Be sure to check the StackOverflow question: How to grep for the dollar symbol ($)?