Blog
Mert Özen's blog posts on software development, backend, frontend, and DevOps.
Testing Scripts and Making Them Portable: ShellCheck, shfmt, bats-core, CI and From Bash 3.2 on macOS to Bash 5.3
Bash scripts are linted with ShellCheck, formatted with shfmt and tested with bats-core using stubs placed on PATH, and all three should run in CI on every pull request. We write tests for Bookstore's deploy script and library, wire them into GitHub Actions, and run the same tests on Bash 3.2 on macOS, on Bash 5.3 and on Ubuntu 26.04's Rust coreutils to show where portability breaks.
Variables, Quoting and Expansion: Parameter Expansion, Command Substitution, Arrays and the Word Splitting Trap
In Bash you should always use a variable inside double quotes, because an unquoted value goes through word splitting and globbing, and a file name with a space can get the wrong file deleted. Using Bookstore's health script we show the expansion order, parameter expansion, command substitution and arithmetic, indexed and associative arrays, export and ShellCheck, and explain the rm -rf with an empty variable and macOS Bash 3.2 traps with real output.