On Friday, October 9, 2015 at 8:34:19 PM UTC-4, Bill Hart wrote: 
>
> indicates that withenv can also be used with a do..end block. However, try 
> as I might, I cannot figure out how to do anything with this. Can someone 
> provide an example of this in operation.
>

julia> *withenv("FOO"=>"bar") do*

*           run(`bash -c "echo FOO is \$FOO"`)*

*       end*

FOO is bar

 

>
> Whilst I'm asking trivial questions, I may as well also ask this related 
> one.
>
> If I do:
>
> run(`echo \$PATH`)
>

The $FOO syntax is a feature of the shell, not of /bin/echo.    When you 
run(`echo ...args...`) you are executing /bin/echo directly, without 
involving the shell, so no shell expansions like * patterns or $variables 
are performed.

If you want to use the $FOO syntax, you need to invoke the shell, as in my 
example above where I invoked bash.

>

Reply via email to