#!/bin/sh
#
# chug usr [grp [dir..]]
#
# Change the ownership of the listed directories and contents.

if [ $# -lt 1 ];then echo "Usage: $0 usr [grp [dir..]]"; exit 1; fi
U=$USER
G=$GROUP
D=.
if [ $# -gt 0 ];then U=$1; shift;fi
if [ $# -gt 0 ];then G=$1; shift;fi

if [ -n "$U" ];then     find $* | xargs chown $U;fi
if [ -n "$G" ];then     find $* | xargs chgrp $G;fi
find $* | xargs chmod ug+rw

