Question

I did a recursive grep in current directory by following command.

grep -r -s <searchterm> .

But it says on output lines but all but on some output lines as below.

 Traversal results in a loop.

Please help.

Was it helpful?

Solution

The -r flag follows symbolic links which may result in an infinite loop in cases when an inner directory is a symbolic link to an outer one. You can use the -R flag to not follow symbolic links. On the other hand, the error harmless. If you want to follow symbolic links use -r and let grep warn you when a possible cycle is detected.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top