Search
3 results for “variables”
Search results
Why should variables almost always be quoted, e.g. `"$name"` instead of `$name`?
An unquoted variable expansion undergoes word-splitting (on whitespace) and globbing (on `*`, `?`, etc.) before the command sees it, so a value containing a space or a shell metacharacter silently becomes multiple arguments or an unintended file-glob expansion instead of one literal string. Quoting (`"$name"`) suppresses both, so the variable's value is always passed through as exactly one argument, which is why nearly every Bash style guide treats an unquoted variable expansion as a latent bug rather than a style preference.
The Tiny Tool That Would Have Stopped a Production Deploy Gone Wrong
Use direnv to load project-specific environment variables on entry, restore prior shell state on exit, and reduce wrong-account Terraform deploys.
Bash Fundamentals
Bash scripting from variables to functions, plus the quoting and exit-status habits that separate a script that looks right from one that fails safely.