# How to execute echo $PATH from Julia

**URL:** <https://discourse.julialang.org/t/how-to-execute-echo-path-from-julia/41364>\
**Category:** New to Julia\
**Created:** [June 14, 2020, 10:39am UTC](https://discourse.julialang.org/t/how-to-execute-echo-path-from-julia/41364 "2020-06-14T10:39:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pauljurczak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pauljurczak/32/921_2.png) [@pauljurczak](https://discourse.julialang.org/u/pauljurczak)\
**Post date:** [June 14, 2020, 10:39am UTC](https://discourse.julialang.org/t/how-to-execute-echo-path-from-julia/41364/1 "2020-06-14T10:39:13Z")

</div>

I would like to run `echo $PATH` bash command, see the result and optionally capture it in a string or array of strings. I started with:

```julia
julia> run(`echo $PATH`)
ERROR: UndefVarError: PATH not defined
julia> run(`echo \$PATH`)
$PATH

```

which doesn’t work.

---

<div class="post-metadata">

**Author:** ![dilumaluthge](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dilumaluthge/32/29283_2.png) [@dilumaluthge](https://discourse.julialang.org/u/dilumaluthge)\
**Post date:** [June 14, 2020, 10:42am UTC](https://discourse.julialang.org/t/how-to-execute-echo-path-from-julia/41364/2 "2020-06-14T10:42:14Z")

</div>

Probably this is what you are looking for?

```julia
julia> ENV["PATH"]

julia> my_variable = ENV["PATH"]

```

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [June 14, 2020, 10:49am UTC](https://discourse.julialang.org/t/how-to-execute-echo-path-from-julia/41364/3 "2020-06-14T10:49:16Z")

</div>

You need to invoke a shell that interprets the `$` for you:

```julia
run(`bash -c "echo \$PATH"`)

```
