[bazel] Simplify the hash check in bazelisk.sh
Signed-off-by: Miles Dai <milesdai@google.com>
diff --git a/bazelisk.sh b/bazelisk.sh
index 3233e86..75daee3 100755
--- a/bazelisk.sh
+++ b/bazelisk.sh
@@ -37,12 +37,10 @@
}
function check_hash() {
- local file target value
+ local file target
file="$1"
target="$(os_arch)"
- value="$(sha256sum "${file}" | cut -f1 -d' ')"
- local expect="${hashes[$target]}"
- test "$value" == "$expect"
+ echo "${hashes[$target]} $file" | sha256sum --check --quiet
}
function prepare() {