Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有効なリンクを持つディレクトリ内のすべてのシンボリック リンクのリストを取得したいと考えています。つまり、壊れたリンクをすべてリストから削除したいと考えています。
シェルで[ -L "$f" ] && [ -e "$f" ]は、「$f」がターゲットが存在するシンボリックリンクの名前である場合にのみ真です。そう:
[ -L "$f" ] && [ -e "$f" ]
for f in *; do if [ -L "$f" ] && [ -e "$f" ]; then # do something with "$f" fi done
(-aまたは-oオプションをtest/ [...に使用しないでください]。適切な優先順位があるとは限りません。)
-a
-o
test
[
]