From: Jayson Williams Date: 2008-11-26T02:05:00+09:00 Subject: Re: Can you run a command line script with arguments, withou Doesn't seem to work that way for me. I created a file called args.rb that looks like this puts ARGV[0] #end This is what I get >args.rb hello >nil >ruby args.rb hello >hello I think in the first example ruby is using my arguments for the interpreter. Any ideas how I can tell ruby to use the arguments for the script and not the interpreter? Jayson On Mon, Nov 24, 2008 at 4:53 PM, Siep Korteling wrote: > Jayson Williams wrote: >> I am using win os, so the shabang thing isn't an option for me. I put >> the script in my ruby bin path, and I can access the script from >> anywhere now, but I still have the same problem with the script not >> running properly unless i type ruby first. It is as if ruby does not >> attempt to read in arguments unless you explicitly pass the script >> through ruby. If I call the script with the arguments without putting >> 'ruby' first, the args don't seem to get read. > > With my one-click-install it works just fine. This is my test1.rb: > > puts ARGV > > #when called like this: > > #test1.rb first second > > #it produces > > #first > #second > > hth, > > Siep > > > > -- > Posted via http://www.ruby-forum.com/. > >