From bc3e1b316d91f76dc1b385b8b4f3533d2ae1738d Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 27 Feb 2018 06:23:00 +0100 Subject: [PATCH] Use "command -v" instead of "which" in bash scripts shellcheck recently added SC2330 checking for this. "which" is non-standard, and not guaranteed by POSIX to have a meaningful exit status, while "command -v" is specified by POSIX: https://stackoverflow.com/q/592620 --- misc/userscripts/open_download | 2 +- misc/userscripts/password_fill | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/misc/userscripts/open_download b/misc/userscripts/open_download index ecc1d7209..8dbb11384 100755 --- a/misc/userscripts/open_download +++ b/misc/userscripts/open_download @@ -52,7 +52,7 @@ die() { if ! [ -d "$DOWNLOAD_DIR" ] ; then die "Download directory »$DOWNLOAD_DIR« not found!" fi -if ! which "${ROFI_CMD}" > /dev/null ; then +if ! command -v "${ROFI_CMD}" > /dev/null ; then die "Rofi command »${ROFI_CMD}« not found in PATH!" fi diff --git a/misc/userscripts/password_fill b/misc/userscripts/password_fill index 8dba68c2b..a61a42c68 100755 --- a/misc/userscripts/password_fill +++ b/misc/userscripts/password_fill @@ -220,7 +220,7 @@ user_pattern='^(user|username|login): ' GPG_OPTS=( "--quiet" "--yes" "--compress-algo=none" "--no-encrypt-to" ) GPG="gpg" export GPG_TTY="${GPG_TTY:-$(tty 2>/dev/null)}" -which gpg2 &>/dev/null && GPG="gpg2" +command -v gpg2 &>/dev/null && GPG="gpg2" [[ -n $GPG_AGENT_INFO || $GPG == "gpg2" ]] && GPG_OPTS+=( "--batch" "--use-agent" ) pass_backend() {