Created
May 17, 2013 09:05
-
-
Save JbIPS/5597917 to your computer and use it in GitHub Desktop.
This script allows you to easily switch between multiples install of Haxe made by my install script "install-haxe-osx".
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 | |
i=0 | |
while read line; do | |
targets[i]=$line | |
v=$($line"/haxe" 2>&1 | head -1) | |
[[ $v =~ [0-9]+\.[0-9]+(\.[0-9]+)? ]] && versions[i]=$BASH_REMATCH | |
i=$((i+1)) | |
done < <(find /usr/lib -name haxe\* -depth 1 -type d) | |
echo 'Which installed version of Haxe you want to set ?' | |
PS3='version: ' | |
select opt in "${versions[@]}" | |
do | |
case $opt in | |
${versions[0]}) | |
echo "Setting version to "${versions[0]} | |
rm /usr/lib/haxe | |
ln -s ${targets[0]} /usr/lib/haxe | |
break | |
;; | |
${versions[1]}) | |
echo "Setting version to "${versions[1]} | |
rm /usr/lib/haxe | |
ln -s ${targets[1]} /usr/lib/haxe | |
break | |
;; | |
"quit") | |
break | |
;; | |
*) echo invalid option;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment