# 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') %> # Read up to one byte and save it into temp file; discard stderr (stats) tf=$td/input dd bs=1 count=1 of="$tf" 2>/dev/null # If there's now a byte in the file, spit it and the rest of the input into the # requested command [ -s "$tf" ] && cat -- "$tf" - | "$@"