Call a program

G

greg

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
 
R

Robert Klemme

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top