Quoting

noun

say it: “KWOH-ting” /ˈkwoʊtɪŋ/

Putting quotes around text in a command so the shell keeps it as one piece; double quotes still fill in variables, single quotes keep every character as typed.

What is quoting in the shell?

Quoting tells the shell where a piece of text starts and ends. Without quotes, the shell splits text at every space, so reminder=wind daily fails. Inside double quotes ("…") it still fills in variables such as $part; inside single quotes ('…') it keeps every character exactly as typed. Braces, as in ${part}s, mark where a variable's name ends.

reminder="wind daily"
part=feather
echo "12 ${part}s"     # 12 feathers
echo '12 ${part}s'     # 12 ${part}s

In a sentence

  • “Single-quote quoting kept the dollar sign in the price, so echo printed $36.00 instead of an empty space.”
  • “Without quoting, bash split "wind daily" into two words and tried to run daily as a command.”

Level: Apprentice · More Unix terms at this level

Updated