Last Updated: November 23, 2016
· fluxsauce

Get the Drupal major version using Drush

You know, for kicks.

drush status | grep "Drupal version" | awk -F ':' '{print $2}' | sed 's/^ *//'

1 Response
Add your response

Could be done with only drush with with a few options:
drush @site status --fields=drupal-version --field-labels=0

If you only want the major version of Drupal you can use awk to get only that:
drush @site status --fields=drupal-version --field-labels=0 | awk -F. '{print$1}'

over 1 year ago ·