Skip to content

Commit

Permalink
Fix php version listing
Browse files Browse the repository at this point in the history
  • Loading branch information
Marlosoft committed Dec 12, 2020
1 parent fb4c3cd commit 1bcc55c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions php-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
declare -a php_versions

version=$(php -v | grep -o -e "PHP [0-9+]\.[0-9+]" | cut -d " " -f2)
php_versions=($(brew ls --versions | grep -e "^php" | cut -d " " -f2 | grep -o -e "[0-9+]\.[0-9+]" | xargs))
php_versions=($(brew ls --versions | egrep "^php(\ |@)" | cut -d " " -f2 | grep -o -e "[0-9+]\.[0-9+]" | xargs))

if [ -z "$1" ]; then
php_versions=$(printf ", %s" "${php_versions[@]}")

echo "Usage: $0 <version>"
echo "Usage: $(basename $0) <version>"
echo "PHP Versions: ${php_versions:2}"
exit 0
fi
Expand Down

0 comments on commit 1bcc55c

Please sign in to comment.