I'm using m4 to create some basic macros and I realize that when using esyscmd
there's a trailing new line added to a string when the command is run.
Example:
define(MY_HOSTNAME, esyscmd(`hostname'))
MY_HOSTNAME
Some other text...
Renders:
> my.host.name
>
> Some other text...
(complete with a trailing new line)
By adding dnl
at the end of the define (or esyscmd) nothing appears to happen and there's still a trailing newline.
What's the best way to drop the trailing newline when calling esyscmd
in m4?
*nix systems have
tr
by default. Make use of that:and you'd get rid of the trailing newline!