grep: unknown directories method

Thank you LornaJane for your post about “grep: unknown directories method.” This was making me crazy today.

This happens when you’re wildcarding and there’s a file in your directory that starts with a hyphen (“-“).  In my case it was -orders.php: someone had “saved off” copy of a file called orders.php. (People, this is why we use version control systems. Never make backups like this! NEVER!).

In LornaJane’s case she demonstrated removing a file in subversion, but I had to remove my file from a plain old directory. Here’s the command I used, on Fedora Core 8:

rm -i ./-orders.php

Problem solved, the grep’d jawnie found and now back to whatever it was I was doing when this obstacle presented itself.