Created
July 19, 2016 06:33
-
-
Save havvg/c4018383b02a60f60c2249bd27c791f3 to your computer and use it in GitHub Desktop.
naive homebrew php-switch
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
# Disables any PHP by unlinking all PHP versions and stopping all PHP services | |
# | |
# Enables the PHP of the provided version. | |
# If no version is provided, no PHP will be enabled, effectively disabling homebrew PHP. | |
# | |
# Usage: php-switch 70 | |
php-switch() { | |
brew list | grep -e ^php..$ | xargs brew unlink | |
brew services list | grep started | cut -d" " -f1 | grep -e ^php | xargs brew services stop | |
if [[ $# -eq 1 ]] | |
then | |
brew link php$1 | |
brew services start php$1 | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment