Skip to content

Instantly share code, notes, and snippets.

@JbIPS
Created May 17, 2013 09:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save JbIPS/5597917 to your computer and use it in GitHub Desktop.
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".
#!/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