in reply to Perl, Unix terminals, and SSH complicated combination

How is my_command forwarded to HostB? Do you do ssh account@HostA "ssh account@HostB my_command" or is the forwarding done via some scripting in .bashr or .profile ? or is my_command itself a script invocation which spawns a ssh session on HostB ?

Meanwhile, maybe a ssh chain with agent forwarding (see option -A in the ssh manpage) would be a solution, maybe the thread ssh chain helps.

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Replies are listed 'Best First'.
Re^2: Perl, Unix terminals, and SSH complicated combination
by RaduH (Scribe) on Dec 14, 2007 at 00:39 UTC
    shmem,

    Your question pointed my in the right direction and I solved the problem without looking at that page (I'll read it soon as I am sure has interesting stuff for me to learn).

    It turns out I need to use back ticks when I invoke a remote command AND print the output, not only return it. If I print the output, that makes it catchable in a cascaded chain of calls. When I execute the command locally (the command is the real stuff, not just a requirement for forwarding) I execute it with 'system' and thus my "parent" 's back ticks can capture the output.

    To summarize: capture with back ticks and also print it for chaining. I was happy to learn this and wanted to share.

    Thanks again!