If you escape or quote the asterisk in *.c (examples: \*.c, "*.c", '*'.c) then it will not be expanded and the word will be passed to grep literally as *.c.If there is no match in the current working directory then ( in some shells) *.c will not be expanded and it will be passed to grep literally as *.c. There are two scenarios where grep actually sees this *.c: The job of picking all pathnames matching the pattern would be done by the shell. dir1/subdir/baz.c), grep would not see the pattern itself, -r might be irrelevant. If you properly used such pattern, the shell would pass all matching paths to grep (e.g. This feature is called "globstar" and one may need to explicitly enable it in a shell. In some shells you can use a glob that can match files in subdirectories. foo.c is a file of the type directory then -r will make grep descend into the directory but grep will read all files in the directory (it is still not aware of *.c you typed).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |