aboutsummaryrefslogtreecommitdiff
path: root/bin/edda.mi5
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-06-02 22:07:52 +1200
committerTom Ryder <tom@sanctum.geek.nz>2017-06-02 22:07:52 +1200
commitbc1d5fb28841f6050605e93886685b3a02e7787a (patch)
treef0f02d8d4884b0864334ad774c98da87c0301379 /bin/edda.mi5
parentCorrect some terms in man mi5(1df) (diff)
downloaddotfiles-bc1d5fb28841f6050605e93886685b3a02e7787a.tar.gz
dotfiles-bc1d5fb28841f6050605e93886685b3a02e7787a.zip
Use mi5 to make templated shell scripts
Diffstat (limited to 'bin/edda.mi5')
-rw-r--r--bin/edda.mi521
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