autoconf
[Top][All Lists]
Advanced

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

Re: m4 macro expansion problem


From: Zack Weinberg
Subject: Re: m4 macro expansion problem
Date: Wed, 25 Aug 2021 14:41:19 -0400
User-agent: Cyrus-JMAP/3.5.0-alpha0-1125-g685cec594c-fm-20210825.001-g685cec59

On Wed, Aug 25, 2021, at 12:06 PM, Sébastien Hinderer wrote:
> Zack Weinberg (2021/08/25 11:39 -0400):
> > m4_syscmd is a primitive, and it doesn't expand its argument, so you need 
> > to expand PKG_VERSION first:
> >
> > m4_syscmd([cat > VERSION << \END_OF_VERSION_FILE
> > ]PKG_VERSION[
> >
> > # Some comments about the format of version numbers
> > END_OF_VERSION_FILE
> > ])
> I double-checked my code and there was no \ before END_OF_VERSION_FILE
> and the code was working so may I ask why you added one in your code?

That's an extra defensive measure.  It makes the *shell* treat the here 
document as quoted, so that if your PKG_VERSION or your commentary ever happens 
to contain shell metacharacters they won't do anything surprising.  I 
habitually add this to here documents unless there's a reason to *want* shell 
variable expansion (for instance) in some particular here document.

zw



reply via email to

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