The command is never run with a shell. Instead, Julia parses the command syntax directly, appropriately interpolating variables and splitting on words as the shell would, respecting shell quoting syntax. The command is run as julia 's immediate child process, using fork and exec calls.
Just because it hasn’t been brought up yet: Enquoting the string argument in single quotes works similarly to other Posix shells, in that it escapes everything except ' itself and `, so in your example run(`echo '"toto"'`) should also just work.
The difference is, that with this the double quotes " are passed as part of the ARG value, which may be not wanted.
In the shell you want:
“a string with space” passed as single argument value, so you do e.g.:
bash > some_cmd -input "a string with space"
Now argv=a string with space
(without the ")
In the case of
run(`some_cmd -input '"a string with space"'`)
which is identical to
run(`some_cmd -input \"a string with space\"`)
some_cmd now receives as argv: "a string with space"
Where double quotes are part of the string.