Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Call a program

Reply
Thread Tools

Call a program

 
 
greg
Guest
Posts: n/a
 
      08-17-2007
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

 
Reply With Quote
 
 
 
 
Robert Klemme
Guest
Posts: n/a
 
      08-17-2007
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
WX call a pywx program from a program, and return values Marcpp Python 1 06-24-2007 11:11 PM
Call Manager limit call duration nazgulero Cisco 0 10-25-2005 06:58 AM
RMI: remote call or local call Buu Nguyen Java 5 09-17-2004 08:05 AM
help: need to call call web service from java bill sandner Java 1 07-01-2004 02:57 PM
PN: Sample code to call another program/command from inside a C++ program Peter Nolan C++ 4 04-08-2004 08:33 PM



Advertisments