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
		
			
				
	
	
		
			11 lines
		
	
	
	
		
			411 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
			
		
		
	
	
			11 lines
		
	
	
	
		
			411 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
| #!/usr/bin/sh
 | |
| 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"
 | |
| git add .
 | |
| git commit -m "Update $plugin $versions"
 |