mirror of
https://github.com/omar-polo/gmid.git
synced 2024-10-03 07:46:57 +02:00
12fcba2f80
it's specified by POSIX AFAIK and requires less redirections.
17 lines
271 B
Bash
Executable File
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
|