# How do I call a shell command containing both single and double quotes

**URL:** <https://discourse.julialang.org/t/how-do-i-call-a-shell-command-containing-both-single-and-double-quotes/23761>\
**Category:** General Usage\
**Tags:** shell\
**Created:** [May 2, 2019, 2:43am UTC](https://discourse.julialang.org/t/how-do-i-call-a-shell-command-containing-both-single-and-double-quotes/23761 "2019-05-02T02:43:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![PeterB](https://avatars.discourse-cdn.com/v4/letter/p/e8c25b/32.png) [@PeterB](https://discourse.julialang.org/u/PeterB)\
**Post date:** [May 2, 2019, 2:43am UTC](https://discourse.julialang.org/t/how-do-i-call-a-shell-command-containing-both-single-and-double-quotes/23761/1 "2019-05-02T02:43:29Z")

</div>

This Julia command works:

```
run(`/Applications/MATLAB_R2018b.app/bin/matlab -nodisplay -nojvm -r "findalpha('file1'); exit"`)`

```

However I want to build a general string between the backquote, so that both the Matlab path, and file name file1, can be anything (but will not have special characters).

I know there is a MATLAB package, but I am unsure of its “status” and am trying to minimise number of external packages I use, because this code is being passed on to someone else.

EDIT: Never mind, I found a workaround. If I remove the space before the exit, I do not need the double quotes. So my julia code is:

```
cmd3 = ["/Applications/MATLAB_R2018b.app/bin/matlab", "-nodisplay", "-nojvm", "-r", "findalpha('file1');exit"]
run(`$cmd3`)

```

and that executes the shell command

```
/Applications/MATLAB_R2018b.app/bin/matlab -nodisplay -nojvm -r findalpha('file1');exit

```
