for wpinstall in $(find "$(pwd)"/ -type f -name wp-config.php | sed 's/wp-config.php//g') 
   do
echo "$wpinstall"

dbname=$(grep DB_NAME "$wpinstall"/wp-config.php | grep -v WP_CACHE_KEY_SALT | cut -d \' -f 4)
echo "Database Name: $dbname"

echo "Creating backup folder /backup/wpdb"
mkdir -p /backup/wpdb

echo "Backing up databases to /backup/wpdb"
        /usr/bin/mysqldump "$dbname" | gzip > /backup/wpdb/"$dbname".sql.gz
done
Did this answer your question?