Forum: Ruby on Rails RE: Re: Looking for a Ruby, ROR code sample or info

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D39d0ca068242d364ae06b7f817244f2?d=identicon&s=25 Straaten, Onno van der (Guest)
on 2006-01-24 10:21
(Received via mailing list)
Yes, sorry that is relevant.
On windows platform I want to call a command line tool and read the
output.

Onno
5b1c58ca5016a810cc7e54db31bf90ce?d=identicon&s=25 NexusNeo - Niket Patel (Guest)
on 2006-01-24 10:30
(Received via mailing list)
>irb
to access ruby prompt
>ruby /script/command
from your rails project directory to access rails object from command
line.

On 1/24/06, Straaten, Onno van der <onno.van.der.straaten@logicacmg.com>
wrote:
> [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Mikkel Bruun
> > Hi all,
> >
>
>
--
Best Regards,
Niket Patel
For NexusNeo Exim
(A Div of NexusNeo System & Exim Pvt. Ltd)
Tel:  +91 79 23244557
Fax: +91 79 23246531
E-mail: info@nexusneo.com
Web:   www.nexusneo.com
9b13522e3b75d56c2949a5030eaaff70?d=identicon&s=25 Johan Sörensen (Guest)
on 2006-01-24 10:45
(Received via mailing list)
Hi,

On 1/24/06, Straaten, Onno van der <onno.van.der.straaten@logicacmg.com>
wrote:
> Yes, sorry that is relevant.
> On windows platform I want to call a command line tool and read the
> output.

use `

irb(main):001:0> `df -h`.grep /disk0s3/
=> ["/dev/disk0s3               81G    72G   8.0G    90%    /\n"]

$ ri Kernel#\`
--------------------------------------------------------------- Kernel#`
     `cmd`    => string
------------------------------------------------------------------------
     Returns the standard output of running _cmd_ in a subshell. The
     built-in syntax +%x{...}+ uses this method. Sets +$?+ to the
     process status.

        `date`                   #=> "Wed Apr  9 08:56:30 CDT 2003\n"
        `ls testdir`.split[1]    #=> "main.rb"
        `echo oops && exit 99`   #=> "oops\n"
        $?.exitstatus            #=> 99

also see `ri popen`

and http://www.ruby-doc.org/stdlib/libdoc/open3/rdoc/

cheers,
JS

--
http://johansorensen.com
http://theexciter.com
This topic is locked and can not be replied to.