LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 10-22-2009, 06:16 AM   #1
sahil.jammu
Member
 
Registered: Jun 2008
Distribution: Ubuntu
Posts: 83

Rep: Reputation: 15
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
----------------------------
 
Old 10-22-2009, 08:05 AM   #2
sahil.jammu
Member
 
Registered: Jun 2008
Distribution: Ubuntu
Posts: 83

Original Poster
Rep: Reputation: 15
Hi All,

I got the solution, then has to be in same line and if ($DAY =~ Mon) needs to be there...
thnx
 
Old 10-22-2009, 07:15 PM   #3
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
You may want to read this: http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/
 
Old 10-23-2009, 02:50 AM   #4
sahil.jammu
Member
 
Registered: Jun 2008
Distribution: Ubuntu
Posts: 83

Original Poster
Rep: Reputation: 15
Thanks Chris
 
Old 10-23-2009, 03:30 AM   #5
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,234

Rep: Reputation: 189Reputation: 189
Quote:
Originally Posted by chrism01 View Post
CSH ain't as bad as you always say.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
help with execute mulitple shell script within shell script ufmale Programming 6 09-13-2008 01:21 AM
cannot execute script file from shell shahrahulb Linux - General 4 03-04-2008 08:02 AM
auto execute shell script ykirankumar Linux - Software 3 09-22-2004 08:23 AM
shell script won't execute brandnewbie Linux - Newbie 7 08-10-2004 02:30 PM
shell script how to execute x2000koh Programming 6 07-29-2003 05:20 PM


All times are GMT -5. The time now is 10:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration