We can easily create our own script containing an update command. This script will attempt to update Ubuntu based system, in this case I am using Pinguy OS 14.04. Its a pretty simple script. This script was build using bash/shell scripting program.
Update script using bash:
[codesyntax lang=”bash” lines=”normal” lines_start=”1″]
1 2 3 4 5 6 7 8 9 10 11 12 13 |
#!/bin/bash #Simple update and upgrade on Ubuntu echo Dear $(hostname)" Are you sure want to update your system? (Y/N)" read answer if [ $answer = "y" ]; then sudo apt-get update echo "update complete" elif [ $answer = "Y" ]; then sudo apt-get update echo "update complete" else echo "error" fi |
[/codesyntax]
When this program is executed the following result will be displayed on screen:
[codesyntax lang=”bash”]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
[live:/home/live/Downloads] 14s $ ./test.sh Dear live Are you sure want to update your system? (Y/N) Y Ign http://dl.google.com stable InRelease Get:1 http://plex.r.worldssl.net lucid InRelease [2,146 B] Ign http://plex.r.worldssl.net lucid InRelease Ign http://dl.google.com stable InRelease Ign http://ppa.launchpad.net trusty InRelease Hit http://repo.steampowered.com precise InRelease Ign http://packages.linuxmint.com debian InRelease Get:2 http://dl.google.com stable Release.gpg [198 B] Ign http://extras.ubuntu.com trusty InRelease Ign http://archive.ubuntu.com trusty InRelease Ign http://archive.canonical.com trusty InRelease Get:3 http://repository.spotify.com stable InRelease [2,980 B] Ign http://repository.spotify.com stable InRelease |
[/codesyntax]
Actually its the ordinary sudo apt-get update command but compiled into a script. :) Its very interesting.