Skip to content

Instantly share code, notes, and snippets.

@ianchanning
Created October 21, 2014 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ianchanning/d3576eaeb2e8c952a801 to your computer and use it in GitHub Desktop.
Save ianchanning/d3576eaeb2e8c952a801 to your computer and use it in GitHub Desktop.
Sed commands to pull out wp-config database constants
# taken from jplew's excellent SyncDB
# @link https://github.com/jplew/SyncDB/blob/master/syncdb
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