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.
15 Nov 2026
·
15 min
·
15