Question: I am writing a ruby file that is called from zsh and, among others, I am trying to pass an array as an input variable like that:

```
ruby cim_manager.rb test --target=WhiteLabel --devices=["iPhone 8", "iPhone 12 Pro"]

```

Inside my ruby file I have a function:

```
# Generates a hash value from an array of arguments
#
# @param [Array<String>] The array of values. Each value of the array needs to separate the key and the value with "=". All "--" substrings will be replaced for empty substrings
#
# @return [Hash]
#
def generate_hash_from_arguemnts(args)
    hash = {}

    args.each{ |item|
        item = item.gsub("--", "")
        item = item.split("=")
        puts item.kind_of?(Array)
        hash[item[0].to_s] = item[1].to_s
    }

    return hash
end 

```

So I can have a value like:

```
{"target": "WhiteLabel", "devices": ["iPhone 8", "iPhone 12 Pro"]}

```

The error I am getting when executing my Ruby file is:

```
foo@Mac-mini fastlane % ruby cim_manager.rb test --target=WhiteLabel --devices=["iPhone 8", "iPhone 12 Pro"]
zsh: bad pattern: --devices=[iPhone 8,

```

Any ideas?

Answer: 
@ReimondHill : I don't see how the error is possibly related to Ruby. You have a zsh-line, in which you have `--devices= [...`. You could get the same error when doing a

```
echo --devices=["iPhone 8", "iPhone 12 Pro"]

```

An open square bracket is a zsh wildcard construct; for instance, `[aeiou]` is a wildcard which tries to match against a vocal in a file name. Hence, this parameter tries to match against files starting with the name *--devices=* in your working directory, so you would expect an error message like *no matches found: --devices=...*. However, there is one gotcha: The list of characters between `[` ... `]` must **not** have an (unescaped) space. Therefore, you don't see *no matches found*, but *bad pattern*.

After all, you don't want a filename expansion to occur, but pass the parameter to your program. Therefore you need to quote it:

```
ruby .... '--devices=["iPhone 8", "iPhone 12 Pro"]'

```

Ronald
Following the answer from @user1934428, I am extending my ruby file like that:

```
# Generates a hash value from an array of arguments
#
# @param [Array<String>] The array of values. Each value of the array needs to separate the key and the value with "=". All "--" substrings will be replaced for empty substrings
#
# @return [Hash]
#
def generate_hash_from_arguemnts(args)
    hash = {}

    args.each{ |item|
        item = item.gsub("--", "")
        item = item.gsub("\"", "")
        item = item.split("=")

        key = item[0].to_s

        value = item[1]
        if value.include?("[") && value.include?("]") #Or any other pattern you decide
            value = value.gsub("[","")
            value = value.gsub("]","")
            value = value.split(",")
        end

        hash[key] = value
    }

    return hash
end

```

And then my zsh-line:

```
ruby cim_manager.rb test --target=WhiteLabel --devices='[iPhone 8,iPhone 12 Pro]'

```

The return value from generate\_hash\_from\_arguemnts prints:

```
{"target"=>"WhiteLabel", "devices"=>["iPhone 8", "iPhone 12 Pro"]} 

```