add version update tool
This commit is contained in:
parent
6eff67b701
commit
f2827470be
|
|
@ -0,0 +1,34 @@
|
|||
#!/bin/bash
|
||||
|
||||
UserInput() {
|
||||
read -r -p "$(echo -e 'New version: ')" version
|
||||
read -e -r -p "$(echo -e 'File: ')" file
|
||||
}
|
||||
|
||||
SedFindReplace() {
|
||||
local rex='([0-9]{1,}\.[0-9]{1,}\.[0-9]{1,})'
|
||||
sed -i -E "s/$rex/$1/g" "$2"
|
||||
}
|
||||
|
||||
BashFindReplace() {
|
||||
in=$2
|
||||
rex='[0-9]{1,}\.[0-9]{1,}\.[0-9]{1,}'
|
||||
while [[ $in =~ $rex ]]; do
|
||||
in=${BASH_REMATCH[1]}${BASH_REMATCH[2]}
|
||||
done
|
||||
}
|
||||
|
||||
main() {
|
||||
UserInput
|
||||
SedFindReplace "$version" "$file"
|
||||
# BashFindReplace "$version" "$file"
|
||||
}
|
||||
|
||||
while getopts a option
|
||||
do
|
||||
case "$option" in
|
||||
a ) SedFindReplace "$2" "matrix-synapse_purge-remote-media.sh"; exit 0;;
|
||||
esac
|
||||
done
|
||||
|
||||
main
|
||||
Loading…
Reference in New Issue