Bash Scripting Full Course 3 Hours
HTML-код
- Опубликовано: 28 сен 2024
- Try our Bash Boot Camp Course to really uplevel your bash skills!
linuxhint.biz/...
Or join our Linux Hint Community with access to all our courses and a community forum where you can interact with our instructors: www.linuxhint....
In this FREE Bash Scripting Course, you will learn from printing a simple “Hello World” to using conditional statements such as if statements, case statements to using loops such as while, for and until loops to using awk, sed and debugging bash scripts. All in all, we will learn and cover the following topics:
1-Hello Bash Scripting
2-Redirect to file
3-Comments
4-Conditional Statements
5-Loops
6-Script input
7-Script output
8-how to send output from one script to another scrpt
9-String Processing
10-Numbers and Arithmetic
11-Declare Command
12-Arrays
13-Functions
14-Files and Directories
15-Send Email Via Script
16-Curl in Scripts
17-Professional Menus
18-Wait for filesystem events with inotify
19-Introduction to grep
20-Introduction to awk
21-Introduction to sed
22- Debugging bash scripts
Link to written article on this course:
linuxhint.com/...
0:55 Hello Bash Scripting
5:25 Redirect to file
8:49 Comments
11:49 HereDoc
14:01 IF Conditional Statement
16:47 IF-ELSE Conditional Statement
19:00 ELIF Conditional Statement
21:18 AND Operator
26:21 OR Operator
29:10 CASE Conditional Statement (Incomplete explanation)
29:47 Loops
30:19 WHILE Loop
33:54 UNTIL Loop
36:20 FOR Loop
39:44 BREAK and CONTINUE Statements
45:29 Script input (STDIN)
55:58 Script output (STDOUT and STDERR)
1:01:40 Pipes (Send output from one script to another script)
1:05:53 Strings processing
1:15:39 Numbers and Arithmetic
1:20:56 Convert from Hexadecimal to Decimal Numbers
1:23:07 DECLARE command
1:28:27 Arrays
1:35:06 Functions
1:43:10 Files and directories
1:58:42 Sending email via script
Thanks 😊😊😊😊😊😊😊😊😊😊😊😊😊
@@emptyFull123 Welcome. I haven't finished that table of contents.
you saved me... thankyou...
2:05:20 Curl
2:12:44 Professional Menus
2:31:12 grep
2:41:37 awk
2:51:54 sed
3:02:24 Debugging
Thank you!
When i hear the accent, I know I'm gonna learn a lot today ! Thank you sir, really good video.
Liar. U like them bc your one of them. They're so inferior in absolutely anything pertaining to , technology in understanding or teaching its basis. It's strange. They're the worst teachers in tech.
dude 😂
ooh mmm I'm sooo anti-racist yep yep oop oop aaaaagghh... - tosses the comments section a wetwipe - ...clean yourself up
Feels good to finally have a positive stereotype.
Same 😂
for i in (1..100000000000); do echo"thank you";done ..
You are amazing, and doing a great job. Keep you the good work
This great. I'm about half way through but wanted to acknowledge your teaching style of going detail and the time. This is one of the best I've seen on youtube and it's a good resource for me to brush up my bash scripts for work.
This tutorial is one of the best tutorials I ever have used to learn something. Man you are doing a great job. Love from Pakistan.
I appreciate the effort put into this video lecture and I'd like to share my personal points for improvement. It's an okay intro in my humble opinion, and some important stuff is either lacking or overlooked.
1. In string processing, string comparisons are made by checking the ASCII code of each character, thus "abc" is not equal to "acb". In the lecture, it was represented like the length of the strings are checked. Maybe in the earlier versions, it could be true (by looking at the date of the video uploaded), but in the latest version, it is not. I didn't come across such a comparison in Java, Matlab, or Python, and it bugged me.
2. If you'll upload a newer version of this lecture, I would suggest, please, indicate the type of variable you're using. E.g, when you're showing how to write and if conditional for the first time, indicate that the program understands the variables when you use double quotes and dollar sign, and whether or not it is a string.
3. No need to mention that you've cut the part where you've explained case statement, so maybe you may want to explore that part in the newer version of the video.
If there'll be no newer video on this topic, maybe you'll update the website accordingly. Thank you for the effort.
Can agree 100% with that. He sometimes gives wrong ideas about what's happening behind the scenes. As you've mentioned with string comparison but also with export. In this chapter he should have at least mentioned local and global/environment variables. He just says that we are sending it to the other script which can be confusing. Haven't watched further yet. Not sure if he wants to over simplify stuff or if he really doesn't know better.
Besides this I'm happy that somebody puts so much effort into and provides an 3h video on shell scripting.
Hazal hanim değerli yorumunuz için teşekkür ederim.
thank you, the string processing bit was confusing me.
@@alperenceliktas5028 Yolun açık olsun paşam
@@Deksudo eyvallah seninde kral ❤️
I had BASH script training as port of my Red Hat RHEL Administration III 6 years ago but needed a review of BASH scripting. Very good course. Provides essential information for BASH scripting without insulting your intelligence.
Bro you a fantastic teacher on bash scripting, I have come across. I have been studying Linux for one year but I have not come across scenarios based cases like these. Congratulations I hope this knowledge would help me to land a job.
We created a written version of this course: linuxhint.com/3hr_bash_tutorial/
i hardly sit 1 full hour on tutorial ...But you managed me to sit one full hour ...Thank you.
You explain things very well. A full 2 hour course on awk would be good!
Awk is a good idea! We'll do it soon!
BEST. OPENING. STATEMENT. EVER!! LOOOL. "I guarantee.. you will know about bash scripting, more than......... a lot more people." #facts Thank you for putting together this course!
Just finished the video. This was an excellent. Would it be possible for you to do a Part 2 where you go over over commands/create an "Advanced" video? Thanks again for the great video! Really appreciate you putting this out there man!
Thanks Very useful video. Case statement is missed at 29:40. Found source code for it at 30:09 thanks.
CLICK the link below & Join now to get access to Membership and Perks:
ruclips.net/channel/UCHErB0TULAlldbhPMfBJ1Xgjoin
At 1:12:40 ,does the program know that you are comparing the length of strings? How?
Thanks ahead.
For the email part (at 2:03:00) , is it possible to send the email from a different address?how?
Thank you sir. It was a tremendous effort from your side to teach through this course.
I request you to bring more course/s on bash scripting. Finally, I completed this course with practice.
Thank you again.
Great video! Just a comment on converting a string to lowercase. At 1:14:00 (close to it), you mention using ${st1^} to convert the string st1 to lowercase. However, ${st1^} converts st1 to proper noun form (i.e., the first letter of the string is uppercase; remaining letters are lowercase). I believe the proper way to convert st1 to lowercase is ${st1,,}.
The string comparison operators are not comparing lengths they are comparing ascii values. You can test this by entering "A" for the first string and "a" for the second string. You will see that "A" is smaller because it has an ascii value of 65 and "a" is larger because it has an ascii value of 97.
Thank you so much sir this tutorial helps me lot learn shell scripting and way of explanation was fabulous
there's a mistake in a section about strings, when you want to change string to lowercase you should use ${string,,} rather than ${string^}
I am search bash script course in Russian RUclips, but i find this lesson, it is really awesome work, ty so much i hope you have inspiration for new video
Thank you very much for investing your time to help people. I learned something new which I don't used to know before. Keep making these types of videos it helps a lot
Very good course. I studied Intro to linux and I remember things from the course studied on here. But in the course i didnt understand it. Until i went through you video
thank you i finally understand what i studied on the course.
Section:
0:55 Hello Bash Scripting
5:25 Redirect to file
8:49 Comments
11:49 HereDoc
14:01 IF Conditional Statement
16:47 IF-ELSE Conditional Statement
19:00 ELIF Conditional Statement
21:18 AND Operator
26:21 OR Operator
29:10 CASE Conditional Statement (Incomplete explanation)
29:47 Loops
30:19 WHILE Loop
33:54 UNTIL Loop
36:20 FOR Loop
39:44 BREAK and CONTINUE Statements
45:29 Script input (STDIN)
55:58 Script output (STDOUT and STDERR)
1:01:40 Pipes (Send output from one script to another script)
1:05:53 Strings processing
1:15:39 Numbers and Arithmetic
1:20:56 Convert from Hexadecimal to Decimal Numbers
1:23:07 DECLARE command
1:28:27 Arrays
1:35:06 Functions
1:43:10 Files and directories
1:58:42 Sending email via script
2:05:20 Curl
2:12:44 Professional Menus
2:31:12 grep
2:41:37 awk
2:51:54 sed
3:02:24 Debugging
Great course. Suggestion : use Gedit with Embedded Terminal plugin. It makes it even easier to try these bash script. See also gedit-plugin-word-completion .
Excellent material to understand the basics of bash scripting. Deeply appreciate your efforts.
still til now the 2nd best bash scripting source OF MY OWN choice
Dude... crushed it. So good.
1:15:10
Actually, to change the string cases, here are the right options:
1) To upper case: str=${str^^} this is a string -------> THIS IS A STRING
2) To lower case: str=${str,,} THIS IS A STRING -------> this is a string
3) To start with a capital letter: str=${str^} this is a string -------> This is a string
^does not change the case to lower, two commas do
Hope this helps someone.
Thanks buddy! Yesterday in 4 days I completed this tutorial. I am not from the programming field.
thanks you so much for your kindness bro
29:45 i think you forgot CASE statements? something went wrong in editing? you begin but dont end?
yeah i noticed it too
yes it's missing
busted! :D
At 30:14 you can see the code he wrote at least. But there is no explanation of course....
So, I tried to figure out what must have been the original code and purpose of it. Instead of going through lot of if statements, you set cases. You have one question to the user and in case his response in BMW, your script returns BMW.
It should look something like this:
!# /bin/bash
echo "What is the make of your car?"
read car
case $car in
"BMW" )
echo "It's BMW" ;;
"Mercedes" )
echo "It's Mercedes" ;;
"Toyota" )
echo It's Toyota" ;;
"Honda" )
echo "It's Honda" ;;
* )
echo "unknown car name" ;;
esac
I hope this helps.
It should be noted... for conditions. If you're running a COMMAND like if grep -q somethingsomething file.txt then you DO NOT put [ ] around it. You only put [ ] around your if if it's an expression like "is 10 = to 9?"
Liked your video as it deserves it. Fascinating method of explaining hard topics easily. Thank you
Well explained....
It is really worth to watch.
Thank you so much for your time and this session plus the basis examples to keep the actual point's to be in clear 🙂
Thoroughly enjoyed the course. Thank you
really best lecture to the point teaching no time waste
1:42:30 The variable inside the function is still a global variable, you need to use keyword local for local variables that are visible inside functions only.
Thank you based roshan
Kudos to the tutor🙌🙌. Looking at the time on the top of his screen, one can imagine the time it took to create this video
This is "BASICALLY" a good tutorial
This was great! Thank you for the thorough explanation. I had trouble with sudo executions for Mac. Other than that it was a wonderful tutorial.
Thank you so much for providing this helpful tutorials on shell script. It's really help me to clear out doubts. Thanks a lot.
Can you please provide me shell script for a program. I have achieved 60% stuff. So the question is : Find 1 days old files then zip all those files and remove that zip file after 5 days. Please help me
@1:14:41 the string linuxhint the L is printed in uppercase if the ^ operator converts the string in the lower case then why the L is printed instead of l
Please clarify if anyone knows
I spent 1 week going through this course
One week well spent
Please can we have a crash course on how to create a bash script for CSV file manipulation and reporting
omg thank you so much!!!!!! , I writed everything like code program (like a notepad) for remember when to need !!
mil likes cara ! (thousand likes dude) from Brazil ^^
Can u please share ur notes with us
@@sachin-chaurasiya if u write it by yourself then only you gotta know that closely
@@sachin-chaurasiya I like to write for learn better... but I will share ( I am brazilian..., so will be something in portuguese, and my english is bad....)
@@sachin-chaurasiya
just copy and past to notepadd , for example: tutorial_bash.sh :
#!/usr/bin/env bash
clear
#for use terminal comands just type here...
echo hello world
:'
#I cannot use simple aspas in some cases just " "
read -p "type your name: " name
echo "welcome $name!"
'
############################ conditions: ################################
:'
eq-> equal
ne -> not equal
gt -> greater than
lt -> less than
'
x=10
:'i could use [[ $x -eq 10 && $x -lt 20 ]] &&, ||
or [ $x -eq 10 -a $x -lt 20 ] -a means and -o means or '
if [ $x -eq 10 ] && [ $x -lt 20 ]
then
echo "condition true"
else # i can use elif too
echo "condition false"
fi
:' i can use >, 10 ))
'
#################### loops #########################
i=0
while (( $i < 10 )) #i can use: until (( $i < 10 )) but stop when condition is true
do
echo $i
i=$(( i+1 ))
done
#
for i in {0..20..2} # {start..end..increment} or for ((i=0;i bigger, \< smalller
#concatenar strings
string1="any"
string2="thing"
conca=$string1$string2 # or conca=$string1\ $string2 for space between
echo ${string1^^} # uppercase string and ${str^} only first letter maiuscula
####### operation ####
:' + , - , *, /, %'
####### array ###########################3
array=('alec','o terrivel alec' 'luca' 'douglas')
# how you can see, the ',' don't separe array elements... its the space
echo ${array[0]}
echo ${array[@]} #for print all array
echo ${!array[@]} #array index
echo ${array[@]} #array size
unset array[1] #free the position (remove)
##################### functions ############################
function funcPrint()
{
echo $valor
valor=10
#echo $1 $2 $3 $4
}
valor=-5
echo $valor
funcPrint hello this is function
echo $valor #the variable is modificated inside the function
###### check directory ##
:' direct='pasta1'
if [ -d "$direct" ] (and use -f for check file) '
####debug ####
# when you compile use: "bash -x" before
# use: set - and set + for delimitate the region the debug
################################################################################
#usefull
:'grep (modificar expressoes regulares)
awk (encontrar mensagens em um arquivo de texto e modifica lo)
sed (text manipulation)
'
#Nivestar notepadd! #########
I hope I've helped ^^
what happens there at 29:45? Edited out case statements?
Explanation is simply superb...Thanx a lot sir to give from scratch. But y skip case statements multiple if else conditions
This was an amazing introduction to bash scripting. Great work, it helped me a lot.
Loved this one. Learned so much i never knew. Thanks ser!
so helpful! thank you so much for sharing this with us Malik!
Thanks for all dedication and knowledge that you share.
This is a perfect linux learning task. Thanks! 😁
Fantastic ! Easy to understand and amazing tutorial to get started with Bash Scripting, helped me a lot ! Thanks ! Keep the great work !
Great tutorial with detailed explanations for the beginers..!!
God bless you anywhere you are!!
Excellent content
Useful tip guys, do not let the length of the video scare you. Set speed to 1.75x
This way of demonstrating is best for me, this is how I can learn, thank you for this method
Why is variable wrapped in quotes when used for comparison? "$age" -gt 18 at 24:00 min
Yeah, it didn't make sense to me either, but if you try it another way, it gives an error message. I tried it.
Your content is fantastic.
At 29:45 the case statement is not explained.
So, I tried to figure out what must have been the original code and purpose of it. Please read below.
Instead of going through lot of if statements, you set cases. You have one question to the user and in case his response in BMW, your script returns BMW.
It should look something like this:
!# /bin/bash
echo "What is the make of your car?"
read car
case $car in
"BMW" )
echo "It's BMW" ;;
"Mercedes" )
echo "It's Mercedes" ;;
"Toyota" )
echo It's Toyota" ;;
"Honda" )
echo "It's Honda" ;;
* )
echo "unknown car name" ;;
esac
I hope this helps.
Thank you! I went from knowing very little about Bash scripts to feeling like I could do a lot!
What a very useful resource, thank you.
Great video, explained very simple and clear, helped a lot, thank you for taking your time to do this
Thanks for the written article
Bloody awesome tutorial man, thank you.
Simple details and straight to the point.
Thanks a lot mate! You're legend. Great tutorial!
Thank You so much 🙏🏽
This helped me a lot . very clear explanation and easy to follow.
Thanks !!! subcribed! great job, hi from Uzbekistan
you explained well i gained a lot concepts i need for a bash scripts thanks more
Thank you so much sir
learned so many basic concepts
Great video! What happened to the segment with the case statements in the half-hour mark?
yes im wondering the exact same thing lol
Same here..
Booyakasha! Check it, 10 hours later and me finally gots to the end. Big up yourselves if you rolled dis slow.
Thanks sir
It helps me in exam next week
Lovely. Which test bro?
what exam ?
good work making this course. much appreciated
what a nice course... big thanks from turkey
Bash is so much similar to Java. God Bless all those who commented the Timestamp.
to install gedit write this command apt-get install gedit and if you see [Y/n] hit y
that's all thanks
For people who cant figure out why they get error messages when they run the install command:
I had the same problem, just run sudo apt-get update && sudo apt-get upgrade, hit Y
and then just run the sudo apt-get install gedit command and everything should work
thanks a lot.
you are pro in bash scripting.
great
love from Pakistan
Excellent tutorial my friend!
I really appreciate for the effort. I have learnt a lot by watching this video. Is there any course after this one, i.e. in somehow advanced level? Please let me know if there is some.
Thanks again
Regards
Shirzad
You explain well, but there are random cuts in the content. For example the "case", you start to explain, but suddenly it jumps to the loop???
In your remove script 1:57 you don't quote variable name in " " so if user inputs an space before name, everything in that directory could be deleted because bash can interpret space as everything in that directory. "${FILE_NAME}"
GREAT CONTENT!!
very thankful to you for your great job
Yes clear and easy to understand.
This helped me learn a lot, thank you!
Thank you for this course!
C program using stat system call and stat structure to display details of all files in
the current working directory whose size is greater than or equal to 300 bytes and accessed
yesterday.
int stat(const char *path, struct stat *buf);
int readdir(unsigned int fd, struct dirent *dirp, unsigned int count); // man 2 readdir
struct dirent *readdir(DIR *dir); // man 3 readdir
Please help me out bro
What company do you work from? I guess you have a background in device drivers and linux kernel programming? Make interview questions also for companies like Qualcomm, Nvidia, Samsung which usually work on these things
Awesome video thank you for this I am a new subscriber. I was wondering after I complete this course what resources would you recommend to keep improving my Bash scripting.
Completed till 1:59:00, need to continue post that
Nice one 👍 1:34
Great information.. This course I believe will help anyone with the technical career. I cannot reframe from telling you that I am a publics speaker. I have belong to Toastmasters International. Where one of the things that will cause lost of point are crutch words. Umm, So, and So. You could greatly increase your delivery of you content by not using that word over and over again and again. Go back and count the times you used that word and remove and see the different. They is not any thing wrong with your English and the information is priceless. I find the use of the word painful.
Informative video but Why switch statement is skipped after if else explanation ?
Indian youtubers are creating the next generation's IT crackheads. Thank you for your effort sir, hell of a video for beginners.
1. At 53:55 are you using stdin or arg1 as input file? I think you meant you are redirecting stdin to arg1 so now /dev/stdin is replaced by arg1 file.
2. At 1:14:50 it is capitalizing without ^l also, and same you are doing it at 1:15:10. Whats the difference? As per my tests it will not capitalize any other character other than 'l', provided one entered any other strings which is not starting with 'l'
Make videos on sed and awk.
Great tutorial.
At 1:11:00 >,< compares string lexographically not lengthwise
Good thing I can pause video or come back to it for clarification.