Shell program

Hi, rubyists

I'm using system() to execute a shell program under Windows. I wonder
how I can get the result of the external program as a string, since
the system() returns either true or false. I also try to use the Dos
pipeline to save the result to a file, but it doesn't work like this:
system(" program.exe >result.txt"). I can't find anything to explain
why in ruby document. Anyone can help me a bit?

Thanks,

Sky

I'm using system() to execute a shell program under Windows. I wonder
how I can get the result of the external program as a string, since
the system() returns either true or false.

string = `program.exe`

(See also: IO.popen for another way.)

Hope this helps,

Bill

···

From: "Sky Yin" <sky.yin@gmail.com>

Thanks, Bill.

The yet another ruby shortcut works.

···

On 12/4/05, Bill Kelly <billk@cts.com> wrote:

From: "Sky Yin" <sky.yin@gmail.com>
>
> I'm using system() to execute a shell program under Windows. I wonder
> how I can get the result of the external program as a string, since
> the system() returns either true or false.

string = `program.exe`

(See also: IO.popen for another way.)

Hope this helps,

Bill