Use command shell builtin instead of which

This commit is contained in:
Ben 2023-07-19 14:12:31 +02:00
parent e1d7f7c8d9
commit bf929327c2
Signed by: ben
GPG key ID: 1353F41CF1CFF2D3
2 changed files with 9 additions and 9 deletions

8
run.sh
View file

@ -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

View file

@ -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