# How to remove quotes folowing variable interpolation in Run() command?

**URL:** <https://discourse.julialang.org/t/how-to-remove-quotes-folowing-variable-interpolation-in-run-command/49849>\
**Category:** General Usage\
**Tags:** strings\
**Created:** [November 9, 2020, 3:41pm UTC](https://discourse.julialang.org/t/how-to-remove-quotes-folowing-variable-interpolation-in-run-command/49849 "2020-11-09T15:41:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fred](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fred/32/14175_2.png) [@Fred](https://discourse.julialang.org/u/Fred)\
**Post date:** [November 9, 2020, 3:41pm UTC](https://discourse.julialang.org/t/how-to-remove-quotes-folowing-variable-interpolation-in-run-command/49849/1 "2020-11-09T15:41:10Z")

</div>

Hi,

I try to use Julia to start and existing R software. But I have problems because I dont know how to remove extra quotes added by variable interpolation.

Thanks !

See example here (it is a toy example, I have a much more complex command line in reality, with many arguments)

```julia
julia> files = "f1.txt"
"f1.txt"

julia> cmd = `R --vanilla --args $files`
`R --vanilla --args f1.txt` # this is good !

julia> files = join(["f1.txt", "f2.txt"], " ")
"f1.txt f2.txt"

julia> cmd = `R --vanilla --args $files`
`R --vanilla --args 'f1.txt f2.txt'` # this command fail because of the quotes around 'f1.txt f2.txt'
# how can I obtain `R --vanilla --args f1.txt f2.txt` ?

```

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [November 9, 2020, 4:10pm UTC](https://discourse.julialang.org/t/how-to-remove-quotes-folowing-variable-interpolation-in-run-command/49849/2 "2020-11-09T16:10:50Z")

</div>

Not sure what you’re trying to do ultimately, but have you considered [RCall.jl](https://github.com/JuliaInterop/RCall.jl)?

---

<div class="post-metadata">

**Author:** ![Fred](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fred/32/14175_2.png) [@Fred](https://discourse.julialang.org/u/Fred)\
**Post date:** [November 9, 2020, 4:43pm UTC](https://discourse.julialang.org/t/how-to-remove-quotes-folowing-variable-interpolation-in-run-command/49849/3 "2020-11-09T16:43:52Z")

</div>

@nilshg thank you for your answer. Ultimately I want to replace a graphical interface by a command line utility in Julia.

```julia
cmd = `R --vanilla --args $var1 $var2 ... $varn`
run(pipeline("Rsoft.r", cmd))

```

I know Rcall but the R program I use is not directlty compatible with Rcall that is why I prefer to send arguments to the R program.

It is very unclear why thoses extra-quotes appears when the $files variable is build with join().

---

<div class="post-metadata">

**Author:** ![ericphanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ericphanson/32/215186_2.png) [@ericphanson](https://discourse.julialang.org/u/ericphanson)\
**Post date:** [November 9, 2020, 5:10pm UTC](https://discourse.julialang.org/t/how-to-remove-quotes-folowing-variable-interpolation-in-run-command/49849/4 "2020-11-09T17:10:40Z")

</div>

Just don’t `join` them yourself:

```julia
julia> files = ["f1.txt", "f2.txt"]
2-element Array{String,1}:
 "f1.txt"
 "f2.txt"

julia> cmd = `R --vanilla --args $files`
`R --vanilla --args f1.txt f2.txt`

```

See the docs [here](https://docs.julialang.org/en/v1/manual/running-external-programs/#command-interpolation) for more on how interpolating works with command objects.

---

<div class="post-metadata">

**Author:** ![Fred](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fred/32/14175_2.png) [@Fred](https://discourse.julialang.org/u/Fred)\
**Post date:** [November 9, 2020, 5:19pm UTC](https://discourse.julialang.org/t/how-to-remove-quotes-folowing-variable-interpolation-in-run-command/49849/5 "2020-11-09T17:19:12Z")

</div>

@ericphanson, simple and efficient solution, many thanks !
