>>>>> Glynn Clements <[EMAIL PROTECTED]> writes:

 >>> The proper command to search for the latter (assuming POSIX `grep'
 >>> [1]) is:

 >>> $ grep -F r.cats *

 >> Right. FWIW my method was 'grep -rI r\.cats *'

 > If you're doing that from the shell, it needs two backslashes:

 > grep -rI r\\.cats *

 > or quotes:

 > grep -rI 'r\.cats' *

 > so that grep actually "sees" a backslash.

 > Or just use "grep -F" or "fgrep" for searching for fixed strings.

        And since one cannot reliably and portably quote a string into a
        regular expression in Shell, one has to use:

$ grep -F -- "$string" ...

        to search for a user-supplied string in a Shell script.

        (The `--' ``option'' prevents `"$string"' from being processed
        as an option even if it begins with `-'; consider, e. g.: `$
        grep -l *' vs. `$ grep -- -l *'.)

_______________________________________________
grass-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-dev

Reply via email to