m4-discuss
[Top][All Lists]
Advanced

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

Re: How to replace with `$1` literally?


From: Marc Chantreux
Subject: Re: How to replace with `$1` literally?
Date: Mon, 8 Aug 2016 09:17:55 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Sun, Aug 07, 2016 at 11:30:04PM -0500, Peng Yu wrote:
> Hi, The following code is not able to replace ENV with `$1`.
> 
> /tmp$ m4 -D ENV='$1' <<< ENV

you can add a empty string between $ and 1 to avoid interpolation. to do
so, your m4 content must be $`'1, not $1.

if your using a shell with rc quoting (rc, es or zsh with rcquotes
option enabled), you can write:

        m4 -D ENV='$`''1' <<< ENV

the more readable posix way that comes to my mind is

        m4 -D ENV=$\`\'1 <<< ENV

regards

marc 



reply via email to

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