I'm trying to understand how grep deciding to take $ as regex, or as a searchable character. My results show that grep is inconsistently deciding what $ means.
As such, I made a basic example:
$ cat testfile
$illy
$unset
Here I want to see if I can grab the line ending in "illy" using regex:
$ grep 'illy$' testfile
$illy
It seems to work, and it is interpreting the 'illy$' criteria as the $ being a regex to say "match this expression at the end of the line". So my thinking now, is that grep interprets $ as a regex criteria, and not a string. So if I wanted to try and grep for '$illy', then this should not match anything because it's interpreting $ as regex.
However:
$ grep '$illy' testfile
$illy
Why does it find this line? This proves that even grep doesn't know how to interpret the character $. Let alone, myself trying to understand it.