#!bin/sh


function changef
{
  for i in `ls .`; do
    changefg1 $i;
  done;
}

function changefg1
{
  if [ -d $1 ]; then
      chmod -f u=rwx,g=rx,o=rx $1;
    else
      chmod -f u=rw,g=r,o=r $1;
    fi;
}

# Moving through directories recursively.
#   There is a command for this, I read somewhere.
function recursived
{
  # ls needs read attribute on parent directory,
  # pushd needs excecute attribute.
  for i in `ls .`; do
    if [ -d $i ]; then
      chmod u=rxw $i;
      pushd $i;
      recursived;
      popd;
    else
      g2 $i;
    fi;
  done;
}

function g2
{
  chmod u=rw $i;
}



