#! /bin/sh for d in "$@"; do if [ -d "$d" ]; then if [ "$d" = .. ]; then echo 'Cannot operate on ".."!' >&2 exit 1 fi chmod u+rwX,go+rX "$d" find "$d" -type d -print0 | xargs -r0 chmod u+rwX,go+rX find "$d" -type f -print0 | xargs -r0 chmod u+rwX,go+rX else chmod u+rwX,go+rX "$d" fi done