From 757607f29b4bdca3dce5a6b76b0c1d32610ab3e9 Mon Sep 17 00:00:00 2001 From: "Kasper D. Fischer" Date: Sun, 31 Oct 2021 13:27:17 +0100 Subject: [PATCH] fixed error output if sponge is not installed --- scripts/patchVersion.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/patchVersion.sh b/scripts/patchVersion.sh index ad0846d..f7d982f 100755 --- a/scripts/patchVersion.sh +++ b/scripts/patchVersion.sh @@ -1,5 +1,9 @@ #!/bin/bash # version: VVVVV +function fail { + printf '%s\n' "$1" >&2 ## Send message to stderr. + exit "${2-1}" ## Return a code specified by $2, or 1 by default. +} if [ $# -le 1 ] ; then echo usage: ${0} version_string files ... @@ -10,7 +14,7 @@ shift files="$*" echo ${version} ${files} -which sponge > /dev/null || ( echo "sponge util must be installed" ; exit 0 ) +which sponge > /dev/null || fail "sponge util must be installed" for file in ${files}; do sed "s/V\{5\}/${version}"/ ${file} | sponge ${file}