Last active
February 6, 2020 11:01
-
-
Save viewpointsa/99ea346a499a7b0f1f1eb0ab5ec320cb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Correction problem when upgrade package link | |
# /sbin/ldconfig.real: /usr/lib/libQt5Widgets.so.5 is not a symbolic link | |
# run program output command line to execute with sudo | |
for file in /usr/lib/*; do | |
if [[ ! -L "$file" && ! -d "$file" ]] | |
then | |
pattern="(.*so)\." | |
if [[ $file =~ $pattern ]] | |
then | |
target=${BASH_REMATCH[1]} | |
link=$file | |
md5file1=$(md5sum $target| awk '{print $1}') | |
md5file2=$(md5sum $link| awk '{print $1}') | |
if [[ "$md5file1" == "$md5file2" ]] | |
then | |
echo "sudo rm $file" | |
echo "sudo ln -s $target $link" | |
fi | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment