From 7bfc233fc5ff03109786dd5ea98d86f5d5ad3c6c Mon Sep 17 00:00:00 2001 From: James Date: Wed, 14 Jun 2017 12:43:00 -0700 Subject: [PATCH] Add : as it removes need for if. : makes it use if var is empty or unset not just unset --- test.sh | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/test.sh b/test.sh index c2b110756..faacbe0c3 100755 --- a/test.sh +++ b/test.sh @@ -9,7 +9,7 @@ docker run --name func-mysql-test -p 3307:3306 -e MYSQL_DATABASE=funcs -e MYSQL_ docker rm -fv func-redis-test|| echo No prev redis test db container docker run --name func-redis-test -p 6301:6379 -d redis sleep 5 -case ${DOCKER_LOCATION-localhost} in +case ${DOCKER_LOCATION:-localhost} in localhost) export POSTGRES_HOST=localhost export POSTGRES_PORT=15432 @@ -24,18 +24,14 @@ docker_ip) if [[ ! -z ${DOCKER_HOST} ]] then DOCKER_IP=`echo ${DOCKER_HOST} | awk -F/ '{print $3}'` - if [[ -z ${DOCKER_IP} ]] - then - DOCKER_IP=localhost - fi fi - export POSTGRES_HOST=${DOCKER_IP-localhost} + export POSTGRES_HOST=${DOCKER_IP:-localhost} export POSTGRES_PORT=15432 - export MYSQL_HOST=${DOCKER_IP-localhost} + export MYSQL_HOST=${DOCKER_IP:-localhost} export MYSQL_PORT=3307 - export REDIS_HOST=${DOCKER_IP-localhost} + export REDIS_HOST=${DOCKER_IP:-localhost} export REDIS_PORT=6301 ;; container_ip)