My backup script works well except for logging the info. I have run "script" to debug the operation but when I do this everything runs perfectly. The problem must be some dumb thing I am not seeing. I hope some other eyes will help. BTW the script runs as a cron job. It does the backups (checked), it creates the date variable (checked) it creates and properly dates the info file (checked) but then doesn't put any info into the file. If the same script is run from the command line, everything including file info is done as expected. I'm at a loss, so any help will be greatly appreciated.
# backup changed or new files
rsync -rtpogvc /home/jimm/Documents/ /media/removeable/backup/
# set yesterdays date
date=$(date --date='1 day ago' +%Y-%m-%d)
# check what was backed up and put the info in a file
ls -la /media/removeable/backup/ | grep $date > /home/jimm/BackupLogs/backup.$date