Skip to content

Instantly share code, notes, and snippets.

@zhiyelee
Last active August 29, 2015 14:08
Show Gist options
  • Save zhiyelee/575cbc7d1ae68afa3c27 to your computer and use it in GitHub Desktop.
Save zhiyelee/575cbc7d1ae68afa3c27 to your computer and use it in GitHub Desktop.
Why do Unix man pages use double backticks in place of double quotes?

Original link in stackoverflow: http://unix.stackexchange.com/q/73989/87921

I've noticed that man pages and other documents formatted by Unix utilities often use double backticks `` followed by double single quotes '' to wrap quoted phrases instead of the double quote character ". Single quotes are similarly replaced. Why is this?

Here are a couple examples, from the man page for grep:

 To find all occurrences of the pattern `.Pp' at the beginning of a line:

       $ grep '^\.Pp' myfile

 The apostrophes ensure the entire expression is evaluated by grep instead
 of by the user's shell.  The caret `^' matches the null string at the
 beginning of a line, and the `\' escapes the `.', which would otherwise match
 any character.

 The grep utility is compliant with the IEEE Std 1003.1-2008 (``POSIX.1'')
 specification.

Answers

The semantics and the usual glyphs for these characters have changed(several times) during the last 50 years.

The six-bit predecessors of ASCII contained various multi-purpose characters,including one single quote-like character, which was used for anything that had some similarity witha quote: opening quote, closing quote,apostrophe, or (by overprinting) acute or grave accent.

ASCII introduced one more quote-like character, so that now we had ', which was used as apostrophe, closing quote, and acute accent, and `, which was used as opening quote or grave accent (the concrete glyphs differed in various fonts).

For some bizarre reason, ISO-8859-1 declared ' to be an apostrophe or undirected quote, declared ` to be a grave accent, added one more accent ´ (acute accent), and abolished overprinting (so that the isolated accent marks were now completely pointless). Later extensions (MS-Windows codepages and Unicode) fixed this by introducing new directed quote characters and combining accents.

What you see here is essentially a relict from ASCII times, when most fonts had paired (slanted and/or curly) glyphs for ' and `.

Output like that is generated by makeinfo from Texinfo sources. Texinfo can also render to other formats like PDF, so it needs to be more expressive than ASCII. Maybe to avoid throwing away semantics, makeinfo encodes quotes like that, so you can see what is opening and closing quotes.

Example: If you couldn't see the difference, I can imagine I'd be a bit confusing if you wrote some Texinfo source and relied on the quote difference being visible, because you would have previewed it as PDF. Because you never rendered with makeinfo, you'd never discover that it isn't readable, rendered like that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment