On Sun, Dec 05, 2004 at 08:19:04PM -0500, Kamaraju Kusumanchi wrote:
> On Sun, 05 Dec 2004 18:48:19 -0500, David Mandelberg
> <[EMAIL PROTECTED]> wrote:
> > Miquel van Smoorenburg wrote:
> > >       ssh -t [EMAIL PROTECTED] 'cd / && exec /bin/bash'
> > 
> > That works, but because this is a login shell, and the remote machine
> > may differentiate between login and non-login shells, this is better:
> > 
> > ssh -t [EMAIL PROTECTED] 'cd / && exec /bin/bash --login -i'
> > 
> > Also don't forget the exec because otherwise you'd be running an extra
> > shell or the single quotes before cd and after -i.
> > 
> 
> This does work perfectly. I am wondering if there is a clever trick to
> do the following.
> 
> In the above examples we are specifying the destination directory. But
> can this directory be obtained from the original machine?
> 
> For example, can I do something like
> 
> bash$export DYNAMIC=$(basename $PWD)
> bash$ssh -t [EMAIL PROTECTED] 'cd $DYNAMIC && exec /bin/bash --login -i'
> 
> which dynamically determines the current directory on the ssh client
> and puts me into that directory on the shell.example.net? Needless to
> say, I tried the above example and it does not work.


Do those really have to be single quotes?  If double quotes would work, 
that $DYNAMIC should be interpreted by your local shell, which would 
have the desired effect.  As it stands, the remote shell is looking 
for the variable, which doesn't exist.


-- 
David Jardine

"Running Debian GNU/Linux and
loving every minute of it." -Sacher M.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to