# Remove single quote from command line

**URL:** <https://discourse.julialang.org/t/remove-single-quote-from-command-line/70434>\
**Category:** General Usage\
**Tags:** question\
**Created:** [October 26, 2021, 8:33pm UTC](https://discourse.julialang.org/t/remove-single-quote-from-command-line/70434 "2021-10-26T20:33:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![biona001](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/biona001/32/16497_2.png) [@biona001](https://discourse.julialang.org/u/biona001)\
**Post date:** [October 26, 2021, 8:33pm UTC](https://discourse.julialang.org/t/remove-single-quote-from-command-line/70434/1 "2021-10-26T20:33:29Z")

</div>

Why is there extra single quotes in this command?

```julia
args = ["--arg1 hi.txt", "--arg2 bye.txt"]
cmd = `myscript $args`

```

```julia
`myscript '--arg1 hi.txt' '--arg2 bye.txt'`

```

How do I get just

```julia
`myscript --arg1 hi.txt --arg2 bye.txt`

```

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [October 26, 2021, 9:07pm UTC](https://discourse.julialang.org/t/remove-single-quote-from-command-line/70434/2 "2021-10-26T21:07:31Z")

</div>

The command interpolation is doing exactly what you’ve asked for (but not what you wanted). It’s running the command `myscript` with two arguments, and each of those arguments happens to have a space in it. Presumably `myscript` actually expects to be invoked with 4 arguments (the way your shell would interpret 4 space-separated arguments), which you can get like this:

```julia
julia> args = ["--arg1", "hi.txt", "--arg2", "bye.txt"];

julia> cmd = `myscript $args`
`myscript --arg1 hi.txt --arg2 bye.txt`

```

Note that quote marks are kind of a red herring here. Doing `myscript '--arg1'` and `myscript --arg1` in your shell makes no difference whatsoever. The key is whether the space between `--arg1` and `hi.txt` actually creates separate arguments or not.

You can see this more clearly by creating a file `test.jl` containing this:

```julia
@show ARGS # print the list of command line arguments

```

Now let’s try it from a shell:

```julia
$ julia test.jl hello world
ARGS = ["hello", "world"]
$ julia test.jl 'hello' world
ARGS = ["hello", "world"]
$ julia test.jl 'hello world'
ARGS = ["hello world"]

```

Single quotes around an argument have no effect. But quoting the string `hello world` turns it from a pair of separate arguments into a single argument with a space in the middle.

The command interpolation is giving you the same choice. Let’s run `test.jl` from a Julia cmd:

```julia
julia> args = ["hello world"] # one argument, with a space in it
1-element Vector{String}:
 "hello world"

julia> cmd = `julia test.jl $args` 
`julia test.jl 'hello world'`

# Prints a single argument with a space in it, as expected
julia> run(cmd)
ARGS = ["hello world"]
Process(`julia test.jl 'hello world'`, ProcessExited(0))

# Two actually separate arguments
julia> args = ["hello", "world"]
2-element Vector{String}:
 "hello"
 "world"

julia> cmd = `julia test.jl $args`
`julia test.jl hello world`

# Prints the two separate arguments, as expected
julia> run(cmd)
ARGS = ["hello", "world"]
Process(`julia test.jl hello world`, ProcessExited(0))

```
