While we use * to denote zero or more previous characters in grep, we use *.c to find all C files when we use it with the ls command like ls *.c. Could someone tell how the use of * differs in these two cases?
|
|
|
Shell file name globbing and regular expressions use some of the same characters, and they have similar purposes, but you're right, they aren't compatible. File name globbing is a much less powerful system. In file name globbing:
There is a rough similarity between file globbing syntax and regexes, but if you need regex matching of file names, you need to do it another way. |
|||||||||||||||||
|
|
Answering the title question (why): file name expansion predates regular expressions, already existed with most operating systems (wildcard/joker characters) and is much simpler and intuitive than the latter. While |
|||||||
|