#! /bin/bash # A recursive script to change permissions # Adjust verbosity to taste function go () { for i in `ls -i $@`; do if [ ! -e "$i" ] then j=`find -inum $i` if [ -f "$j" ]; then echo Setting permissions of file $PWD/$j | sed s$/./$/$ chmod 0664 "$j" elif [ -d "$j" ]; then echo Setting permissions on directory $PWD/$j | sed s$/./$/$ chmod 0775 "$j" echo Entering directory $PWD/$j | sed s$/./$/$ cd "$j" go echo "Leaving directory $PWD" cd .. fi fi done } go $@ ###end of script