--------------030807030800080409020704 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 http://ruby-doc.org/core/classes/Kernel.html -Justin --------------030807030800080409020704--