m4: Esyscmd
1
1 13.3 Reading the output of commands
1 ===================================
1
1 If you want 'm4' to read the output of a shell command, use 'esyscmd':
1
1 -- Builtin: esyscmd (SHELL-COMMAND)
1 Expands to the standard output of the shell command SHELL-COMMAND.
1
1 Prior to executing the command, 'm4' flushes its buffers. The
1 default standard input and standard error of SHELL-COMMAND are the
1 same as those of 'm4'. The error output of SHELL-COMMAND is not a
1 part of the expansion: it will appear along with the error output
1 of 'm4'.
1
1 By default, the SHELL-COMMAND will be used as the argument to the
1 '-c' option of the '/bin/sh' shell (or the version of 'sh'
1 specified by 'command -p getconf PATH', if your system supports
1 that). If you prefer a different shell, the 'configure' script can
1 be given the option '--with-syscmd-shell=LOCATION' to set the
1 location of an alternative shell at GNU 'm4' installation; the
1 alternative shell must still support '-c'.
1
1 The macro 'esyscmd' is recognized only with parameters.
1
1 define(`foo', `FOO')
1 =>
1 esyscmd(`echo foo')
1 =>FOO
1 =>
1
1 Note how the expansion of 'esyscmd' keeps the trailing newline of the
1 command, as well as using the newline that appeared after the macro.
1
1 Just as with 'syscmd', care must be exercised when sharing standard
1 input between 'm4' and the child process of 'esyscmd'.
1