wp_get_attachment_url is actually an URL that must be interpreted literally, use single quotes to prevent the shell from interpreting characters. Furthermore, use the
-F option of
grep to avoid it from interpreting the pattern as a regular expression.
http://example.com/?id=1 interpreted as a regular expression would match either
http://example.com/id=1, but not
The command becomes:
grep -rinF 'http://example.com/?id=1' *
If the pattern contains a
'\'' to escape it:
grep -rinF 'mornin'\'' all' *
* matches all non-hidden files in the current directory. If you want to match dot-files as well, just grep the current directory recursively (
grep -rinF 'search term' .