Thanks for your reply
#Users have already been assigned to depts when they were added to the system, some will be in accounts, #some in HR etc....
#We ask the person who is running the script to enter a dept name...
echo -e "Please enter the dept name: \c"
read deptname
# then check the
/etc/group file for the deptname and usernames
deptno=`cat /etc/group | grep $1 | cut -f3 -d:`
# pass the details to the
/etc/passwd file
homeDirectory=`cat /etc/passwd | grep $deptno | cut -f6 -d:`
# in the users home directory we want to check for the existence of a directory called
report
# if it's not there, or is empty, we 'echo' the username to the logfile in the current directory
# if it does exist (and has a file in it) we copy that to a directory called reporting in the current directory....
for i in $(ls /home); do
if [ -d /home/$i/assignment ]; then
files=$(ls /home/$i/assignment/)
if [ -z $files ]; then
echo "$i" >> ./logfile
else
[ -d ./report ] || mkdir -p ./reporting
cp /home/$i/assignment/* ./reporting/
fi
else
echo "$i" >> ./logfile
fi
## not sure how to tie all these elements together into one working script
Thanks again
