# Command from a string

**URL:** <https://discourse.julialang.org/t/command-from-a-string/85237>\
**Category:** New to Julia\
**Created:** [August 3, 2022, 3:15pm UTC](https://discourse.julialang.org/t/command-from-a-string/85237 "2022-08-03T15:15:42Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [August 3, 2022, 4:15pm UTC](https://discourse.julialang.org/t/command-from-a-string/85237/2 "2022-08-03T16:15:36Z")

</div>

> [@whatsthecraic](#):
>
> (assume str is a complex command and I’d like to perform my own escaping of arguments)

Sounds like you are thinking of a shell command? To do that you want to spawn a shell:

```julia
julia> run(`sh -c $str`);
hello world

```

This is the analogue of the `os.system` function in Python or the `system` function in C.

Of course, the whole reason why Julia’s `run` commands are set up the way they are is [to _avoid_ spawning a shell and to avoid brittle manual escaping](https://julialang.org/blog/2012/03/shelling-out-sucks/). See also this discussion: [Better support for running external commands - #8 by stevengj](https://discourse.julialang.org/t/better-support-for-running-external-commands/44933/8)

Could you give more context about why you are doing this?

---

_[View the full topic](https://discourse.julialang.org/t/command-from-a-string/85237)._
