Skip to content

Instantly share code, notes, and snippets.

@8ig8
Last active February 10, 2016 18:14
Show Gist options
  • Save 8ig8/1fcdee3dddcd840083f2 to your computer and use it in GitHub Desktop.
Save 8ig8/1fcdee3dddcd840083f2 to your computer and use it in GitHub Desktop.
Parse DB details from wp-config.php
#!/bin/bash
##
# Parse wp-config.php
#
# https://gist.github.com/8ig8/1fcdee3dddcd840083f2
# curl https://gist.githubusercontent.com/8ig8/1fcdee3dddcd840083f2/raw/parse-wp-config.sh | bash
# curl -k https://gist.githubusercontent.com/8ig8/1fcdee3dddcd840083f2/raw/parse-wp-config.sh | bash
WPDBNAME="$(cat ./wp-config.php | grep DB_NAME | cut -d \' -f 4)"
WPDBUSER="$(cat ./wp-config.php | grep DB_USER | cut -d \' -f 4)"
WPDBPASS="$(cat ./wp-config.php | grep DB_PASSWORD | cut -d \' -f 4)"
WPDBHOST="$(cat ./wp-config.php | grep DB_HOST | cut -d \' -f 4)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment