setting current dir of remote shell
Darren Tucker
dtucker at zip.com.au
Fri Apr 27 11:29:50 EST 2007
Dave Yost wrote:
> I have a command that will upload stuff from the current dir within a
> local copy of a web site to the corresponding dir on the web server.
> http://Yost.com/computers/yostupload
>
> The command has a -l argument that will log you in to the server via
> ssh. So far so good.
>
> But I would like this -l argument to set the current dir on the
> remote host so it is the dir corresponding to the current dir on the
> local host.
> I can't see how to do that with ssh, and if I try something like the
> following, ssh barfs.
>
> #!/bin/zsh
>
> ssh foo.com <<< cd website/bar/baz <& 0
It's not exactly the same as a login shell but it's close:
ssh -t someserver "(cd `pwd` && exec $SHELL -)"
--
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4 37C9 C982 80C7 8FF4 FA69
Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.
More information about the openssh-unix-dev
mailing list