#!/bin/bash sync_cam() { mount /mnt/camera if [ $? -ne 0 ]; then echo "Couldn't mount camera" return 1 fi rsync -av --stats --progress /mnt/camera/dcim/100toshi/ ~/pics/ if [ $? -ne 0 ]; then echo "Couldn't sync camera to hard drive" return 1 fi umount /mnt/camera if [ $? -ne 0 ]; then echo "Couldn't unmount camera" return 1 fi sudo /sbin/rmmod usb_storage sd_mod scsi_mod vfat fat &> /dev/null if [ $? -ne 0 ]; then echo "Couldn't unload modules" echo "Are they built into the kernel?" return 1 fi } sync_cam