Skip to content

Instantly share code, notes, and snippets.

@jiskanulo
Created November 6, 2012 07:35
Show Gist options
  • Save jiskanulo/4023267 to your computer and use it in GitHub Desktop.
Save jiskanulo/4023267 to your computer and use it in GitHub Desktop.
Homebrewでインストールしたphp53とphp54を切り替える
#!/bin/bash
if [ ! -x `which brew` ]; then
echo "Homebrew does not installed."
exit 1
fi
php_path=`which php`
php_real_path=`stat -F $php_path`
if [ -n "`echo $php_real_path | grep 'Cellar/php53'`" ]; then
echo 'now switching php53 -> php54...'
brew unlink php53
brew link php54
elif [ -n "`echo $php_real_path | grep 'Cellar/php54'`" ]; then
echo 'now switching php54 -> php53...'
brew unlink php54
brew link php53
else
echo 'can not switch php'
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment