Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5993857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:44:07+00:00 2026-05-22T23:44:07+00:00

code: #test_argv.rb puts length: #{ARGV.length} ARGV.each do |a| puts Argument: #{a} end If I

  • 0

code:

  #test_argv.rb
  puts "length: #{ARGV.length} "
  ARGV.each do |a|
    puts "Argument: #{a}"
  end

If I supply the string "*.*" (with or without quotes) when I call the above, I get the following output:

  C:\test>test_argv *.*
  length: 5
  Argument: afile.TXT
  Argument: bfile.TXT
  Argument: cfile.TXT
  Argument: dfile.TXT
  Argument: somethingelse.TXT

i.e., a listing of the files in c:\test.

Other values, like "s*.*" returns somethingelse.TXT, as you’d expect if you were doing file operations — but I’m not.

But this behaves as would have expected:

  C:\test>test_argv asdf
  length: 1
  Argument: asdf

So my question is, how can I make a user-friendly script that will take "*.*" (etc) as a command line parameter? In addition, where is this documented/explained?

Edit: this happens on windows and linux, 1.8.7 and 1.9.2

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T23:44:08+00:00Added an answer on May 22, 2026 at 11:44 pm

    You may need to put this into literal quotes:

    test_argv "*.*"
    

    The quotes should avoid having the command-line arguments get expanded on you prematurely.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Below is my code (test.c): #include <stdio.h> #include <string.h> int main(int argc, char **argv)
Consider the following ruby code test.rb: begin puts thisFunctionDoesNotExist x = 1+1 rescue Exception
Here's my code: void display(void); int main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_SINGLE|GLUT_RGBA);
I am testing the following code: int _tmain(int argc, _TCHAR* argv[]) { int sum
I have the following test code: require 'Qt' app = Qt::Application.new( ARGV ) wnd
So I have the following test code: #include <string.h> #include <stdio.h> int main(int argc,
The code under test follows. view.QueryResultsGrid is a System.Windows.Forms.DataGridView object: public void SelectCheckedChanged(object sender,
Our Java code (not the test code) reads files from the current directory, which
How can you depend on test code from another module in Maven? Example, I
Is there a way to test code coverage within visual studio if I'm using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.