crontab issue

I am adding a piece of code which adds entry in crontab ((in brown color))

\crontab -l > $tmpfile
echo "Removing the cleanProcess entry if it already existed.."
grep -v "cleanProcess.sh" $tmpfile > $newtmpfile
lcnt=`grep -c "cleanProcess.sh" $tmpfile`
echo "Number of entries in cron is : $lcnt"
if [ $lcnt -eq 0 ]; then
echo "Entry didn't exist before. Adding new...."
echo "\n" >> $newtmpfile
else
echo "Entry already existed. Replacing it..."
fi
echo "0,5,10,15,20,25,30,35,40,45,50,55 * * * * $/test/bin/cleanProcess.sh" >> $newtmpfile
crontab $newtmpfile
echo "Added the new entry.."

crontab is empty ==>

$> crontab -l
$>

but file is having string as follows :

\n
echo "0,5,10,15,20,25,30,35,40,45,50,55 * * * * $/test/bin/cleanProcess.sh"

becoz of that the crontab is not able to initialized properly .

any anybody help me out whats wrong with it?

Solaris cron does not like empty lines and will not work that way as you have discovered, so your line:

echo "\n" >> $newtmpfile

needs to be:

echo "#\n" >> $newtmpfile

instead.

my system is linux redhat.
and now entry in crontab is

$> crontab -l
#\n
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /test/bin/cleanProcess.sh

is that #\n is valid entry in crontab?

More valid than an empty line or a "\n", the crontab will now work, I see the \n is being treated literally, should have said:

echo "#" >> $newtmpfile

The \n is quite unnecessary! Should have realised that before, doh!

Thanks a lot..