cleanup.sh script
Since I enjoyed yesterday's update so much, I went ahead and wrote the garage cleaner script
#!/bin/bash
STORAGE=/home/jake/garage
CURMONTH=`/bin/date +%m`
if [ $CURMONTH -lt 6 ]
then
echo "Nothing to do - it's not June yet."
exit 0
fi
do_sortclothes()
{
USELESS=`cat $ITEM | egrep -c 'smell|hole|stains|misc_faggotry'`
if [ $USELESS -ne 0 ]
then rm -f $ITEM
else
chown nobody $ITEM
chmod 777 $ITEM
mv $ITEM /goodwill/
fi
}
find $STORAGE -user dave | while read ITEM ; do
# determine what to do with the item
case $ITEM in
*money) chown jake $ITEM ;
mv $ITEM /home/jake/ ;;
*clothes) do_sortclothes ;;
*) rm -f $ITEM ;;
esac
done
Labels: code

<< Home