LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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, 08: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, 09:36 PM   #2
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,191

Rep: Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039
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, 10:18 PM   #3
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian + kde 4 / 5
Posts: 6,846

Rep: Reputation: 2007Reputation: 2007Reputation: 2007Reputation: 2007Reputation: 2007Reputation: 2007Reputation: 2007Reputation: 2007Reputation: 2007Reputation: 2007Reputation: 2007
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-11-2011, 12:35 AM   #4
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,465

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


code tags would help
 
Old 11-11-2011, 12:38 PM   #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, 01:07 PM   #6
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 22,338

Rep: Reputation: 6038Reputation: 6038Reputation: 6038Reputation: 6038Reputation: 6038Reputation: 6038Reputation: 6038Reputation: 6038Reputation: 6038Reputation: 6038Reputation: 6038
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, 09: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, 04:44 PM   #8
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 22,338

Rep: Reputation: 6038Reputation: 6038Reputation: 6038Reputation: 6038Reputation: 6038Reputation: 6038Reputation: 6038Reputation: 6038Reputation: 6038Reputation: 6038Reputation: 6038
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, 03:12 PM   #9
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 913Reputation: 913Reputation: 913Reputation: 913Reputation: 913Reputation: 913Reputation: 913Reputation: 913
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


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

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

All times are GMT -5. The time now is 06:57 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration