Created
September 1, 2022 09:14
-
-
Save garywill/69ea37e8971625b41ebb87cf15c3accb to your computer and use it in GitHub Desktop.
Switch (manually update alternative) gcc version on openSUSE Linux
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 | |
CHOOSE_VER=11 | |
cd /usr/bin | |
declare -a LINK_FILES | |
LINK_FILES=( | |
"gcov" | |
"gcov-dump" | |
"gcov-tool" | |
"gcc" | |
"gcc-ar" | |
"gcc-nm" | |
"gcc-ranlib" | |
"cpp" | |
"g++" | |
) | |
for (( i=0; i<${#LINK_FILES[@]}; i++ )) ; do | |
rm ${LINK_FILES[$i]} | |
ln -s ${LINK_FILES[$i]}-${CHOOSE_VER} ${LINK_FILES[$i]} | |
done | |
rm cc | |
ln -s gcc-${CHOOSE_VER} cc | |
rm c++ | |
ln -s g++-${CHOOSE_VER} c++ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment