If you want to update your Jenkins to the desired version, then following script will help you to install the desired version of Jenkins by restarting it to the actual updated versions.
Create the scripting file using
Grant execute permissions to the file.
chmod +x updateJenkins.sh
Add the following content into your script.
echo "Enter the Jenkins Version you want to update:"
sudo cp jenkins.war /usr/share/jenkins/
sudo service jenkins restart