[mdlug] Execute a command on a host after ssh
Michael Mol
mikemol at gmail.com
Sat Aug 11 15:19:58 EDT 2012
On Sat, Aug 11, 2012 at 2:44 PM, R KANNAN <rk111810 at gmail.com> wrote:
> Hi,
>
> I want to execute a command (more precisely change to a directory) after
> sshing into a machine. The directory location is dynamic and is to be
> passed from a script. I could not find any way of doing this from the man
> pages for 'ssh'.
>
> Any suggestions on how this can be achieved.
ssh -t $hostname $command
Now, $command could conceivably be an explicit invocation of bash with
additional parameters, such as to execute another script.
The -t guarantees that a pty will be allocated on the remote end,
which is vital for most user-interactive programs.
--
:wq
More information about the mdlug
mailing list