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

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

Learn Linux TV

1 год назад

51,249 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@RECURSIVE_MEMORY_LOGIC
@RECURSIVE_MEMORY_LOGIC - 30.11.2022 15:10

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

Ответить
@markjones3107
@markjones3107 - 02.12.2022 18:36

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

Ответить
@h2ocombolhas1
@h2ocombolhas1 - 05.12.2022 22:26

I learn a lot from tour videos !

Ответить
@DrakenARTZsteam
@DrakenARTZsteam - 09.12.2022 04:14

Useful script 👍

Ответить
@guilherme5094
@guilherme5094 - 10.12.2022 20:02

👍Thanks!

Ответить
@damianpodgorski6977
@damianpodgorski6977 - 11.12.2022 17:42

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

Ответить
@ericablack1847
@ericablack1847 - 24.01.2023 15:09

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

Ответить
@jojobobbubble5688
@jojobobbubble5688 - 29.01.2023 07:07

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

Ответить
@jackelofnar
@jackelofnar - 25.04.2023 08:05

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.

Ответить
@brojam11
@brojam11 - 25.04.2023 11:41

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

Ответить
@j0naslarss0n
@j0naslarss0n - 01.05.2023 12:09

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

Ответить
@younesstouzani
@younesstouzani - 02.05.2023 21:04

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

Ответить
@Alpha_Sadigh
@Alpha_Sadigh - 11.05.2023 12:58

☯🙏

Ответить
@GrindAlchemyTech
@GrindAlchemyTech - 10.06.2023 05:36

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

Ответить
@sotude9168
@sotude9168 - 08.09.2023 20:50

Thank you very much♥️

Ответить
@LearnerHarshalRajeshJain
@LearnerHarshalRajeshJain - 20.09.2023 16:48

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

Ответить
@howiedick6857
@howiedick6857 - 01.10.2023 22:58

a tip for all of you guys. if you arent already using chatgpt or an AI to help with learning i would suggest that you do so. for instance i asked chatgpt about the $(( )) part and it said...."n bash scripting, the $(( ... )) construct is used for arithmetic evaluation. The $ before the (( ... )) is essential for indicating that an arithmetic evaluation is about to take place. Without the $, the (( ... )) construct would be treated differently.

Let's break it down:

(( ... )): This is an arithmetic evaluation construct in bash. It allows you to perform arithmetic operations.

$(( ... )): When you prepend the arithmetic evaluation with a $, it returns the result of the arithmetic operation. This is useful when you want to assign the result to a variable or use it in some other way.


its an incredible learning tool.

Ответить
@noweare1
@noweare1 - 14.10.2023 04:22

Excellent

Ответить
@robinedminson6461
@robinedminson6461 - 04.11.2023 19:57

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

Ответить
@mihai6564
@mihai6564 - 07.12.2023 10:59

good video

Ответить
@skmplanet9591
@skmplanet9591 - 19.12.2023 20:09

great video

Ответить
@pepe-perez
@pepe-perez - 20.01.2024 19:08

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

Ответить
@zeppelinmexicano
@zeppelinmexicano - 04.02.2024 19:35

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

Ответить
@subee128
@subee128 - 09.02.2024 05:05

Thank you

Ответить
@davyshah1074
@davyshah1074 - 12.02.2024 16:31

How the fu*k is this course free
THis is absolute goldmine

Ответить
@ChristopherJamesCalo
@ChristopherJamesCalo - 18.02.2024 06:42

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

Ответить
@MiBaLinuxTech
@MiBaLinuxTech - 01.04.2024 02:44

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

Ответить
@barkhadibraahim1023
@barkhadibraahim1023 - 27.04.2024 06:49

thnks bro

Ответить
@Kwazzaaap
@Kwazzaaap - 27.05.2024 20:15

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

Ответить
@Mugen_FB317
@Mugen_FB317 - 13.06.2024 19:19

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!!!!

Ответить
@Sveto8
@Sveto8 - 18.06.2024 13:42

ID_LIKE for Arch is arch, nevertheless, these courses are superb!

Ответить
@mad8ry
@mad8ry - 17.08.2024 00:59

you could have useed egrep "Ubentu|Debian" instead of writting the whole line with or "||"

Ответить
@Leverquin
@Leverquin - 02.09.2024 00:22

what does grep -q does?

Ответить
@Aniki_chan69
@Aniki_chan69 - 14.09.2024 17:10

is this seris also helpful for mac usrs??

Ответить
@nitheshkumar8632
@nitheshkumar8632 - 10.10.2024 16:28

why you didn't use elif in second if conditions that also fine way isn't

Ответить
@iberianful
@iberianful - 22.10.2024 14:24

Your videos are AWESOME!!!

Ответить