Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a home directory that is mounted to several CentOS servers simultaneously, part of an OpenGrid cluster. Most of these server nodes are configured identically, so my personal configurations in my .profile file work fine. However, a couple of the nodes have different versions of R installed in different locations. Some nodes have multiple R versions installed. I'd like to be able to configure my environment so that specific R versions will be used on specific servers when I invoke the Rscript command. Can I do this with a single .profile file in my home directory, or would it be better to configure this another way?

share|improve this question
add comment

1 Answer

It seems (perhaps deceptively?) easy to me: insert a case $HOSTNAME loop in your .profile, like this

case $HOSTNAME in 

       my_first_server) Rscript /path/to/file1
       ;;

       my_second_server) Rscript /path/to/file2
       ;;
esac

Rscript is made for execution in #! scripts.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.