grepすると終わらねぇ
遭遇した問題 。Grepでファイルを検索したら再帰的に無限ループになって検索が終わらない。
ディレクトリのリンクをたどってそれがまた次のディレクトリをたどって、永遠にループする。
シンボリック・リンクを無視する
どうすればいいか。ぐぐってみたら
grep -r を使う
これを書くことでリンクを辿らなくなる。マジカ
再帰的に検索。
man には書いてない。。。
-R, -r, --recursive 各ディレクトリの下にあるすべてのファイルを再帰的に読み込みます。 これは -d recurse オプションと等価です。
Ubuntu の Linux man-JP を読んでも書いてないんだけど.
GNU の最新版のman をんだら書いてあった
-R, --dereference-recursive Read all files under each directory, recursively. Follow all symbolic links, unlike -r. -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.
日本語man信用できない
参考資料
https://stackoverflow.com/questions/21738574/how-do-you-exclude-symlinks-in-a-grep