The side-by-side that makes the difference visible
The side-by-side that makes the difference visible
Answer
ls *.c ls | grep '*.c' ls | grep '\.c$'
Line 1 lists the four C files — the shell expanded the glob. Line 2 lists nothing: with no item in front of it the star is taken literally, so grep hunts for a real asterisk. Line 3 is the regex that was meant all along.
Sarwar & Koretsky 3e ch4 §4.5.2 versus ch7 §7.5