Bash Script To Add Themes To WordPress

Download PDF

Here is a little bash script I wrote while attempting to try out many themes on this blog.

# Script to install themes to WordPress sites.
# Sinan Ozel, Jan 6th, 2013

if [ -z "$1" ]
    die "No argument supplied. Usage: $0 <theme with version>, for example $0 esquire.1.2"

if [ ! -d $DIR ]
    die "$DIR not found... $0 needs to be run from the WordPress root directory."

cd $DIR 
wget $URL
unzip $FILE
rm $FILE

This is meant to be run on your own server hosting the WordPress files, from the WordPress root directory. Create a text file there, (called addtheme, for example) copy and paste the code into the file contents, then set permissions by chmod 0700 addtheme. (Since it is in the root directory, you do not want anybody other than your user doing anything with it.) Then run by entering ./addtheme esquire.1.2

Why use this? I don't use the automatic WordPress installation due to security concerns, so I am using this code instead.

If I write something that works from the client side, I will post that here, too.

Tagged , , , . Bookmark the permalink.

Leave a Reply