LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Error:- Empty If - - can execute script on c shell (https://www.linuxquestions.org/questions/linux-newbie-8/error-empty-if-can-execute-script-on-c-shell-763671/)

sahil.jammu 10-22-2009 05:16 AM

Error:- Empty If - - can execute script on c shell
 
Hi,

I am trying to execute this small shell script in cshell, I am getting if: Empty if.
Error.

----------------------
#!/bin/csh

setenv COMP_FILES /NR/difference_files
#/usr/sbin/sendmail user1@abc.com < $COMP_FILES/taskcomp/diff_task_tue_wed.txt

setenv DAY `date | sed 's/ .*//'`

#Email of comparison files

if ($DAY == Mon)
then
/usr/sbin/sendmail user2@abc.com < $COMP_FILES/taskcomp/diff_task_fri_mon.txt ;

else if ($DAY == Tue)
then
/usr/sbin/sendmail user2@abc.com < $COMP_FILES/taskcomp/diff_task_mon_tue.txt;

else if ($DAY == Wed)
then
/usr/sbin/sendmail user2@abc.com < $COMP_FILES/taskcomp/diff_task_tue_wed.txt;

else if ($DAY == Thu)
then
/usr/sbin/sendmail user2@abc.com < $COMP_FILES/taskcomp/diff_task_wed_thu.txt;

else if ($DAY == Fri)
then
/usr/sbin/sendmail user2@abc.com < $COMP_FILES/taskcomp/diff_task_thu_fri.txt;

else
echo "try again"
endif
----------------------------

sahil.jammu 10-22-2009 07:05 AM

Hi All,

I got the solution, then has to be in same line and if ($DAY =~ Mon) needs to be there...
thnx

chrism01 10-22-2009 06:15 PM

You may want to read this: http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/

sahil.jammu 10-23-2009 01:50 AM

Thanks Chris

smeezekitty 10-23-2009 02:30 AM

Quote:

Originally Posted by chrism01 (Post 3729167)

CSH ain't as bad as you always say.


All times are GMT -5. The time now is 10:43 PM.