15 lines
388 B
Bash
15 lines
388 B
Bash
#! /usr/bin/env bash
|
|
|
|
find /usr -type l -print | while read i
|
|
do
|
|
target="$(realpath -ms "$i")" &&
|
|
source="$(realpath -mP "$i")" &&
|
|
if [ "$(expr substr "$target" 1 "${#1}")" != "$1" ]
|
|
then
|
|
if [ "$(expr substr "$source" 1 "${#1}")" = "$1" ]
|
|
then
|
|
rm "$target" &&
|
|
cp -raf "$source" "$target" || echo "INGORED: $i"
|
|
fi
|
|
fi
|
|
done |