gmid/regress/sha
Omar Polo 12fcba2f80 use shell built-in `command' instead of which(1)
it's specified by POSIX AFAIK and requires less redirections.
2022-02-27 16:24:45 +00:00

17 lines
271 B
Bash
Executable File

#!/bin/sh
# USAGE: ./sha in out
# writes the sha256 of in to file out
if command -v sha256 >/dev/null; then
exec sha256 < "$1" > "$2"
fi
if command -v sha256sum >/dev/null; then
sha256sum "$1" | awk '{print $1}' > "$2"
exit $?
fi
echo "No sha binary found"
exit 1