Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Sed commands to pull out wp-config database constants
# taken from jplew's excellent SyncDB
# @link
all_db_name=$(sed -n "s/.*DB_NAME', '\([^']*\)'.*/\1/p" wp-config.php)
all_db_user=$(sed -n "s/.*DB_USER', '\([^']*\)'.*/\1/p" wp-config.php)
all_db_pass=$(sed -n "s/.*DB_PASSWORD', '\([^']*\)'.*/\1/p" wp-config.php)
all_db_host=$(sed -n "s/.*DB_HOST', '\([^']*\)'.*/\1/p" wp-config.php)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment