Call a program

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

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

On Aug 17, 2007, at 17:44 , greg wrote:

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?

ls = ls -la

HTH,

~Wayne

s///g
Wayne E. Seguin
Sr. Systems Architect & Systems Administrator

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs