php switching for taskfile
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
unlink_php() { | |
PHP_CURRENT=$(php -v | head -n 1 | cut -d " " -f 2 | cut -f1-2 -d"."); | |
PHP_LATEST=$(ls /usr/local/Cellar/php | cut -f1-2 -d"."); | |
echo "Your current PHP version is ${PHP_CURRENT}"; | |
echo "The latest version of PHP installed is ${PHP_LATEST}"; | |
echo "Unlinking PHP ${PHP_CURRENT}..."; | |
if [ ${PHP_CURRENT} = ${PHP_LATEST} ]; then | |
brew unlink php | |
else | |
brew unlink php@${PHP_CURRENT} | |
fi | |
} | |
php7() { | |
unlink_php | |
echo "Linking php 7.4..." | |
brew link php@7.4 | |
} | |
php8() { | |
unlink_php | |
echo "Linking php 8" | |
brew link php@8.0 | |
} | |
php81() { | |
unlink_php | |
echo "Linking php 8.1" | |
brew link php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment