Skip to contentSkip to conversation

configure: Replace which(1) with "command -v"

PATCH In review Fam Zheng 2 participants 2 messages Nov 19, 2014

lore
Share & tools
lore

Fam Zheng

author
#0 lore raw

PATCH 1/1 configure: Replace which(1) with "command -v"

Because which(1) is not always installed, whereas "command -v" is the more native way to check for a command.

---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configure +1 -1
index 47048f0..986a13d 100755
@@ -2727,7 +2727,7 @@ fi
 if test "$modules" = yes; then
     shacmd_probe="sha1sum sha1 shasum"
     for c in $shacmd_probe; do
-        if which $c >/dev/null 2>&1; then
+        if command -v $c >/dev/null 2>&1; then
             shacmd="$c"
             break
         fi
Signature · 1 line
1.9.3
#1 lore raw
Quoted 13 lines · Fam Zheng

Because which(1) is not always installed, whereas "command -v" is the more native way to check for a command.

---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configure +0 -0
index 47048f0..986a13d 100755

configure fi · line 2733

Quoted 8 lines
configure +1 -1
@@ -2727,7 +2727,7 @@ fi
 if test "$modules" = yes; then
     shacmd_probe="sha1sum sha1 shasum"
     for c in $shacmd_probe; do
-        if which $c >/dev/null 2>&1; then
+        if command -v $c >/dev/null 2>&1; then
             shacmd="$c"
             break
         fi

Configure already provides the shell function "has" for checking for existence of a command -- can we just use that?

thanks
-- PMM