Bash Strict Mode: What set -euo pipefail Really Does
set -euo pipefail is good advice, but each option has rules about when it fires. Here is what each one does and the cases that surprise people.
Archive
set -euo pipefail is good advice, but each option has rules about when it fires. Here is what each one does and the cases that surprise people.
while IFS= read -r line is the correct loop, but the last line, pipes, commands that read stdin and Windows line endings each have a trap. Here they are, tested.
PHP-compatible str_pad() in pure Bash, when printf "%-10s" and %05d are enough, and why multibyte text breaks the alignment of your columns.
A correct in_array() for Bash, an associative-array set for many lookups, and a demonstration of why [[ "${arr[*]}" =~ value ]] gives false positives.
Two small functions that stop search boxes and scroll handlers from running too often, with a runnable timeline that shows exactly when each one fires.
PHP's explode() and implode() in Bash: read -ra and mapfile -d for splitting, "${arr[*]}" for joining, and functions that cope with multi-character delimiters.
What the backend really receives behind nginx: proxy_pass URI rewriting, Host and X-Forwarded headers, WebSocket upgrades, 504s from timeouts, and streaming.
Replace text in a Bash string without sed: ${s//search/replace}, anchored replacements, why you must quote the search, and what Bash 5.2 did to &.
One missing slash nests a directory. One empty source wipes a backup. Tested rsync recipes for mirroring, filtering, verifying and copying over SSH.
PHP-style trim(), ltrim() and rtrim() in pure Bash with parameter expansion, plus why the popular read trick quietly removes your backslashes.