Blame


1 5c2e310e 2021-01-22 op #!/bin/sh
2 5c2e310e 2021-01-22 op
3 5c2e310e 2021-01-22 op # USAGE: ./sha in out
4 5c2e310e 2021-01-22 op # writes the sha256 of in to file out
5 5c2e310e 2021-01-22 op
6 5c2e310e 2021-01-22 op if which sha256 2>/dev/null >/dev/null; then
7 5c2e310e 2021-01-22 op exec sha256 < "$1" > "$2"
8 5c2e310e 2021-01-22 op fi
9 5c2e310e 2021-01-22 op
10 5c2e310e 2021-01-22 op if which sha256sum 2>/dev/null >/dev/null; then
11 99f95f77 2021-01-22 op sha256sum "$1" | awk '{print $1}' > "$2"
12 99f95f77 2021-01-22 op exit $?
13 5c2e310e 2021-01-22 op fi
14 5c2e310e 2021-01-22 op
15 5c2e310e 2021-01-22 op echo "No sha binary found"
16 5c2e310e 2021-01-22 op exit 1