0

I'm the beginner of Linux. So I have a problem when I source the file.

$ source ~cupsoft/kims_setup.csh

bash: setenv: command not found bash: setenv: command not found bash: setenv: command not found bash: /home/cupsoft/kims_setup.csh: line 54: syntax error: unexpected end of file

How can I solve this problem?

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
  • 3
    The problem is that you are trying to use a file that is not written for your shell (probably bash). It can be done, but is complicated. Do you have a file kims_setup.sh? If you have it, use it instead, and it would solve your problems. If not, you first have to tell, which version of linux you are using. Then we can provide you with some instructions. – nobody Jun 28 '21 at 05:48
  • Thanks for reply! There's no kims_setup.sh. My Linux ver is Ubuntu 20.04.2 LTS. So how can i change the shell env? – HyungJoe Kwon Jun 28 '21 at 06:23
  • First execute sudo apt install tcsh. Then type csh and you are in C shell. You should be able to run your source command there. When you are done with your work, you can return to previous shell with exit, but the settings you have loaded in C shell will be lost. So I would recommend to finish your work in C shell, and then return to bash. ou can also make C shell your default (https://www.peachpit.com/articles/article.aspx?p=659655&seqNum=3), but I am not sure you want to do that. – nobody Jun 28 '21 at 06:44
  • 3
    Please include kims_setup.csh in your question. Remember to format it as code (select the block and use the {} button) – Chris Davies Jun 28 '21 at 07:08
  • 2
    if all that .csh script does is set some environment variables, it should be fairly easy to convert to bash script - just change setenv var value lines to export var="value". If it does more than that, the conversion will be more complicated. – cas Jun 28 '21 at 07:21
  • In addition to including the script (~cupsoft/kims_setup.csh) it could be helpful if you tell us why you want to source this file / where does it come from, what is it and what's the purpose? (Not a ref to Gauguin lol) – ibuprofen Jun 28 '21 at 11:40

1 Answers1

0

You're trying to use a script for a different kind of shell (the C shell) for your shell (bash).

That doesn't work – these two speak a different language, which is exactly what you see here.

Now, you could use the C shell instead of bash. But, honestly, that's a terrible idea; the C shell is relatively rarely used these days, so getting help will be very hard, and a lot of things you can learn online just don't apply.

The best solution is probably just to figure out what kims_setup.csh actually does - probably the problem it's solving is easier to solve in bash than it is to use the script with your bash. It might be relatively easy to "translate" that script to a bash script. It's also pretty likely the script simply won't work great for you – I assume Kim is the author, and it's not that unlikely that the setup that worked for their PC simply does not apply to your system. Be very sure you actually do something useful for you before you spend a lot of time on this!

You could also start csh, source ~cupsoft/kims_setup.csh from there, and then start bash from there; but it's not very user-friendly, is it.