Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Changed to my own old SED commands because the sqlhost sed was greedy…

… and variable fetch would go to the last quote.

That meant for the line:
define('DB_HOST', 'localhost');   // 99% chance you won't need to change this value

it would produce an $sqlhost value of:
localhost');   // 99% chance you won
  • Loading branch information...
commit 9b7565a6131eb201d49977fb0ba8a46b9e707ad9 1 parent b8e5a01
Brian Layman authored

Showing 1 changed file with 4 additions and 4 deletions. Show diff stats Hide diff stats

  1. +4 4 wpsql
8 wpsql
... ... @@ -1,7 +1,7 @@
1 1 #!/bin/bash
2   -sqlname=`sed -n "s/.*\(['\"]\)DB_NAME\1\s*,\s*\(['\"]\)\(.*\)\2.*/\3/p" $1`
3   -sqluser=`sed -n "s/.*\(['\"]\)DB_USER\1\s*,\s*\(['\"]\)\(.*\)\2.*/\3/p" $1`
4   -sqlhost=`sed -n "s/.*\(['\"]\)DB_HOST\1\s*,\s*\(['\"]\)\(.*\)\2.*/\3/p" $1`
5   -sqlpass=`sed -n "s/.*\(['\"]\)DB_PASSWORD\1\s*,\s*\(['\"]\)\(.*\)\2.*/\3/p" $1`
  2 +sqlname=$(sed -n "/define('DB_NAME', '/s/.*, '\([^']*\).*/\1/p" $1)
  3 +sqluser=$(sed -n "/define('DB_USER', '/s/.*, '\([^']*\).*/\1/p" $1)
  4 +sqlpass=$(sed -n "/define('DB_PASSWORD', '/s/.*, '\([^']*\).*/\1/p" $1)
  5 +sqlhost=$(sed -n "/define('DB_HOST', '/s/.*, '\([^']*\).*/\1/p" $1)
6 6
7 7 mysql -h $sqlhost -u $sqluser -p$sqlpass $sqlname

0 comments on commit 9b7565a

Please sign in to comment.
Something went wrong with that request. Please try again.