7

Drush 8.1.9 & Drupal 7.53. What I'm looking for is a command like 'drush ups' but without all the modules that are [OK] - so when used with an alias of several sites I don't have to scroll through loads. So all I get is:

aliasname     
Name                               Installed Version  Proposed version  Message          
     Metatag (metatag)                  7.x-1.19           7.x-1.20          Update available 
     Views Slideshow (views_slideshow)  7.x-3.4            7.x-3.5           Update available 

I found this command: 'drush vset update_check_disabled 1 -y && drush -n -p up' at https://mark.shropshires.net/blog/list-all-projects-available-updates-using-drush - it works but here's a sample output:

media_ckeditormedia_ckeditormedia_ckeditor
views_slideshowmedia_ckeditor

Any suggestions?

9

Drush puts that [ok] information out on stderr. So you can actually just dump that by using:

drush ups 2>/dev/null

which for me gave:

 $ drush ups 2>/dev/null
 Name    Installed Version  Proposed version  Message
 Drupal  8.2.5              8.2.6             Update available
  • Love it - works perfectly. Don't understand why but that's fine! – iain-g Feb 2 '17 at 20:33
4

Consider using 'grep'. It's not exactly a drush-specific command but will get the job done.

drush ups | grep 'Update available'

This command will return all lines that contain the phrase 'Update available'.

  • Yep, this is one way. For the uninitiated - this will pipe the output of drush ups to grep, which will filter by "Update available" – Kevin Jan 24 '17 at 1:14
  • Just tried this, but I still see all the 'Checking available updates... [OK]' ones above. What it does do is get rid of the 'Name' 'Installed version' column headings above the ones that need updates, so looks like it works on the results rather than the part where drush is checking each module. – iain-g Jan 24 '17 at 8:32
  • yeah, it processes the output from the tool itself. you can also consider custom drush commands. sitepoint.com/drupal-create-drush-command – kombogdan Jan 24 '17 at 20:33
  • Thanks - I'll give that a go - might wait till I've learned more drush basics first :) – iain-g Jan 24 '17 at 22:39
0

In a Drupal 8 project it's better to list updates using composer:

composer outdated 'drupal/*'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.