Hacker News new | ask | show | jobs
by noselasd 5072 days ago
just run echo * in your directory. That's the same argument grep will get(instead of the * ) when you pass it * .

grep will run through all those files, if any, and recurse through all the directories, if any. grep recursing down a directory will process all the files/subdirs in that directory. (which includes . files).

If the shell can't expand the * , grep will receive a literal * and try to open a file/directory named * .

1 comments

Personally, I `shopt -s failglob' in my .bashrc so any glob that fails to expand is treated as an error by the shell and the command never gets started. I then quote all special globbing characters that I intend to pass to the command as it avoids the sometimes hard to spot errors where a glob expanded unintentionally and the command didn't see the wildcards. Relying on non-matching globbing to reach the command will bite one day.