If the command allows invocation without spaces, you can do this:

`command -e$a`


If the command allows invocation with a space *as part of the argument*
(many commands actually do allow this), then you can do this:

`command "-e $a"`


If neither of those is the case you can do something like this:

cmd = `command`

for x in a

    cmd = `$cmd -e $x`

end


On Wed, May 6, 2015 at 10:27 AM, Simon Byrne <[email protected]> wrote:

> I want to pass an array of strings to a command line program, where each
> string needs to be preceded by an -e. e.g. I have
>
> a = ["string1","string2","string3",...]
>
> and I want to call
>
> `command -e $(a[1])  -e $(a[2]) -e $(a[3])` ...
>
> Is there an easy way to do this using the command line interpolation tools?
>
> -Simon
>

Reply via email to