If you're just beginning Bash scripting, you may often find yourself repeating the same commands again and again in your scripts, but a better way exists. I will explain what "DRY" means and how you ...
Using a function in bash allows you to create something in Linux that works as if it were a script within a script. Whenever the data being processed matches a set of conditions, your script can call ...
and only files matching my_test_here would make it onto do_something. I love the while-read pattern, but it just doesn't feel right that there's no simpler, built-in, idiomatic way to write a function ...
Once you’ve gained a solid understanding of Linux and mastered the various commands available, your next big win comes in the form of shell functions. Code wrapped in a function can be reused by your ...
We often read (including in the book Advanced Bash-Scripting Guide by Mendel Cooper) that if we pass variable names as parameters to functions, they will be treated as string literals and cannot be ...
Ever wondered why programming in Bash is so difficult? Bash employs the same constructs as traditional programming languages; however, under the hood, the logic is rather different. The Bourne-Again ...
While Linux systems install with thousands of commands, bash also supplies a large number of “built-ins”—commands that are not sitting in the file system as separate files, but are part of bash itself ...
It is easy to dismiss bash — the typical Linux shell program — as just a command prompt that allows scripting. Bash, however, is a full-blown programming language. I wouldn’t presume to tell you that ...