From 31971c78cd39881003f0c5f4c1618d7e66398537 Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Sun, 19 Sep 2021 02:38:31 +0530 Subject: [PATCH] Fix parsing extra version --- src/scripts/darwin.sh | 5 +++-- src/scripts/linux.sh | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/scripts/darwin.sh b/src/scripts/darwin.sh index 8c18b53e..aee6d5c7 100644 --- a/src/scripts/darwin.sh +++ b/src/scripts/darwin.sh @@ -172,8 +172,9 @@ add_php() { # Function to get extra version. php_extra_version() { - if [[ ${version:?} =~ ${nightly_versions:?} ]]; then - echo " ($(brew cat "$php_formula" | grep -Eo "archive/[0-9a-zA-Z]+" | cut -d'/' -f 2))" + php_formula_file="$tap_dir"/shivammathur/homebrew-php/Formula/php@"$version".rb + if [ -e "$php_formula_file" ] && grep -Eq "archive/[0-9a-zA-Z]+" "$php_formula_file"; then + echo " ($(grep -Eo "archive/[0-9a-zA-Z]+" "$php_formula_file" | cut -d'/' -f 2))" fi } diff --git a/src/scripts/linux.sh b/src/scripts/linux.sh index 3f92c156..2b0a0a3c 100644 --- a/src/scripts/linux.sh +++ b/src/scripts/linux.sh @@ -168,7 +168,7 @@ link_pecl_file() { # Function to get extra version. php_extra_version() { - if [[ ${version:?} =~ ${nightly_versions:?} ]]; then + if [ -e /etc/php/"$version"/COMMIT ]; then echo " ($(cat "/etc/php/$version/COMMIT"))" fi }