Quote every expansion until you mean splitting
Use double quotes around shell expansions unless deliberate word splitting or globbing is required.
The move: quote expansions by default. The shell changes shape before commands run Bash does several passes before a command executes. It parses tokens, expands variables and command substitutions, then performs word splitting and filename expansion. If file="Q4 final.csv", the unquoted command cat $file does not pass one filename. It passes two words. If a value contains *, the shell can expand it to matching files. If it is empty, it can vanish. Double quotes keep data as data Use "$var", "${array[@]}", and "$(cmd)" when you want one argument per value. Add -- before untrusted path operands for commands that…
Sign up free — one personalized lesson every day, matched to your role and goals.
Already have an account? Sign in