Skip to content
This repository was archived by the owner on Jul 16, 2024. It is now read-only.

Commit 8de2685

Browse files
committed
Linting
1 parent 0a441b2 commit 8de2685

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

php-activate.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
#!/usr/bin/env bash
22

33
function php-activate {
4-
if ! [ -z "$1" ]
4+
if [ -n "$1" ]
55
then
6-
local VERSIONS=$(update-alternatives --query php | grep Alternative | cut -d ' ' -f2 )
7-
if echo $VERSIONS | grep -q "$1"
6+
local VERSIONS
7+
VERSIONS=$(update-alternatives --query php | grep Alternative | cut -d ' ' -f2 )
8+
if echo "$VERSIONS" | grep -q "$1"
89
then
9-
export PHP_PICKED=$(echo "$VERSIONS" | sort | grep "$1" | head -n 1)
10+
PHP_PICKED=$(echo "$VERSIONS" | sort | grep "$1" | head -n 1)
11+
export PHP_PICKED
1012
echo "Activated $PHP_PICKED"
1113
else
1214
echo "Error: No matching PHP version found. Use one of the following:"
@@ -20,11 +22,10 @@ function php-activate {
2022
return
2123
fi
2224
function php {
23-
$PHP_PICKED $@
25+
$PHP_PICKED "$@"
2426
}
25-
export -f php
2627
php --version | grep built
2728
hash -r
2829
}
2930

30-
php-activate $1
31+
php-activate "$1"

0 commit comments

Comments
 (0)