From bf929327c2e2c6f717f76e33a9576f62fc780c6d Mon Sep 17 00:00:00 2001 From: Benedikt Ziemons Date: Wed, 19 Jul 2023 14:12:31 +0200 Subject: [PATCH] Use command shell builtin instead of which --- run.sh | 8 ++++---- test.sh | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/run.sh b/run.sh index 73e6a0a..bfa253a 100755 --- a/run.sh +++ b/run.sh @@ -5,11 +5,11 @@ IFS=$'\n\t' DIR="$(realpath ${0%/*})" RUNTIME_IS_PODMAN="false" -if [[ -x "$(which podman)" ]]; then - CONTAINER_RUNTIME="$(which podman 2> /dev/null)" +if [[ -x "$(command -v podman)" ]]; then + CONTAINER_RUNTIME="$(command -v podman 2> /dev/null)" RUNTIME_IS_PODMAN="true" -elif [[ -x "$(which docker)" ]]; then - CONTAINER_RUNTIME="$(which docker 2> /dev/null)" +elif [[ -x "$(command -v docker)" ]]; then + CONTAINER_RUNTIME="$(command -v docker 2> /dev/null)" else echo "Container runtime (docker/podman) not found!" exit 1 diff --git a/test.sh b/test.sh index 00a8055..c9eafdc 100755 --- a/test.sh +++ b/test.sh @@ -5,14 +5,14 @@ IFS=$'\n\t' DIR="$(realpath ${0%/*})" RUNTIME_IS_PODMAN="false" -if [[ -x "$(which podman)" ]]; then - CONTAINER_RUNTIME="$(which podman 2> /dev/null)" +if [[ -x "$(command -v podman)" ]]; then + CONTAINER_RUNTIME="$(command -v podman 2> /dev/null)" RUNTIME_IS_PODMAN="true" -elif [[ -x "$(which docker)" ]]; then - CONTAINER_RUNTIME="$(which docker 2> /dev/null)" +elif [[ -x "$(command -v docker)" ]]; then + CONTAINER_RUNTIME="$(command -v docker 2> /dev/null)" else echo "Container runtime (docker/podman) not found!" exit 1 fi -$CONTAINER_RUNTIME exec --user 33 nextcloud bash -c 'cd /var/www/html/custom_apps/upschooling && make test' \ No newline at end of file +$CONTAINER_RUNTIME exec --user 33 nextcloud bash -c 'cd /var/www/html/custom_apps/upschooling && make test'