Drupal - Drush command to check if Drupal is installed?

$ cd /path/to/drupal6or7or8
$ drush status bootstrap | grep -q Successful

Then, $? will be 0 if Drupal has been installed, or 1 if there is no site, or it does not have a database, or the site has not been installed.


In addition to @greg_1_anderson answer, I'd like to add that that is sensitive to locale problems. Successful will be translated in the output from Drush. To work around this problem, I'd suggest this somewhat dirty workaround:

drush status bootstrap | grep -q $(drush php-eval 'if (function_exists("t")) echo t("Successful");') &> /dev/null;

As mentioned above, $? will be 0 if installed, higher if not.

Tags:

Drush