Browse Source

add version update tool

dev
Joe 1 year ago
parent
commit
f2827470be
Signed by: joe GPG Key ID: 8595A3F8F2CE1B74
1 changed files with 34 additions and 0 deletions
  1. +34
    -0
      tools/vupdate.sh

+ 34
- 0
tools/vupdate.sh View File

@ -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…
Cancel
Save