On Thu, 30 Apr 2015 07:51:55 +0200, Martin Natano wrote:

> grep reads from standard input when no files are specified. It also does
> so when -R is used, which doesn't really make sense. I think using the
> current working directory as a fallback when no directories are
> specified would make sense. POSIX says "If no file operands are
> specified, the standard input shall be used.", but -R is an extension
> to POSIX, so I guess it is not bound by that.

GNU grep warns in this case before reading from stdin which seems reasonable.
% grep -R foo
grep: warning: recursive search of stdin
...

I'd rather add a warning than change the behavior.

 - todd

Reply via email to