Hello I'm trying to run my ssh bash script from root (which has access to all hundreds of databases on my server). I'm trying to get the database name of my wordpress websites without having to login and open the file and copy and paste the db name. I'm doing this so I can then continue on to do other things in the particular database using the scripts.
So the line item for the database in file wp-config.php looks like this always: name define( 'DB_NAME', 'xyz' );
I'm simply trying to find that line item and then get/extract and use that db name (ie. xyz) later in the script (ie. $db). That's it.
I'm assuming using grep/sed/regex or combo or something would do it but I can't find out how. Let me know if anyone knows how to do this?