Host command with rsh ?

Discussion in 'Ruby' started by Jerome Hauss, Jan 13, 2004.

  1. Jerome Hauss

    Jerome Hauss Guest

    ------=_NextPart_000_017A_01C3DA07.A93CB4A0
    Content-Type: text/plain;
    charset="iso-8859-1"
    Content-Transfer-Encoding: quoted-printable

    Hi,

    I am trying to launch a host command to windows, the command is =
    something like
    "rsh myaixmachine -l myuser \"export PATH=3D/pvcsbindir:$PATH; vlog =
    mypvcsarchive > tomyfile; echo\""

    I would like to get the standard output for this command. But it does =
    not work properly : I need to do <ENTER> in my Windows console window, =
    and if I launch several such commands, it happens I am really stuck.

    It works with simple commands to Windows. And it works also when I try =
    some prepared command with `mycommand`

    An idea to this problem ?

    Regards,
    J=E9r=F4me Hauss


    PS. One of my simple tries

    def rsh(myaixmachine, command)
    @t =3D nil
    s =3D "rsh " + myaixmachine + " -l myuser \"#{ command }\""
    puts s
    @pipe =3D IO.popen(s)
    @t =3D @pipe.read
    @pipe.close
    @t
    end
    ------=_NextPart_000_017A_01C3DA07.A93CB4A0--
    Jerome Hauss, Jan 13, 2004
    #1
    1. Advertising

  2. You can use net/telnet instead

    require 'net/telnet'

    c=%^export PATH=/pvcsbindir:$PATH; vlogmypvcsarchive > tomyfile; echo "^

    s = Net::Telnet.new({"Host" => "myaixmachine")

    s.login("myuser","password")

    p s.command(c)


    s.close


    Jerome Hauss wrote:

    >Hi,
    >
    >I am trying to launch a host command to windows, the command is
    >something like
    >"rsh myaixmachine -l myuser \"export PATH=/pvcsbindir:$PATH; vlog
    >mypvcsarchive > tomyfile; echo\""
    >
    >I would like to get the standard output for this command. But it does
    >not work properly : I need to do <ENTER> in my Windows console window,
    >and if I launch several such commands, it happens I am really stuck.
    >
    >It works with simple commands to Windows. And it works also when I try
    >some prepared command with `mycommand`
    >
    >An idea to this problem ?
    >
    >Regards,
    >Jérôme Hauss
    >
    >
    >PS. One of my simple tries
    >
    >def rsh(myaixmachine, command)
    > @t = nil
    > s = "rsh " + myaixmachine + " -l myuser \"#{ command }\""
    > puts s
    > @pipe = IO.popen(s)
    > @t = @pipe.read
    > @pipe.close
    > @t
    > end
    >
    >
    >
    Bermejo, Rodrigo, Jan 13, 2004
    #2
    1. Advertising

  3. Jerome Hauss

    Jerome Hauss Guest

    Thank you Rodrigo,

    I have discovered that my example with IO.popen works fine if I use the -n
    option of Windows' rsh.
    (this option redirects the input of RSH on NULL)

    Regards,
    Jérôme Hauss

    ----- Original Message -----
    From: "Bermejo, Rodrigo" <>
    To: "ruby-talk ML" <>
    Sent: Tuesday, January 13, 2004 7:27 PM
    Subject: Re: Host command with rsh ?


    > You can use net/telnet instead
    >
    > require 'net/telnet'
    >
    > c=%^export PATH=/pvcsbindir:$PATH; vlogmypvcsarchive > tomyfile; echo "^
    >
    > s = Net::Telnet.new({"Host" => "myaixmachine")
    >
    > s.login("myuser","password")
    >
    > p s.command(c)
    >
    >
    > s.close
    >
    >
    > Jerome Hauss wrote:
    >
    > >Hi,
    > >
    > >I am trying to launch a host command to windows, the command is
    > >something like
    > >"rsh myaixmachine -l myuser \"export PATH=/pvcsbindir:$PATH; vlog
    > >mypvcsarchive > tomyfile; echo\""
    > >
    > >I would like to get the standard output for this command. But it does
    > >not work properly : I need to do <ENTER> in my Windows console window,
    > >and if I launch several such commands, it happens I am really stuck.
    > >
    > >It works with simple commands to Windows. And it works also when I try
    > >some prepared command with `mycommand`
    > >
    > >An idea to this problem ?
    > >
    > >Regards,
    > >Jérôme Hauss
    > >
    > >
    > >PS. One of my simple tries
    > >
    > >def rsh(myaixmachine, command)
    > > @t = nil
    > > s = "rsh " + myaixmachine + " -l myuser \"#{ command }\""
    > > puts s
    > > @pipe = IO.popen(s)
    > > @t = @pipe.read
    > > @pipe.close
    > > @t
    > > end
    > >
    > >
    > >

    >
    Jerome Hauss, Jan 14, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sc0ri0n

    disconnecting rsh session

    sc0ri0n, Feb 16, 2005, in forum: Perl
    Replies:
    1
    Views:
    539
    Jim Gibson
    Feb 16, 2005
  2. Replies:
    1
    Views:
    1,028
    Thomas Weidenfeller
    Apr 8, 2005
  3. David H
    Replies:
    0
    Views:
    471
    David H
    Dec 3, 2004
  4. rh0dium
    Replies:
    0
    Views:
    372
    rh0dium
    Aug 22, 2005
  5. Replies:
    16
    Views:
    731
    Martin Gregorie
    Jun 2, 2007
Loading...

Share This Page