LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-10-2011, 07:31 PM   #1
nipuniitg
LQ Newbie
 
Registered: Nov 2011
Posts: 3

Rep: Reputation: Disabled
line 23 :syntax error unexpected end of file detected


Below is a script in a software.
I used the command "source setup_env.csh" and it says
"line 23:syntax error unexpected end of file detected"


#setup_env.csh
echo "#####################################################################"
echo ""
echo "Setting up the environment ..."

if ( ! ( -d bin ) || ! ( -d lib ) ) then
echo "ERROR: Your installation is not proper or you are you are sourcing itt from a wrong directory ..."
echo "Contact support@questatechnologgies.com for any help "
echo "#####################################################################"
exit 1
endif

setenv QUESTATECH_HOME $PWD

setenv PATH "$QUESTATECH_HOME/bin:$PATH"

echo ""
echo "Completed the environment setup, you're all set to run the tool(s) ..."
echo ""
echo "#####################################################################"
echo ""
exit 0



thanks a lot if u help...and waiting eagerly for your reply
 
Old 11-10-2011, 08:36 PM   #2
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
The close tag for if is fi, not endif
At least I hope csh sytax is the same as bash.

jlinkels
 
Old 11-10-2011, 09:18 PM   #3
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
Please use [code][/code] tags around your code, to preserve formatting and to improve readability. ...And to prevent the page from side-scrolling.

An "end of file" error nearly always means that you've missed a closing mark of some kind. The parser reached the end of the file without finding the quote-mark, character, or word that's supposed to end an expression (or it found an unmatched opening mark that's not supposed to be there).

Don't pay too much attention to the line number given with the errors either; the message indicates the point where it couldn't continue to process the script, which is often not the place where the actual mistake lies. Work backwards from that point until you find the mistake.

@jinkels No, it appears that endif is correct.

http://www.csem.duke.edu/Cluster/csh_basics.htm#if

That means, however, that there are no mistakes that I can see offhand. Not that I'm very familiar with csh myself. But most of the lines are just simple echo strings, all properly quoted AFAICT.
 
Old 11-10-2011, 11:35 PM   #4
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
line 22 is "exit 0 " so 23 is the missing new line ? maybe ?


code tags would help
 
Old 11-11-2011, 11:38 AM   #5
nipuniitg
LQ Newbie
 
Registered: Nov 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
thanks a lot for your replies but i couldn't make out the mistake....
my observation says that the error is in the "if" conditional statement(i used a test echo before "if" and it worked fine)
so anyone who pin points the flaw reply me soon....


thanks for your patience and waiting for your cursor to be on the 'reply post' button
 
Old 11-11-2011, 12:07 PM   #6
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by nipuniitg View Post
thanks a lot for your replies but i couldn't make out the mistake....
my observation says that the error is in the "if" conditional statement(i used a test echo before "if" and it worked fine) so anyone who pin points the flaw reply me soon....
thanks for your patience and waiting for your cursor to be on the 'reply post' button
Instead of waiting or telling us to hurry and "reply me soon", why don't you try to figure it out yourself?

Running the script under bash causes that error...and judging by the extension, it's a c-shell script. If I go into a cshell, it works fine...if not, it produces the error. Put a "#!/bin/csh" at the top.
 
1 members found this post helpful.
Old 11-11-2011, 08:35 PM   #7
nipuniitg
LQ Newbie
 
Registered: Nov 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
@TBone even "#!/bin/csh" did not work....
 
Old 11-12-2011, 03:44 PM   #8
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by nipuniitg View Post
@TBone even "#!/bin/csh" did not work....
Ok...is that the path for csh on your system?? What version? Because under csh 6.17.02, it works fine, and under bash it works fine as well, if I specify the /bin/csh line at the very top of the script.

What version/distro of Linux are you using, and do you want this to be a csh or bash script? It works fine as is under a csh environment, or by calling it explicitly in bash, as stated.
 
Old 11-13-2011, 02:12 PM   #9
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Moved: This thread is more suitable in <Software> as it has nothing to do w/ the kernel, and has been moved accordingly to help your thread/question get the exposure it deserves.
 
  


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
Error in Bash: line 77: syntax error: unexpected end of file bribon Programming 8 07-13-2011 12:43 PM
line 313: syntax error: unexpected end of file bes Linux - Newbie 3 05-02-2010 03:32 AM
-bash: *.sh: line 25: syntax error: unexpected end of file prashanth212 Linux - General 8 04-05-2010 11:52 PM
bash line 74: syntax error: unexpected end of file help? andycol Linux - General 5 09-14-2009 08:12 AM
/usr/bin/lesspipe: line 223: syntax error: unexpected end of file fakie_flip Linux - Software 1 09-06-2006 02:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:59 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