Interview Prep/Linux/Packages, Shell & Text Tools

What is the difference between single quotes, double quotes and no quotes?

BeginnerConceptPackages, Shell & Text Tools
Answer

Single quotes are literal: nothing expands. Double quotes expand $var, $(cmd) and backslash escapes, but prevent word splitting and globbing. Unquoted variables are split on whitespace and glob-expanded, so rm $file with file="my report.txt" tries to delete two files. Rule: always double-quote variables, "$file".

All Linux questions Roadmap: Linux

More on Packages, Shell & Text Tools