From 8c4e5d733ed380247c33ee87368800da09395a30 Mon Sep 17 00:00:00 2001 From: Joey Hafner Date: Thu, 18 Aug 2022 10:43:59 -0700 Subject: [PATCH] Refactor grep'ing --- server/scripts/nas_down.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/scripts/nas_down.sh b/server/scripts/nas_down.sh index 4502b3c..009dedd 100755 --- a/server/scripts/nas_down.sh +++ b/server/scripts/nas_down.sh @@ -5,7 +5,8 @@ do CONTAINER_NAME=$(docker ps -aq --filter "id=$CONTAINER_ID" --format '{{.Names}}') # get the container's name CONTAINER_MOUNTS=$(docker inspect --format '{{range .Mounts}}{{println .Source}}{{end}}' $CONTAINER_ID) # print the container's volume mounts echo "======== CHECKING $CONTAINER_NAME ========" - if $(echo "$CONTAINER_MOUNTS" | grep /mnt/nas); then + if grep -q /mnt/nas "$CONTAINER_MOUNTS" + then echo "IS NAS DEPENDENT" else echo "IS NOT NAS DEPENDENT"