Problem running old software under .bashrc
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.
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.
i have tried all ways to delete this noob reply,all failed however.:cry:
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:
If you get something back like
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):
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".
|All times are GMT -5. The time now is 02:16 PM.|