21 lines
473 B
Bash
Executable File
21 lines
473 B
Bash
Executable File
#!/bin/bash
|
|
# version: v1.2 (2022-02-23)
|
|
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 |