23 lines
469 B
Bash
Executable File
23 lines
469 B
Bash
Executable File
#!/bin/sh
|
|
|
|
if [ $# -eq 0 ] || [ "$1" = "-h" ]; then
|
|
cat <<EOF
|
|
Usage: ${0##*/} FOLDERS
|
|
|
|
Set file/directory owner and permissions according to current umask for current
|
|
used.
|
|
EOF
|
|
exit
|
|
fi
|
|
|
|
FMASK=$(umask -S | sed 's/x//g')
|
|
DMASK=$(umask -S)
|
|
[ -z "$UID" ] && UID=$(id -u)
|
|
[ -z "$GID" ] && GID=$(id -g)
|
|
|
|
for i ; do
|
|
find "$i" -exec chown -R ${UID}:${GID} {} \;
|
|
find "$i" -type d -exec chmod ${DMASK} {} \;
|
|
find "$i" -type f -exec chmod ${FMASK} {} \;
|
|
done
|