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. Advertisements

  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. Advertisements

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:
    1,086
    iksrazal
    Jul 1, 2004
  2. Buu Nguyen

    RMI: remote call or local call

    Buu Nguyen, Sep 9, 2004, in forum: Java
    Replies:
    5
    Views:
    1,008
    Esmond Pitt
    Sep 17, 2004
  3. Peter Nolan
    Replies:
    4
    Views:
    11,231
    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:
    3,539
    E. Robert Tisdale
    Feb 11, 2004
  5. system call and library call

    , Aug 22, 2005, in forum: C Programming
    Replies:
    7
    Views:
    3,306
    Jonathan Bartlett
    Aug 23, 2005
  6. ravi
    Replies:
    10
    Views:
    1,364
    Chris Torek
    Feb 23, 2007
  7. leoman730

    System call and library call

    leoman730, May 3, 2007, in forum: C++
    Replies:
    6
    Views:
    1,084
    Jim Langston
    May 6, 2007
  8. Marcpp
    Replies:
    1
    Views:
    885
Loading...