On April 30, 2015 7:51:55 AM GMT+02:00, Martin Natano <nat...@natano.net> 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 Fl R > Recursively search subdirectories listed. I don't like this implied "." entry. If anything, it could fail or whine, but I think it does exactly what is said to do. If there are any directory entries listed, recursively search them. While the situation you describe is admittedly horribly annoying (BTDT), we do allow 'grep -I "123"', which would also seem "pointless". /Alexander