From ffce0f93d55807a2863756bbf5b259285315717d Mon Sep 17 00:00:00 2001 From: larryeitel Date: Wed, 31 Aug 2016 05:52:03 -0600 Subject: [PATCH] Fix: ERROR: expr: syntax error #272 --- xdebugPhpFpm | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/xdebugPhpFpm b/xdebugPhpFpm index 1a343ce..d1e7513 100644 --- a/xdebugPhpFpm +++ b/xdebugPhpFpm @@ -6,12 +6,21 @@ # Grab full name of php-fpm container PHP_FPM_CONTAINER=$(docker-compose ps | grep php-fpm | cut -d" " -f 1) + +# Grab OS type +if [[ "$(uname)" == "Darwin" ]]; then + OS_TYPE="OSX" +else + OS_TYPE=$(expr substr $(uname -s) 1 5) +fi + + xdebug_status () { echo 'xDebug status' # If running on Windows, need to prepend with winpty :( - if [[ "$(expr substr $(uname -s) 1 5)" == "MINGW" ]]; then + if [[ $OS_TYPE == "MINGW" ]]; then winpty docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v' else @@ -20,6 +29,7 @@ xdebug_status () } + xdebug_start () { echo 'Start xDebug' @@ -30,7 +40,7 @@ xdebug_start () # If running on Windows, need to prepend with winpty :( - if [[ "$(expr substr $(uname -s) 1 5)" == "MINGW" ]]; then + if [[ $OS_TYPE == "MINGW" ]]; then winpty docker exec -it $PHP_FPM_CONTAINER bash -c "${ON_CMD}" docker restart $PHP_FPM_CONTAINER winpty docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v' @@ -40,9 +50,9 @@ xdebug_start () docker restart $PHP_FPM_CONTAINER docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v' fi - } + xdebug_stop () { echo 'Stop xDebug' @@ -52,7 +62,7 @@ xdebug_stop () # If running on Windows, need to prepend with winpty :( - if [[ "$(expr substr $(uname -s) 1 5)" == "MINGW" ]]; then + if [[ $OS_TYPE == "MINGW" ]]; then # This is the equivalent of: # winpty docker exec -it laradock_php-fpm_1 bash -c 'bla bla bla' # Thanks to @michaelarnauts at https://github.com/docker/compose/issues/593