0

I would like my .cshrc file to carry out several commands depending on the host I've logged in to (the .cshrc file is on a disk that is shared by two different hosts).

Let's assume the two hosts are: login1.university.edu and login2.university.edu

I tried this command:

if(hostname == 'login1.university.edu') then
setenv R_LIBS_USER /n/Users/me/R.login1
else
setenv R_LIBS_USER /n/Users/me/R.login2
endif

which doesn't work.

What is the correct syntax?

Martin Tournoij
  • 26,737
  • 24
  • 105
  • 146
user1701545
  • 5,706
  • 14
  • 49
  • 80

1 Answers1

4

Surround the hostname command with backtics to execute it and compare the result.

if(`hostname` == 'login1.university.edu') then
setenv R_LIBS_USER /n/Users/me/R.login1
else
merlin2011
  • 71,677
  • 44
  • 195
  • 329