Forum: Ruby running a system command

54c33acb1f7ebc9e0f06984bf41a4962?d=identicon&s=25 Very Newbie (verynewbie)
on 2006-06-14 21:22
how do i run a system command in ruby

in php it is exec("commandhere");

what is the ruby equivalent
B33ea5c12d767bfd1253940a960274f5?d=identicon&s=25 Tim Hunter (timhunter)
on 2006-06-14 21:28
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")
54c33acb1f7ebc9e0f06984bf41a4962?d=identicon&s=25 Very Newbie (verynewbie)
on 2006-06-14 21:39
Tim Hunter wrote:
> very newbie wrote:
>> how do i run a system command in ruby

> system("commandhere")

thanks that was it
31ab75f7ddda241830659630746cdd3a?d=identicon&s=25 Austin Ziegler (Guest)
on 2006-06-14 21:49
(Received via mailing list)
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

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
F3b7109c91841c7106784d229418f5dd?d=identicon&s=25 Justin Collins (justincollins)
on 2006-06-14 22:03
(Received via mailing list)
Tim Hunter wrote:
>
>

`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
http://ruby-doc.org/core/classes/Kernel.html

-Justin
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.