From d034795e2bcc6ec47f44490e01999ff0c8d66313 Mon Sep 17 00:00:00 2001
From: chrfranke <chrfranke@4ea69e1a-61f1-4043-bf83-b5c94c648137>
Date: Sat, 6 Aug 2022 17:15:49 +0000
Subject: [PATCH] examplescripts/Example8: Use 'command -v' builtin instead of
 'which'.

git-svn-id: https://svn.code.sf.net/p/smartmontools/code/trunk@5404 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
 smartmontools/ChangeLog               | 2 ++
 smartmontools/examplescripts/Example8 | 5 +++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/smartmontools/ChangeLog b/smartmontools/ChangeLog
index 12a0b94f1..a0ad758e8 100644
--- a/smartmontools/ChangeLog
+++ b/smartmontools/ChangeLog
@@ -2,6 +2,8 @@ $Id$
 
 2022-08-06  Christian Franke  <franke@computer.org>
 
+	examplescripts/Example8: Use 'command -v' builtin instead of 'which'.
+
 	Detect accidental use of smartd_warning script in '-M exec'.
 	smartd.cpp: Set SMARTD_SUBJECT to empty.
 	smartd_warning.sh.in, os_win32/smartd_warning.cmd: Abort if
diff --git a/smartmontools/examplescripts/Example8 b/smartmontools/examplescripts/Example8
index 0a175cc8b..2bf60afe7 100755
--- a/smartmontools/examplescripts/Example8
+++ b/smartmontools/examplescripts/Example8
@@ -13,9 +13,10 @@
 test -n "$SMARTD_ADDRESS" || exit 0
 
 # Try mail[x]
+# Note: The 'command -v' builtin requires a POSIX >= 2008 conforming shell
 for mailer in \
-  $(which mail 2>/dev/null) \
-  $(which mailx 2>/dev/null) \
+  $(command -v mail 2>/dev/null) \
+  $(command -v mailx 2>/dev/null) \
   /usr/bin/mail \
   /usr/bin/mailx
 do
-- 
GitLab