You could use setenv:
http://julia.readthedocs.org/en/latest/stdlib/base/#Base.setenv

`run` in Julia executes calls directly (setting up the environment,
interpolating, and spawning subprocess) - not via the shell. So, built-ins
like `export` don't work.

See this blog post for some more information:
http://julialang.org/blog/2012/03/shelling-out-sucks/

(I do think it would be convenient to allow single-shot environment changes
as keyword arguments to `run`. not sure if there is an open issue for this
already, but it feels like something that has come up before)

On Sun, Dec 7, 2014 at 9:48 PM, David Koslicki <[email protected]> wrote:

> Hello,
>
> I am trying to sort a large (4G) file consisting only of strings of length
> 50 on the alphabet {A,C,T,G}. While the built in Julia sort() works, it
> uses quite a bit of memory. I have had good success using the linux command
> LC_ALL=C sort larg_file.txt -o out.txt, but get the following error when I
> try to evaluate the command run(`LC_ALL=C sort larg_file.txt -o out.txt`)
> in Julia:
>
> ERROR: could not spawn `LC_ALL=C sort large_file.txt -o out.txt`: no such
> file or directory (ENOENT)
>  in _jl_spawn at process.jl:217
>  in spawn at process.jl:348
>  in spawn at process.jl:389
>  in run at process.jl:470
>
> Running the command
> export LC_ALL=C in the shell before running Julia works, but I would like
> to be able to do this directly from Julia. Unfortunately, the command
> run(`export LC_ALL=C`) also returns the error:
>
> ERROR: could not spawn `export LC_ALL=C`: no such file or directory
> (ENOENT)
>  in _jl_spawn at process.jl:217
>  in spawn at process.jl:348
>  in spawn at process.jl:389
>  in run at process.jl:470
>
> Does anyone know how to set LC_ALL=C in julia using run()?
>
> Thanks,
>
> ~David
>

Reply via email to