G'day,
I highly recommend moving away from csh towards something like bash or zsh.
stdio manipulation is not possible in csh. Have a read of "csh programming considered harmful". An elegant treatise on this topic.
Sorry it's not a direct answer but you'll find that you'll keep banging your head against the constraints of csh the longer you stick with it.
A lot of csh syntax is already available in bash so your learning curve won't be too steep.
Here's a quick suggestion for the same thing written in bash. It's not elegant though.
#!/bin/bash
TO_LOGFILE= "| tee -a ./install.log"
tar -zxf Python-3.1.1.tgz 2>&1 ${TO_LOGFILE}
if [ $? -ne 0 ];then
echo "Untar of Python failed. Exiting..."; exit 5
fi
cd Python-3.1.1 2>&1 ${TO_LOGFILE}
if [ $? -ne 0 ];then
echo "Can't change into Python dir. Exiting..."; exit 5
fi
echo "============== configure ================"
./configure 2>&1 ${TO_LOGFILE}
if [ $? -ne 0 ];then
echo "Configure failed. Exiting..."; exit 5
fi
echo "================ make ==================="
make 2>&1 ${TO_LOGFILE}
if [ $? -ne 0 ];then
echo "Compile of Python failed. Exiting..."; exit 5
fi
echo "================ install ================"
make install 2>&1 ${TO_LOGFILE}
if [ $? -ne 0 ];then
echo "Install of Python failed. Exiting..."; exit 5
fi
cd ..
rm -rf Python-3.1.1 2>&1 ${TO_LOGFILE}
exit 0
I've added a bit more checking and reporting so that if there's a problem in an earlier step the log file will just contain up until the error was uncovered rather than a stack of pretty useless error messages from the later phases that wouldn't complete anyway.
cheers,