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}