Programming By Stealth
PBS 153 – Bash: Functions & Scope

PBS 153 – Bash: Functions & Scope

Programming By Stealth

1:06:32

About this episode

In Programming By Stealth, we’ve come to the end of our journey with Bash. I’ll be sad to have it complete because as I tell Bart in this episode, I’ve really enjoyed it. Next time he will do a final bow-tying episode where he brings everything we learned together in one set of notes as a handy reference guide.

In this episode, he explains how functions work in Bash, and after about the 12th time he repeated it, I understand that functions we create in Bash work just like built-in functions such as ls or cat.

After walking us through some easy-to-follow scripts to illustrate this and show us the syntax, we go into a harder concept: scope. We learn that Bash does scope differently from pretty much every other language, and so he teaches us how to avoid spooky action at a distance because of this different way of dealing with scope. Protecting ourselves isn’t actually hard but it is very important to understand why we need to do this.

You can find Bart’s fabulous tutorial shownotes at pbs.bartificer.net.

More from Programming By Stealth

In this week's installment of Programming By Stealth, Bart wraps up his Jekyll on GitHub miniseries as he explains how to use data files, control permalinks, and set defaults in our front matter. At t…

1h 10m

In our penultimate installment of the Jekyll miniseries, Bart teaches about collections. They're a bit difficult to explain briefly because collections can be whatever you want them to be. To illustra…

1h 8m

Bart continues us on our journey to use Jekyll with GitHub Pages to make a proper website. Most proper websites these days include a blog, so that's what he tackles this week. With a few for loops, a…

1h 4m

We dust off our memory from where we left off learning about Jekyll back in PBS 181 in June of last year. After some housekeeping, Bart takes us through the challenge solution from PBS 181, and then t…

1h 14m