i seem to be having a problem with ARGV.
something as simple as this:
ARGV.each {|x| print “#{x}”}
prints: %*
regardless of how many arguments i use.
what’s the proper way of getting commandline arguments. i was hoping to
keep the code down by not using getoptlong, but i’ll use it if necessary
···
–
http://home.cogeco.ca/~tsummerfelt1
It works for me...
[ensemble] ~/p/ruby $ ruby -e 'ARGV.each {|x| print "#{x}\n"}' aa bb cc
aa
bb
cc
Can you give an example, or more context?
Cheers,
Sam
Quoteing snowzone5@hotmail.com, on Wed, Feb 04, 2004 at 02:25:12AM +0900:
···
i seem to be having a problem with ARGV.
something as simple as this:
ARGV.each {|x| print "#{x}"}
prints: %*
regardless of how many arguments i use.
what's the proper way of getting commandline arguments. i was hoping to
keep the code down by not using getoptlong, but i'll use it if necessary
--
http://home.cogeco.ca/~tsummerfelt1
In article HFQTb.1317$_62.501@read1.cgocable.net ,
i seem to be having a problem with ARGV.
something as simple as this:
ARGV.each {|x| print “#{x}”}
prints: %*
regardless of how many arguments i use.
what’s the proper way of getting commandline arguments. i was hoping to
keep the code down by not using getoptlong, but i’ll use it if necessary
Is that your entire code?
[mike@ratdog tmp]$ cat try.rb
#!/usr/bin/env ruby
ARGV.each {|x| puts “#{x}”}
[mike@ratdog tmp]$ ./try.rb foo bar baz
foo
bar
baz
[mike@ratdog tmp]$
Mike
···
mike@stok.co.uk | The “`Stok’ disclaimers” apply.
http://www.stok.co.uk/~mike/ | GPG PGP Key 1024D/059913DA
mike@exegenix.com | Fingerprint 0570 71CD 6790 7C28 3D60
http://www.exegenix.com/ | 75D2 9EC4 C1C0 0599 13DA
Gennady1
(Gennady)
3 February 2004 19:45
4
Mike Stok wrote:
In article HFQTb.1317$_62.501@read1.cgocable.net ,
i seem to be having a problem with ARGV.
something as simple as this:
ARGV.each {|x| print “#{x}”}
prints: %*
I would make a wild guess that you call your ruby script from a shell
script trying to pass it all command line parameters the sell script has
been called with. In a shell script $* stands for the entire command
line, and it seems like you do %* instead.
However if you use .bat files on Windows, where %* is a correct way to
specify all parameters, than it beats me.
Gennady.
···
tony summerfelt snowzone5@hotmail.com wrote:
yup.
i AM using the new windows installer version of ruby (v1.8.1 (2004-01-07)
that was just announced.
[checking older version (2004-01-27)].
ah ha…older version works fine…
i’d guess there’s something seriously wrong with the installer version
···
On Tue, 03 Feb 2004 at 19:27 GMT, Mike Stok mike@stok.co.uk wrote:
Is that your entire code?
ARGV.each {|x| puts “#{x}”}
–
http://home.cogeco.ca/~tsummerfelt1
this was all from the command line.
on further investigation, my command shell is 4nt (nt version of 4dos) and
just typing the program: argtest.rb aa bb
using a batch file it ran ok.
if i use the direct path to ruby g:\ruby\bin\ruby argtest.rb aa bb it
works fine also…
···
On Tue, 03 Feb 2004 at 19:45 GMT, Gennady gfb@tonesoft.com wrote:
I would make a wild guess that you call your ruby script from a shell
script trying to pass it all command line parameters the sell script has i
–
http://home.cogeco.ca/~tsummerfelt1
yes, actually i use .rb=“g:\ruby\bin\ruby.exe” and i had a typo
now of course it works
that should be the last of the dumb questions i ask…for awhile…
···
On Tue, 03 Feb 2004 at 23:38 GMT, nobu.nokada@softhome.net wrote:
Do you associate .rb to “g:\ruby\bin\ruby.exe %0 %*”?
–
http://home.cogeco.ca/~tsummerfelt1