0

I was given a software suite which is based around cshrc. Such that a user is supposed to source a setup.cshrc file and within that it sources numerous other .cshrc scripts to set up the environment to compile and run a bunch of old fortran written programs.

I am running RHEL 7.9 x86-64, and the author had told me to make a user account, or change my user account, to /usr/bin/csh in order to run everything properly. Is this really necessary?

All my attempts to run these csh setup files fail when doing from a bash shell. However if I do make a local user account in linux where in /etc/passwd it says /usr/bin/csh instead of /usr/bin/bash then all the csh scripts provided to me work when I run them. But I prefer that all my linux accounts (including mine) is bash. Is there a way to keep my account as bash but run these csh scripts?

4
  • If you log into your account where bash is the default and type csh that'll start an instance of the csh shell. If your run the commands at that point, do they work? Commented Apr 1, 2021 at 1:58
  • no, they do not work. Commented Apr 1, 2021 at 12:23
  • 1
    Some mention of what you saw when you tried it might be helpful Commented Apr 1, 2021 at 13:40
  • This seems apropos: Csh Programming Considered Harmful Commented Apr 2, 2021 at 20:33

1 Answer 1

0
  • You will be able to run your setup file from either csh or tcsh, generally not from bash (it really depends on the content of the csh script).

  • As a rule for (shell) scripts, if file setup.cshrc is properly equipped with a shebang #!/bin/csh or #!/bin/tcsh (or a variation of that) on its first line, then you need that interpreter to be present because the corresponding shell environment will be called for the content of the script to be properly executed.

If the output of chsh -l includes /bin/csh, or /bin/tcsh, just try:

$ /bin/csh setup.cshrc         # replace csh by tcsh if needed

If the output of chsh -l does NOT include /bin/csh, or /bin/tcsh, install tcsh on your system:

$ sudo yum install tcsh
$ cat /etc/shells       # < check that output includes /bin/tcsh 

Then you can either run from a shell as above:

$ tcsh setup.cshrc

or temporarily change your current account's default login shell to tcsh with:

$ chsh -s tcsh

and perform your setup from there.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.