5 usage() { echo "Usage: checksum -t <sha1|sha256> [--] [PATH]"; }
7 misuse() { usage 1>&2; exit 2; }
10 while test $# -gt 0; do
18 test $# -gt 0 || misuse
33 test "$kind" || misuse
42 # Use KINDsum if available, else KIND (e.g. sha1sum or sha1). Assumes
43 # the former is compatible with the coreutils version, and the latter
44 # is compatible with the FreeBSD version.
46 if command -v "$kind"sum > /dev/null; then
48 result=$("$kind"sum "$src")
53 elif command -v "$kind" > /dev/null; then
60 echo "Can't find sha1sum or sha1" 1>&2