Bash Scripting on Linux (The Complete Guide) Class 08 - Universal Update Script
40,906
Published 2022-11-28
Brand LPI Linux Essentials Course Available
Now just $44.99 for a limited time! ➜ learnlinux.link/lpi-course
➜ learnlinux.link/lpi-course
Check out the Linux Shop
In the official shop, you'll find Shirts, hats, stickers, bags and more!
➜ merch.learnlinux.tv/
5% discount on LPI exam vouchers
After you finish Jay's new course, get 5% off an LPI exam voucher here:
➜ learnlinux.link/lpi-voucher
Become a Patron
Show your support for Learn Linux TV on Patreon and get access to exclusive perks!
➜ learnlinux.link/patron
Become a Channel Member
Show your support for Learn Linux TV here on YouTube and get access to exclusive perks!
➜ learnlinux.link/member
Mastering Ubuntu Server: 4th Edition
Jay's latest book covers everything you need to know in order to master Ubuntu Server. It's available here:
➜ ubuntuserverbook.com/
Linux Gear and Kits
Check out Jay's choice of hardware products, audio/video equipment, and more.
➜ learnlinux.link/amazon
Grab an awesome Pi-powered KVM
Support Learn Linux TV and grab yourself a TinyPilot KVM here:
➜ learnlinux.link/tinypilot
Note: Royalties and/or commission is earned from each of the above links
Time Codes
00:00 - Pre-Intro
00:48 - Intro
01:23 - Explanation of the "Universal Update Script"
08:06 - Using the /etc/os-release file to our advantage in a Bash Script
OTHER BASH SCRIPTING SERIES EPISODES
- Class 01 ➜ Introduction: linux.video/bash1
- Class 02 ➜ Hello World: linux.video/bash2
- Class 03 ➜ Variables: linux.video/bash3
- Class 04 ➜ Math Functions: linux.video/bash4
- Class 05 ➜ If Statements: linux.video/bash5
- Class 06 ➜ Exit Codes: linux.video/bash6
- Class 07 ➜ While Loops: linux.video/bash7
- Class 08 ➜ Universal Update Script: linux.video/bash8
- Class 09 ➜ For Loops: linux.video/bash9
- Class 10 ➜ Where To Store Your Scripts: linux.video/bash10
- Class 11 ➜ Data Streams: linux.video/bash11
- Class 12 ➜ Functions: linux.video/bash12
- Class 13 ➜ Case Statements: linux.video/bash13
- Class 14 ➜ Scheduling Jobs (Part 1): linux.video/bash14
- Class 15 ➜ Scheduling Jobs (Part 2): linux.video/bash15
- Class 16 ➜ Arguments: linux.video/bash16
- Class 17 ➜ Building a Backup Script: linux.video/bash17
- Class 18 ➜ Closing: linux.video/bash18
Recommended stand-alone videos from Learn Linux TV
• How to create a bootable flash drive for installing Linux ➜ linux.video/flash-usb
• Installing an operating system for Raspberry Pi ➜ linux.video/pi-imager
• Understanding Linux permissions ➜ linux.video/perms
• Essential tweaks for ALL Linux Servers ➜ linux.video/all-servers
Recommended Courses from Learn Linux TV
• Get up to speed with managing an OpenStack Cloud ➜ linux.video/openstack
• Learn how to write your own Bash Scripts ➜ linux.video/bash
• Install, configure, and maintain a Proxmox VE Cluster ➜ linux.video/pve
• Automate tedious setup jobs by learning Ansible ➜ linux.video/ansible
• Learn how to exit vim (and use it too) ➜ linux.video/vim
Linux-related Podcasts
• Enterprise Linux Security ➜ enterpriselinuxsecurity.show/
• The Homelab Show ➜ thehomelab.show/
Official *Learn Linux TV on the Web*
• Main site ➜ www.learnlinux.tv/
• Community ➜ community.learnlinux.tv/
Learn Linux TV provides technical content that will hopefully be helpful to you and teach you something new. However, this content is provided without any warranty (expressed or implied). Learn Linux TV is not responsible for any damages that may arise from any use of this content. The person viewing Learn Linux TV's content is expected to follow their best judgement and to make their best decisions while working with any related technology. Always make sure you have written permission before working with any infrastructure. Also, be sure that you're compliant with all company rules, change control procedures, and local laws.
#commandline #bash #terminal
All Comments (21)
-
You are a very good teacher !
I like the way you explain
You are awesome
Thank you
I will recommend your channel in Moldova -
I learn a lot from tour videos !
-
You give me great inspiration for my work. Many thanks.
-
I've been wanting to make a script for auto update for awhile. This is a huge step in the direction I want to go with my script. Trying to find a way to have it auto reboot if the upgrade command actually upgrades
-
It was really fun for me, I also added a line for CentOS as I am running this OS on my virtual machine with RPM package
-
Semi useful is a necessary step for newbies. Several intrinsic "tricks" of the trade in that script, things to own on the automatic level.
-
Thank you very much♥️
-
Useful script 👍
-
great video
-
Just curious, when you ran the grep -q “Ubuntu” your U was capitalized, but is evident that in the ID_LIKE section of the /etc/os-release file it’s there but lowercase. Had you searched for “ubuntu” instead of “Ubuntu” I believe it may have run the way it was intended. If I’m not mistaken? 8:48
-
Excellent
-
Men the word thanks it's not enough for you <3 👌
-
Thank you
-
👍Thanks!
-
good video
-
Do all distribution /etc/os-release files consistently contain the parameter ID_LIKE as operating system identifier?
I am using Zorin OS, and the os-release file contains:
ID=zorin
ID_LIKE=ubuntu -
Great tutorial serie on bash! I have some questions. Wouldn't changing "Debian" to lower case "debian" grep all in os-release file on any system downstream from Debian (i.e Ubuntu, Mint, PopOS etc )work grepping from the ID_LIKE row, thus all deb-depending systems/OS'?
I added below to the script but with the first method, I couldn't find what to grep saying flatpak is/isn't installed (maybe you'll come to that later on).
If anyone is interested...
# If flatpak is installed on this system this should update flatpak apps
# add this variable on top: <extra_repos=/var/lib/flatpak>
if [ -d $extra_repos ]
then
# Additional repositories using flatpak
echo "Flatpak installed on system"
flatpak update
fi -
Why does a script fail even if the example is followed to the detail... for instance a basic ldd lookup & grab dependencies script for bash in Context of creating a chroot environment
-
thnks bro
-
I have tried to write the following simple script:
#!/bin/bash
echo "What is your favorite color?"
read color
select_color () {
echo "What is your favorite color?"
read color
}
x=1
while [ $x -lt 10 ]
do
if [ "$color" = "red" ]
then
echo "Nice one......"
x=20
elif [ "$color" \= "red" ]
then
echo "Pick another color......."
select_color
fi
done
I cannot get it to run on my linux. I intentionally pick a color other than red, but tt stops at the while loop but never runs the procedure on how to pick another color. I also tried red and same thing, it does not tell me nice one. Could you show me where I am going wrong?
Thanks