diff --git a/scripts/find-container.sh b/scripts/find-container.sh index e2e6c99..50f2248 100755 --- a/scripts/find-container.sh +++ b/scripts/find-container.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -e -if [[ ! -z "$NEXTCLOUD_PROJECT_NAME" ]]; then +if [[ -n "$NEXTCLOUD_PROJECT_NAME" ]]; then containerName="${NEXTCLOUD_PROJECT_NAME}[_-]" matchEnd="[\._-]\d+" else @@ -12,6 +12,6 @@ containerName="${containerName}${NEXTCLOUD_CONTAINER_NAME}" # Get the ID of the first matching container so we can exec something in it later docker ps --format '{{.Names}},{{.ID}}' | \ - egrep "^${containerName}${matchEnd}" | \ + grep -E "^${containerName}${matchEnd}" | \ awk '{split($0,a,","); print a[2]}' | \ head -n 1