Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make it a bit more complex. Any number of spaces and different types …

…of quotes.
  • Loading branch information...
commit 3247e4b7dba196724463f1337042252d67aaa3af 1 parent 1cc7416
@joncave joncave authored committed
Showing with 4 additions and 4 deletions.
  1. +4 −4 wpsql
View
8 wpsql
@@ -1,7 +1,7 @@
#!/bin/bash
-sqlname=`sed -n "s/.*'DB_NAME', '\(.*\)'.*/\1/p" $1`
-sqluser=`sed -n "s/.*'DB_USER', '\(.*\)'.*/\1/p" $1`
-sqlhost=`sed -n "s/.*'DB_HOST', '\(.*\)'.*/\1/p" $1`
-sqlpass=`sed -n "s/.*'DB_PASSWORD', '\(.*\)'.*/\1/p" $1`
+sqlname=`sed -n "s/.*\(['\"]\)DB_NAME\1\s*,\s*\(['\"]\)\(.*\)\2.*/\3/p" $1`
+sqluser=`sed -n "s/.*\(['\"]\)DB_USER\1\s*,\s*\(['\"]\)\(.*\)\2.*/\3/p" $1`
+sqlhost=`sed -n "s/.*\(['\"]\)DB_HOST\1\s*,\s*\(['\"]\)\(.*\)\2.*/\3/p" $1`
+sqlpass=`sed -n "s/.*\(['\"]\)DB_PASSWORD\1\s*,\s*\(['\"]\)\(.*\)\2.*/\3/p" $1`
mysql -h $sqlhost -u $sqluser -p$sqlpass $sqlname
Please sign in to comment.
Something went wrong with that request. Please try again.