LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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, 05: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, 07: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, 06:15 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,362

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

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

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


Reply



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 12:21 AM
cannot execute script file from shell shahrahulb Linux - General 4 03-04-2008 07:02 AM
auto execute shell script ykirankumar Linux - Software 3 09-22-2004 07:23 AM
shell script won't execute brandnewbie Linux - Newbie 7 08-10-2004 01:30 PM
shell script how to execute x2000koh Programming 6 07-29-2003 04:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:08 PM.

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
Open Source Consulting | Domain Registration