LinuxQuestions.org
Help answer threads with 0 replies.
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 03-16-2021, 01:28 AM   #1
Mirror of Erised
LQ Newbie
 
Registered: Oct 2020
Posts: 1

Rep: Reputation: Disabled
/.cshrc: Syntax error: unexpected end of file


Hello to all the wonderful people out there,

I am a newbie in the world of Linux (obviously!!!!). I would love to get some help regarding the following matter. I am trying to install a software called SPARTA+. While installing I sourced the .cshrc file and I faced the following error when .

/.cshrc: line 5: syntax error: unexpected end of file

This is how the .cshrc file looks like

if (-e $SPARTAP_Dir/sparta+Init.com) then
source $SPARTAP_Dir/sparta+Init.com
endif

It will be great if someone can tell me what's wrong with this .cshrc file or what does the error mean.
Thank you
 
Old 03-16-2021, 04:15 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,852

Rep: Reputation: 7310Reputation: 7310Reputation: 7310Reputation: 7310Reputation: 7310Reputation: 7310Reputation: 7310Reputation: 7310Reputation: 7310Reputation: 7310Reputation: 7310
I guess the file $SPARTAP_Dir/sparta+Init.com was not ok, but without details hard to say more.
 
Old 03-16-2021, 06:40 AM   #3
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,795

Rep: Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201
Yes indeed.
Put
Code:
set echo
before the source command to see what it does.
 
Old 03-16-2021, 09:55 PM   #4
X-LFS-2010
Member
 
Registered: Apr 2016
Posts: 510

Rep: Reputation: 58
looks like an ad for asian software funded by USA to me. also - it says it's gains are "modest"

also, "set echo" is NOT AN ANSWER, and csh is default shell in freeBSD not linux
 
Old 03-16-2021, 09:59 PM   #5
X-LFS-2010
Member
 
Registered: Apr 2016
Posts: 510

Rep: Reputation: 58
/.cshrc: line 5: syntax error: unexpected end of file IS THE PROBLEM

the sytax in this case doesn't work in bash or csh if i remember a little csh correctly

if [ -e $SPARTAP_Dir/sparta+Init.com ] ; then
source $SPARTAP_Dir/sparta+Init.com
endif

if (-e $SPARTAP_Dir/sparta+Init.com) ; then
source $SPARTAP_Dir/sparta+Init.com
endif

if $(test -e $SPARTAP_Dir/sparta+Init.com) ; then
source $SPARTAP_Dir/sparta+Init.com
endif
 
Old 03-19-2021, 10:25 AM   #6
cynwulf
Senior Member
 
Registered: Apr 2005
Posts: 2,727

Rep: Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367
https://spin.niddk.nih.gov/bax/software/SPARTA+/

The instructions are for macOS (and apparently "linux9"... RHEL9?) and assume that either csh or tcsh are installed.

You should post the whole contents of ~/.cshrc, along with the distribution you are using and what you enter to produce the error, if you expect to receive any meaningful assistance.

Last edited by cynwulf; 03-19-2021 at 10:28 AM.
 
Old 03-19-2021, 11:55 AM   #7
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
Missing line terminator probably, incompatible editor.
 
Old 03-19-2021, 12:59 PM   #8
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,670

Rep: Reputation: Disabled
^Nope. Tried it with tcsh 6.20.00, 6.21.00, and csh 20110502. All of them recognize scripts without the trailing newline just fine.
 
Old 03-19-2021, 01:04 PM   #9
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
OP said they sourced it, never mentioned what shell was used. It may been even bash.
 
Old 03-19-2021, 02:38 PM   #10
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,670

Rep: Reputation: Disabled
Quote:
Originally Posted by Emerson View Post
It may been even bash.
Yep, you're right. Sourcing a C-Shell script in Bash gives this error:
Code:
$ cat script.csh
#!/bin/csh
if(-e $Undefined_Variable/a_file)then
	source $Undefined_Variable/a_file
endif
$ csh script.csh
Undefined_Variable: Undefined variable.
$ bash -c 'source script.csh'
script.csh: line 5: syntax error: unexpected end of file
I also suspect that OP haven't defined $SPARTAP_Dir anywhere, so even sourcing it in csh would fail.

Last edited by shruggy; 03-19-2021 at 02:59 PM.
 
Old 03-19-2021, 04:13 PM   #11
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
I saw 2 things in line 5
Code:
if (-e $SPARTAP_Dir/sparta+Init.com) then
    ^                              ^ ^
    |                              | |
1. test requires space between the argument and the enclosing brackets.
2. if - then requires that then be on the next line or that there be a ; between the test and then.
Thus it should be

if ( -e $SPARTAP_Dir/sparta+Init.com ); then
Regardless of what else is wrong the form of that line must be fixed.
 
Old 03-19-2021, 04:37 PM   #12
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,670

Rep: Reputation: Disabled
@computersavvy. No. This is csh. Even the white space around parentheses is optional. The following is perfectly correct in csh:
Code:
if(-e $SPARTAP_Dir/sparta+Init.com)then

Last edited by shruggy; 03-20-2021 at 12:12 PM.
 
1 members found this post helpful.
  


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
Command line execution error: unexpected EOF while looking for matching `"' bash: -c: line 25: syntax error: unexpected end of file maheshreddy690 Linux - Newbie 1 12-25-2018 01:13 PM
[SOLVED] Script returning with error "syntax error: unexpected end of file" n_raghuvanshi Linux - Software 4 08-25-2013 08:49 AM
Error in Bash: line 77: syntax error: unexpected end of file bribon Programming 8 07-13-2011 12:43 PM
why to commit .cshrc "source .cshrc" file in every new shell session simer_anand88 Mandriva 3 10-23-2009 09:44 AM
Backup Script error "line 31: syntax error: unexpected end of file" eswanepoel General 7 12-07-2007 09:28 AM

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

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