According to manpage of grep:
-r, --recursive
Read all files under each directory, recursively, following
symbolic links only if they are on the command line. Note that
if no file operand is given, grep searches the working
directory. This is equivalent to the -d recurse option.
-R, --dereference-recursive
Read all files under each directory, recursively. Follow all
symbolic links, unlike -r.
Example:
I have a folder test in which there is a file 1.txt. 2.txt is a symbolic link to 1.txt such that output of ls -l test
looks like:
-rw-r--r-- 1 kulfy kulfy 15 Jun 12 21:53 1.txt
lrwxrwxrwx 1 kulfy kulfy 5 Jun 12 21:53 2.txt -> 1.txt
The content of 1.txt is:
This is a file.
If I want to search for "file" string in files inside test folder and I run:
grep "file" test
I'll encounter an error:
grep: test: Is a directory
But if I do:
grep -R "file" test
I get an output:
test/2.txt:This is a file
test/1.txt:This is a file
On the other hand if I run:
grep -r "file" test
I get output:
test/1.txt:This is a file
Here, I haven't explicitly mentioned to scan all the files. So, when I used R
flag, symbolic link (here 2.txt) was respected and output was generated. But when I used r
flag, symbolic link was ignored simply because I didn't mention to scan 2.txt also.
./mods-enabled/php7.0.load
is indeed a symbolic link; my original reading of the manual was that-r
would not recurse through a directory if that directory was a symbolic link (but that it would still look through files that symbolic links), so I was confused given that./mods-enabled
was not a symbolic link.