Re: chaining ssh commands

From: Unruh (unruh-spam_at_physics.ubc.ca)
Date: 09/26/05


Date: 26 Sep 2005 15:26:03 GMT


"tom" <weiyetang@yahoo.com> writes:

>Hi,

>I need to cd to /usr/me directory on the remote machine and extract
>me.tar in that directory. I'm wondering how we can chain ssh commands
>like this:

>ssh me@remotebox cd /usr/me;ssh me@remotebox tar -xvf me.tar

ssh me@remotebox 'cd /usr/me; tar -xvf me.tar'

>Unfortunately, ssh will relogin into /home/me directory to extract the
>tar instead of using /usr/me directory. Does someone have an idea of
>how to do that properly?