From 12fcba2f80034356e75d73380d22012fd72476a8 Mon Sep 17 00:00:00 2001 From: Omar Polo Date: Sun, 27 Feb 2022 16:24:45 +0000 Subject: [PATCH] use shell built-in `command' instead of which(1) it's specified by POSIX AFAIK and requires less redirections. --- regress/sha | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/regress/sha b/regress/sha index 02b8eb2..6fc6273 100755 --- a/regress/sha +++ b/regress/sha @@ -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