From: Lorin Hochstein Date: Fri, 13 Jan 2017 05:49:13 +0000 (-0800) Subject: Default value in bash script X-Git-Url: https://git.halfball.org/?a=commitdiff_plain;h=cc6c53cf68b4dc124c0d5f8fadc489de53e14309;p=ansiblebook.git Default value in bash script --- diff --git a/ch10/playbooks/library/can_reach_bash b/ch10/playbooks/library/can_reach_bash index 0e3fec2..36824b8 100644 --- a/ch10/playbooks/library/can_reach_bash +++ b/ch10/playbooks/library/can_reach_bash @@ -6,6 +6,12 @@ host=`jq -r .host < $1` port=`jq -r .port < $1` timeout=`jq -r .timeout < $1` +# Default timeout=3 + +if [[ $timeout -eq "null" ]]; then + timeout=3 +fi + # Check if we can reach the host nc -z -w $timeout $host $port