On Monday, August 8, 2016, Marc Chantreux <[email protected]> wrote: > 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
The thing to replace ENV might be read from a file. m4 -D ENV=$(< file) << ENV How to escape the content of file so that the content of file will be used to replace ENV literally? > regards > > marc > -- Regards, Peng
