summaryrefslogtreecommitdiff
path: root/cmdline
diff options
context:
space:
mode:
authorVille Skyttä <ville.skytta@iki.fi>2021-11-04 00:02:41 +0200
committerVille Skyttä <ville.skytta@iki.fi>2021-11-04 00:02:41 +0200
commit48d4b06013ae3d80b95cf72efaf9a5e7468de965 (patch)
tree63dcd9a5cc32141d00ca4ca5325622a3c6bb1ee5 /cmdline
parentf4c4f057665adf5d26b6d83be30362fcd837db22 (diff)
Use `command -v` instead of `which`
`which` has been deprecated in debianutils 5.0+. The recommended replacement, `command -v`, is mandated by Debian policy these days, in addition to being required by POSIX and its predecessor specs at least since 1994. Not found commands cause no output from `command -v` per POSIX, so remove the redundant 2>&1's while at it.
Diffstat (limited to 'cmdline')
-rw-r--r--cmdline/apt-key.in13
1 files changed, 1 insertions, 12 deletions
diff --git a/cmdline/apt-key.in b/cmdline/apt-key.in
index baf3df5c3..137546de3 100644
--- a/cmdline/apt-key.in
+++ b/cmdline/apt-key.in
@@ -92,18 +92,7 @@ requires_root() {
command_available() {
if [ -x "$1" ]; then return 0; fi
- # command -v "$1" >/dev/null 2>&1 # not required by policy, see #747320
- # which "$1" >/dev/null 2>&1 # is in debianutils (essential) but not on non-debian systems
- local OLDIFS="$IFS"
- IFS=:
- for p in $PATH; do
- if [ -x "${p}/${1}" ]; then
- IFS="$OLDIFS"
- return 0
- fi
- done
- IFS="$OLDIFS"
- return 1
+ command -v "$1" >/dev/null # required by policy, see #747320
}
escape_shell() {