How to start Julia REPL with a command?

question

#1

How do you start the Julia REPL with a command?

This would be equivalent to how adding code to .juliarc.jl works (but without having any permenance to it)

One way I thought of doing was to:

  • make a scratch file and
  • then load it using julia ~/.../scratch.jl

This just seems kind of hacky, though.


Use case:

I want to be able to do:

> julia | "using DataStructures"

// but the DataStructures is just an example and it changes frequently

(also, that’s just pseudo-code)


#2

I think $ julia -ie "using DataStructures" does what you want? -i starts the REPL interactively and -e evaluates the code. :slight_smile:


#3

Thanks!

// for the curious, this got used in a new Julz command