Can the m4 macro-expansion language execute user-defined bash scripts? consider the m4 file
define(`FOOBAR', `esyscmd(mycmd)') dnl
FOOBAR
where mycmd is a bash file defined in the same directory as the m4 file which looks like
#!/bin/bash
echo "Hello World"
However, on executing m4 on the input file I get the error
sh: 1: mycmd: not found
Does that mean I need to modify some sort of variable containing a list of directories where m4 looks for particular commands?
I hope to be able to run awk (or even python) scripts and stick the output of those scripts in place of the corresponding macro name.
The m4
can execute external programs. You forgot only one thing: the PATH
. Please try:
define(`FOOBAR', `esyscmd(./mycmd)') dnl
FOOBAR
Please note ./mycmd
!