#!/bin/sh # $Id: plt-dir-enema,v 1.2 2009/05/31 00:14:39 neilpair Exp $ # http://www.neilvandyke.org/plt-dir-enema/ # Version 1.0 -- 2009-05-30 PltDir="${HOME}/.plt-scheme" PrefsFile="${PltDir}/plt-prefs.ss" if [ ! -d "$PltDir" ] ; then echo "No directory \"${PltDir}\"." >&2 exit 0 fi Temp="" if [ -f "$PrefsFile" ] ; then Temp=`tempfile -p plt-dir-enema` cp "$PrefsFile" "$Temp" if [ $? != 0 ] ; then echo "*ERROR* Could not copy file \"${PrefsFile}\" to \"${Temp}\"." >&2 exit 1 fi else echo "*WARNING* No \"${PrefsFile}\" to back up." >&2 fi /bin/rm -rf "$PltDir" if [ $? != 0 ] ; then echo "*ERROR* Could not remove directory \"${PltDir}\"." >&2 exit 1 fi mkdir "$PltDir" if [ $? != 0 ] ; then echo "*ERROR* Could not create directory \"${PltDir}\"." >&2 exit 1 fi cp "$Temp" "$PrefsFile" if [ $? != 0 ] ; then echo "*ERROR* Could not copy file \"${Temp}\" to \"${PrefsFile}\"." >&2 exit 1 else rm "$Temp" fi #EOF