I'm trying to work out how to get SSH to run a script before passing a shell to me. The reason for this is that I will be logging into shared users on many boxes and I want my own configuration when I log in. It would not be appropriate to put my own environment variables and aliases into
.cshrc, not least because of the number of different users on different boxes that I will be logging in to.
So let's say I have my script with various
setenv commands at
/home/adam/my_script and I want it to be sourced when I log in.
I've tried using:
ssh user@server1 'source /home/adam/my_script; tcsh' ssh user@server1 '. /home/adam/my_script; tcsh'
and also this:
ssh user@server1 /home/adam/my_script ssh user@server1 'csh -c /home/adam/my_script'
tcsh (without an ampersand) is at the bottom of
my_script, but no combination works as you expect. Either the environment variables and aliases don't exist, or the shell will behave strangely, like there is no line input prompt.
What am I doing wrong?