Looping

Hey guys, so I am trying to do a loop script that will go through each folder (no gui so just each domain has a folder) and grab out the databases being used on that domain. I know I would use
mysql -e "show databases where not 'information_schema';" once in each directory to pull the actual databases but not sure how to loop in and out of each folder "
thanks

mysql keeps its files in a central place, what are the folders for?

Just to pull the active DB's but i'm trying to practice using a loop rather than just pulling the entire database schema

'show databases' would be better, really, and not require root access (the sql folders are often restricted), but since you ask:

 find /var/lib/mysql/ -type d '!' -path '/var/lib/mysql/'