I have used m4 in the past to generate source code where aesthetics and space were of no consequence [ provided it worked ]. Now I am using it to generate script and program templates [ in an effort to improve the readability and general soundness of my scripts/programs ].
So here is an excerpt from my m4 file for producing a generic bash script:
It outputs what you'd expect but tacks on 16 blank lines at the beginning of the file. I can use sed to remove these but I am thinking there is an m4 basic I am missing. I've looked through the docs and various tutorials. Maybe I have a buggy m4?
This does help -- thanks. Where is this documented? I've been looking and haven't seen any examples where the defines were ended this way. I assume you mean:
Thanks for the replies. I tried adding dnl both in the macro and in the file and I still end up with one blank line at the top.
However, the resulting scripts work and if it really bothers me I can pull out a can o' sed on it.
What bothers me is the fact that there does not appear to be rhyme or reason for this behavior. Is m4 truly obsolete and no longer maintained? Other than sendmail is m4 worth the trouble verses using some bloated perl template script?
I hate to make a whing-fest out of a single blank line ...yet ...
Well, here's the pertinent parts for the curious. Maybe I've overlooked something else.
As an aside:
This is part of a larger make script to generate various projects with different options/parameters ...otherwise I could simply copy a template. I hope to use the macros as I'd be passing in various options ...more flexibility, etc..
Thanks again for all your input!
Bubnoff
---------- Post updated at 04:01 PM ---------- Previous update was at 03:53 PM ----------