Skip to content

Commit 9e2e2ef

Browse files

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

inst/bin/switch-phpfarm

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/bin/sh
2-
basedir="`dirname "$0"`/../"
3-
cd "$basedir"
4-
basedir=`pwd`
2+
basedir="$(dirname "$0")/../"
3+
cd "$basedir" || exit
4+
basedir="$(pwd)"
55
binlink="$basedir/current"
6-
active=`basename $(readlink "$binlink") 2>/dev/null | sed -e 's/^php-//;s/\./\\\\./g'`
6+
active=`basename "$(readlink "$binlink")" 2>/dev/null | sed -e 's/^php-//;s/\./\\\\./g'`
77

88
php_system=""
99
if [ -f "/usr/bin/php" ]; then
@@ -23,17 +23,17 @@ fi
2323
version="$1"
2424
phpdir="php-$version"
2525

26-
if [ $version != "$php_system" ]; then
26+
if [ "$version" != "$php_system" ]; then
2727
if [ ! -d "$basedir/$phpdir" ]; then
2828
echo "PHP version $version is not installed"
2929
exit 2
3030
else
31-
echo Setting active PHP version to $version
31+
echo "Setting active PHP version to $version"
3232
ln -sfT "$phpdir" "$binlink"
33-
$basedir/current/bin/php --version
33+
"$basedir/current/bin/php" --version
3434
fi
35-
else
35+
else
3636
echo "Setting active PHP version to system version ($version)"
3737
rm -f "$binlink"
3838
php --version
39-
fi
39+
fi

0 commit comments

Comments
 (0)