Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
#Double-check you're ready to rock and roll with an update
read -r -p "Are you sure you want to update all specified directories? [y/N] " response
if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]; then
#Set the array of folders
DIRECTORIES=( 'wordpress-default' 'wordpress-develop' );
#For each item in array, run the commands
for dir in ${DIRECTORIES[@]} ; do
cd ${dir}/public_html;
echo "";
echo "";
echo "*****************************************************" ;
echo "UPDATING: " ${dir} " in " `pwd` ;
echo "*****************************************************" ;
echo "";
echo "";
wp theme update --all;
wp plugin update --all;
wp theme list;
wp plugin list;
wp core update;
wp checksum core;
wp db check;
echo '';
echo '';
echo "*****************************************************" ;
echo "UPDATE for ${dir} COMPLETE!" ;
echo "*****************************************************" ;
echo '';
echo '';
cd ../.. ;
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment