Skip to main content
Writing better Bash scripts

Series articles: Writing better Bash scripts

Level up your Bash scripts with logging, parallelism, docs, and tests.

📄 View this series as plain Markdown

Follow the "Writing better Bash scripts" series

They land in your feed reader on their own — no account, no email address, nothing to unsubscribe from. Paste this URL into your reader:

https://www.avonture.be/series/writing-better-bash-scripts/rss.xml

No feed reader yet? Start here — it takes two minutes.

Linux - Bash scripts - Running unit tests with bats/bats
Testing

Linux - Bash scripts - Running unit tests with bats/bats →

Learn how to effectively unit test your Bash scripts on Linux using the powerful bats (Bash Automated Testing System) framework. See practical examples for assertions, output checks, and failures.

July 10, 2025

Linux - Using a progression bar in your script
Bash

Linux - Using a progression bar in your script →

Add a visual progression bar to your Bash scripts on Linux. This guide shows you how to easily implement a progress bar to track concurrent jobs, visualize progress, and improve your terminal user interface.

October 7, 2024

Linux - Take advantage of the number of CPUs you have; start concurrent jobs
Bash

Linux - Take advantage of the number of CPUs you have; start concurrent jobs →

Optimize your Bash scripts! Learn how to run concurrent jobs and leverage all your CPU cores using process IDs (pids), wait, and nproc to dramatically reduce execution time.

October 6, 2024

Linux - Generate documentation from Bash scripts
Bash

Linux - Generate documentation from Bash scripts →

Learn to auto-generate documentation for your Bash scripts on Linux. This guide provides a custom script to parse function doc blocks and create structured Markdown files automatically.

July 29, 2024

Linux - Compare two versions of the same script
Linux

Linux - Compare two versions of the same script →

Use a simple Linux command-line trick with diff, grep, and awk to compare two versions of the same Bash script. Quickly identify missing or new functions across file versions or entire folders.

July 28, 2024

Linux - Sort functions in a Bash script
Bash

Linux - Sort functions in a Bash script →

Learn how to use diff and sort in Bash to check if functions in your shell scripts are defined in alphabetical order. Includes a script to scan an entire directory.

July 28, 2024

Bash - Echo on the console and in a logfile in the same time
Bash

Bash - Echo on the console and in a logfile in the same time →

Tired of silent Bash scripts? Learn the simple, effective method to simultaneously echo command output to the console and write it to a log file line-by-line.

May 3, 2024

Bash - Script to add logging features to your script
Bash

Bash - Script to add logging features to your script →

Add robust logging features to your Bash scripts with this simple, reusable library. Get automatic log files, timestamps, and full function call traces for easy debugging.

May 1, 2024

Bash - ASCII art
Bash

Bash - ASCII art →

Learn how to add eye-catching ASCII art banners to your Bash scripts for a bigger visual impact. Includes a full sample code implementation.

December 19, 2023

Bash - Loading environment variables from a file
Bash

Bash - Loading environment variables from a file →

Learn how to load environment variables from a .env file into a Bash script, so you can externalize configuration and reuse variables across other applications like Laravel.

December 19, 2023