I have a ~/.cshrc file that is sourcing another file, which should source an additional file but is not

0

I recently inherited an administration role for my lab and I'm still fairly new to this... so hopefully this question makes sense. Our system is set up so that one server hosts the data/user directories, one has the software and apps, and three systems are used as working computers that have these other servers mounted. When a new user is created, a ~/.cshrc file is generated that sources a parent .cshrc file on the software server. This parent file contains all the path settings and variables etc necessary to access the different programs we install onto the mounted software server. It's a total mess... but oh well.

One of the programs we use needs to source a different file before starting up in order to properly set the environment and load the correct directories. For some reason, this source instance is no longer happening upon opening a terminal window. Here's what I've found:

  • I try and start the program from command line and it recognizes the command from the parent .cshrc, tries to load but looks in the /usr/local directory on the computer rather than the directory on the software server (I believe this is the software's default action).

  • If I run source ~/.cshrc in terminal, nothing changes. However, if I source the parent .cshrc file from the terminal, and then try and load the program, it opens up no problem.

  • I know the ~/.cshrc is properly sourcing the parent .cshrc file because I placed a test echo within that file and I can see this echo when I open up a terminal window. It seems the source command within the sourced parent file is not happening.

Does this make sense? Are there too many layers of sourcing going on or something? I have no idea why this is happening. Here's the code within the parent .cshrc file that isn't properly completing:

set hname = `hostname`

##############
####
#### ccp4i
####
##############
switch ($hname)
    case phase15.XXX.edu:
         source /usr/local_programs/32-bit/ccp4/6.3.01/ccp4-6.3.0/bin/ccp4.setup-csh
         source /usr/local_programs/32-bit/ccp4/6.3.01/ccp4-6.3.0/setup-scripts/ccp4.setup-csh
         echo "ccp4i sourced" #(THIS SHOWS UP)
         breaksw
    default:
         echo "CCP4 env setting?"
         breaksw
endsw
##############

The switch is because different computers need to load different versions of the software. Thanks in advance.

beowulfey

Posted 2014-11-17T21:05:22.803

Reputation: 1

Answers

0

Just for recording purposes, I figured out the problem; kind of obvious in retrospect. The users' ~./cshrc file had a separate source command in it that was messing up everything after sourcing the parent file. In the end, I guess this is a lesson to always read through everything carefully...

beowulfey

Posted 2014-11-17T21:05:22.803

Reputation: 1