[GRASS-dev] missing help for r.cats

Ivan Shmakov ivan at theory.asu.ru
Wed Feb 20 09:05:15 EST 2008


>>>>> Glynn Clements <glynn at gclements.plus.com> 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 *'.)



More information about the grass-dev mailing list