Bash Script to Upgrade Hugo

A quick bash script that upgrades Hugo.

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 }')