#!/bin/bash SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" WP_CONTENT_DIRS=( plugins upgrade uploads ) export WEB_GID=33 perms() { sudo chown -R $UID:$WEB_GID "$1" find "$1" -type d -exec chmod g+rwx '{}' \; find "$1" -type f -exec chmod g+rw '{}' \; } for DIR in "${WP_CONTENT_DIRS[@]}"; do perms "$SCRIPT_DIR/../wp-content/$DIR" done