Refactor grep'ing

This commit is contained in:
Joey Hafner 2022-08-18 10:43:59 -07:00
parent c0f99419c8
commit 8c4e5d733e

View File

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