The script below is failing with the addition of ${arrUsers[i]} to the echo line, if I change this to ${arrUsers[1]} it works, but I need the variable - I also tried ${arrUsers[$i]} without success. This worked in a prior script I wrote, but it may have been an older version of AIX - is there a new/better approach?
For those that will ask - this tool will search through directories to find content owned by users that are scheduled to have their AIX account removed, chowning the item (directory / folder) to a generic ID and make the file available to all users in a group.
Code:
#!/usr/bin/ksh
set -A arrFolders /dir2 /dir1
set -A arrUsers User1 User2
############################################################################
if [ "$1" = "" ]
then
echo USAGE:
echo " usercleanup.sh OldUser"
else
# Loop through each RootFolder
for i in ${arrFolders[@]}
do
echo "Searching $i for $1 and chowning to ${arrUsers[i]}"
#find . -user $1 \( -exec echo {} \; -o -exec true \; \) -exec grep banana {} \;
#find $i -user $1 -exec chown ${arrUsers[i]} {} \; -exec chmod 766{} \;
done
fi