groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] Getting properly rendered single quotes in groff


From: Ralph Corderoy
Subject: Re: [Groff] Getting properly rendered single quotes in groff
Date: Wed, 11 Jun 2008 09:49:26 +0100

Hi Stuart,

> > Historically, CSTR 54, page 7, shows that \` is equivalent to \(ga
> > and gives a grave accent, as distinct from ` which just gives plain
> > `.
> 
> Where plain ` at one point was an opening quote mark, I assume...

Yes.

> What worries me is cases such as command substitution, e.g. ls -l `find
> -type f -name *foo*` -- the main concern being that if a user copies an
> example, then it should simply work.

Absolutely.  Cut-and-paste and copying by typing what's apparently on
the screen must both give working shell quotes for ` ' and ".

> Currently, on UTF-8 locales, groff renders ` as an opening quote mark,
> but the user's shell will complain if they use that.  It's easy enough
> to update man pages to use \`, but it seems to me that old man pages
> were correct to use plain `.

I'd have thought so too, but take a look at this 7th Ed. Unix man page
for sh(1) written by Bell Labs themselves.

    http://minnie.tuhs.org/UnixTree/V7/usr/man/man1/sh.1.html

Some interesting extracts, first those that show `' is used in normal
writing.

    .B PS1
    Primary prompt string, by default `$ '.
    .B PS2
    Secondary prompt string, by default `> '.

    unless the
    .B export
    command is used to bind the shell's
    .I parameter

    The following prints `a=b c' and `c':

    Except for the `special commands' listed below a new

And then uses where the backtick operator is desired.

    Explicit null arguments ("" or \'\') are retained.

    All characters enclosed between a pair of quote marks (\fB\'\|\'\fP),
    except a single quote,
    are quoted.
    Inside double quotes
    (\fB"\|"\fP)
    parameter and command substitution occurs and
    .B
    \\
    quotes the characters
    .B
    \\ \` "
    and
    .BR $ \|.

    The standard output from a command enclosed in
    a pair of grave accents
    .RB ( \`\|\` )
    may be used as part or all
    of a word;
    trailing newlines are removed.

    (So that, for example,
    echo ${d\-\`pwd\`}
    will only execute
    .I pwd
    if
    .I d
    is unset.)

So it seems clear that man pages should use \` or its verbose \(ga
equivalent when they mean a shell backtick operator, ASCII character 96.

Cheers,


Ralph.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]