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
سؤال
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?
المحلول
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