Skip to content

Instantly share code, notes, and snippets.

@xZero707
Last active September 21, 2021 20:02
Show Gist options
  • Save xZero707/7a3fb3e12e7192c96dbc60d45b3dc91d to your computer and use it in GitHub Desktop.
Save xZero707/7a3fb3e12e7192c96dbc60d45b3dc91d to your computer and use it in GitHub Desktop.
attrs
#!/usr/bin/env sh
# This script is recursive by default
# Arguments
TARGET_PATH=${1:-}
OWNERSHIP=${2:-}
FMODE=${3:-}
DMODE=${4:-}
if [ -z "${TARGET_PATH}" ]; then
echo "InvalidArgumentError: Missing target path"
exit 1
fi
if [ -z "${OWNERSHIP}" ]; then
echo "InvalidArgumentError: Missing ownership"
exit 1
fi
if [ -z "${FMODE}" ]; then
echo "InvalidArgumentError: Missing target path"
exit 1
fi
if [ -z "${DMODE}" ]; then
echo "InvalidArgumentError: Missing target path"
exit 1
fi
chown -hR "${OWNERSHIP}" "${TARGET_PATH}"
chmod -R "${FMODE}" "${TARGET_PATH}"
find "${TARGET_PATH}" -type d -exec chmod "${DMODE}" {} \;
@xZero707
Copy link
Author

Update: Development moved to separate repository https://github.com/N0rthernL1ghts/attr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment