aboutsummaryrefslogtreecommitdiff
path: root/bin/oii.mi5
blob: 51f37fb41e66fa5c94de4db0073529bf60c3f512 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Only run a command on input if there was at least one byte
self=oii

# Need at least a command name
if [ "$#" -eq 0 ] ; then
    printf >&2 '%s: Need a command\n' "$self"
    exit 2
fi

<%
include(`include/mktd.m4')
%>

# There is probably a way better way to do this than writing the whole file to
# disk and then reading it off again, but until I think of something better,
# this works and is byte-safe.
cat - > "$td"/in
[ -s "$td"/in ] || exit
"$@" < "$td"/in