mirror of https://github.com/omar-polo/gmid.git
use shell built-in `command' instead of which(1)
it's specified by POSIX AFAIK and requires less redirections.
This commit is contained in:
parent
cd3e28ffe4
commit
12fcba2f80
|
@ -3,11 +3,11 @@
|
|||
# USAGE: ./sha in out
|
||||
# writes the sha256 of in to file out
|
||||
|
||||
if which sha256 2>/dev/null >/dev/null; then
|
||||
if command -v sha256 >/dev/null; then
|
||||
exec sha256 < "$1" > "$2"
|
||||
fi
|
||||
|
||||
if which sha256sum 2>/dev/null >/dev/null; then
|
||||
if command -v sha256sum >/dev/null; then
|
||||
sha256sum "$1" | awk '{print $1}' > "$2"
|
||||
exit $?
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue