-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbrew-switch-php.sh
executable file
·43 lines (36 loc) · 1.14 KB
/
brew-switch-php.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#Variables
cellar_path='/usr/local/Cellar/'
pwd=`pwd`
echo "== PHP in use =="
php -v
cd $cellar_path
echo -e "\n== PHP versions at: $cellar_path =="
ls -d php??/ | sed 's#/##'| awk '{print}' ORS=' '
echo -e "\n----------------------------------------------------"
echo -n "Which PHP would you like to use? (0 cancel): php"
read php_xx
if [ $php_xx -ne 0 ] ; then
phpxx=php$php_xx
cd $phpxx
echo ""
echo "== Available $phpxx versions =="
ls -d */ | sed 's#/##'| awk '{print}' ORS=' '
echo -e "\n----------------------------------------------------"
echo -n "Which version? (0 cancel): "
read php_v
if [ $php_v != '0' ] ; then
#echo -en "\nAre you sure you want to switch to PHP $php_v? (y/n): "
echo -en "\nRun \`brew switch $phpxx $php_v\` ? (y/n): "
read brew_switch
if [ $brew_switch = 'y' ] ; then
brew switch $phpxx $php_v
echo -en "\nRun \`brew link --overwrite $phpxx\` ? (y/n): "
read brew_link
if [ $brew_link = 'y' ] ; then
brew link --overwrite $phpxx
fi
echo -e "\n== Remember to edit your httpd.conf and then restart Apache. =="
fi
fi
fi
cd $pwd #Is this needed?