2021-10-27 10:02:12 +02:00
|
|
|
#!/bin/bash
|
2021-10-26 23:28:42 +02:00
|
|
|
# version: VVVVV
|
2021-10-31 13:27:17 +01:00
|
|
|
function fail {
|
|
|
|
printf '%s\n' "$1" >&2 ## Send message to stderr.
|
|
|
|
exit "${2-1}" ## Return a code specified by $2, or 1 by default.
|
|
|
|
}
|
2021-10-26 23:28:42 +02:00
|
|
|
|
|
|
|
if [ $# -le 1 ] ; then
|
|
|
|
echo usage: ${0} version_string files ...
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
version="$1"
|
|
|
|
shift
|
|
|
|
files="$*"
|
|
|
|
|
|
|
|
echo ${version} ${files}
|
2021-10-31 13:27:17 +01:00
|
|
|
which sponge > /dev/null || fail "sponge util must be installed"
|
2021-10-26 23:28:42 +02:00
|
|
|
|
|
|
|
for file in ${files}; do
|
|
|
|
sed "s/V\{5\}/${version}"/ ${file} | sponge ${file}
|
|
|
|
done
|