Call a program

Discussion in 'Ruby' started by greg, Aug 17, 2007.

  1. greg

    greg Guest

    Hi all,

    Can anyone help me with the following issue: How can I call a program
    (such as less, g++ etc.) from ruby script and save the output to a
    variable inside the ruby script?

    Thanks,
    Greg
    greg, Aug 17, 2007
    #1
    1. Advertising

  2. On 17.08.2007 23:42, greg wrote:
    > Can anyone help me with the following issue: How can I call a program
    > (such as less, g++ etc.) from ruby script and save the output to a
    > variable inside the ruby script?


    The easiest forms are these

    x=`ls -l`
    x=%x{ls -l}

    For more complex interactions please look at various versions of popen.

    Kind regards

    robert
    Robert Klemme, Aug 17, 2007
    #2
    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. bill sandner
    Replies:
    1
    Views:
    874
    iksrazal
    Jul 1, 2004
  2. Buu Nguyen

    RMI: remote call or local call

    Buu Nguyen, Sep 9, 2004, in forum: Java
    Replies:
    5
    Views:
    789
    Esmond Pitt
    Sep 17, 2004
  3. Peter Nolan
    Replies:
    4
    Views:
    11,002
    E. Robert Tisdale
    Apr 8, 2004
  4. hasho

    call by address vs. call by value

    hasho, Feb 10, 2004, in forum: C Programming
    Replies:
    35
    Views:
    2,977
    E. Robert Tisdale
    Feb 11, 2004
  5. Marcpp
    Replies:
    1
    Views:
    786
Loading...

Share This Page