On Sun, Dec 05, 2004 at 05:35:59PM -0500, Kamaraju Kusumanchi wrote: > On Sun, 5 Dec 2004 23:28:07 +0100, Maurits van Rees <[EMAIL PROTECTED]> wrote: > > On Sun, Dec 05, 2004 at 05:18:54PM -0500, David Mandelberg wrote: > > > ssh [EMAIL PROTECTED] "sh -c 'cd dirname; exec somecommand'" > > > > > > somecommand is the command you want to run after cd'ing. E.g. if you > > > want to run bash in / as joe at shell.example.net: > > > > > > ssh [EMAIL PROTECTED] "sh -c 'cd /; exec bash'" > > > > Alternatively, if you *always* want to start in that directory, you > > can edit the .bash_profile or similar on the remote machine. Just add > > `cd <some directory>'. > > > > No, I want this to happen only when I ssh. If i edit the bash_profile, > then everytime I open a window/shell, it gets executed. That is not > what I want. >
I'm ssh'ed in right now and see that the following variables are set: SSH_CLIENT=<stuff> SSH_CONNECTION=<more stuff> SSH_TTY=/dev/pts/0 You probably could wrap your cd command with a conditional testing for one of these. HTH dt -- Dave Thayer | WARNING: Persons denying the existence of Denver, Colorado USA | robots may be robots themselves. [EMAIL PROTECTED] | -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

