Download WordPress latest and unzip to root directory – Bash (upgraded to wp-cli)

I was looking for something like this for my local development environment, but created one instead.

I called it dlwp

!# /bin/bash

read -r -p "Is this the root directory? [y/N] " response
 case $response in
 tar -zxvf latest.tar.gz
 cd wordpress
 mv -i * ../
 cd ..
 rm -rf wordpress
 rm -rf latest.tar.gz
 echo "done"
 echo "Script stopped."


I’m not sure how this actually worked… it had some problems to say the least – just experimenting with Bash scripts at the time, I would not recommend this technique.

Now that I’ve discovered wp-cli, I have a much easier time installing and updating WordPress from the command line.

$ wp core download && wp core install

Of course you will need to provide the proper arguments for the “core install” command but check out the documentation for that. Makes life so easy!



, , ,




Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.