Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Julia - run a script and keep the interpreter running

I am running a Julia script, but would like to have the interpreter keep itself open after the script is executed.

E.g. when I run julia example.jl, I'd like the script to run and the interpreter to stay open after that, so I can experiment with the results.

Is this possible?

Thanks!

like image 216
Nikola Yuroukov Avatar asked Apr 29 '16 13:04

Nikola Yuroukov


2 Answers

Alternatively, you can just use the -i (interactive) flag. See julia --help for more details.

julia -i example.jl

Note, though, that the REPL won't start if the script errors.

like image 178
mbauman Avatar answered Oct 12 '22 23:10

mbauman


Open up the REPL from the shell with julia and run your code from there with:

include("example.jl")

This will execute your file from the REPL and will allow you play around with your results. If you want to learn more, I recommend this tutorial which is simple and easy to follow.

like image 38
niczky12 Avatar answered Oct 12 '22 23:10

niczky12