misterorion
11/9/2018 - 4:32 PM

Bash script to upgrade Hugo to a given version

Bash script to upgrade Hugo to a given version

#!/bin/bash

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

read version

file="hugo_0.${version}_Linux-64bit.tar.gz"
URL=https://github.com/gohugoio/hugo/releases/download/v0.$version/$file
target_dir="/home/$(whoami)/bin/"

echo Installing...

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

echo Done!

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