From 1840aea9893e237628269c3c33b3cfe87ca25b14 Mon Sep 17 00:00:00 2001 From: kdeppe Date: Tue, 16 Aug 2022 17:03:03 -0400 Subject: [PATCH] added non-docker case to script --- bin/docker.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/bin/docker.sh b/bin/docker.sh index 40e5c72..27e54a0 100755 --- a/bin/docker.sh +++ b/bin/docker.sh @@ -1,8 +1,13 @@ #!/usr/bin/env bash # Outputs information about the current docker status -DOCKER_STATUS=$(docker info) -CONTAINERS=$(echo "$DOCKER_STATUS" | awk '/Containers/ {print $2}') -RUNNING=$(echo "$DOCKER_STATUS" | awk '/Running/ {print $2}') -STOPPED=$(echo "$DOCKER_STATUS" | awk '/Stopped/ {print $2}') -IMAGES=$(echo "$DOCKER_STATUS" | awk '/Images/ {print $2}') -echo -e "\ue7b0 $RUNNING \ufb99 $STOPPED \uf1c5 $IMAGES" +EXISTS=$(which docker) +if [[ -z $EXISTS ]] ; then + echo "" +else + DOCKER_STATUS=$(docker info) + CONTAINERS=$(echo "$DOCKER_STATUS" | awk '/Containers/ {print $2}') + RUNNING=$(echo "$DOCKER_STATUS" | awk '/Running/ {print $2}') + STOPPED=$(echo "$DOCKER_STATUS" | awk '/Stopped/ {print $2}') + IMAGES=$(echo "$DOCKER_STATUS" | awk '/Images/ {print $2}') + echo -e "\ue7b0 $RUNNING \ufb99 $STOPPED \uf1c5 $IMAGES" +fi