4 ms·
For simple templating I use my own version[1] of pp[2] preprocessor. The idea behind it is ridiculously simple: everything between ^#!$ markers is shell script.
by TeddyDD 5y ago
For simple templating I use my own version[1] of pp[2] preprocessor. The idea behind it is ridiculously simple: everything between ^#!$ markers is shell script. Output of the script is pasted verbatim in the document.
[1]: https://github.com/TeddyDD/pp.awk https://github.com/TeddyDD/pp.awk
[2]: https://www.mkws.sh/pp.html https://www.mkws.sh/pp.html
- stevekemp 5y agoThat's pretty cool. I wrote something similar in my static collection of sysadmin tools - https://github.com/skx/sysbox https://github.com/skx/sysbox - In my simple pre-processor I only allow two special things: #include "file/goes/here" #execute ls -l | wc -l Though there is a more complex version included, which supports all the syntax of the golang text/template library which is more powerful.
- totony 5y agoWhy not just use a shell script and output using cat<<EOF EOF