Bash: Guides and Practical Know-how | Page 16 | mironsoft Blog
Bash
-
Jan 24, 2025
find and xargs are among the most widely used shell tools, and among the most frequently misused. The null-byte delimiter, correct parallelization and safe handling of arbitrary filenames are not niche topics; they are the foundation for Bash workflows that keep working reliably on production systems with real filenames.
-
Jan 23, 2025
declare -A can do far more than store a handful of configuration values under readable names. Simulating nested structures, using arrays as sets, and quoting correctly during iteration turn built-in Bash arrays into lookup tables that stay reliable and fast even with thousands of entries.
-
Jan 22, 2025
When an upload fails, an archive appears corrupted, or a deployment script processes the wrong kind of file, no graphical hex editor gets you there faster than a direct look with xxd or od on the command line. Being able to read the first bytes of a file makes formats, corruption and misconfiguration visible faster than any automated tool.
-
Jan 20, 2025
Many Bash scripts only use the case statement for a handful of fixed strings, but it can do far more: multiple patterns in one branch, wildcard combinations, deliberate fallthrough with ;& and ;;&, and case-insensitive matching. Anyone who knows these tools can replace long, hard-to-maintain if/elif chains with compact, readable branches.
-
Jan 20, 2025
Good interactive Bash tools have a clear interface: numbered menus with select, input via read -r with timeout, colored status messages and confirmation dialogs that guard against dangerous actions. All of this is achievable with pure Bash builtins.
-
Jan 18, 2025
A database password in a .env file or a pipeline variable is a secret that eventually ends up in a log, a backup, or a history file. Vault secrets that Bash scripts fetch, verify, and never persist anywhere close exactly that gap, including dynamic database credentials and automatic rotation.
-
Jan 13, 2025
AWS Lambda does not force a specific programming language. Through the Runtime API, any executable file, including a plain Bash script, can act as a full Lambda runtime. Understanding how the bootstrap file fetches events, calls the actual handler and reports the result back makes it possible to run small glue scripts in Lambda without any interpreter overhead.
-
Jan 12, 2025
ulimit controls how many files, processes, and how much virtual memory a process may use, through a clear interplay of soft and hard limits. Knowing the typical cause of too-many-open-files errors in deployment scripts means setting limits deliberately, either scoped to a script's runtime or permanently via systemd, instead of discovering the failure in production.
-
Jan 12, 2025
File permissions in Bash scripts often arise only implicitly through the inherited umask instead of being set explicitly, and that is exactly what leads to unnecessarily broad access rights. This article shows how umask, chmod, and chown are applied systematically, which risks SUID and SGID pose in automation scripts, and how a dedicated audit script reliably checks file permissions.