On 2015/04/30 07:51, 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. > > Far too often I've started a grep -R and waiting for the output, only to > recognize minutes later, that I forgot to add the '.' at the end of the > command and it is reading from stdin.
It's an extension, and it might not make sense to you (though I can imagine counter-arguments), but the current behaviour matches other common greps in use - deviating from this seems like a bad idea. Apart from potential damage in ports, I'd also be concerned about user scripts misbehaving if this were to change.