setting current dir of remote shell

Bob Proulx bob at proulx.com
Sat Apr 28 03:20:37 EST 2007


> Darren Tucker wrote:
> It's not exactly the same as a login shell but it's close:
> ...
> ssh -t someserver "cd `pwd` && exec $SHELL -"

If the shell supports it then the -l extension (e.g. bash) can enable
it to be a login shell and then it would be the same.

  ssh -t someserver "cd $(pwd) && exec -l $SHELL"

However that does make for a funny looking $0.

  echo $0
  -/bin/bash

For me the following works:

  ssh -t someserver "cd $(pwd) && exec -l \$0"
  $ echo $0
  -bash

Bob


More information about the openssh-unix-dev mailing list