Running a system command

how do i run a system command in ruby

in php it is exec("commandhere");

what is the ruby equivalent

···

--
Posted via http://www.ruby-forum.com/.

very newbie wrote:

how do i run a system command in ruby

in php it is exec("commandhere");

what is the ruby equivalent

system("commandhere")

···

--
Posted via http://www.ruby-forum.com/\.

Please remember to look in the various information sources that exist
before asking a simple question like this. This could have been
Googled pretty easily. You *are* posting to a mailing list, not a mere
web forum.

-austin

···

On 6/14/06, qubit qubit <verynewbie@qubit17.com> wrote:

how do i run a system command in ruby

in php it is exec("commandhere");

what is the ruby equivalent

--
Austin Ziegler * halostatue@gmail.com * http://www.halostatue.ca/
               * austin@halostatue.ca * You are in a maze of twisty little passages, all alike. // halo • statue
               * austin@zieglers.ca

Tim Hunter wrote:

very newbie wrote:

how do i run a system command in ruby

system("commandhere")

thanks that was it

···

--
Posted via http://www.ruby-forum.com/\.

Tim Hunter wrote:

very newbie wrote:
  

how do i run a system command in ruby

in php it is exec("commandhere");

what is the ruby equivalent
    
system("commandhere")

`commandhere` will return the output:

irb(main):001:0> `ls -alt`
=> "total 8\ndrwxrwxr-x 2 justinc justinc 4096 Jun 14 12:55 .\n-rw-rw-r-- 1 justinc justinc 0 Jun 14 12:55 another\n-rw-rw-r-- 1 justinc justinc 0 Jun 14 12:55 file\n-rw-rw-r-- 1 justinc justinc 0 Jun 14 12:55 afile\ndrwxr-xr-x 59 justinc justinc 4096 Jun 14 11:13 ..\n"

Also, please checkout http://ruby-doc.org/ and especially module Kernel - RDoc Documentation

-Justin