There are those who know how to streamline the code you showed, but I appreciate that you explained variables, if, case, sed, & awk in just a few lines of code in just 16 minutes. This was helpful for us noobs out here. Thank you.
@@BreadOnPenguins I'm very new to bash scripting so your "quick & dirty" is very helpful to see the process, as well as the different options you presented. Keeping it simple for noobs such as myself is appreciated. Knowing there are more advanced ways of doing the same thing is cool, but I'm not quite there yet.
sed and awk are two tools everyone should get to grips with, they're incredibly powerful. Love the vids! Keep it up! Still learning new things even after 30 years of Linux..
I hope you maintain interest in this channel and that it grows more. There seems to be some sort of Linux oriented market on youtube, currently. I'm a dude working in CI, where we automate stuff a lot using bash scripts. Probably this video would've helped me when I started out with it, like half an year ago.
These kinds of videos, where you use several different tools in combination, really show the strength of command-line proficiency. I learn something from every one of your videos! I would love to see you flex more of your sed/awk skillset because that stuff is fascinating.
The case / esac combination comes from the gentleman who wrote the Bourne shell and comes from the Algol programming language which used reversed keywords to mark the end of code blocks. Glad that I discovered your channel a short time ago!
excellent video, actual practical example demonstrating multiple concepts, unlike some other first bash script videos I've seen. look forward to more from you! thanks
Greetings from Romania! Just discovered your channel. Very well-structured content with very clean explanations from such a young girl. :) You can easily become a teacher. :P Keep up the good work!
SWEET! As promised. Sadly I'm too busy preparing for a professional certification exam to dive into this until week after next, but I am excited to get started.
Thank you! I have a few videos going through how I've configured some aspects and will make more on the subject. I will eventually make a repo for dotfiles (but I'll have to clean up and organize everything neatly, first).
Hey that's an interesting one, I just looked it up since I hadn't known about it before, apparently it applies to many different animals in order to camouflage. Thanks for sharing!!
Closing an if statement with 'fi' is not unique to Bash, it was also the convention in Bourne script, the predecessor to Bash, as well as most other Unix shells, so they just kept it. Dude who wrote Bourne came from Algol 68 where the reverse closing delimiter was originally used. So 'if/fi', 'case/esac' are unique but you close 'do' with 'done' because 'od' was already used. The others like 'while', 'for' or 'until' are called within do and don't need a terminating delimiter. So basically it's just creative arbitrary decisions of old.
I know you are doing beginner-level tutorials for now, but I hope one day you make one about the more obscure aspects of utilities like sed, awk, xargs, grep, etc. Oh, and regex... :P
1:37 Fun fact: you don't even need to look beyond Linux to see that, NixOS doesn't have /bin/bash, so you are forced to put /usr/bin/env bash in the shebang. /bin/sh does exist though.
It's a razer blackwidow v4 atm, but I'm only using it because I got it cheaply from a friend - honestly I wouldn't recommend it since I've had several issues with switches becoming unresponsive, apparently this is a common issue with this model
Why the double brackets in " if [[ $myvar -gt 90 ]] ??? Are they really necessary? Also, out of curiosity, why the case needs double ;; to separate choices?
The shebang line does not tell the shell how to run the script, it tells the kernel how to run the script. It is rather strange to pipe output from awk (the much more powerful tool for text modification) to sed. The solution is to do that in awk (value=$5; sub("%","",value); print value) or in bash: myvar=$( ... ) myvar="${myvar%\%}" But you need neither awk nor sed, you can do that in bash directly: df -h / | ( while read dev v2 v3 v4 percentage rest; do [[ $dev != /dev/* ]] && continue; echo "$percentage"; done )
I did want to show both awk and sed in the video since those are commonly used tools that are worth introducing, even if that's not the "best" way for that particular example. Regardless, I appreciate the full explanations - thanks for commenting!
@@BreadOnPenguins That's awesome that @HaukeLaging was able to condense the script down to one or two lines. Something to grasp in the future as I learn to crawl before I can run. Thank you for explaining awk & sed. I'm new to bash scripting, just a couple of months now and I'm loving the sed command. It's so powerful and yet I know only 10% of it's capability.
Not bash related, but you may want to consider always putting a consistent graphic or photo of a smiling Bread on your video thumbnails. This Bread video almost got overlooked on my little phone.
Nice work! Keep it up! (I get it - you want to show several commands. At least you said it in comments) But - your code could and should be better. Why use more than you actually need for a simple task. #!/usr/bin/env bash clear # Prints disk info: essentials df -h | awk '/\/$/ {print "Used: "$3"\t Available: "$4}' And of course you can do more elegantly with "if then else" statements. DT compared you with Luke Smith. So, why not watch Luke's "Never say "If" writing a Bash script" wonderful video? 😺
Hello, thank you for commenting! I have indeed seen Luke's video; if I recall, there was significant debate in the comments over concise vs elegant. Verbosity can be appropriate in the circumstance that others need to quickly and easily understand your code. Given the concept of this video, my priority was packing in as much as possible. I agree that the end result was certainly not elegant, lol But, especially for personal projects, I prefer concise code, and yes, I do avoid if statements! :-)
Give us this day our daily bread
🍞🍞🍞
You can use the select statement to create and display a menu of items to choose from.
There are those who know how to streamline the code you showed, but I appreciate that you explained variables, if, case, sed, & awk in just a few lines of code in just 16 minutes. This was helpful for us noobs out here. Thank you.
I appreciate that! I do think it could've been better, but the goal was just some quick and dirty code for showing examples. No problem.
@@BreadOnPenguins I'm very new to bash scripting so your "quick & dirty" is very helpful to see the process, as well as the different options you presented. Keeping it simple for noobs such as myself is appreciated. Knowing there are more advanced ways of doing the same thing is cool, but I'm not quite there yet.
A technically literate and practical Linux RUclipsr. I don't think I've ever seen one. Subbed!
Haha thanks very much! :)
Me too 😊
sed and awk are two tools everyone should get to grips with, they're incredibly powerful. Love the vids! Keep it up! Still learning new things even after 30 years of Linux..
For sure - I'll 100% be making vids on both at some point. Thanks so much :) Glad to hear.
I hope you maintain interest in this channel and that it grows more. There seems to be some sort of Linux oriented market on youtube, currently. I'm a dude working in CI, where we automate stuff a lot using bash scripts. Probably this video would've helped me when I started out with it, like half an year ago.
I definitely intend to!
Gotcha, it's not a hard learning curve once you've gotten started. Bash scripting is applicable in so many areas, as well.
I’m glad I stumbled upon your video! My use of bash scripting has been lost over the years
Thanks for stopping by! I've got several other vids going over other useful/practical scripts as well
These kinds of videos, where you use several different tools in combination, really show the strength of command-line proficiency. I learn something from every one of your videos! I would love to see you flex more of your sed/awk skillset because that stuff is fascinating.
Thanks so much - I'm glad to hear that! I'm definitely intending to make full videos for sed, awk, even grep and other tools.
The case / esac combination comes from the gentleman who wrote the Bourne shell and comes from the Algol programming language which used reversed keywords to mark the end of code blocks. Glad that I discovered your channel a short time ago!
Thank you for answering! :)
excellent video, actual practical example demonstrating multiple concepts, unlike some other first bash script videos I've seen. look forward to more from you! thanks
Thanks very much! :)
best concise guide. keep making more such videos
Thank you! Will do
Wow, you rule! You're a great teacher; much appreciated!!
Thank you! :)
Greetings from Romania! Just discovered your channel. Very well-structured content with very clean explanations from such a young girl. :) You can easily become a teacher. :P Keep up the good work!
Thanks very much :)
Thank you very for this on learning bash, truly enlightening video
Glad it was helpful!
Penguinz0 if he was really cool linux person! Love your videos
Haha thanks so much!
Based bash🗿 I'm glad I'm watching this from the terminal
Heck yeah
SWEET! As promised. Sadly I'm too busy preparing for a professional certification exam to dive into this until week after next, but I am excited to get started.
Good luck with your exam!
the contents you makes are amazing!
Thank you! :)
Hey, I like your theme. Your Terminal looks great, your Desktop looks amazing. Would you mind sharing your configurations with us?
Thank you! I have a few videos going through how I've configured some aspects and will make more on the subject. I will eventually make a repo for dotfiles (but I'll have to clean up and organize everything neatly, first).
Hey Bread, great vid! Also, where do you find your wallpapers?? Thery're great
Thank you! :)
Everything from stock photo sites, to /wg/ threads, to looking through work from artists and photographers
the fastest penguin species is the gentoo penguin, which can reach speeds of up to 36 kmph when swimming
Hence the distro name!
Let's gooo! THANK YOU! Keep up the good work!
No problem and thanks for watching! :) Will do
Super useful content, ty
Glad to hear! Np
Luke doesn't care about noobs!
Meanwhile, Luke with his AI girl form:
Lmao
A penguins black and white colouring is called counter-shading.
Hey that's an interesting one, I just looked it up since I hadn't known about it before, apparently it applies to many different animals in order to camouflage. Thanks for sharing!!
Closing an if statement with 'fi' is not unique to Bash, it was also the convention in Bourne script, the predecessor to Bash, as well as most other Unix shells, so they just kept it. Dude who wrote Bourne came from Algol 68 where the reverse closing delimiter was originally used. So 'if/fi', 'case/esac' are unique but you close 'do' with 'done' because 'od' was already used. The others like 'while', 'for' or 'until' are called within do and don't need a terminating delimiter. So basically it's just creative arbitrary decisions of old.
Thanks very much for answering that!
you give off MoistCr1TiKaL vibes
Lol I've gotten that a couple times now
You can use cut -d'%' -f1 instead of sed. Might be a little bit faster
For sure, I was going to use cut but figured it was better to introduce people to awk and sed.
woo woo another good video hehe ^_^
Thank you!
I know you are doing beginner-level tutorials for now, but I hope one day you make one about the more obscure aspects of utilities like sed, awk, xargs, grep, etc. Oh, and regex... :P
Yeah, those are worth going over especially for maximizing efficiency - I'll keep it in mind. :D
Can you make a video about your vim setup ?
Hello, sure! It's on the to-do list :)
Thank you, you are the best creator !
1:37 Fun fact: you don't even need to look beyond Linux to see that, NixOS doesn't have /bin/bash, so you are forced to put /usr/bin/env bash in the shebang. /bin/sh does exist though.
Good to know! All the more reason to use a universally applicable shebang
not sure if anybody asked before but what keyboard do you use ?
It's a razer blackwidow v4 atm, but I'm only using it because I got it cheaply from a friend - honestly I wouldn't recommend it since I've had several issues with switches becoming unresponsive, apparently this is a common issue with this model
Why the double brackets in " if [[ $myvar -gt 90 ]] ??? Are they really necessary?
Also, out of curiosity, why the case needs double ;; to separate choices?
any chance we will see u using wayland ??
I'll probably make a video about it at some point :)
Fun stuff.
You're so cool lol
Lol thanks!
Hope you are using shell check in daily 'bashing'?
That's a useful too as well :)
@@BreadOnPenguins yep, it will keep you on track with latest syntax
double quote "$variables" (almost) always hehe. and double quote "$(captured subshells)" hehe.
The shebang line does not tell the shell how to run the script, it tells the kernel how to run the script.
It is rather strange to pipe output from awk (the much more powerful tool for text modification) to sed. The solution is to do that in awk (value=$5; sub("%","",value); print value) or in bash:
myvar=$( ... )
myvar="${myvar%\%}"
But you need neither awk nor sed, you can do that in bash directly:
df -h / | ( while read dev v2 v3 v4 percentage rest; do [[ $dev != /dev/* ]] && continue; echo "$percentage"; done )
I did want to show both awk and sed in the video since those are commonly used tools that are worth introducing, even if that's not the "best" way for that particular example. Regardless, I appreciate the full explanations - thanks for commenting!
@@BreadOnPenguins That's awesome that @HaukeLaging was able to condense the script down to one or two lines. Something to grasp in the future as I learn to crawl before I can run. Thank you for explaining awk & sed. I'm new to bash scripting, just a couple of months now and I'm loving the sed command. It's so powerful and yet I know only 10% of it's capability.
There are penguins in South America
South America has some very distinctive penguins! The Humboldt penguin is a cool species, super interesting coloring
@@BreadOnPenguins They do have cool coloring! The beaks as well :D
Not bash related, but you may want to consider always putting a consistent graphic or photo of a smiling Bread on your video thumbnails. This Bread video almost got overlooked on my little phone.
Thanks for pointing that out! I'm still experimenting with what thumbnail style works best
Luke Smith transitioned? I was wondering where he went... makes sense... typical linux chud
Lmao
Nice work! Keep it up! (I get it - you want to show several commands. At least you said it in comments)
But - your code could and should be better. Why use more than you actually need for a simple task.
#!/usr/bin/env bash
clear
# Prints disk info: essentials
df -h | awk '/\/$/ {print "Used: "$3"\t Available: "$4}'
And of course you can do more elegantly with "if then else" statements. DT compared you with Luke Smith.
So, why not watch Luke's "Never say "If" writing a Bash script" wonderful video? 😺
Hello, thank you for commenting!
I have indeed seen Luke's video; if I recall, there was significant debate in the comments over concise vs elegant.
Verbosity can be appropriate in the circumstance that others need to quickly and easily understand your code.
Given the concept of this video, my priority was packing in as much as possible. I agree that the end result was certainly not elegant, lol
But, especially for personal projects, I prefer concise code, and yes, I do avoid if statements! :-)
I use the more portable #!/use/bin/env bash
Yup that's what I would recommend :)