Package:     backup2l
Subject:     switch which to command
Author:      Joachim Wiedorn <joodebian at joonet.de>
Forwarded:   not needed
Last-Update: 2022-01-20

Program 'which' is deprecated. Please use instead 'command -v'
which is a builtin function of the shell (dash, bash).
---

diff -urN s16/backup2l s31/backup2l
--- s16/backup2l	2025-04-25 13:25:37.954289533 +0200
+++ s31/backup2l	2025-04-25 15:34:15.701586209 +0200
@@ -75,7 +75,7 @@
 {
     local NOT_AVAIL=""
     for TOOL in $@; do
-        if [ "`which $TOOL 2> /dev/null`" == "" ]; then NOT_AVAIL="$NOT_AVAIL $TOOL"; fi
+        if [ "`command -v $TOOL 2> /dev/null`" == "" ]; then NOT_AVAIL="$NOT_AVAIL $TOOL"; fi
     done
     if [[ "$NOT_AVAIL" != "" ]]; then
         echo "ERROR: The following required tool(s) cannot be found: $NOT_AVAIL"
@@ -1198,7 +1198,7 @@
     fi
 
     # create CD labels
-    if which cdlabelgen > /dev/null; then
+    if command -v cdlabelgen > /dev/null; then
       echo
       echo "Creating CD labels..."
       read -p "  Enter CD title [Backup]: " ANSWER
diff -urN s16/backup2l.8 s31/backup2l.8
--- s16/backup2l.8	2025-04-25 13:24:06.286710774 +0200
+++ s31/backup2l.8	2025-04-25 15:34:15.701586209 +0200
@@ -251,7 +251,7 @@
 you can simply create a symlink, e. g. by:
 
 .ce
-ln \-s `which backup2l` /etc/cron.daily/zz\-backup2l
+ln \-s `command \-v backup2l` /etc/cron.daily/zz\-backup2l
 
 The "zz\-" prefix causes the backup job to be the last one executed, so that other jobs are not delayed
 if the backup takes somewhat longer. The status output is e\-mailed to root by the cron daemon.
diff -urN s16/zz-backup2l s31/zz-backup2l
--- s16/zz-backup2l	2022-08-31 22:11:22.000000000 +0200
+++ s31/zz-backup2l	2025-04-25 15:34:15.701586209 +0200
@@ -7,4 +7,4 @@
 #
 # Redirect its output if you do not want automatic e-mails after each backup.
 
-! which backup2l > /dev/null || nice -n 19 backup2l -b
+! command -v backup2l > /dev/null || nice -n 19 backup2l -b
