Hey, It's me again.
Have a problem, that's not really a problem. I have the below script, that goes to the directory I want it to go to. lists out the directories available, lets you choose the directory you want, then it changes the permissions on said directory. using chmod -R and chown -R.
I however am setting chmod to 0770 recursively, but I want to be able to chose the directory, go into the directory, and determine if it's a file then chmod 0660, if directory 0770 and so on and so forth throughout the entire directory structure
I know i can test -f a file or test -d a directory. But cant work the logic out in my head to get what I want accomplished any help would be appreciated.
#!/bin/bash
source /generic/utils/etc/environments/perm.conf
cd $ENVR
DIRS=`ls -l $ENVR | egrep '^d' | awk '{print $9}'`
for DIR in "${DIRS[@]}";
do
echo "$DIR"
echo "Which environment do you want?: "
echo -n "> "
read i
echo "Changing permissions now..."
sudo chown -R $OWN:$GRP "$i" && sudo chmod -R $MOD1 "$i"
#cd $ENVR/$i
#sudo chmod -R $MOD2 *
echo "Permissions are changed!"
done