diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2017-06-02 22:07:52 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2017-06-02 22:07:52 +1200 |
commit | bc1d5fb28841f6050605e93886685b3a02e7787a (patch) | |
tree | f0f02d8d4884b0864334ad774c98da87c0301379 /bin/edda.mi5 | |
parent | Correct some terms in man mi5(1df) (diff) | |
download | dotfiles-bc1d5fb28841f6050605e93886685b3a02e7787a.tar.gz dotfiles-bc1d5fb28841f6050605e93886685b3a02e7787a.zip |
Use mi5 to make templated shell scripts
Diffstat (limited to 'bin/edda.mi5')
-rw-r--r-- | bin/edda.mi5 | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/bin/edda.mi5 b/bin/edda.mi5 new file mode 100644 index 00000000..aaf974cf --- /dev/null +++ b/bin/edda.mi5 @@ -0,0 +1,21 @@ +# Run ed(1) over multiple files, duplicating stdin. +self=edda + +# Need at least one file +if [ "$#" -eq 0 ] ; then + printf >&2 'edda: Need at least one file\n' + exit 2 +fi + +<% +include(`include/mktd.m4') +%> + +# Duplicate stdin into a file +script=$td/script +cat >"$script" || exit + +# Run ed(1) over each file with the stdin given +for file ; do + ed -- "$file" <"$script" +done |