I'm writing a module for drupal. Its functionality is contingent on the directory name, certain file names, and function names being identical.

I'm troubleshooting now, and I wanted to to a search to see that I had an identical string in all the places I needed it to be, but I realized I would be missing the directory name and filename! Is there a way to do a grep or something that would search all that information?

For example, if my module was named string, I would need

  function string_function1() {...}
  function string_function2() {...}

If I did my everythinggrep string . and I saw

  function string_function1() {...}
  function string_function2() {...}

I would know that I had misnamed my module file.

  • Would the file actually be string.module? – k.parnell Oct 6 '11 at 18:57
  • @k.parnell Yes. The directory name, the first part of the file name, and the first parts of function names must all be identical. – user394 Oct 6 '11 at 20:10

Not in a single statement, but in two statements:

For searching in text-files:

grep -RI "string" directory/*

For finding file-names:

find directory -type f -name "*string*" -ls

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.