#!/bin/sh -e if test $# -eq 0 then test "$(od | awk 'NR=1{ print $2; exit; }')" = "000012" && exit ! test "$(tail -c 2)" && \ >&2 printf ": Trailing newlines\n" && \ exit 1 fi s=0 for f in "$@" do test -d "$f" && continue test "$(od "$f" | awk 'NR=1{ print $2; exit; }')" = "000012"\ && continue if ! test "$(tail -c 2 "$f")" then >&2 printf "%s: Trailing newlines\n" "$f" s=1 fi done exit $s