#!/bin/sh
#
# chmod(1) all files in the current directory and its subdirectories
# recursively.  Set permissions to 700 for directories and scripts and
# to 600 for other files. 
#

. sh/verbose.sh

chmod_all ()
{
    for file in `ls`
    do
	if [ -d "$file" ]
	then
	    chmod 700 $file
	    cd $file
	    echo 1>&4 cd $file
	    chmod_all
	    cd ..
	    echo 1>&4 cd ..
	else
	    if grep '^#!/bin/[a-z]*$' $file >/dev/null
	    then
		chmod 700 $file
	    else
		chmod 600 $file
	    fi
	fi
    done
}

chmod_all


