Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

grep warning: recursive directory loop

Tags:

grep

I'm searching recursively some location e.g. /cygdrive/c/dev/maindir/dir/ There's a loop inside that directory structure i.e. there's a link .../maindir/dir/loopedDir/loopedDir pointing to .../maindir/dir/loopedDir.

When I run:

grep --exclude="/cygdrive/c/dev/maindir/dir/loopedDir/loopedDir" 'myPattern' -R /cygdrive/c/dev/maindir/dir/

...it works fine, like expected and finds what I need. However, I also get a warning:

grep: warning: /cygdrive/c/dev/maindir/dir/loopedDir/loopedDir: recursive directory loop

...and I'm wondering why is that. Shouldn't dir exclusion prevent this particular looping occurance? How should I modify my query in order not to get the warning?

like image 810
karokir Avatar asked Aug 18 '15 14:08

karokir


1 Answers

Add grep's option -s to suppress this and other error messages.

like image 185
Cyrus Avatar answered Sep 28 '22 16:09

Cyrus