Bash Scripting for Beginners: Complete Guide to Getting Started - Universal Update Script (Part 8)

preview_player
Показать описание
The word "Universal" can refer to good or a bad thing. Universal is working on another Jurassic Park sequel? Probably a bad thing. A universal script to help you consolidate tasks on the Linux commandline? Definitely a GOOD thing! In this video, you'll see an example of creating a "universal update script" to help you deal with using multiple distributions.

*🎓 BRAND NEW UDEMY COURSES AVAILABLE!*
Check out my new courses on Udemy and take your learning even further!

*🐧 SUPPORT LINUX LEARNING!*
_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*

*🌐 LEARN LINUX TV ON THE WEB*

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
Рекомендации по теме
Комментарии
Автор

You are a very good teacher !
I like the way you explain
You are awesome
Thank you
I will recommend your channel in Moldova

ericablack
Автор

Before watching this video, I created my own update and upgrade bash script when I started watching your channel. I never used the directory path to update a particular application, so now I will start doing some experiments. Thank you again for another great video!!!!

Mugen_FB
Автор

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

jojobobbubble
Автор

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

damianpodgorski
Автор

You give me great inspiration for my work. Many thanks.

MiBaLinuxTech
Автор

Semi useful is a necessary step for newbies. Several intrinsic "tricks" of the trade in that script, things to own on the automatic level.

zeppelinmexicano
Автор

instead of checking for "Arch", "Ubuntu", etc, why not just check for the existence of the update commands "pacman", "apt", etc? 🤔

ChristopherJamesCalo
Автор

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

BLT
Автор

Men the word thanks it's not enough for you <3 👌

younesstouzani
Автор

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:
if [ -d $extra_repos ]
then
# Additional repositories using flatpak
echo "Flatpak installed on system"
flatpak update
fi

jnaslarssn
Автор

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

RECURSIVE_MEMORY_LOGIC
Автор

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

GrindAlchemyTech
Автор

you can write this line like this:
if grep -q "Pop\|Ubuntu" $release_file
etc...

pepe-perez
Автор

Would which apt, which pacman, which dnf work as a test case?

markjones
Автор

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

x=20

elif [ "$color" \= "red" ]
then
echo "Pick another
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

brojam
Автор

Great series but I ran into a snag with this one. I'm running Raspian Bookworm where ID_LIKE=debian - all lower case. Found that grep -iq "Debian" ran the script correctly

robinedminson
Автор

I may be missing something but why wouldn't you use if else or case statement? Say your on a Arch system the following if statements will be executed witch is wasting resources.

jackelofnar
Автор

Note it doesnt ignore 1st line #!/bin/bash rest treated as comment who start with #

LearnerHarshalRajeshJain
Автор

9:58 It should work fine if you didn't capitalize the U in Ubuntu right? Since the word ubuntu IS in the os-release for your system. 15:09 That wouldn't have fixed it either since you have a capital D in Debian. By changing it to Pop you are just cheating as far as I'm concerned. :P

fictitiousnightmares
Автор

Keeping everything up to date is not as fun when nvidia ships a driver that segfaults your desktop

Kwazzaaap
join shbcf.ru