Run ruby application with params

Hi, i need to run an aplication and send a param with it
like
$ ruby application.rb -param_here

Is it possible ?
how to receive this param_here in the ruby application ?

thanks any help

Is it possible ?
how to receive this param_here in the ruby application ?

thanks any help

Posted via http://www.ruby-forum.com/.

[email protected]:~$ cat test.rb
require ‘pp’
pp ARGV
[email protected]:~$ ruby test.rb blah1 blah2
[“blah1”, “blah2”]
[email protected]:~$

There are also the GetOptLong and OptionParser standard libraries.

HTH,

Felix

Luiz M. a écrit :

Hi, i need to run an aplication and send a param with it
like
$ ruby application.rb -param_here

Is it possible ?
how to receive this param_here in the ruby application ?

thanks any help
Hi,

You can use CmdParse or OptionParser gems

On Aug 22, 6:35 am, Luiz M. [email protected]
wrote:

Hi, i need to run an aplication and send a param with it
like
$ ruby application.rb -param_here

Is it possible ?
how to receive this param_here in the ruby application ?

thanks any help

Posted viahttp://www.ruby-forum.com/.

$ ruby temp.rb fee fi fo fum
[“fee”, “fi”, “fo”, “fum”]

And the file temp.rb has
p ARGV

2007/8/22, Stephane W. [email protected]:

You can use CmdParse or OptionParser gems

OptionParser is not a gem AFAIK - it’s part of the std lib.

robert

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs