#!/bin/bash# identify the latest version of mavenlatest=$(curl http://www-us.apache.org/dist/maven/maven-3/ | tac | sed -ne 's/[^0-9]*\(\([0-9]\.\)\{0,3\}[0-9]\).*/\1/p'| head -1)# download itwget http://www-us.apache.org/dist/maven/maven-3/$latest/binaries/apache-maven-$latest-bin.tar.gz
# unpack itsudo tar -zxf apache-maven-$latest-bin.tar.gz -C /usr/local/
# create a symlink to itsudo ln -s /usr/local/apache-maven-$latest/bin/mvn /usr/bin/mvn
# confirm successful installationecho"You have installed `mvn -v`"
This is for the article on https://www.tomred.net/devops/install-the-latest-version-of-maven-on-linux.html.