[Rails] Re: Looking for a Ruby, ROR code sample or info
Johan Sörensen
johans at gmail.com
Tue Jan 24 09:43:53 GMT 2006
Hi,
On 1/24/06, Straaten, Onno van der <onno.van.der.straaten at 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
More information about the Rails
mailing list