Listing Enabled Modules Using a bash Script

A shell script that prints out a list of enabled modules in all accessible databases, designed for ssh use when you need to check multiple Drupal 6 or 7 databases at one time.

Editor's Note:  A similar concept would work just as well for Drupal 8, but the database table names and structures have changed in Drupal 8, so you would need to adjust the script accordingly.  Also, be aware that this script will not work on any Drupal instance where you have used a custom table prefix for all of your Drupal site tables.