Get WordPress database credentials - bash script
# option #1
db_name=$(awk -F "'" '/DB_NAME/ {print $4}' ${current_dir_full}/wp-config.php)
db_prefix=$(awk -F "'" '/table_prefix/ {print $2}' ${current_dir_full}/wp-config.php)
db_username=$(awk -F "'" '/DB_USER/ {print $4}' ${current_dir_full}/wp-config.php)
db_password=$(awk -F "'" '/DB_PASS/ {print $4}' ${current_dir_full}/wp-config.php)
# option #2
DB_USER=`grep "DB_USER" wp-config.php | cut -d \' -f 4`
DB_PASS=`grep "DB_PASSWORD" wp-config.php | cut -d \' -f 4`
DB_NAME=`grep "DB_NAME" wp-config.php | cut -d \' -f 4`
DB_PREFIX=`grep "table_prefix" wp-config.php | cut -d \' -f 2`