LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices


Reply
  Search this Thread
Old 12-14-2006, 09:21 PM   #1
wollery
LQ Newbie
 
Registered: Dec 2006
Location: China
Distribution: Red Hat Enterprise
Posts: 1

Rep: Reputation: 0
Problem running old software under .bashrc


Hi,
I recently installed Enterprise, version 2.6.9-5.EL, and have some old software that I need to run for work, but bash doesn't seem to like it. I installed it from a script that was designed to get it working under .cshrc or .tcshrc by writing a source script into them and the .login file. I figured it was just a case of adding this script to the .bashrc file, but it doesn't seem to like it. The programs are installed, and some of them work if I type the explicit file path, but some don't, I think because the .cshrc script should set them up when it runs, but isn't doing it from .bashrc.

When I log in or source the link manually I get the following error message;

bash: /star/etc/cshrc: line 694: syntax error: unexpected end of file

The software is the Starlink Astronomy package, and can be found at ftp.starlink.rl.ac.uk/pub/ussc/cdrom/current/

Unfortunately the Starlink organisation ceased to exist in 2004, and there have been no updates since then.


ETA Sorry, my bad, I just assumed that a forum called Linux - Enterprise would be about the Enterprise version of Linux. Could a mod please move this to the Software forum? Cheers.

Last edited by wollery; 12-14-2006 at 09:25 PM.
 
Old 12-15-2006, 02:25 AM   #2
hmc
LQ Newbie
 
Registered: Aug 2004
Location: Denmark
Distribution: Centos, Fedora
Posts: 23

Rep: Reputation: 15
Hi,

If your software is working with the C shell configuration and not with your Bash configuration, it is likely that you only need to establish some environment variables. There are different syntaxes for this is the two shells.

Csh style: setenv VARNAME value-string
Bash style: export VARNAME="value-string"

Check your csh configuration and all files 'source'd and include any variables set therein in you .bashrc (or create another file which defines them and source that from your .bashrc).

Sourcing from bash is: . <file-path>
Yes that is a dot.

Hope this helps.
 
Old 12-15-2006, 02:31 AM   #3
lcn
LQ Newbie
 
Registered: Dec 2006
Posts: 2

Rep: Reputation: 0
Unhappy

Quote:
Originally Posted by hmc
Hi,

If your software is working with the C shell configuration and not with your Bash configuration, it is likely that you only need to establish some environment variables. There are different syntaxes for this is the two shells.

Csh style: setenv VARNAME value-string
Bash style: export VARNAME="value-string"

Check your csh configuration and all files 'source'd and include any variables set therein in you .bashrc (or create another file which defines them and source that from your .bashrc).

Sourcing from bash is: . <file-path>
Yes that is a dot.

Hope this helps.
sorry for choosing as test of the first.
i have tried all ways to delete this noob reply,all failed however.

Last edited by lcn; 12-15-2006 at 03:24 AM. Reason: sorry...not able to delete it --_-
 
Old 12-15-2006, 09:44 AM   #4
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 31
Bourne csh differences

The fundamental problem is that you're dealing with two families of shell syntax: the Bourne family, and the csh family. Your .bashrc uses (duh) bash, which is in the Bourne family, and your problem script is (obviously) in the csh family.

You have two possible ways of fixing this. I'll describe the simpler way first.

The first way is to use csh to execute the problem script.

Enter the following at the command prompt:

which csh

If you get something back like

/bin/csh

then you're in luck. Go to the problem script and add a new line at the top. For this to work, it must be the first line of the script. The new line should look like this (but adjust it appropriately if your output from the "which" command was slightly different):

#!/bin/csh

Your script should now work. But make sure that if you've made any prior changes to it trying to get it to work, undo those changes! For example, if you've changed any statements from setenv to export (as advised by hmc in a different reply to your question), then you need to change those back.

But if you get something like this:

which: no csh in (/usr/local/bin:/usr/bin:/bin)

then you probably don't have csh on your system. In that case, try this whole first way over again, using tcsh instead of csh; tcsh is another shell in the csh syntax family.

If that doesn't work either, then you need to use the second way. This will be a little more work. It will involve converting your script so that it uses the Bourne syntax, so bash can handle it.

To do that, go to google (I hope that works in China), and search for this:

Bourne csh differences

You'll get several reference works that will help you out. Pick the one that works best for you. Don't forget to remove the "#!/bin/csh".

Good luck!
 
  


Reply

Tags
bash, bashrc, bourne, csh, cshell, cshrc, enterprise, shell, shell script



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
Assertion failed when running software (and compile problem) brickwalden Linux - Software 1 05-08-2006 07:19 PM
Problem running software!! nectron101 Linux - Software 2 04-09-2006 04:12 PM
How to modify my .bashrc in general to accomodate running binaries (e.g. SCHEME)? Erik_the_Red Linux - Software 1 08-01-2005 12:23 PM
Problem with bashrc file johnstv3 Red Hat 10 02-26-2004 02:09 AM
.bashrc problem davis2199 Linux - Software 1 09-02-2003 03:45 PM

LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise

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