8

I've just been looking through a few man pages for a few different commands including grep and ifconfig.

I've noticed over a few pages, the content uses a strange syntax to notate what i think are quotations (back-tick followed by a single or double quote):

`text'

Quote Example

Why can't they use ' or " to open and close quotations?

Update

I now realise that this should be bolding out the characters instead of noting quotes. Is there any reason my system is ignoring these when formatting? I'm using OSX.

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
Matt
  • 223
  • 1
  • 7
  • In my manpages, it doesn't show like this. The keywords `never`, `always` and `auto` are shown as bold. I am on Linux Mint 17.1. What is your distribution? – shivams May 21 '15 at 16:28
  • @shivams I'm on OSX. Interestingly I've just loaded up my Ubuntu distro and it highlights these in bold. I just assumed these were meant to be quotations! I'll update/rephrase my question. – Matt May 21 '15 at 16:33
  • @Matt This has nothing to do with osx. Many man pages use this kind of quotation marks on linux too, especially in gnu family programs. For example both `man emacs` and `info emacs` use it a lot. I believe this is historical habit. – jimmij May 21 '15 at 16:49
  • See [A quotation mark mystery explained](http://www.trilithium.com/johan/2005/07/quotation-marks/) which links to [ASCII and Unicode quotation marks](http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html) – don_crissti May 21 '15 at 17:49
  • 1
    Duplicate of [Why some strings are quoted with backticks and single quotes in man pages?](http://unix.stackexchange.com/q/155674/80216) – G-Man Says 'Reinstate Monica' May 22 '15 at 04:31

2 Answers2

12

Man pages historically have been written in the troff/nroff markup language, although there are alternatives now such as DocBook.

Troff, which is meant for preparing output to a phototypesetter (or to files in formats such as PostScript or PDF), will automatically change the ` and ' characters in the input into curved quotation marks, and . (See the Troff User’s Manual, section 2.1).

Nroff, which is what the man command runs when the output is to a terminal, will pass those characters through unchanged.

Those quotes are actually in the man page sources for the older version of GNU grep (2.5.1) in FreeBSD and OSX:

.B GREP_COLOR
environment variable. WHEN may be `never', `always', or `auto'

More recent versions of GNU grep do not have those quotes in the man page sources:

.I WHEN
is
.BR never ", " always ", or " auto .
Mark Plotnick
  • 24,913
  • 2
  • 59
  • 81
6

These quotation marks are often used because they look nice, similar to the quotation marks in printed books (which are different at the beginning and end of the quoted passage).

These quotation marks may also have been added by your local troff configuration (or, could be removed by it!). The actual file may not contain these characters literally. You can check with something like

zcat /usr/share/man/man8/ifconfig.8.gz | less

how the man pages look like on disk. They are formatted for screen output by the tron/troff family of programs (hardly known or in use today, but very useful in the text-only console times...). Check the man page of man(1) for details!

Ned64
  • 8,486
  • 9
  • 48
  • 86
  • As Mark Plotnik points out, the manual page in question _does_ contain these characters in the source. [Markus Kuhn has something to say on the subject of writers who went with (then) U.S. norms](http://www.cl.cam.ac.uk./~mgk25/ucs/quotes.html). – JdeBP May 21 '15 at 17:47
  • You are right. Regarding the link, thanks, but please consider that `troff`/`nroff` etc. were invented when characters were encoded as 7-bit ASCII - the comment of Mr Kuhn applies to Unicode times... – Ned64 May 21 '15 at 17:51
  • There are some viewers for man pages that re-format the page and add hyperlinks. One is built into KDE's `konqueror` web/file browser. Try the URI `man:/usr/share/man/man1/ls.1.gz` in its address bar. It also handles the newer (than man) info pages well: `info:/bash/Top` (again a URI for konqueror only). – Ned64 May 21 '15 at 18:04
  • 1
    @Ned64 or GNOME's Yelp (`yelp man:ls`, `yelp info:grep#Introduction`). – muru May 22 '15 at 00:29