Bash: Guides and Practical Know-how | Page 13 | mironsoft Blog
Bash
-
May 5, 2025
A migration runner ensures database schemas change traceably and in the right order across multiple environments. This article shows how to build a custom migration runner in Bash, with a tracking table, checksum verification, transactional execution, and a slim command line interface for up, down, and status.
-
May 3, 2025
As soon as a Bash script reads configuration from more than one source, the load order determines its behavior in production. Scripts that do not deliberately prioritize system environment, .env file and command-line overrides tend to work fine on one machine and silently pick up the wrong value on a colleague's laptop or in a CI runner.
-
May 3, 2025
Iterating over filenames that contain spaces is one of the most common mistakes in shell scripts. for f in $(find ...) breaks on spaces, tabs, and newlines in filenames. find -print0 with null byte separation, correct globbing, and read -d '' solve the problem once and for all: reliably, portably, and without special-case logic.
-
Apr 30, 2025
Bash gives you three different ways to do math, $(( )), let, and (( )), that look interchangeable at first glance but differ in return value, exit status, and error behavior. Anyone who does not know the integer limits of 64-bit systems, the lack of floating point, and the typical traps around comparison operators ends up with scripts that suddenly produce wrong results, or abort entirely, for certain inputs.
-
Apr 28, 2025
A raw diff output is technically complete but hard to read in a terminal, because lines marked with plus and minus barely stand out visually. This article shows how colored diff output emerges in Bash scripts, from ready-made tools like colordiff and git diff to your own ANSI coloring with awk for edge cases no standard tool covers.
-
Apr 26, 2025
CSV exports from ERP systems, inventory management, or legacy databases almost always need to become JSON before they can be imported into modern APIs. A CSV to JSON pipeline built from mlr, jq, and Bash glue code handles type coercion, nesting, and validation without a single line of Python.
-
Apr 21, 2025
Passing a password as a command line argument leaves it permanently in Bash history, visible to anyone who later uses the same shell. This article shows how secrets end up in Bash history, the process list, and logs, how HISTCONTROL and safe handoff methods prevent that, and how to search existing history files for forgotten credentials.
-
Apr 20, 2025
A snapshot test saves a Bash script's output once as a reference and automatically compares it against the current result on every subsequent test run. Normalize volatile values like timestamps, process IDs, or generated UUIDs before comparing, and you get a safety net against unintended changes in scripts that are otherwise hard to test with classic assertions.
-
Apr 20, 2025
A good changelog generator reads the commit history, recognizes the type and scope of every change, and builds a structured CHANGELOG.md from it, with no manual editing required. This article shows how such a changelog generator can be built as a plain Bash script, what pitfalls appear when parsing Conventional Commits, and how the result plugs cleanly into a release pipeline.
-
Apr 17, 2025
When a production system starts behaving unexpectedly, the quality of your diagnostic toolset decides whether the outage lasts minutes or hours. ps, top, ss, lsof and journalctl together provide a complete picture, provided you know the right flags and combine them into targeted Bash helpers.