Bash Script to Upgrade Hugo

November 09, 2018

A quick bash script that upgrades Hugo.

Bash Logo

I’m a big fan of Hugo, the static website generator. With over 30,000 stars on GitHub, Hugo has an active development community that regularly adds new features and squashes bugs. I often like to experiment with bleeding-edge enhancements and find myself upgrading the binary regularly. To make this easier, I wrote a small Bash script that upgrades Hugo to a given version number based on user input.

The complete script is below. You should change the value of $target_dir to a directory with execute permission.


echo -e "Which release would you like to install? (e.g. 51): \c"

read version


echo Installing...

wget -qO- $URL | tar xz -C $target_dir hugo

echo Done!

echo Installed Hugo $(hugo version | awk '{ print $5 }')


Contact Form

Form submissions are sent to my email inbox. Besides reading your comment, I don't do anything with your information. Caveat: I log IPs to prevent spam.

Enter a valid email if you want a response.