(reposting in plain text…)
Using the following one line ruby script (to dump out argv):
puts “ARGV:\n#{ARGV.join(”\n")}\n—"
I’m seeing VERY strange behavior with Ruby 1.8.0:
First, I’ll show that 4 different files exist in a local directory.
M:\builds\SYStest\eic\Yellow\products\EIC\src\attendant>dir
audiodetaildlg.*
Volume in drive M is WorkDrive3
Volume Serial Number is 90DB-A0F3
Directory of M:\builds\SYStest\eic\Yellow\products\EIC\src\attendant
09/04/2002 03:15 PM 3,817 AudioDetailDlg.cpp
03/25/2003 05:00 PM 1,498 AudioDetailDlg.h
2 File(s) 5,315 bytes
0 Dir(s) 6,820,958,208 bytes free
M:\builds\SYStest\eic\Yellow\products\EIC\src\attendant>dir audionode.*
Volume in drive M is WorkDrive3
Volume Serial Number is 90DB-A0F3
Directory of M:\builds\SYStest\eic\Yellow\products\EIC\src\attendant
08/01/2002 02:25 PM 3,409 AudioNode.cpp
07/31/2002 04:07 PM 1,849 AudioNode.h
2 File(s) 5,258 bytes
0 Dir(s) 6,820,958,208 bytes free
Now, I’ll run the script that dumps out argv and pass it some wildcard
arguments which should match these files.
M:\builds\SYStest\eic\Yellow\products\EIC\src\attendant>ruby bs.rb test
AudioDetailDlg.* AudioNode.*
ARGV:
test
AudioDetailDlg.* AudioNode.*
···
Huh? Why did the two arguments get passed in as one argument to argv !?
This is causing some of my scripts serious problems.
M:\builds\SYStest\eic\Yellow\products\EIC\src\attendant>ruby bs.rb test
AudioDetailDlg.*
ARGV:
test
AudioDetailDlg.cpp
AudioDetailDlg.h
Hmmm… now it performed wildcard expansion and put the two files as
separate arguments.
Basically, the first option after a wildcard argument gets grouped in
with that wildcard parameter as a single argument and the expansion
doesn’t occur.
M:\builds\SYStest\eic\Yellow\products\EIC\src\attendant>ruby bs.rb test
AudioDetailDlg.* foo AudioNode.*
ARGV:
test
AudioDetailDlg.* foo
AudioNode.cpp
AudioNode.h
Cheers…
Patrick Bennett