seisobs-webapp/scripts/patchVersion.sh
2023-04-17 14:38:31 +02:00

21 lines
473 B
Bash
Executable File

#!/bin/bash
# version: v1.3 (2023-04-17)
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 ...
exit 0
fi
version="$1"
shift
files="$*"
echo ${version} ${files}
which sponge > /dev/null || fail "sponge util must be installed"
for file in ${files}; do
sed "s/V\{5\}/${version}"/ ${file} | sponge ${file}
done