#!/usr/bin/env bash mapfile -t CONTAINERS < <(docker container ls --format '{{ .ID }},{{ .Image }}' | grep wordpress) DRY_RUN=" --dry-run" if [ "$1" == "--live" ]; then DRY_RUN="" fi for i in "${!CONTAINERS[@]}"; do CONTAINERID="${CONTAINERS[$i]%,*}" echo "Site $i, $CONTAINERID" docker exec -u www-data -it "${CONTAINERID}" /app/pkg/wp plugin update --all $DRY_RUN docker exec -u www-data -it "${CONTAINERID}" /app/pkg/wp theme update --all $DRY_RUN done