This is from manpage, but I not sure what _exactly_ it means, and whether
it applies to your problem:
Care should be taken when using the shell metacharacters
$*[^|()=\ and newline in pattern; it is safest to enclose
the entire expression in single quotes '...'. An expression
starting with '*' will treat the rest of the expression as
literal characters.
more strange behavior:
% echo foo.c | 9 grep '*\.c'
%
% echo foo.c | 9 grep '*.c'
foo.c
% echo fooxc | 9 grep '*.c'
%
% echo fooxc | 9 grep '.*.c'
fooxc
% echo fooxc | 9 grep '.*\.c'
%
% echo foo.c | 9 grep '.*\.c'
foo.c
% echo foo.c | 9 grep '*foo.c'
foo.c
% echo foo.c | 9 grep '*.00.c'
%
Looks like
" An expression
starting with '*' will treat the rest of the expression as
literal characters."
(see above) really applies (for unknown reasons).
However, I am just a 'toy programmer', so you were warned ;-)
Regards,
++pac
On Thu, Jun 14, 2012 at 10:28 AM, Gorka Guardiola <[email protected]> wrote:
> While playing with grep, I was suprised by grep '*\.c' not giving
> an error (* is missing an operand). Arguably * applied to empty ... [snip]
>