As another great year wraps up at Opensource.com, my fascination with all things Bash has me looking back at the top 10 Bash articles we published in 2019. These articles include basic how-to articles, tools, shortcuts, and even a way to build your own command-line game with Bash.
I didn't select these articles based solely on the number of hits they had but rather on a number of criteria. In the true spirit of top 10 countdowns, the top Bash article from 2019 is at the end for the final reveal.
- Bash vs. Python: Which language should you use? by Archit Modi looks at the strengths and weaknesses of these popular languages. Although both have many good points, the bottom line—as with most things Linux—is, "it depends."
- How to program with Bash: Logical operators and shell expansions is the second in a three-part series I wrote about Bash programming. This article lists all of the Bash logical operators and provides some easy examples for using them. It also discusses five of the seven types of shell expansions and includes easy-to-understand examples that help to clarify how these expansions work.
- Abhishek Tamrakar shows us how to Hone advanced Bash skills by building Minesweeper. This is an interesting, fun, and informative way to improve the Bash skills you already have. When finished, you have a working command-line game of Minesweeper and some serious skills. This article is one of my favorites because it not only stretches our skills, but it illustrates the power of Bash as a programming language.
- How to program with Bash: Syntax and tools is the first article in my Bash programming series. In addition to introducing Bash as a programming language, it looks at the basic syntax of Bash programming, the use of variables, and flow control.
- Matthew Broberg's The birth of the Bash shell delves into the history of the Bash shell with a look at how it all started with Unix and the original (Ken) Thompson shell. As someone who appreciates the historical roots of Linux and many of its components, I gained some new insights from this article.
- Seth Kenlon contributed How to write a loop in Bash, which explores the for loop in some detail. A for loop is a recipe detailing what actions you want your computer to take for each data object (such as a file) you specify. This article has some excellent examples to get you started and shows the power that loops can bring to Bash scripts.
- 7 Bash history shortcuts you will actually use shows how to save time on the command line by using Bash shortcuts. Ian Miell describes time-saving tools that go far beyond just simple command-line recall. These are very cool, and I especially like the easy method for reissuing the previous command while reordering the arguments.
- Seth Kenlon also shows some Bash aliases you can't live without that will save even more time. This article takes us through one of the ways that we "lazy sysadmins" can become even more efficient than we already are. This is all about less typing while getting more results.
- I always recommend testing scripts to ensure that they do what they are intended to—and that they don't create any other problems while doing so. Darin London introduces us to Testing Bash with BATS, the Bash Automated Testing System, a TAP-compliant testing framework for Bash. The Test Anything Protocol is also used for testing many other Unix languages. This article is loaded with examples and recommendations for structuring Bash programs so that they can be tested easily with this tool.
- Our number 1 spot for 2019 is—drum-roll—Seth Kenlon with 3 command line games for learning Bash the fun way. Learning is work, but it can be fun. If you are into games (and it seems that we sysadmins like to have fun), this article looks at three tools for learning more about Bash for everyone from noobs to gurus. Everything you do in the game of Bashcrawl, for example, is a valid Bash command that you can use later in real life, and playing the game provides Bash practice because the "game" is made out of actual directories and files on your computer.
These articles can help you learn Bash and some of its many powerful features. I have certainly learned a lot from them.