Fixer Debugging

School:Syrian Virtual University - Bachelor in Information Technology - Tutor: A.Issa - course: S10-iti320

hi all, would you please help me correcting and debugging this script: fx-permiss.sh which accepts a list of users as argument resiting those files permissions:
say our directory structure:
/home/erzal/file
/home/erzal/dire
/home/erzal/share
/home/erzal/share/file
/home/erzal/share/dire
1- If a user or more are given as arguments, the script should reset files permissions as follows:
a. Directory ~/share to 750 (if it exists).
b. All regular files inside ~/share to 744.
c. All directories inside ~/share to 750.
d. All other regular files in ~ to 600 and all other directories in ~ to 700.
e. files of other types are left as they are.

#!/bin/bash

for   user in $1 $2 $3 ; do
   if -d /home/$1/share ; then
      chmod  750 /home/$1/share ; else
      echo �No folder named �share� is in  $user home directory�
   fi

   find /home/$1/share -type f  -exec chmod 744 {} \;
   find /home/$1/share -type d -exec chmod 750  {} \;
   find ~ -type f -not \( -name share -o -name ~ \) -exec chmod  600
   find ~ -type d -not \( -name share -o -name ~ \) -exec chmod  700

shift
done
#2- If no arguments are give, the script  should identify normal users in the system (UID >= 500) and for each  user, reset files permissions as described above.
for User in $(cat  /etc/passwd) ; do
   UserId=$(echo $User | cut -d ":" -f 3)
   if  ($UserId -gt 500) ; then
      # All reset permission stuff here
    fi
done

#3-At end of execution, produce a file named  report.txt that contains a list of all files in the user's home  directory including full path, owner, group and permissions for each  file.
find . -ls | awk '{print $11 "\t"  $5 "\t" $6 "\t" $1}' | tee  report.txt
#it shoul be for all users
#where it should be saved?

chmod   755 fix-permiss
#for T.Issa, my id is 20347, ever puplished on Oct27 by 20347
exit 0

---------- Post updated at 05:40 AM ---------- Previous update was at 05:38 AM ----------

You are only allowed to post URLs once you have at least 5 posts.!!
General SVU-BIT link
svuonline.org/isis_beta/pages.php?id=18