From cc6c53cf68b4dc124c0d5f8fadc489de53e14309 Mon Sep 17 00:00:00 2001 From: Lorin Hochstein Date: Thu, 12 Jan 2017 21:49:13 -0800 Subject: [PATCH] Default value in bash script --- ch10/playbooks/library/can_reach_bash | 6 ++++++ 1 file changed, 6 insertions(+) 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 -- 2.44.0