TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

script problems



I got to tinkering with my delete script, and I've fixed the problem
where it changes the names of files to delete. I think only two problems
are left. One is that if I run 

deltest "john's data"
is tries to move john's and then data -- it is as if the "" aren't there.

If I run deltest on the directory john it works, but if I run deltest
again on another directory called john (while /home/delete/username/john/
exists) I get an error message that is can't overwrite the directory.

Any ideas? I'd like to get the script to the point where I can rename it
to rm and rm to something else and know that it'll always work right.

Thanks again,

Ben




Ben Luey
lueyb@carleton.edu
ICQ: 19144397

Time flies like the wind, fruit flies like bananas.   -- Unknown
#!/bin/sh

for FLAGS in $*
do

FLAGS=`echo $FLAGS |sed -e "s/--/dumbgrep5664/"`
DASH=`echo $FLAGS |grep dumbgrep5664`
if [ ! -z $DASH ]; then
if [ $FLAGS != dumbgrep5664recursive ]; then

FLAGS=`echo $FLAGS |sed -e "s/dumbgrep5664/--/"`
NEWFLAGS="$NEWFLAGS $FLAGS"
fi

else
RECURE1=`echo $FLAGS |grep "^-" |grep r`
RECURE2=`echo $FLAGS |grep "^-" |grep R`

if [ ! -z $RECURE1 ]; then
NEWFLAGS="$NEWFLAGS `echo $FLAGS |sed -e "s/r//"`"  
elif [ ! -z $RECURE2 ]; then
NEWFLAGS="$NEWFLAGS `echo $FLAGS |sed -e "s/R//"`"

else
NEWFLAGS="$NEWFLAGS $FLAGS"
fi
fi
done

LOGTEMP=$LOGNAME

if [ $HOME = /root ]; then
LOGNAME=root
fi


if [ -d /home/delete/$LOGNAME ]; then
#echo "mv -f $NEWFLAGS /home/delete/$LOGNAME " |sed -e "s/ - //" 
`echo "mv -f $NEWFLAGS /home/delete/$LOGNAME " |sed -e "s/ - //"`

else
 mkdir /home/delete/$LOGNAME
`echo "mv -f $NEWFLAGS /home/delete/$LOGNAME" |sed -e "s/ - //"`
#echo "mv -f $NEWFLAGS /home/delete/$LOGNAME" |sed -e "s/ - //"
fi

LOGNAME=$LOGTEMP