Skip to content

Instantly share code, notes, and snippets.

@mwinters-stuff
Created May 16, 2017 22:20
Show Gist options
  • Save mwinters-stuff/ef2d7379eac0feffbae12be10eff009c to your computer and use it in GitHub Desktop.
Save mwinters-stuff/ef2d7379eac0feffbae12be10eff009c to your computer and use it in GitHub Desktop.
Small script for creating missing alternatives for gcc/g++ and clang/clang++ in ubuntu.
#!/bin/bash
ALTS="gcc g++ clang clang++"
for VAR in $ALTS
do
echo $VAR
update-alternatives --remove-all $VAR
FOUND=`find /usr/bin -name $VAR-* -print | grep $VAR-[0-9] | sort`
C=10
for FF in $FOUND
do
echo $C $FF
update-alternatives --install /usr/bin/$VAR $VAR $FF $C
C=$((C + 10))
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment