From 36eccb3f83bf94ecd43896a878a6bfb9ab777bcb Mon Sep 17 00:00:00 2001 From: Troy McConaghy Date: Sun, 22 Jan 2017 16:20:13 +0100 Subject: [PATCH] Better error handling in awsdeploy.sh --- deploy-cluster-aws/awsdeploy.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/deploy-cluster-aws/awsdeploy.sh b/deploy-cluster-aws/awsdeploy.sh index ca504f16..00d1f431 100755 --- a/deploy-cluster-aws/awsdeploy.sh +++ b/deploy-cluster-aws/awsdeploy.sh @@ -1,8 +1,10 @@ -#! /bin/bash +#!/bin/bash -# The set -e option instructs bash to immediately exit -# if any command has a non-zero exit status -set -e +set -euo pipefail +# -e Abort at the first failed line (i.e. if exit status is not 0) +# -u Abort when undefined variable is used +# -o pipefail (Bash-only) Piped commands return the status +# of the last failed command, rather than the status of the last command # Check for the first command-line argument # (the name of the AWS deployment config file)