How is it that grep -r utf-8 * is a valid search, while grep -r utf-8 *.rb instantly returns

grep: *.rb: No such file or directory

It can't mean "sorry, I looked and didn't find any *.rb files with that content" because it returns instantly; it's not even looking.

...and for the record, yes, I also tried ".rb", with the same result.

· · Web · 3 · 0 · 0

@woozle i thiiink it's looking for directories matching *.rb

@woozle because the shell is doing that expansion for you. Put it in single quotes, like '*.rb'

i think it doesn't recurse since no directories match '*.rb'
(i did not make or implement file globbing logic in unix utilities)

you can also use find:
find . -name '*.rb' | grep utf-8

also, i find it better to focus on getting it done (learning, flexible in approach) as opposed to finding tools that work as you'd expect them to ...

but that's me (and may not be you)

good luck!

Sign in to participate in the conversation

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!