Hi there,
I'm trying to write a shell script where I create a file of directories that I want to compress. Then I loop round reading the file picking up the directory name and then doing a find with a gzip -9.
That's the theory anyway, what is happening is that the variable $LINE is ALWAYS blank and for the life of me I have no idea where I'm going wrong.
Does anyone have any ideas. I have tried also using a WHILE loop as well, but I get the same result. Below is the code I'm using.
Any suggestions anyone
sed '/^$/d' $CTM_FILEDIR/filelist.txt > /tmp/file_output.txt
mv /tmp/file_output.txt $CTM_FILEDIR/filelist.txt
rm -f /tmp/file_output.txt
echo "Generating Directory list" >> $LOGFILE 2>&1
while read LINE do
echo $LINE
cd $LINE
find . -mtime +$CMPDAY -exec gzip -9 * {} \; >> $LOGFILE 2>&1
done < $CTM_FILEDIR/filelist.txt
The file I'm reading from is $CTM_FILEDIR/filelist.txt. It has no blank lines
Thanks
Bob...
I'm trying to write a shell script where I create a file of directories that I want to compress. Then I loop round reading the file picking up the directory name and then doing a find with a gzip -9.
That's the theory anyway, what is happening is that the variable $LINE is ALWAYS blank and for the life of me I have no idea where I'm going wrong.
Does anyone have any ideas. I have tried also using a WHILE loop as well, but I get the same result. Below is the code I'm using.
Any suggestions anyone
sed '/^$/d' $CTM_FILEDIR/filelist.txt > /tmp/file_output.txt
mv /tmp/file_output.txt $CTM_FILEDIR/filelist.txt
rm -f /tmp/file_output.txt
echo "Generating Directory list" >> $LOGFILE 2>&1
while read LINE do
echo $LINE
cd $LINE
find . -mtime +$CMPDAY -exec gzip -9 * {} \; >> $LOGFILE 2>&1
done < $CTM_FILEDIR/filelist.txt
The file I'm reading from is $CTM_FILEDIR/filelist.txt. It has no blank lines
Thanks
Bob...