#!/bin/sh wp_var() { grep "define([']$1[']" wp-config.php | cut -d\' -f 4 } DB=`wp_var DB_NAME` USER=`wp_var DB_USER` PASSWORD=`wp_var DB_PASSWORD` HOSTPORT=`wp_var DB_HOST` HOST=`echo $HOSTPORT | cut -d: -f 1` PORT=`echo $HOSTPORT | cut -d: -f 2` exec mysql -u $USER --password="$PASSWORD" -h $HOST -P $PORT -D $DB