Skip to content

Instantly share code, notes, and snippets.

@mattanja
Created September 9, 2015 12:30
Show Gist options
  • Save mattanja/8a2169852b2f75f3f448 to your computer and use it in GitHub Desktop.
Save mattanja/8a2169852b2f75f3f448 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# (c) 2007 Mattanja Kern <mattanjakern.de>
#
#USAGE="Usage: mkchmod"
USAGE="Usage: mkchmod [dirmode [filemode]]"
if [ "$1" = "" ] ; then
echo $USAGE
DIRMODE="u=rwx,g=rwxs,o-rwx"
else
DIRMODE=$1
fi
if [ "$2" = "" ] ; then
echo $USAGE
FILEMODE="u+rwX,g+rwX,o-rwx"
else
FILEMODE=$2
fi
#DIRMODE=770
#FILEMODE=$2
echo find ./ -type d -exec chmod "$DIRMODE" {} \;
find ./ -type d -exec chmod "$DIRMODE" {} \; # chmod 755 /blah
#echo find ./ -type f -perm +111 -exec chmod 111 {} \;
echo find ./ -type f -exec chmod "$FILEMODE" {} \;
find ./ -type f -exec chmod "$FILEMODE" {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment