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

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 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?

ls = `ls -la`

HTH,

   ~Wayne

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

···

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?