Why should you quote variable expansions in bash?
⚡
Quick Answer
Unquoted $var undergoes word-splitting and glob expansion, breaking on spaces or special characters.
Detailed Answer
"$var" preserves the value as a single word; unquoted it splits on whitespace and expands globs, causing subtle bugs with filenames containing spaces. Always quote expansions and use "${arr[@]}" for arrays. shellcheck flags missing quotes automatically.
Code Example
for f in "$@"; do echo "processing: $f"; done
💡
Interview Tip
Mention shellcheck as the linter that catches this.
bashquotingshellcheck