TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
It works
Thanks for all your help. My script now works. I'm in the process of
testing it to make sure it changes the flags right and everything. Am I
right that I can pass all the flags to mv except recursive (-r)?
Thanks again,
Ben
Ben Luey
lueyb@carleton.edu
ICQ: 19144397
No building is too tall for even the smallest dog to lift its leg on.
-- Jim Hightower
#!/bin/sh
for FLAGS in $*
do
FLAGS=`echo $FLAGS |sed -e "s/--/dumbgrep5664/"`
DASH=`echo $FLAGS |grep dumbgrep`
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`
echo $RECURE1
echo $RECURE2
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
if [ -d /home/delete/$LOGNAME ]; then
echo "mv $NEWFLAGS /home/delete/$LOGNAME " |sed -e "s/ - //"
else
echo mkdir /home/delete/$LOGNAME
echo "mv $NEWFLAGS /home/delete/$LOGNAME " |sed -e "s/ - //"
fi