Need help with script to get user ftp logs
I'm trying to write a shell script that will grab a users ftp logs and put it in his home dir. The server I will run this script on keeps two plan text logs and the other 6 are compressed with .gz. For example there is auth.log, auth.log.1 auth.log.2.gz ..... auth.log.8.gz I would like to scan all those plus xferlog (which is setup the same way) for a user and have it place a auth.log and xferlog file in the customers root. I have the below script which works but only does it for one file. All help is appreciated.
if [ $# -eq 0 ]
echo "$0 : You must supply username"
if [ -f $DIR/auth.log ]
cat $DIR/auth.log | grep $USER >> /hsphere/local/home/$USER/auth.log
echo "File doesn't exist"
P.S This is my first time posting to any Forum so please be gentle