From b197daaab3e485a4b9c937dbd04cef0ad7c61d81 Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Mon, 14 May 2018 12:18:39 +0100 Subject: [PATCH] Make the update plugin script take an optional argument If an argument is given, it will grep the list of plugins for it and update the first match rather then the first available for an update --- bin/updatePlugin | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/updatePlugin b/bin/updatePlugin index 4541580d..0cf0172c 100755 --- a/bin/updatePlugin +++ b/bin/updatePlugin @@ -1,5 +1,9 @@ #!/usr/bin/sh -plugin=$(wp plugin list 2> /dev/null | grep available | head -n 1 | awk '{print $1}') +if [ -n "$1" ]; then + plugin=$(wp plugin list 2> /dev/null | grep available | grep $1 | head -n 1 | awk '{print $1}') +else + plugin=$(wp plugin list 2> /dev/null | grep available | head -n 1 | awk '{print $1}') +fi echo "$plugin" versions=$(wp plugin update $plugin 2> /dev/null | tail -n 2 | head -n 1 | awk '{print $2 "->" $3}') echo "$versions"