メモ:リンク切れになっているシンボリックリンクをfindで見つける
find . -xtype l
で探せるらしい。
-xtype
って知らなかった。man find
を見ると、
-xtype c The same as -type unless the file is a symbolic link. For symbolic links: if the -H or -P option was specified, true if the file is a link to a file of type c; if the -L option has been given, true if c is `l`. In other words, for symbolic links, -xtype checks the type of the file that -type does not check.
となっている。-type
と違ってシンボリックリンクの先まで追ってファイルを判定する(ちなみに、find
は何も指定しないと-P
がデフォルトの動作)。
で、シンボリックリンクの先まで追ってるのになおシンボリックリンクということは、リンクしてる先にファイルがない、ということらしい。分かりづらい…