gmid/regress/sha

16 lines
281 B
Bash
Executable File

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