From 2aea0527828227b14ce0faba142acb2a7563c69c Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sun, 8 Jul 2018 13:59:20 -0700 Subject: [PATCH] scripts/maintenance/tag-route53-hosted-zones: Error messages for missing deps At least on Bash 4.4, the -V form writes a missing-command message to stderr: $ echo $BASH_VERSION 4.4.23(1)-release $ command -v does-not-exist >/dev/null $ command -V does-not-exist >/dev/null -bash: command: does-not-exist: not found Because we're not redirecting command's stderr in the script, it will fall through to the caller's stderr and make it easier for them to figure out what went wrong. Also write a "Missing required dependencies" string to stderr. We'd had a "Dependencies not installed." string literal from 82bdd9fe (installer/scripts: AWS tag and delete scripts, 2017-06-28, coreos/tectonic-installer#1239), but it hadn't been written anywhere so it was effectively an internal comment. --- scripts/maintenance/tag-route53-hosted-zones.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/maintenance/tag-route53-hosted-zones.sh b/scripts/maintenance/tag-route53-hosted-zones.sh index f9baa134d4..dd3dbf4b50 100755 --- a/scripts/maintenance/tag-route53-hosted-zones.sh +++ b/scripts/maintenance/tag-route53-hosted-zones.sh @@ -45,8 +45,8 @@ while [ $# -gt 0 ]; do shift done -if ! command -v jq > /dev/null || ! command -v aws > /dev/null; then - "Dependencies not installed." +if ! command -V jq >/dev/null || ! command -V aws >/dev/null; then + echo "Missing required dependencies" >&2 exit 1 fi