Merge pull request #51 from fradelg/support-hyphen-in-db-name

relax regex in grep from Database
This commit is contained in:
Fco. Javier Delgado del Hoyo 2021-05-24 20:49:49 +02:00 committed by GitHub
commit 4ee035f7d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,7 +13,7 @@ SQL=$(gunzip -c "$1")
DB_NAME=${MYSQL_DATABASE:-${MYSQL_DB}}
if [ -z "${DB_NAME}"]
then
DB_NAME=$(echo "$SQL" | grep -oE '(Database: (\w*))' | cut -d ' ' -f 2)
DB_NAME=$(echo "$SQL" | grep -oE '(Database: (.+))' | cut -d ' ' -f 2)
fi
[ -z "${DB_NAME}" ] && { echo "=> database name cannot be found" && exit 1; }