I have a ruby script that takes two inputs for ARGV
. The second input is an array of files. I'm having trouble iterating through the file array passed to ARGV
. Here is what I have so far:
arg1, FILES = ARGV
FILES.each do |fname|
#do something with fname
end
I'm running my script from the command line like this:
ruby myScript.rb arg1 ['path/to/file1.jpg', '/path/to/file2.jpg']
And I'm getting the following error:
zsh: bad pattern: [path/to/file1.jpg,
Enclosing the array argument in single quotes like this:
ruby myScript.rb arg1 '['path/to/file1.jpg', '/path/to/file2.jpg']'
Produces a different error, as it interprets it as a String rather than array.
How can I accomplish this correctly?