I have the following to process a file:
$ vim file2
define(add2, `eval($1+$2)')
Adding 2+4=add2(2,4)
And to run:
$ m4 file
Adding 2+4=6
Is there a way to run m4
with the file contents inline? For example something like:
$ m4 <inline>
define(add2, `eval($1+$2)')
Adding 2+4=add2(2,4)
<ctrl-d>
# Adding 2+4=6
How could that be done?
One option is to the 'interactive mode':
-e, --interactive unbuffer output, ignore interrupts
In which case you can do:
IM-MM:DD_Objects david$ m4 -e
define(add2, `eval($1+$2)')
Adding 2+4=add2(2,4)
Adding 2+4=6