Bash Scripting
- 2 minsThe following is a list of published articles I wrote about Bash scripting.
Bash: How to Delete Empty Lines Using Sed
In this article, we explored how to use sed
to eliminate those pesky empty lines, making your scripts and text files cleaner and more manageable.
We started with the basics of the sed
command and the regular expressions used to identify empty lines. Then, we combined that knowledge to help you remove all types of empty lines.
[Read more here]
Reading and Writing CSV in Bash
In this article, we took a look at various ways to read and write CSV files in Bash.
We explored the different tools available and provide examples of how to use them. This article will provide you with the information you need to effectively work with CSV files in your shell scripts.
[Read more here]
Comparing Numbers in Bash
In this article, we provided a comprehensive overview of comparing numbers in Bash. We covered the basics of arithmetic operations, comparison operators, and how to use these operators within an if
statement.
We also discussed different methods for comparing numbers and strings in Bash, providing examples along the way.
[Read more here]
Guide to Parameter Expansion in Bash
In this guide, we go over parameter expansion in Bash. We explained what it is, why you should consider using it, how to use it, and, finally, give you several tips on how to use parameter expansion in Bash more efficiently.
[Read more here]
How to Get the Source Directory of a Bash Script
The article covers the basics of the $0
parameter in Bash, which holds the name of the script.
We then discussed the dirname
command, which is used to extract the directory portion of a file path.
Finally, we put everything together to demonstrate how to get the source directory of a script using these tools.
[Read more here]
How to Grep Recursively in Bash
This article covers the basic syntax for recursive grep
, practical use cases, and advanced options to help you become more proficient in using this powerful tool.
[Read more here]
What Does “2>&1” do on the Command Line?
In this article, we discussed what 2>&1
is, how it works, and its various use cases.
With a deeper understanding of 2>&1
, developers and system administrators can use it to streamline their workflow and troubleshoot issues more effectively.
[Read more here]
Other Notable Articles and Guides
- How to Check if String Contains Substring in Bash
- Bash: Check if Directory or File Exists
- Bash: Difference Between [ and [[ Operators
- Extract Filename and Extension in Bash
- Print Newline in Bash