Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
6 lines (6 sloc) 593 Bytes
#!/bin/bash
sqlname=`grep -oP "define\s*\(\s*['\"]DB_NAME['\"]\s*,\s*['\"]([^'\"]+)['\"]" $1 | cut -d, -f2 | sed "s/^ \+//" | sed "s/['\"]//g"`
sqluser=`grep -oP "define\s*\(\s*['\"]DB_USER['\"]\s*,\s*['\"]([^'\"]+)['\"]" $1 | cut -d, -f2 | sed "s/^ \+//" | sed "s/['\"]//g"`
sqlhost=`grep -oP "define\s*\(\s*['\"]DB_HOST['\"]\s*,\s*['\"]([^'\"]+)['\"]" $1 | cut -d, -f2 | sed "s/^ \+//" | sed "s/['\"]//g"`
sqlpass=`grep -oP "define\s*\(\s*['\"]DB_PASSWORD['\"]\s*,\s*['\"]([^'\"]+)['\"]" $1 | cut -d, -f2 | sed "s/^ \+//" | sed "s/['\"]//g"`
mysql -h $sqlhost -u $sqluser -p$sqlpass $sqlname