Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > getting array input from command line

Reply
Thread Tools

getting array input from command line

 
 
Ted Flethuseo
Guest
Posts: n/a
 
      06-26-2010
Hi everyone,

I want to get some data from
a user, that I want to put in an
array.. well the first one is filename
and the rest are a bunch of numbers
which are sepparated by -i and -o
options.


inFile = ARGV[0]
myArr = -i params
myArr2 = -o params

Any help appreciated.
Ted.
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
botp
Guest
Posts: n/a
 
      06-26-2010
On Sat, Jun 26, 2010 at 1:58 PM, Ted Flethuseo <(E-Mail Removed)> wrote:
> inFile =3D ARGV[0]
> myArr =A0=3D -i params
> myArr2 =3D -o params


start fr a program that only contains:

p ARGV

kind regards -botp

 
Reply With Quote
 
 
 
 
Lee Jarvis
Guest
Posts: n/a
 
      06-26-2010
[Note: parts of this message were removed to make it a legal post.]

On 26 June 2010 06:58, Ted Flethuseo <(E-Mail Removed)> wrote:

> Hi everyone,
>
> I want to get some data from
> a user, that I want to put in an
> array.. well the first one is filename
> and the rest are a bunch of numbers
> which are sepparated by -i and -o
> options.
>
>
> inFile = ARGV[0]
> myArr = -i params
> myArr2 = -o params
>
> Any help appreciated.
> Ted.
> --
> Posted via http://www.ruby-forum.com/.
>
>

Also, check out OptionParser -
http://www.ruby-doc.org/stdlib/libdo...doc/index.html

 
Reply With Quote
 
Ted Flethuseo
Guest
Posts: n/a
 
      07-02-2010
Cool, but now I'm having some trouble transforming the array from:

["0", "1", "2", "3"] to [0,1,2,3].. how can I do this?

Ted.

Lee Jarvis wrote:
> On 26 June 2010 06:58, Ted Flethuseo <(E-Mail Removed)> wrote:
>
>> inFile = ARGV[0]
>> myArr = -i params
>> myArr2 = -o params
>>
>> Any help appreciated.
>> Ted.
>> --
>> Posted via http://www.ruby-forum.com/.
>>
>>

> Also, check out OptionParser -
> http://www.ruby-doc.org/stdlib/libdo...doc/index.html


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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Line in connector input not working? disabled? input radio to computer. 8ball meme Computer Support 7 11-18-2010 10:39 PM
Getting user input at command line when script also takes arguments Paul Ruby 1 04-24-2007 03:24 PM
Beginner: read $array with line breaks line by line Marek Stepanek Perl Misc 12 09-02-2006 10:27 AM
Getting User Input after getting Input from a file dei3cmix@uga.edu C++ 3 03-23-2006 05:01 AM
Re: character-at-a-time input from command line Tim Tyler Java 1 06-27-2003 05:25 PM



Advertisments