# Question about Single vs. Double Quotes

**URL:** <https://boards.straightdope.com/t/question-about-single-vs-double-quotes/349617>\
**Category:** Factual Questions\
**Created:** [March 23, 2006, 6:19pm UTC](https://boards.straightdope.com/t/question-about-single-vs-double-quotes/349617 "2006-03-23T18:19:51Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![dolphinboy](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/dolphinboy/32/330_2.png) [@dolphinboy](https://boards.straightdope.com/u/dolphinboy)\
**Post date:** [March 23, 2006, 6:19pm UTC](https://boards.straightdope.com/t/question-about-single-vs-double-quotes/349617/1 "2006-03-23T18:19:51Z")

</div>

I must have been napping in High School when my English teacher explained this, but when is it appropriate to use single quotes, versus double quotes, around a word or phrase in a sentence?

---

<div class="post-metadata">

**Author:** ![RealityChuck](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/realitychuck/32/195_2.png) [@RealityChuck](https://boards.straightdope.com/u/RealityChuck)\
**Post date:** [March 23, 2006, 6:26pm UTC](https://boards.straightdope.com/t/question-about-single-vs-double-quotes/349617/2 "2006-03-23T18:26:40Z")

</div>

In the US, double quotes are used to indicate quoted material. Single quotes are used for quotes within quotes:

He said, “My boss said, ‘Put up or shut up.’”

In the UK, it’s often the opposite.

---

<div class="post-metadata">

**Author:** ![Garfield226](https://avatars.discourse-cdn.com/v4/letter/g/9e8a1a/32.png) [@Garfield226](https://boards.straightdope.com/u/Garfield226)\
**Post date:** [March 23, 2006, 6:27pm UTC](https://boards.straightdope.com/t/question-about-single-vs-double-quotes/349617/3 "2006-03-23T18:27:34Z")

</div>

Double quotes are used for quoted material (duh), as well as sometimes around words when you’re talking about the word itself.

e.g. The word “itself” is interesting, because. . .

Single quotes are generally only used when you’re quoting someone who is quoting someone else. You use the single quotes inside the double quotes.

e.g. I was talking to Bill, and he said, “You’ll never guess what Susan told me. She said, ‘Jay likes to use packaging tape instead of duct tape!’ I couldn’t believe it.”

Also, if you’re in the newspaper industry, you generally never use double quotes in headlines. That’s our style, at least.

e.g. Chancellor to University: ‘You suck!’

---

<div class="post-metadata">

**Author:** ![iamthewalrus\_3](https://avatars.discourse-cdn.com/v4/letter/i/258eb7/32.png) [@iamthewalrus\_3](https://boards.straightdope.com/u/iamthewalrus_3)\
**Post date:** [March 23, 2006, 6:48pm UTC](https://boards.straightdope.com/t/question-about-single-vs-double-quotes/349617/4 "2006-03-23T18:48:52Z")

</div>

Double quotes allow for the expansion of variables within a string. Single quotes do not.

Example:

\> which “$EDITOR”  
/usr/bin/emacs

\> which ‘$EDITOR’  
$EDITOR: Command not found.

---

<div class="post-metadata">

**Author:** ![CookingWithGas](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/cookingwithgas/32/485_2.png) [@CookingWithGas](https://boards.straightdope.com/u/CookingWithGas)\
**Post date:** [March 23, 2006, 9:12pm UTC](https://boards.straightdope.com/t/question-about-single-vs-double-quotes/349617/5 "2006-03-23T21:12:48Z")

</div>

> [@iamthewalrus(:3=](#):
>
> Double quotes allow for the expansion of variables within a string. Single quotes do not.

You forgot a smiley. And that’s only for PHP (AFAIK), which is not English.

🙂

---

<div class="post-metadata">

**Author:** ![pulykamell](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/pulykamell/32/3166_2.png) [@pulykamell](https://boards.straightdope.com/u/pulykamell)\
**Post date:** [March 24, 2006, 2:14am UTC](https://boards.straightdope.com/t/question-about-single-vs-double-quotes/349617/6 "2006-03-24T02:14:24Z")

</div>

> [@CookingWithGas](#):
>
> You forgot a smiley. And that’s only for PHP (AFAIK), which is not English.
> 
> 🙂

PERL, too…

---

<div class="post-metadata">

**Author:** ![Balthisar](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/balthisar/32/2825_2.png) [@Balthisar](https://boards.straightdope.com/u/Balthisar)\
**Post date:** [March 24, 2006, 11:43am UTC](https://boards.straightdope.com/t/question-about-single-vs-double-quotes/349617/7 "2006-03-24T11:43:56Z")

</div>

The example shown looks like it was just a plain, ordinary, Unix-style, generic shell.

---

<div class="post-metadata">

**Author:** ![Johanna](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/johanna/32/8318_2.png) [@Johanna](https://boards.straightdope.com/u/Johanna)\
**Post date:** [March 24, 2006, 2:53pm UTC](https://boards.straightdope.com/t/question-about-single-vs-double-quotes/349617/8 "2006-03-24T14:53:20Z")

</div>

Single quotes are used for a gloss following a foreign word, e.g.

Arabic _sihâqîyah_ ‘lesbian’

---

<div class="post-metadata">

**Author:** ![Small\_Clanger](https://avatars.discourse-cdn.com/v4/letter/s/9fc348/32.png) [@Small\_Clanger](https://boards.straightdope.com/u/Small_Clanger)\
**Post date:** [March 24, 2006, 2:59pm UTC](https://boards.straightdope.com/t/question-about-single-vs-double-quotes/349617/9 "2006-03-24T14:59:38Z")

</div>

Double quotes define a null terminated string.

> [@Balthisar](#):
>
> The example shown looks like it was just a plain, ordinary, Unix-style, generic shell.

Care to explain the shell’s use of back-quotes?

---

<div class="post-metadata">

**Author:** ![gigi](https://avatars.discourse-cdn.com/v4/letter/g/a587f6/32.png) [@gigi](https://boards.straightdope.com/u/gigi)\
**Post date:** [March 24, 2006, 3:36pm UTC](https://boards.straightdope.com/t/question-about-single-vs-double-quotes/349617/10 "2006-03-24T15:36:49Z")

</div>

NB: Quotation marks are NOT to be used to emphasize a word. Unfortunately this incorrect use is rampant.

They can be used to indicate irony, or the fact that the phrase inside quotes is not actually true:

My “friend” Mary was spreading hideous lies about me.  
Then when quotes are incorrectly used for emphasis, you’re not sure what to think, as in this sign at the turkey farm near me:

Frozen or “Fresh” Turkey Available

---

<div class="post-metadata">

**Author:** ![gigi](https://avatars.discourse-cdn.com/v4/letter/g/a587f6/32.png) [@gigi](https://boards.straightdope.com/u/gigi)\
**Post date:** [March 24, 2006, 3:37pm UTC](https://boards.straightdope.com/t/question-about-single-vs-double-quotes/349617/11 "2006-03-24T15:37:54Z")

</div>

Sorry, I got caught up in my rant…I guess you meant single vs. double quotes, not quotes in general.

Carry on!

---

<div class="post-metadata">

**Author:** ![Balthisar](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/balthisar/32/2825_2.png) [@Balthisar](https://boards.straightdope.com/u/Balthisar)\
**Post date:** [March 24, 2006, 3:50pm UTC](https://boards.straightdope.com/t/question-about-single-vs-double-quotes/349617/12 "2006-03-24T15:50:08Z")

</div>

> [@Small Clanger](#):
>
> DCare to explain the shell’s use of back-quotes?

What’s a back-quote? A tick-mark: (`)?

I’ve never used the tick-mark, but a quick Google groups search seems to indicate that it’s used to ignore newline characters in the input stream. So I guess if you needed to break a line in the middle of a quoted string for some reason, you could.

I don’t know how it affects variable expansion, though. Oh, and what if the variable has newlines? It seems like it’s something I’d just try to avoid – console windows are plenty wide (and widenable) these days.

---

<div class="post-metadata">

**Author:** ![Small\_Clanger](https://avatars.discourse-cdn.com/v4/letter/s/9fc348/32.png) [@Small\_Clanger](https://boards.straightdope.com/u/Small_Clanger)\
**Post date:** [March 24, 2006, 4:17pm UTC](https://boards.straightdope.com/t/question-about-single-vs-double-quotes/349617/13 "2006-03-24T16:17:38Z")

</div>

> [@Balthisar](#):
>
> What’s a back-quote? A tick-mark: (`)?

That’s it. The text/command inside the back quotes is replaced by the results of that command.

```auto

wpsun:filelist=`ls *log`

wpsun:echo $filelist

float.log perth.log trace.log

```

I’ve never seen it used for anything outside a Unix shell. Has a tick-mark got an ordinary purpose?

---

<div class="post-metadata">

**Author:** ![Chronos](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/chronos/32/134_2.png) [@Chronos](https://boards.straightdope.com/u/Chronos)\
**Post date:** [March 24, 2006, 10:38pm UTC](https://boards.straightdope.com/t/question-about-single-vs-double-quotes/349617/14 "2006-03-24T22:38:22Z")

</div>

They’re also sometimes used paired with regular single-quotes, with the ` opening a quote and the ’ closing it. I’ve especially seen this usage in legal documents seeking to avoid ambiguity about just what is and is not quoted.
