Converting bash script to csh

Hi,

I'm a beginner in scripting and I recently wrote a bash script that would've worked fine until I realized it needed to be written in csh. Could someone please show me how to correctly change the syntax from bash to csh in this script? Any help will be greatly appreciated. I can provide more details on the nature of the script if need be.

#!/bin/bash
print "Separating crashlist for today's date? (y/n)"
read choice
case $choice in
y)

crashlist > separate
;;
n)

echo "Please enter date (yyyymmdd)"
read date
crashlist -d $date > separate
;;
esac

whale ()

{

for host in "whale-1" "whale-2" "whale-3" "whale-4"
do
if grep $host separate
then
echo
echo
echo "Jobs above were lost on $host" ; echo ; echo "Total hours lost:"
grep $host separate | awk ' {sum += $11 }; END { print sum } '
echo
echo "Number of jobs lost:"
grep $host separate | awk 'END{print NR}'
echo -n Press Enter to continue ; read
echo
else
echo
echo
echo "No jobs lost on $host." ; echo ; echo -n Press Enter to continue ; read
echo
echo
echo
fi

done

}

dolphin ()

{

for host in "dolphin-1" "dolphin-2" "dolphin-3" "dolphin-4"
do
if grep $host separate
then
echo
echo
echo "Jobs above were lost on $host" ; echo ; echo "Total hours lost:"
grep $host separate | awk ' {sum += $11 }; END { print sum } '
echo
echo "Number of jobs lost:"
grep $host separate | awk 'END{print NR}'
echo -n Press Enter to continue ; read
echo
else
echo
echo
echo "No jobs lost on $host." ; echo ; echo -n Press Enter to continue ; read
echo
echo
echo
fi

done

}

if grep -q "whale" separate
then
whale
else
dolphin
fi

I think there is a conspiracy in educational establishments to force people to use csh.

Does anyone voluntarily use csh in the real world, if so why?

Where I work they do use csh, don't ask me why but they do. I already have a perfectly working bash script, but I have to change it now. :mad:

Hi.

See http://www.bsdforums.org/forums/showthread.php?t=49709 post #4 and others for some links that may help ... cheers, drl

( edit 1: minor typo )

Thanks for the help!