Newbie question: Calling a shell script from ruby

thanks all :slight_smile:

···

-----Original Message-----
From: GOTO Kentaro [mailto:gotoken@notwork.org]
Sent: Wednesday, 25 September 2002 10:36 AM
To: ruby-talk@ruby-lang.org
Subject: Re: Newbie question: Calling a shell script from ruby

At Wed, 25 Sep 2002 08:50:01 +0900, > Sethna, Zubin ZSethna@rsasecurity.com.au wrote:

Apologies if this question is already answered in the doc.
How do I call a
shell script from within ruby code? I have a lot of
existing scripts that
are written in perl and I’d like to call them from a ruby
framework. I
haven’t found anything in the doc about this, maybe I
missed something?

A simple way is

system(“/some/where/foo.sh”)

See also:

http://www.rubycentral.com/book/ref_m_kernel.html#Kernel.system
http://www.ruby-lang.org/en/man-1.4/syntax.html#command
http://www.rubycentral.com/book/ref_m_kernel.html#Kernel.fork
http://www.rubycentral.com/book/ref_m_kernel.html#Kernel.exec
http://www.rubycentral.com/book/ref_c_io.html#IO.popen

http://www.ruby-lang.org/~knu/cgi-bin/cvsweb.cgi/ruby/lib/open3.rb?rev=1.6.2
.4&content-type=text/x-cvsweb-markup

– Gotoken