From: Wayne Kelly Date: 2006-06-21T11:15:09+09:00 Subject: Re: Announcing Beta Release of GP Ruby.NET Compiler At 02:37 AM 21/06/2006, you wrote:
On Wed, 21 Jun 2006 01:04:22 +0900, you wrote:

>> rubycompiler -e "puts 'Hello, world!'"
># No output

[r:\ruby.net\bin]rubycompiler -e 'puts "hello, world"'
hello, world

Actually quoted strings on the command line is an interesting issue ...

Single quoted arguments is a UNIX concept and not generally supported on Windows:

[r:\ruby.net\bin]rubycompiler -e 'puts "hello, world"'

On Windows would produce argc = 4 and
argv[0] = "rubycompiler"
argv[1] = "-e"
argv[2] = "'puts"
argv[3] = "hello, world'"

To get around this, the Ruby interpreter on Windows instead calls the
windows library function GetCommandLineA() to retrieve the raw command line
and then parses it manually to reproduce UNIX semantics.

We similarly call System.Environment.CommandLine and perform our own
command line parsing, but that parsing code is so far, far from
complete - as you have illustrated.

Interestingly, even the Ruby 1.8 interpreter on Windows doesn't produce
the same results as on UNIX when the following command is issued from
a command prompt window as everything following the '&' character
is not even accessible to the GetCommandLineA function.

Ruby -i.bak -pe 'sub(/^[0-9]+$/){$&.to_i * 5}' script_tmp


Cheers, Wayne.

Dr Wayne Kelly                    Senior Lecturer
Email: w.kelly@qut.edu.au        School of Software Engineering and DC
Phone: +61 7 3864 9336           Faculty of Information Technology
Fax: +61 7 3864 9390             Queensland University of Technology