broken_symlinks: Nuevo

This commit is contained in:
Tuxliban Torvalds 2021-10-11 03:19:19 -05:00
parent 738a7a92d4
commit 503e13aab7
1 changed files with 15 additions and 0 deletions

15
varios/broken_symlinks Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
# Script para buscar enlaces simbólicos rotos en el directorio actual
# Si se desea buscar en todo el sistema cambiar ./ por /
find ./ -type l > tmp
while IFS= read -r file
do
cd "$(dirname "$file")" || return
if [ ! -e "$(readlink "$(basename "$file")")" ]; then
ls -g "$file" | awk '{print $8" "$9" "$10}'
echo "Realpath: $(realpath "$file")"
fi
cd - > /dev/null || exit
done < tmp
rm tmp