From 5aeca742426b798f42d32a7efdc68463430d4f39 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Wed, 24 Jan 2018 17:33:06 -0600 Subject: [PATCH] change from using which to using hash which was noisy on a box without pv which lead me to want to change it. which is also not recommended to be used in scripts since return code and output isn't necessarily guaranteed. Since we're on bash its safer to use hash, which is a built-in which will speed all this up. --- bashfiles | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bashfiles b/bashfiles index b743906..f2592de 100755 --- a/bashfiles +++ b/bashfiles @@ -386,7 +386,8 @@ function bf_md5() { # Provide checksum progress using `pv` if `pv` is present and we're above # the minimum size cut-off - if [[ -n `which pv` && $size -ge BF_CHECKSUM_PROGRESS_MIN_SIZE ]]; then + hash pv > /dev/null 2>&1 + if [[ $? -eq 0 && $size -ge BF_CHECKSUM_PROGRESS_MIN_SIZE ]]; then cmd="pv $filename | " else cmd="cat $filename | "