Created
September 10, 2018 09:53
-
-
Save xorenio/8f06e470eae4bda6e394a2a0260c913f to your computer and use it in GitHub Desktop.
cli 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
#!/bin/bash | |
echo"" | |
read -p "Changing php Which version? #1:5.6 | #2:7.0 | #3:7.1 | #4:7.2 ?" -n 1 -r && echo "" | |
if [[ $REPLY =~ ^[1]$ ]]; then | |
update-alternatives --set php /usr/bin/php5.6 | |
echo 'Now your cli env is 5.6' | |
elif [[ $REPLY =~ ^[2]$ ]]; then | |
update-alternatives --set php /usr/bin/php7.0 | |
echo 'Now your cli env is 7.0' | |
elif [[ $REPLY =~ ^[3]$ ]]; then | |
update-alternatives --set php /usr/bin/php7.1 | |
echo 'Now your cli env is 7.1' | |
elif [[ $REPLY =~ ^[4]$ ]]; then | |
update-alternatives --set php /usr/bin/php7.2 | |
echo 'Now your cli env is 7.2' | |
else | |
echo 'No changes use php -v o find current version' | |
fi | |
echo"" | |
exit 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment