fixed error output if sponge is not installed
This commit is contained in:
parent
5d3a9b81aa
commit
757607f29b
@ -1,5 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# version: VVVVV
|
# 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
|
if [ $# -le 1 ] ; then
|
||||||
echo usage: ${0} version_string files ...
|
echo usage: ${0} version_string files ...
|
||||||
@ -10,7 +14,7 @@ shift
|
|||||||
files="$*"
|
files="$*"
|
||||||
|
|
||||||
echo ${version} ${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
|
for file in ${files}; do
|
||||||
sed "s/V\{5\}/${version}"/ ${file} | sponge ${file}
|
sed "s/V\{5\}/${version}"/ ${file} | sponge ${file}
|
||||||
|
Loading…
Reference in New Issue
Block a user