Enclose the $ in square brackets [ .. ], that is, specify the special character as a character class. For example,
grep ‘[$]foo’ file.txt
Enclose the $ in square brackets [ .. ], that is, specify the special character as a character class. For example,
grep ‘[$]foo’ file.txt