From 9d2d45b4739eec605e9e34f3e704400584f6319d Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Thu, 1 Nov 2018 05:59:14 -0700 Subject: [PATCH] Query php directly for major and minor version id strings. Signed-off-by: Dan Schaper --- automated install/basic-install.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 8d7d8c48..1745d624 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -166,10 +166,9 @@ if command -v apt-get &> /dev/null; then fi # Check for and determine version number (major and minor) of current php install if command -v php &> /dev/null; then - phpInsVersion="$(php -v | head -n1 | grep -Po '(?<=PHP )[^ ]+')" - printf " %b Existing PHP installation detected : PHP version %s\\n" "${INFO}" "${phpInsVersion}" - printf -v phpInsMajor "%d" "${phpInsVersion%%.*}" - printf -v phpInsMinor "%d" "${phpInsVersion##*.}" + printf " %b Existing PHP installation detected : PHP version %s\\n" "${INFO}" "$(php <<< "")" + printf -v phpInsMajor "%d" "$(php <<< "")" + printf -v phpInsMinor "%d" "$(php <<< "")" # Is installed php version 7.0 or greater if [ "${phpInsMajor}" -ge 7 ]; then phpInsNewer=true