aboutsummaryrefslogtreecommitdiff
path: root/regress/sha
blob: 02b8eb211eb3c2d1e7d2f072d17e8b98173bacf1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/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
	sha256sum "$1" | awk '{print $1}' > "$2"
	exit $?
fi

echo "No sha binary found"
exit 1