autoconf
[Top][All Lists]
Advanced

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

Re: Variable substitiution in help strings


From: Thomas Dickey
Subject: Re: Variable substitiution in help strings
Date: Tue, 30 Dec 2003 18:20:27 -0500 (EST)

On Tue, 30 Dec 2003, Roger Leigh wrote:

> Rafael Laboissiere <address@hidden> writes:
> > Thanks for your reply.  I have already noticed that in configure the help
> > strings are output using:
> >
> >       cat <<\_ACEOF
> >
> >     Optional Features:
> >     [...]
> >     _ACEOF
> >
> > The problem is the backslash before _ACEOF.  This comes from the code in
> > general.m4, apparently.  Is there any strong reason why the here-document
> > delimiter is backslashed?
>
> No idea, sorry.  It isn't in the bash documentation for "here"
> documents.  Perhaps it's an obscure portability hack?

It's in the manpage for (afaik) all implementations of 'sh'.  For
instance, in bash:

       The format of here-documents is:

              <<[-]word
                      here-document
              delimiter

       No  parameter expansion, command substitution, arithmetic expansion, or
       pathname expansion is performed on word.  If any characters in word are
       quoted,  the  delimiter is the result of quote removal on word, and the
       lines in the here-document are not expanded.  If word is unquoted,  all
       lines  of  the here-document are subjected to parameter expansion, com-
       mand substitution, and arithmetic expansion.  In the latter  case,  the
       character  sequence  \<newline> is ignored, and \ must be used to quote
       the characters \, $, and `.

Under QUOTING,
       There are  three  quoting  mechanisms:  the  escape  character,  single
       quotes, and double quotes.

So you can put a backslash before (or iirc within) the word and quote it
for the purpose of a here-document.

-- 
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net




reply via email to

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