vaf
March 2nd, 2009, 08:06 AM
Please tell me what I'm doing wrong!!!
i=79 \
j=1 \
while [ $i -gt 0 ] \
do \
j =`expr $i + 1` \
if [ -d $SNAPSHOT_RW/hourly.$i ] ; then \
$MV $SNAPSHOT_RW/hourly.$i $SNAPSHOT_RW/hourly.$j ; \
fi; \
i=`expr $i - 1` \
done \
I get
line 63: syntax error near unexpected token `then'
line 63: ` if [ -d $SNAPSHOT_RW/hourly.$i ] ; then \'
It should be an easy one! Thanks from a beginner scripter (not even close to a programmer!)
[-o<
I'm trying to create a loop to do this from 79 to 1
if [ -d $SNAPSHOT_RW/home/hourly.2 ] ; then \
$MV $SNAPSHOT_RW/home/hourly.2 $SNAPSHOT_RW/home/hourly.3 ; \
fi;
if [ -d $SNAPSHOT_RW/home/hourly.1 ] ; then \
$MV $SNAPSHOT_RW/home/hourly.1 $SNAPSHOT_RW/home/hourly.2 ; \
fi;
i=79 \
j=1 \
while [ $i -gt 0 ] \
do \
j =`expr $i + 1` \
if [ -d $SNAPSHOT_RW/hourly.$i ] ; then \
$MV $SNAPSHOT_RW/hourly.$i $SNAPSHOT_RW/hourly.$j ; \
fi; \
i=`expr $i - 1` \
done \
I get
line 63: syntax error near unexpected token `then'
line 63: ` if [ -d $SNAPSHOT_RW/hourly.$i ] ; then \'
It should be an easy one! Thanks from a beginner scripter (not even close to a programmer!)
[-o<
I'm trying to create a loop to do this from 79 to 1
if [ -d $SNAPSHOT_RW/home/hourly.2 ] ; then \
$MV $SNAPSHOT_RW/home/hourly.2 $SNAPSHOT_RW/home/hourly.3 ; \
fi;
if [ -d $SNAPSHOT_RW/home/hourly.1 ] ; then \
$MV $SNAPSHOT_RW/home/hourly.1 $SNAPSHOT_RW/home/hourly.2 ; \
fi;