ryandesign at macports.org
Wed Aug 18 12:10:00 PDT 2010
On Aug 18, 2010, at 13:20, Jasper Frumau wrote:
> On Wed, Aug 18, 2010 at 10:07 PM, Ryan Schmidt wrote:
>> I guess "!" has special meaning. You could try:
>> grep -r -- ':q!' .
>> (where "." is the directory you want to search)
> jaspersmbp:www jasper$ grep -r -- ':q!' phpmyadmin
> jaspersmbp:www jasper$ cd phpmyadmin
> jaspersmbp:phpmyadmin jasper$ sudo vim config.inc.php
> Found the culprit as you expected. Did not exit properly using vim. All good now. Thanks a lot Ryan! So I guess "--" makes grep look for ! instead of using its special meaning?
Well, "--" means "treat everything that follows as a filename / directory, not a flag, even if it begins with a dash" so that wasn't really very relevant here after all.
You started by using double quotes, in which special characters like "!" get interpreted. ("!" is special to Bash, not to Grep.) Since you didn't want that, using single quotes is the solution to suppress the special meaning.
You also weren't specifying what to search, hence stdin was being searched, hence grep's warning that you asked for a recursive search (which is applicable only to directories) but you didn't specify any directories.
More information about the macports-users